repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
siriusphp/html | src/Builder.php | Builder.make | public function make($tag, $props = null, $content = null)
{
if (! isset($this->tagFactories[$tag])) {
return Tag::create($tag, $props, $content, $this);
}
$constructor = $this->tagFactories[$tag];
if (is_callable($constructor)) {
/* @var $tag Tag */
... | php | public function make($tag, $props = null, $content = null)
{
if (! isset($this->tagFactories[$tag])) {
return Tag::create($tag, $props, $content, $this);
}
$constructor = $this->tagFactories[$tag];
if (is_callable($constructor)) {
/* @var $tag Tag */
... | [
"public",
"function",
"make",
"(",
"$",
"tag",
",",
"$",
"props",
"=",
"null",
",",
"$",
"content",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"tagFactories",
"[",
"$",
"tag",
"]",
")",
")",
"{",
"return",
"Tag",
":... | Make an HTML tag with a specific tag name (div, p, section etc)
@param string $tag
@param mixed $props
@param mixed $content
@throws \InvalidArgumentException
@return Tag | [
"Make",
"an",
"HTML",
"tag",
"with",
"a",
"specific",
"tag",
"name",
"(",
"div",
"p",
"section",
"etc",
")"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Builder.php#L107-L132 |
JoffreyPoreeCoding/MongoDB-ODM | src/Tools/QueryCaster.php | QueryCaster.getCastedQuery | public function getCastedQuery()
{
$newQuery = $this->castArray($this->query, $this->initialMetadata);
ArrayModifier::aggregate($newQuery, self::$mongoDbQueryOperators);
return $newQuery;
} | php | public function getCastedQuery()
{
$newQuery = $this->castArray($this->query, $this->initialMetadata);
ArrayModifier::aggregate($newQuery, self::$mongoDbQueryOperators);
return $newQuery;
} | [
"public",
"function",
"getCastedQuery",
"(",
")",
"{",
"$",
"newQuery",
"=",
"$",
"this",
"->",
"castArray",
"(",
"$",
"this",
"->",
"query",
",",
"$",
"this",
"->",
"initialMetadata",
")",
";",
"ArrayModifier",
"::",
"aggregate",
"(",
"$",
"newQuery",
"... | Get the caster query
@return array | [
"Get",
"the",
"caster",
"query"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Tools/QueryCaster.php#L75-L80 |
JoffreyPoreeCoding/MongoDB-ODM | src/Tools/QueryCaster.php | QueryCaster.castArray | private function castArray($array, $classMetadata)
{
$newQuery = [];
if (is_array($array)) {
foreach ($array as $field => $value) {
$field = $this->castDottedString($field, $classMetadata);
if (is_array($value)) {
if (false != ($fieldIn... | php | private function castArray($array, $classMetadata)
{
$newQuery = [];
if (is_array($array)) {
foreach ($array as $field => $value) {
$field = $this->castDottedString($field, $classMetadata);
if (is_array($value)) {
if (false != ($fieldIn... | [
"private",
"function",
"castArray",
"(",
"$",
"array",
",",
"$",
"classMetadata",
")",
"{",
"$",
"newQuery",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"field",
"=>",
"$",
... | Undocumented function
@param [type] $array
@param [type] $classMetadata
@return void | [
"Undocumented",
"function"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Tools/QueryCaster.php#L99-L124 |
heyday/heystack | src/Console/Command/GenerateDataObjects.php | GenerateDataObjects.execute | protected function execute(Input\InputInterface $input, Output\OutputInterface $output)
{
$this->generatorService->process($input->getOption('force'));
$output->writeln('Completed');
} | php | protected function execute(Input\InputInterface $input, Output\OutputInterface $output)
{
$this->generatorService->process($input->getOption('force'));
$output->writeln('Completed');
} | [
"protected",
"function",
"execute",
"(",
"Input",
"\\",
"InputInterface",
"$",
"input",
",",
"Output",
"\\",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"generatorService",
"->",
"process",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'forc... | Generate the container
@param Input\InputInterface $input The commands input
@param Output\OutputInterface $output The commands output
@return null | [
"Generate",
"the",
"container"
] | train | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/Console/Command/GenerateDataObjects.php#L67-L71 |
comelyio/comely | src/Comely/IO/Session/ComelySession/Bag.php | Bag.has | public function has(string ...$props): bool
{
foreach ($props as $prop) {
if (!array_key_exists(strtolower($prop), $this->props)) {
return false;
}
}
return true;
} | php | public function has(string ...$props): bool
{
foreach ($props as $prop) {
if (!array_key_exists(strtolower($prop), $this->props)) {
return false;
}
}
return true;
} | [
"public",
"function",
"has",
"(",
"string",
"...",
"$",
"props",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"props",
"as",
"$",
"prop",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"strtolower",
"(",
"$",
"prop",
")",
",",
"$",
"this",
"->",... | Checks if 1 or all the keys exist in Bag
@param string[] ...$props
@return bool | [
"Checks",
"if",
"1",
"or",
"all",
"the",
"keys",
"exist",
"in",
"Bag"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Session/ComelySession/Bag.php#L88-L97 |
wizbii/pipeline | Service/Producers.php | Producers.get | public function get($key, $default = null)
{
return array_key_exists($key, $this->producers) ? $this->producers[$key] : $default;
} | php | public function get($key, $default = null)
{
return array_key_exists($key, $this->producers) ? $this->producers[$key] : $default;
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"producers",
")",
"?",
"$",
"this",
"->",
"producers",
"[",
"$",
"key",
"]",
":",
"$",
... | Returns a Producer by name.
@param string $key The key
@param Producer $default The default value
@return Producer | [
"Returns",
"a",
"Producer",
"by",
"name",
".",
"@param",
"string",
"$key",
"The",
"key",
"@param",
"Producer",
"$default",
"The",
"default",
"value"
] | train | https://github.com/wizbii/pipeline/blob/8d22b976a53bb52abf0333b62b308ec7127cf414/Service/Producers.php#L73-L76 |
jan-dolata/crude-crud | src/Engine/CrudeSetupTrait/ModelDefaults.php | ModelDefaults.setModelDefaults | public function setModelDefaults($attr, $value = null)
{
if (is_array($attr))
$this->modelDefaults = array_merge($this->modelDefaults, $attr);
else
$this->modelDefaults[$attr] = $value;
return $this;
} | php | public function setModelDefaults($attr, $value = null)
{
if (is_array($attr))
$this->modelDefaults = array_merge($this->modelDefaults, $attr);
else
$this->modelDefaults[$attr] = $value;
return $this;
} | [
"public",
"function",
"setModelDefaults",
"(",
"$",
"attr",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"attr",
")",
")",
"$",
"this",
"->",
"modelDefaults",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"modelDefaults",
",... | Sets the Model default values.
@param string|array $attr
@param array $value
@return self | [
"Sets",
"the",
"Model",
"default",
"values",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/ModelDefaults.php#L32-L40 |
okvpn/fixture-bundle | src/Migration/Sorter/DataFixturesSorter.php | DataFixturesSorter.sort | public function sort(array $fixtures)
{
$this->fixtures = $fixtures;
$this->orderedFixtures = [];
$usePrioritySorting = $this->usePrioritySorting($fixtures);
$useDependenciesSorting = $this->useDependenciesSorting($fixtures);
if ($usePrioritySorting) {
... | php | public function sort(array $fixtures)
{
$this->fixtures = $fixtures;
$this->orderedFixtures = [];
$usePrioritySorting = $this->usePrioritySorting($fixtures);
$useDependenciesSorting = $this->useDependenciesSorting($fixtures);
if ($usePrioritySorting) {
... | [
"public",
"function",
"sort",
"(",
"array",
"$",
"fixtures",
")",
"{",
"$",
"this",
"->",
"fixtures",
"=",
"$",
"fixtures",
";",
"$",
"this",
"->",
"orderedFixtures",
"=",
"[",
"]",
";",
"$",
"usePrioritySorting",
"=",
"$",
"this",
"->",
"usePrioritySort... | Returns the array of data fixtures to execute.
@param array $fixtures
@return array $fixtures | [
"Returns",
"the",
"array",
"of",
"data",
"fixtures",
"to",
"execute",
"."
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Migration/Sorter/DataFixturesSorter.php#L30-L52 |
okvpn/fixture-bundle | src/Migration/Sorter/DataFixturesSorter.php | DataFixturesSorter.orderFixturesByNumber | protected function orderFixturesByNumber()
{
$this->orderedFixtures = $this->fixtures;
usort(
$this->orderedFixtures,
function ($a, $b) {
if ($a instanceof OrderedFixtureInterface && $b instanceof OrderedFixtureInterface) {
if ($a->getOrder... | php | protected function orderFixturesByNumber()
{
$this->orderedFixtures = $this->fixtures;
usort(
$this->orderedFixtures,
function ($a, $b) {
if ($a instanceof OrderedFixtureInterface && $b instanceof OrderedFixtureInterface) {
if ($a->getOrder... | [
"protected",
"function",
"orderFixturesByNumber",
"(",
")",
"{",
"$",
"this",
"->",
"orderedFixtures",
"=",
"$",
"this",
"->",
"fixtures",
";",
"usort",
"(",
"$",
"this",
"->",
"orderedFixtures",
",",
"function",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
... | Order fixtures by priority
@return array | [
"Order",
"fixtures",
"by",
"priority"
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Migration/Sorter/DataFixturesSorter.php#L59-L80 |
okvpn/fixture-bundle | src/Migration/Sorter/DataFixturesSorter.php | DataFixturesSorter.orderFixturesByDependencies | protected function orderFixturesByDependencies($usedPrioritySorting)
{
$sequenceForClasses = $orderedFixtures = [];
// If fixtures were already ordered by number then we need
// to remove classes which are not instances of OrderedFixtureInterface
// in case fixtures implementing Dep... | php | protected function orderFixturesByDependencies($usedPrioritySorting)
{
$sequenceForClasses = $orderedFixtures = [];
// If fixtures were already ordered by number then we need
// to remove classes which are not instances of OrderedFixtureInterface
// in case fixtures implementing Dep... | [
"protected",
"function",
"orderFixturesByDependencies",
"(",
"$",
"usedPrioritySorting",
")",
"{",
"$",
"sequenceForClasses",
"=",
"$",
"orderedFixtures",
"=",
"[",
"]",
";",
"// If fixtures were already ordered by number then we need",
"// to remove classes which are not instanc... | @param bool $usedPrioritySorting
@return array
@throws CircularReferenceException
@SuppressWarnings(PHPMD.NPathComplexity) | [
"@param",
"bool",
"$usedPrioritySorting"
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Migration/Sorter/DataFixturesSorter.php#L90-L167 |
okvpn/fixture-bundle | src/Migration/Sorter/DataFixturesSorter.php | DataFixturesSorter.validateDependencies | protected function validateDependencies($fixtureClass, $dependenciesClasses)
{
if (!is_array($dependenciesClasses) || empty($dependenciesClasses)) {
throw new \InvalidArgumentException(
sprintf(
'Method "%s" in class "%s" must return an array of classes which ... | php | protected function validateDependencies($fixtureClass, $dependenciesClasses)
{
if (!is_array($dependenciesClasses) || empty($dependenciesClasses)) {
throw new \InvalidArgumentException(
sprintf(
'Method "%s" in class "%s" must return an array of classes which ... | [
"protected",
"function",
"validateDependencies",
"(",
"$",
"fixtureClass",
",",
"$",
"dependenciesClasses",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"dependenciesClasses",
")",
"||",
"empty",
"(",
"$",
"dependenciesClasses",
")",
")",
"{",
"throw",
"new... | @param string $fixtureClass
@param mixed $dependenciesClasses
@return bool | [
"@param",
"string",
"$fixtureClass",
"@param",
"mixed",
"$dependenciesClasses"
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Migration/Sorter/DataFixturesSorter.php#L175-L207 |
okvpn/fixture-bundle | src/Migration/Sorter/DataFixturesSorter.php | DataFixturesSorter.getUnsequencedClasses | protected function getUnsequencedClasses(array $sequences, array $classes = null)
{
$unsequencedClasses = array();
if (is_null($classes)) {
$classes = array_keys($sequences);
}
foreach ($classes as $class) {
// might not be set if depends on ordered fixture
... | php | protected function getUnsequencedClasses(array $sequences, array $classes = null)
{
$unsequencedClasses = array();
if (is_null($classes)) {
$classes = array_keys($sequences);
}
foreach ($classes as $class) {
// might not be set if depends on ordered fixture
... | [
"protected",
"function",
"getUnsequencedClasses",
"(",
"array",
"$",
"sequences",
",",
"array",
"$",
"classes",
"=",
"null",
")",
"{",
"$",
"unsequencedClasses",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"classes",
")",
")",
"{",
"$",
... | @param array $sequences
@param null|array $classes
@return array | [
"@param",
"array",
"$sequences",
"@param",
"null|array",
"$classes"
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Migration/Sorter/DataFixturesSorter.php#L215-L231 |
heyday/heystack | src/DataObjectSchema/JsonDataObjectSchema.php | JsonDataObjectSchema.getLastJsonError | protected function getLastJsonError()
{
$error = json_last_error();
return array_key_exists($error, self::$errors) ? self::$errors[$error] : "Unknown error ({$error})";
} | php | protected function getLastJsonError()
{
$error = json_last_error();
return array_key_exists($error, self::$errors) ? self::$errors[$error] : "Unknown error ({$error})";
} | [
"protected",
"function",
"getLastJsonError",
"(",
")",
"{",
"$",
"error",
"=",
"json_last_error",
"(",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"error",
",",
"self",
"::",
"$",
"errors",
")",
"?",
"self",
"::",
"$",
"errors",
"[",
"$",
"error",
... | Get the last error
@return string | [
"Get",
"the",
"last",
"error"
] | train | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/DataObjectSchema/JsonDataObjectSchema.php#L63-L67 |
JoffreyPoreeCoding/MongoDB-ODM | src/Tools/UpdateQueryCreator.php | UpdateQueryCreator.createUpdateQuery | public function createUpdateQuery($old, $new, $prefix = "")
{
$update = [];
foreach ($new as $key => $value) {
if (is_array($old) && array_key_exists($key, $old)) {
if (is_array($value) && strstr(key($value), '$') !== false) {
$update[key($value)][$pr... | php | public function createUpdateQuery($old, $new, $prefix = "")
{
$update = [];
foreach ($new as $key => $value) {
if (is_array($old) && array_key_exists($key, $old)) {
if (is_array($value) && strstr(key($value), '$') !== false) {
$update[key($value)][$pr... | [
"public",
"function",
"createUpdateQuery",
"(",
"$",
"old",
",",
"$",
"new",
",",
"$",
"prefix",
"=",
"\"\"",
")",
"{",
"$",
"update",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"new",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"i... | Create an update query from old and new values of a document
@param array $old Old values of document
@param array $new New values of document
@param string $prefix
@return void | [
"Create",
"an",
"update",
"query",
"from",
"old",
"and",
"new",
"values",
"of",
"a",
"document"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Tools/UpdateQueryCreator.php#L19-L91 |
OpenClassrooms/UseCaseBundle | DependencyInjection/Compiler/UseCaseProxyPass.php | UseCaseProxyPass.process | public function process(ContainerBuilder $container)
{
$this->container = $container;
$this->buildReader();
$this->buildUseCaseProxies();
} | php | public function process(ContainerBuilder $container)
{
$this->container = $container;
$this->buildReader();
$this->buildUseCaseProxies();
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"this",
"->",
"container",
"=",
"$",
"container",
";",
"$",
"this",
"->",
"buildReader",
"(",
")",
";",
"$",
"this",
"->",
"buildUseCaseProxies",
"(",
")",
";",
"}... | You can modify the container here before it is dumped to PHP code.
@param ContainerBuilder $container
@api | [
"You",
"can",
"modify",
"the",
"container",
"here",
"before",
"it",
"is",
"dumped",
"to",
"PHP",
"code",
"."
] | train | https://github.com/OpenClassrooms/UseCaseBundle/blob/9c18047c03a2137aa2ee7fab4de44dc80a41e6ef/DependencyInjection/Compiler/UseCaseProxyPass.php#L28-L33 |
kleijnweb/php-api-routing-bundle | src/DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$rootNode = ($builder = new TreeBuilder())->root('api_routing');
$rootNode
->children()
->scalarNode('name')->defaultValue('php-api')
->end();
return $builder;
} | php | public function getConfigTreeBuilder()
{
$rootNode = ($builder = new TreeBuilder())->root('api_routing');
$rootNode
->children()
->scalarNode('name')->defaultValue('php-api')
->end();
return $builder;
} | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"rootNode",
"=",
"(",
"$",
"builder",
"=",
"new",
"TreeBuilder",
"(",
")",
")",
"->",
"root",
"(",
"'api_routing'",
")",
";",
"$",
"rootNode",
"->",
"children",
"(",
")",
"->",
"scalarNode... | {@inheritdoc} | [
"{"
] | train | https://github.com/kleijnweb/php-api-routing-bundle/blob/7671e513de0411efc14baf299010dc57c8e1a0a5/src/DependencyInjection/Configuration.php#L22-L31 |
movoin/one-swoole | src/FileSystem/MimeType.php | MimeType.detectByFileExtension | public static function detectByFileExtension(string $extension): string
{
static $extToMimeTypeMap;
if (! $extToMimeTypeMap) {
$extToMimeTypeMap = static::getExtensionToMimeTypeMap();
}
if (isset($extToMimeTypeMap[$extension])) {
return $extToMimeTypeMap[$ex... | php | public static function detectByFileExtension(string $extension): string
{
static $extToMimeTypeMap;
if (! $extToMimeTypeMap) {
$extToMimeTypeMap = static::getExtensionToMimeTypeMap();
}
if (isset($extToMimeTypeMap[$extension])) {
return $extToMimeTypeMap[$ex... | [
"public",
"static",
"function",
"detectByFileExtension",
"(",
"string",
"$",
"extension",
")",
":",
"string",
"{",
"static",
"$",
"extToMimeTypeMap",
";",
"if",
"(",
"!",
"$",
"extToMimeTypeMap",
")",
"{",
"$",
"extToMimeTypeMap",
"=",
"static",
"::",
"getExte... | 根据扩展名返回 MimeType
@param string $extension
@return string | [
"根据扩展名返回",
"MimeType"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/MimeType.php#L24-L37 |
movoin/one-swoole | src/FileSystem/MimeType.php | MimeType.detectByFilePath | public static function detectByFilePath(string $path): string
{
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
return empty($extension) ? 'text/plain' : static::detectByFileExtension($extension);
} | php | public static function detectByFilePath(string $path): string
{
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
return empty($extension) ? 'text/plain' : static::detectByFileExtension($extension);
} | [
"public",
"static",
"function",
"detectByFilePath",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"$",
"extension",
"=",
"strtolower",
"(",
"pathinfo",
"(",
"$",
"path",
",",
"PATHINFO_EXTENSION",
")",
")",
";",
"return",
"empty",
"(",
"$",
"extensi... | 根据文件路径返回 MimeType
@param string $path
@return string | [
"根据文件路径返回",
"MimeType"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/MimeType.php#L46-L51 |
yosmanyga/resource | src/Yosmanyga/Resource/Util/XmlKit.php | XmlKit.extractContent | public function extractContent($nodes)
{
if (isset($nodes['name'])) {
$nodes = [$nodes];
}
$content = [];
foreach ($nodes as $node) {
$name = $node['name'];
unset($node['name']);
$content[$name] = current($node);
}
ret... | php | public function extractContent($nodes)
{
if (isset($nodes['name'])) {
$nodes = [$nodes];
}
$content = [];
foreach ($nodes as $node) {
$name = $node['name'];
unset($node['name']);
$content[$name] = current($node);
}
ret... | [
"public",
"function",
"extractContent",
"(",
"$",
"nodes",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"nodes",
"[",
"'name'",
"]",
")",
")",
"{",
"$",
"nodes",
"=",
"[",
"$",
"nodes",
"]",
";",
"}",
"$",
"content",
"=",
"[",
"]",
";",
"foreach",
"... | @param array $nodes
@return array | [
"@param",
"array",
"$nodes"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Util/XmlKit.php#L135-L149 |
drpdigital/json-api-parser | src/Concerns/ChecksTypes.php | ChecksTypes.isTypeWithinArray | protected function isTypeWithinArray($type, array $haystackTypes)
{
$iterator = new \ArrayIterator($haystackTypes);
while($iterator->valid()) {
$seenValue = $iterator->current();
if ($seenValue === $type) {
return true;
}
$parts = ex... | php | protected function isTypeWithinArray($type, array $haystackTypes)
{
$iterator = new \ArrayIterator($haystackTypes);
while($iterator->valid()) {
$seenValue = $iterator->current();
if ($seenValue === $type) {
return true;
}
$parts = ex... | [
"protected",
"function",
"isTypeWithinArray",
"(",
"$",
"type",
",",
"array",
"$",
"haystackTypes",
")",
"{",
"$",
"iterator",
"=",
"new",
"\\",
"ArrayIterator",
"(",
"$",
"haystackTypes",
")",
";",
"while",
"(",
"$",
"iterator",
"->",
"valid",
"(",
")",
... | Checks if the given type exists within the array of types.
@param string $type
@param array $haystackTypes
@return boolean | [
"Checks",
"if",
"the",
"given",
"type",
"exists",
"within",
"the",
"array",
"of",
"types",
"."
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/Concerns/ChecksTypes.php#L14-L37 |
jasny/router | src/Router/Middleware/ErrorPage.php | ErrorPage.reviveRequest | protected function reviveRequest(ServerRequestInterface $request)
{
$isStale = interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
$request instanceof GlobalEnvironmentInterface &&
$request->isStale();
return $isStale ? $request->revive() : $request;
... | php | protected function reviveRequest(ServerRequestInterface $request)
{
$isStale = interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
$request instanceof GlobalEnvironmentInterface &&
$request->isStale();
return $isStale ? $request->revive() : $request;
... | [
"protected",
"function",
"reviveRequest",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"$",
"isStale",
"=",
"interface_exists",
"(",
"'Jasny\\HttpMessage\\GlobalEnvironmentInterface'",
")",
"&&",
"$",
"request",
"instanceof",
"GlobalEnvironmentInterface",
"&&",
... | Revive a stale request
@param ServerRequestInterface $request
@return ServerRequestInterface | [
"Revive",
"a",
"stale",
"request"
] | train | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Middleware/ErrorPage.php#L68-L75 |
jasny/router | src/Router/Middleware/ErrorPage.php | ErrorPage.getErrorRoute | protected function getErrorRoute(ServerRequestInterface $request, ResponseInterface $response)
{
if (
interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
$request instanceof GlobalEnvironmentInterface
) {
$request = $request->withoutGlobalEnvironme... | php | protected function getErrorRoute(ServerRequestInterface $request, ResponseInterface $response)
{
if (
interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
$request instanceof GlobalEnvironmentInterface
) {
$request = $request->withoutGlobalEnvironme... | [
"protected",
"function",
"getErrorRoute",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"if",
"(",
"interface_exists",
"(",
"'Jasny\\HttpMessage\\GlobalEnvironmentInterface'",
")",
"&&",
"$",
"request",
"instanceof",
... | Get the route to the error page
@param ServerRequestInterface $request
@param ResponseInterface $response
@return Router\Route | [
"Get",
"the",
"route",
"to",
"the",
"error",
"page"
] | train | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Middleware/ErrorPage.php#L84-L101 |
jasny/router | src/Router/Middleware/ErrorPage.php | ErrorPage.routeToErrorPage | protected function routeToErrorPage(ServerRequestInterface $request, ResponseInterface $response)
{
$errorRoute = $this->getErrorRoute($request, $response);
if (!isset($errorRoute)) {
return $response;
}
$runner = $this->router->getRunner();
... | php | protected function routeToErrorPage(ServerRequestInterface $request, ResponseInterface $response)
{
$errorRoute = $this->getErrorRoute($request, $response);
if (!isset($errorRoute)) {
return $response;
}
$runner = $this->router->getRunner();
... | [
"protected",
"function",
"routeToErrorPage",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"errorRoute",
"=",
"$",
"this",
"->",
"getErrorRoute",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"i... | Route to the error page
@param ServerRequestInterface $request
@param ResponseInterface $response
@return ResponseInterface | [
"Route",
"to",
"the",
"error",
"page"
] | train | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Middleware/ErrorPage.php#L110-L121 |
antarctica/laravel-token-auth | src/Antarctica/LaravelTokenAuth/TokenAuthServiceProvider.php | TokenAuthServiceProvider.register | public function register()
{
// Load package config to allow use of values
Config::package('antarctica/laravel-token-auth', __DIR__.'/../../config');
// Register package dependencies' service providers and aliases (so the user doesn't have to in app/config/app.php)
$loader = AliasLo... | php | public function register()
{
// Load package config to allow use of values
Config::package('antarctica/laravel-token-auth', __DIR__.'/../../config');
// Register package dependencies' service providers and aliases (so the user doesn't have to in app/config/app.php)
$loader = AliasLo... | [
"public",
"function",
"register",
"(",
")",
"{",
"// Load package config to allow use of values",
"Config",
"::",
"package",
"(",
"'antarctica/laravel-token-auth'",
",",
"__DIR__",
".",
"'/../../config'",
")",
";",
"// Register package dependencies' service providers and aliases ... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/antarctica/laravel-token-auth/blob/58a0cb29197d78294363df2be61eca4419ce755a/src/Antarctica/LaravelTokenAuth/TokenAuthServiceProvider.php#L34-L58 |
Jagepard/Rudra-Auth | src/ExternalTraits/AuthTrait.php | AuthTrait.auth | public function auth(string $userToken = null, string $redirect = '')
{
return rudra()->get('auth')->access($userToken, $redirect);
} | php | public function auth(string $userToken = null, string $redirect = '')
{
return rudra()->get('auth')->access($userToken, $redirect);
} | [
"public",
"function",
"auth",
"(",
"string",
"$",
"userToken",
"=",
"null",
",",
"string",
"$",
"redirect",
"=",
"''",
")",
"{",
"return",
"rudra",
"(",
")",
"->",
"get",
"(",
"'auth'",
")",
"->",
"access",
"(",
"$",
"userToken",
",",
"$",
"redirect"... | Предоставление доступа к общим ресурсам,
либо личным ресурсам пользователя
@param string|null $userToken
@param string $redirect
@return mixed | [
"Предоставление",
"доступа",
"к",
"общим",
"ресурсам",
"либо",
"личным",
"ресурсам",
"пользователя"
] | train | https://github.com/Jagepard/Rudra-Auth/blob/3158d7b8bc52f4aeb51cfd949b9f830bfaff7a5c/src/ExternalTraits/AuthTrait.php#L51-L54 |
movoin/one-swoole | example/app/Middlewares/AcmeFilter.php | AcmeFilter.doFilter | public function doFilter(Request $request, Response $response)
{
if ((int) $request->get('error') === 1) {
return
$response
->withStatusCode(404)
->write('error')
;
}
} | php | public function doFilter(Request $request, Response $response)
{
if ((int) $request->get('error') === 1) {
return
$response
->withStatusCode(404)
->write('error')
;
}
} | [
"public",
"function",
"doFilter",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"(",
"int",
")",
"$",
"request",
"->",
"get",
"(",
"'error'",
")",
"===",
"1",
")",
"{",
"return",
"$",
"response",
"->",
"withSt... | 过滤请求,返回 null 则放行请求
@param \One\Protocol\Contracts\Request $request
@param \One\Protocol\Contracts\Response $response
@return \One\Protocol\Contracts\Response|null | [
"过滤请求,返回",
"null",
"则放行请求"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/example/app/Middlewares/AcmeFilter.php#L29-L38 |
paulzi/multicurl | MultiCurlQueue.php | MultiCurlQueue.run | public function run($requests)
{
$this->_queue = $requests;
$this->_status = array_fill(0, $this->threads, false);
$this->_retries = array_fill(0, $this->threads, 0);
$this->processNext();
parent::run();
} | php | public function run($requests)
{
$this->_queue = $requests;
$this->_status = array_fill(0, $this->threads, false);
$this->_retries = array_fill(0, $this->threads, 0);
$this->processNext();
parent::run();
} | [
"public",
"function",
"run",
"(",
"$",
"requests",
")",
"{",
"$",
"this",
"->",
"_queue",
"=",
"$",
"requests",
";",
"$",
"this",
"->",
"_status",
"=",
"array_fill",
"(",
"0",
",",
"$",
"this",
"->",
"threads",
",",
"false",
")",
";",
"$",
"this",
... | Execute requests
@param MultiCurlRequest[] $requests | [
"Execute",
"requests"
] | train | https://github.com/paulzi/multicurl/blob/2e326d868add238bb2820f3271e235bfed12e5cb/MultiCurlQueue.php#L46-L53 |
paulzi/multicurl | MultiCurlQueue.php | MultiCurlQueue.processNext | protected function processNext()
{
foreach ($this->_status as $i => $status) {
if ($status === false && ($request = array_shift($this->_queue)) !== null) {
$this->_status[$i] = $request;
$this->_retries[$i] = 0;
$this->add($request);
}... | php | protected function processNext()
{
foreach ($this->_status as $i => $status) {
if ($status === false && ($request = array_shift($this->_queue)) !== null) {
$this->_status[$i] = $request;
$this->_retries[$i] = 0;
$this->add($request);
}... | [
"protected",
"function",
"processNext",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_status",
"as",
"$",
"i",
"=>",
"$",
"status",
")",
"{",
"if",
"(",
"$",
"status",
"===",
"false",
"&&",
"(",
"$",
"request",
"=",
"array_shift",
"(",
"$",
"... | Execute free threads | [
"Execute",
"free",
"threads"
] | train | https://github.com/paulzi/multicurl/blob/2e326d868add238bb2820f3271e235bfed12e5cb/MultiCurlQueue.php#L58-L67 |
BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.addHeader | public function addHeader($add, $dca)
{
$catId = $add['id'];
unset($add['id']); //delete the helper
$sql = 'SELECT CAST(`banner_published` AS UNSIGNED INTEGER) AS published
,count(id) AS numbers
FROM `tl_banner`
WHERE `pid`=?
... | php | public function addHeader($add, $dca)
{
$catId = $add['id'];
unset($add['id']); //delete the helper
$sql = 'SELECT CAST(`banner_published` AS UNSIGNED INTEGER) AS published
,count(id) AS numbers
FROM `tl_banner`
WHERE `pid`=?
... | [
"public",
"function",
"addHeader",
"(",
"$",
"add",
",",
"$",
"dca",
")",
"{",
"$",
"catId",
"=",
"$",
"add",
"[",
"'id'",
"]",
";",
"unset",
"(",
"$",
"add",
"[",
"'id'",
"]",
")",
";",
"//delete the helper",
"$",
"sql",
"=",
"'SELECT CAST(`banner_p... | Add Header Rows, call from header_callback | [
"Add",
"Header",
"Rows",
"call",
"from",
"header_callback"
] | train | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L57-L92 |
BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.listBanner | public function listBanner($row)
{
switch ($row['banner_type'])
{
case self::BANNER_TYPE_INTERN :
return $this->listBannerInternal($row);
break;
case self::BANNER_TYPE_EXTERN :
return $this->listBannerExternal($row);
... | php | public function listBanner($row)
{
switch ($row['banner_type'])
{
case self::BANNER_TYPE_INTERN :
return $this->listBannerInternal($row);
break;
case self::BANNER_TYPE_EXTERN :
return $this->listBannerExternal($row);
... | [
"public",
"function",
"listBanner",
"(",
"$",
"row",
")",
"{",
"switch",
"(",
"$",
"row",
"[",
"'banner_type'",
"]",
")",
"{",
"case",
"self",
"::",
"BANNER_TYPE_INTERN",
":",
"return",
"$",
"this",
"->",
"listBannerInternal",
"(",
"$",
"row",
")",
";",
... | List banner record
@param object $row | [
"List",
"banner",
"record"
] | train | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L99-L116 |
BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.listBannerInternal | protected function listBannerInternal($row)
{
if ($row['banner_image'] == '')
{
return '<p class="error">'.$GLOBALS['TL_LANG']['tl_banner']['tl_be_read_error'].' (1)</p>';
}
//convert DB file ID into file path ($objFile->path)
$objFile = \FilesModel::findByUuid($r... | php | protected function listBannerInternal($row)
{
if ($row['banner_image'] == '')
{
return '<p class="error">'.$GLOBALS['TL_LANG']['tl_banner']['tl_be_read_error'].' (1)</p>';
}
//convert DB file ID into file path ($objFile->path)
$objFile = \FilesModel::findByUuid($r... | [
"protected",
"function",
"listBannerInternal",
"(",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"row",
"[",
"'banner_image'",
"]",
"==",
"''",
")",
"{",
"return",
"'<p class=\"error\">'",
".",
"$",
"GLOBALS",
"[",
"'TL_LANG'",
"]",
"[",
"'tl_banner'",
"]",
"[",
... | List internal banner record
@param object $row
@return string record as html | [
"List",
"internal",
"banner",
"record"
] | train | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L124-L344 |
BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.listBannerExternal | protected function listBannerExternal($row)
{
$fallback_content = '';
$arrImageSize = $this->BannerImage->getBannerImageSize($row['banner_image_extern'], self::BANNER_TYPE_EXTERN);
//resize if necessary
$arrImageSizeNew = array();
switch ($arrImageSize[2])
{
... | php | protected function listBannerExternal($row)
{
$fallback_content = '';
$arrImageSize = $this->BannerImage->getBannerImageSize($row['banner_image_extern'], self::BANNER_TYPE_EXTERN);
//resize if necessary
$arrImageSizeNew = array();
switch ($arrImageSize[2])
{
... | [
"protected",
"function",
"listBannerExternal",
"(",
"$",
"row",
")",
"{",
"$",
"fallback_content",
"=",
"''",
";",
"$",
"arrImageSize",
"=",
"$",
"this",
"->",
"BannerImage",
"->",
"getBannerImageSize",
"(",
"$",
"row",
"[",
"'banner_image_extern'",
"]",
",",
... | List external banner record
@param object $row
@return string record as html | [
"List",
"external",
"banner",
"record"
] | train | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L352-L540 |
BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.listBannerText | protected function listBannerText($row)
{
//Banner Ziel per Page?
if ($row['banner_jumpTo'] >0)
{
//url generieren
$objBannerNextPage = \Database::getInstance()->prepare("SELECT id, alias FROM tl_page WHERE id=?")
->limi... | php | protected function listBannerText($row)
{
//Banner Ziel per Page?
if ($row['banner_jumpTo'] >0)
{
//url generieren
$objBannerNextPage = \Database::getInstance()->prepare("SELECT id, alias FROM tl_page WHERE id=?")
->limi... | [
"protected",
"function",
"listBannerText",
"(",
"$",
"row",
")",
"{",
"//Banner Ziel per Page?",
"if",
"(",
"$",
"row",
"[",
"'banner_jumpTo'",
"]",
">",
"0",
")",
"{",
"//url generieren",
"$",
"objBannerNextPage",
"=",
"\\",
"Database",
"::",
"getInstance",
"... | List text banner record
@param object $row
@return string record as html | [
"List",
"text",
"banner",
"record"
] | train | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L548-L610 |
BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.toggleVisibility | public function toggleVisibility($intId, $blnVisible)
{
// Check permissions to publish
if (!$this->User->isAdmin && !$this->User->hasAccess('tl_banner::banner_published', 'alexf'))
{
$this->log('Not enough permissions to publish/unpublish Banner ID "'.$intId.'"', 'tl_banner togg... | php | public function toggleVisibility($intId, $blnVisible)
{
// Check permissions to publish
if (!$this->User->isAdmin && !$this->User->hasAccess('tl_banner::banner_published', 'alexf'))
{
$this->log('Not enough permissions to publish/unpublish Banner ID "'.$intId.'"', 'tl_banner togg... | [
"public",
"function",
"toggleVisibility",
"(",
"$",
"intId",
",",
"$",
"blnVisible",
")",
"{",
"// Check permissions to publish",
"if",
"(",
"!",
"$",
"this",
"->",
"User",
"->",
"isAdmin",
"&&",
"!",
"$",
"this",
"->",
"User",
"->",
"hasAccess",
"(",
"'tl... | Disable/enable banner
@param integer
@param boolean | [
"Disable",
"/",
"enable",
"banner"
] | train | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L651-L663 |
BugBuster1701/banner | classes/DcaBanner.php | DcaBanner.getBannerImageSizes | public function getBannerImageSizes()
{
$sizes = array();
$imageSize = $this->Database
->prepare("SELECT id, name, width, height FROM tl_image_size ORDER BY pid, name")
->execute(\Input::get('id'));
while ($imageSize->next())
{
... | php | public function getBannerImageSizes()
{
$sizes = array();
$imageSize = $this->Database
->prepare("SELECT id, name, width, height FROM tl_image_size ORDER BY pid, name")
->execute(\Input::get('id'));
while ($imageSize->next())
{
... | [
"public",
"function",
"getBannerImageSizes",
"(",
")",
"{",
"$",
"sizes",
"=",
"array",
"(",
")",
";",
"$",
"imageSize",
"=",
"$",
"this",
"->",
"Database",
"->",
"prepare",
"(",
"\"SELECT id, name, width, height FROM tl_image_size ORDER BY pid, name\"",
")",
"->",
... | Return all image sizes as array
@return array
@deprecated | [
"Return",
"all",
"image",
"sizes",
"as",
"array"
] | train | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/DcaBanner.php#L670-L682 |
refinery29/piston | src/Piston.php | Piston.group | public function group($prefix, callable $group)
{
$group = new RouteGroup($prefix, $group, $this);
$this->groups[] = $group;
return $group;
} | php | public function group($prefix, callable $group)
{
$group = new RouteGroup($prefix, $group, $this);
$this->groups[] = $group;
return $group;
} | [
"public",
"function",
"group",
"(",
"$",
"prefix",
",",
"callable",
"$",
"group",
")",
"{",
"$",
"group",
"=",
"new",
"RouteGroup",
"(",
"$",
"prefix",
",",
"$",
"group",
",",
"$",
"this",
")",
";",
"$",
"this",
"->",
"groups",
"[",
"]",
"=",
"$"... | Add a group of routes to the collection.
@param string $prefix
@param callable $group
@return RouteGroup | [
"Add",
"a",
"group",
"of",
"routes",
"to",
"the",
"collection",
"."
] | train | https://github.com/refinery29/piston/blob/75c402e814136577fa9a02479e8803aca664c865/src/Piston.php#L86-L93 |
refinery29/piston | src/Piston.php | Piston.launch | public function launch()
{
try {
$this->processPipeline();
$this->response = $this->dispatch($this->request, $this->response);
if ($this->response instanceof CompiledResponse) {
$this->response->compileContent();
}
return $this->... | php | public function launch()
{
try {
$this->processPipeline();
$this->response = $this->dispatch($this->request, $this->response);
if ($this->response instanceof CompiledResponse) {
$this->response->compileContent();
}
return $this->... | [
"public",
"function",
"launch",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"processPipeline",
"(",
")",
";",
"$",
"this",
"->",
"response",
"=",
"$",
"this",
"->",
"dispatch",
"(",
"$",
"this",
"->",
"request",
",",
"$",
"this",
"->",
"response",
... | @throws \Exception
@return ApiResponse | [
"@throws",
"\\",
"Exception"
] | train | https://github.com/refinery29/piston/blob/75c402e814136577fa9a02479e8803aca664c865/src/Piston.php#L117-L138 |
dpi/ak | src/AvatarServiceDiscovery.php | AvatarServiceDiscovery.discoverClasses | protected function discoverClasses(array $namespaces) : array {
$classes = [];
foreach ($namespaces as $namespace => $namespace_directories) {
$namespace_directories = array_filter($namespace_directories, function ($dir) {
return is_dir($dir);
});
foreach ($namespace_directories as $n... | php | protected function discoverClasses(array $namespaces) : array {
$classes = [];
foreach ($namespaces as $namespace => $namespace_directories) {
$namespace_directories = array_filter($namespace_directories, function ($dir) {
return is_dir($dir);
});
foreach ($namespace_directories as $n... | [
"protected",
"function",
"discoverClasses",
"(",
"array",
"$",
"namespaces",
")",
":",
"array",
"{",
"$",
"classes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"namespaces",
"as",
"$",
"namespace",
"=>",
"$",
"namespace_directories",
")",
"{",
"$",
"namespac... | Discover files that look like avatar service classes.
@param array $namespaces
An array of namespaces where keys are namespaces and values are
directories.
@return string[]
An array of classes. | [
"Discover",
"files",
"that",
"look",
"like",
"avatar",
"service",
"classes",
"."
] | train | https://github.com/dpi/ak/blob/cc61b172a827498cf6284191d51ce04d0f7c0f97/src/AvatarServiceDiscovery.php#L86-L113 |
dpi/ak | src/AvatarServiceDiscovery.php | AvatarServiceDiscovery.discoverAnnotations | protected function discoverAnnotations(array $classes) : array {
AnnotationRegistry::reset();
AnnotationRegistry::registerLoader('class_exists');
$reader = $this->createReader();
$annotations = [];
foreach ($classes as $class) {
$reflection = new \ReflectionClass($class);
if (!$reflect... | php | protected function discoverAnnotations(array $classes) : array {
AnnotationRegistry::reset();
AnnotationRegistry::registerLoader('class_exists');
$reader = $this->createReader();
$annotations = [];
foreach ($classes as $class) {
$reflection = new \ReflectionClass($class);
if (!$reflect... | [
"protected",
"function",
"discoverAnnotations",
"(",
"array",
"$",
"classes",
")",
":",
"array",
"{",
"AnnotationRegistry",
"::",
"reset",
"(",
")",
";",
"AnnotationRegistry",
"::",
"registerLoader",
"(",
"'class_exists'",
")",
";",
"$",
"reader",
"=",
"$",
"t... | Discovers and caches annotations.
@param string[] $classes
An array of classes.
@return \dpi\ak\Annotation\AvatarService[]
An array of avatar services keyed by class name. | [
"Discovers",
"and",
"caches",
"annotations",
"."
] | train | https://github.com/dpi/ak/blob/cc61b172a827498cf6284191d51ce04d0f7c0f97/src/AvatarServiceDiscovery.php#L131-L154 |
dpi/ak | src/AvatarServiceDiscovery.php | AvatarServiceDiscovery.getMetadata | public function getMetadata(string $id) : AvatarService {
$class = $this->getClass($id);
$avatar_services = $this->getAvatarServices();
if (isset($avatar_services[$class])) {
return $avatar_services[$class];
}
throw new AvatarDiscoveryException(sprintf('Requested service `%s` does not exist.',... | php | public function getMetadata(string $id) : AvatarService {
$class = $this->getClass($id);
$avatar_services = $this->getAvatarServices();
if (isset($avatar_services[$class])) {
return $avatar_services[$class];
}
throw new AvatarDiscoveryException(sprintf('Requested service `%s` does not exist.',... | [
"public",
"function",
"getMetadata",
"(",
"string",
"$",
"id",
")",
":",
"AvatarService",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getClass",
"(",
"$",
"id",
")",
";",
"$",
"avatar_services",
"=",
"$",
"this",
"->",
"getAvatarServices",
"(",
")",
";... | {@inheritdoc} | [
"{"
] | train | https://github.com/dpi/ak/blob/cc61b172a827498cf6284191d51ce04d0f7c0f97/src/AvatarServiceDiscovery.php#L159-L166 |
dpi/ak | src/AvatarServiceDiscovery.php | AvatarServiceDiscovery.getClass | public function getClass(string $id) : string {
if (!isset($this->idMap)) {
$services = $this->getAvatarServices();
$this->idMap = array_combine(
array_map(function (AvatarService $service) : string {
return $service->id;
}, $services),
array_keys($services)
);
... | php | public function getClass(string $id) : string {
if (!isset($this->idMap)) {
$services = $this->getAvatarServices();
$this->idMap = array_combine(
array_map(function (AvatarService $service) : string {
return $service->id;
}, $services),
array_keys($services)
);
... | [
"public",
"function",
"getClass",
"(",
"string",
"$",
"id",
")",
":",
"string",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"idMap",
")",
")",
"{",
"$",
"services",
"=",
"$",
"this",
"->",
"getAvatarServices",
"(",
")",
";",
"$",
"this",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dpi/ak/blob/cc61b172a827498cf6284191d51ce04d0f7c0f97/src/AvatarServiceDiscovery.php#L171-L188 |
it-blaster/color-picker-type-bundle | DependencyInjection/FenrizbesColorPickerTypeExtension.php | FenrizbesColorPickerTypeExtension.registerResources | protected function registerResources(ContainerBuilder $container)
{
$templatingEngines = $container->getParameter('templating.engines');
if (in_array('twig', $templatingEngines)) {
$container->setParameter('twig.form.resources', array_merge(
array('FenrizbesColorPickerTy... | php | protected function registerResources(ContainerBuilder $container)
{
$templatingEngines = $container->getParameter('templating.engines');
if (in_array('twig', $templatingEngines)) {
$container->setParameter('twig.form.resources', array_merge(
array('FenrizbesColorPickerTy... | [
"protected",
"function",
"registerResources",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"templatingEngines",
"=",
"$",
"container",
"->",
"getParameter",
"(",
"'templating.engines'",
")",
";",
"if",
"(",
"in_array",
"(",
"'twig'",
",",
"$",
"temp... | Registers form templates
@param ContainerBuilder $container | [
"Registers",
"form",
"templates"
] | train | https://github.com/it-blaster/color-picker-type-bundle/blob/507dba21e7ac32174090f08e7192673f3752b311/DependencyInjection/FenrizbesColorPickerTypeExtension.php#L36-L46 |
leongkui/silex-php-redis | src/SilexPhpRedis/RedisClientProvider.php | RedisClientProvider.getClientInitializer | protected function getClientInitializer(Application $app, $prefix)
{
return $app->protect(function ($args) use ($app, $prefix) {
$extract = function ($bag, $key) use ($app, $prefix) {
$default = "default_$key";
if ($bag instanceof Application) {
... | php | protected function getClientInitializer(Application $app, $prefix)
{
return $app->protect(function ($args) use ($app, $prefix) {
$extract = function ($bag, $key) use ($app, $prefix) {
$default = "default_$key";
if ($bag instanceof Application) {
... | [
"protected",
"function",
"getClientInitializer",
"(",
"Application",
"$",
"app",
",",
"$",
"prefix",
")",
"{",
"return",
"$",
"app",
"->",
"protect",
"(",
"function",
"(",
"$",
"args",
")",
"use",
"(",
"$",
"app",
",",
"$",
"prefix",
")",
"{",
"$",
"... | Returns an anonymous function used by the service provider initialize
lazily new instances of Redis\Client.
@param Application $app
@param string $prefix
@return \Closure | [
"Returns",
"an",
"anonymous",
"function",
"used",
"by",
"the",
"service",
"provider",
"initialize",
"lazily",
"new",
"instances",
"of",
"Redis",
"\\",
"Client",
"."
] | train | https://github.com/leongkui/silex-php-redis/blob/65fb4f52077fc75a9e134db7888683f07dd3583d/src/SilexPhpRedis/RedisClientProvider.php#L43-L68 |
leongkui/silex-php-redis | src/SilexPhpRedis/RedisClientProvider.php | RedisClientProvider.getProviderHandler | protected function getProviderHandler(Application $app, $prefix)
{
return function () use ($app, $prefix) {
$initializer = $app["$prefix.client_initializer"];
return $initializer($app);
};
} | php | protected function getProviderHandler(Application $app, $prefix)
{
return function () use ($app, $prefix) {
$initializer = $app["$prefix.client_initializer"];
return $initializer($app);
};
} | [
"protected",
"function",
"getProviderHandler",
"(",
"Application",
"$",
"app",
",",
"$",
"prefix",
")",
"{",
"return",
"function",
"(",
")",
"use",
"(",
"$",
"app",
",",
"$",
"prefix",
")",
"{",
"$",
"initializer",
"=",
"$",
"app",
"[",
"\"$prefix.client... | Returns an anonymous function used by the service provider to handle
accesses to the root prefix.
@param Application $app
@param string $prefix
@return mixed | [
"Returns",
"an",
"anonymous",
"function",
"used",
"by",
"the",
"service",
"provider",
"to",
"handle",
"accesses",
"to",
"the",
"root",
"prefix",
"."
] | train | https://github.com/leongkui/silex-php-redis/blob/65fb4f52077fc75a9e134db7888683f07dd3583d/src/SilexPhpRedis/RedisClientProvider.php#L79-L85 |
leongkui/silex-php-redis | src/SilexPhpRedis/RedisClientProvider.php | RedisClientProvider.register | public function register(Container $app)
{
$prefix = $this->prefix;
$app["$prefix.default_parameters"] = array();
$app["$prefix.default_options"] = array();
$app["$prefix.uri_parser"] = $app->protect(function ($uri) {
return Parameters::parse($uri);
});
... | php | public function register(Container $app)
{
$prefix = $this->prefix;
$app["$prefix.default_parameters"] = array();
$app["$prefix.default_options"] = array();
$app["$prefix.uri_parser"] = $app->protect(function ($uri) {
return Parameters::parse($uri);
});
... | [
"public",
"function",
"register",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"prefix",
";",
"$",
"app",
"[",
"\"$prefix.default_parameters\"",
"]",
"=",
"array",
"(",
")",
";",
"$",
"app",
"[",
"\"$prefix.default_options... | {@inheritdoc} | [
"{"
] | train | https://github.com/leongkui/silex-php-redis/blob/65fb4f52077fc75a9e134db7888683f07dd3583d/src/SilexPhpRedis/RedisClientProvider.php#L90-L139 |
RinkAttendant6/JsonI18n | src/Resource.php | Resource.fromJson | public static function fromJson(string $json): self
{
$input = json_decode($json, true);
$data = reset($input);
$locale = key($input);
return new self($locale, $data);
} | php | public static function fromJson(string $json): self
{
$input = json_decode($json, true);
$data = reset($input);
$locale = key($input);
return new self($locale, $data);
} | [
"public",
"static",
"function",
"fromJson",
"(",
"string",
"$",
"json",
")",
":",
"self",
"{",
"$",
"input",
"=",
"json_decode",
"(",
"$",
"json",
",",
"true",
")",
";",
"$",
"data",
"=",
"reset",
"(",
"$",
"input",
")",
";",
"$",
"locale",
"=",
... | Factory method to create a translation resource from a JSON string
@param string $json
@return \self | [
"Factory",
"method",
"to",
"create",
"a",
"translation",
"resource",
"from",
"a",
"JSON",
"string"
] | train | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L43-L50 |
RinkAttendant6/JsonI18n | src/Resource.php | Resource.setLocale | private function setLocale(string $locale)
{
$arr = \Locale::parseLocale($locale);
if ($arr === false) {
throw new \InvalidArgumentException('Invalid locale');
}
$this->locale = $arr;
} | php | private function setLocale(string $locale)
{
$arr = \Locale::parseLocale($locale);
if ($arr === false) {
throw new \InvalidArgumentException('Invalid locale');
}
$this->locale = $arr;
} | [
"private",
"function",
"setLocale",
"(",
"string",
"$",
"locale",
")",
"{",
"$",
"arr",
"=",
"\\",
"Locale",
"::",
"parseLocale",
"(",
"$",
"locale",
")",
";",
"if",
"(",
"$",
"arr",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExcep... | Sets the locale of the resource
@param string $locale The locale
@throws \InvalidArgumentException When provided with an invalid locale | [
"Sets",
"the",
"locale",
"of",
"the",
"resource"
] | train | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L57-L66 |
RinkAttendant6/JsonI18n | src/Resource.php | Resource.addData | public function addData(array $data, bool $overwrite = true): void
{
if ($overwrite) {
$this->data = array_merge($this->data, $data);
} else {
$this->data = array_merge($data, $this->data);
}
} | php | public function addData(array $data, bool $overwrite = true): void
{
if ($overwrite) {
$this->data = array_merge($this->data, $data);
} else {
$this->data = array_merge($data, $this->data);
}
} | [
"public",
"function",
"addData",
"(",
"array",
"$",
"data",
",",
"bool",
"$",
"overwrite",
"=",
"true",
")",
":",
"void",
"{",
"if",
"(",
"$",
"overwrite",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
","... | Adds translation values to the resource
@param array $data Values to add
@param boolean $overwrite Whether the new array should overwrite already existing values | [
"Adds",
"translation",
"values",
"to",
"the",
"resource"
] | train | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L91-L98 |
RinkAttendant6/JsonI18n | src/Resource.php | Resource.merge | public function merge(self $resource, bool $overwrite = true): void
{
if ($this->getLocale() !== $resource->getLocale()) {
trigger_error('Attempting to merge resources of different locale', \E_USER_NOTICE);
}
$this->addData($resource->data, (bool) $overwrite);
} | php | public function merge(self $resource, bool $overwrite = true): void
{
if ($this->getLocale() !== $resource->getLocale()) {
trigger_error('Attempting to merge resources of different locale', \E_USER_NOTICE);
}
$this->addData($resource->data, (bool) $overwrite);
} | [
"public",
"function",
"merge",
"(",
"self",
"$",
"resource",
",",
"bool",
"$",
"overwrite",
"=",
"true",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"getLocale",
"(",
")",
"!==",
"$",
"resource",
"->",
"getLocale",
"(",
")",
")",
"{",
"tri... | Merges a resource into the current resource
@param self $resource
@param boolean $overwrite Whether the new resource should overwrite already existing values | [
"Merges",
"a",
"resource",
"into",
"the",
"current",
"resource"
] | train | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L114-L121 |
RinkAttendant6/JsonI18n | src/Resource.php | Resource.jsonSerialize | public function jsonSerialize(): string
{
$output = array($this->getLocale() => $this->data);
return json_encode($output, JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG);
} | php | public function jsonSerialize(): string
{
$output = array($this->getLocale() => $this->data);
return json_encode($output, JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG);
} | [
"public",
"function",
"jsonSerialize",
"(",
")",
":",
"string",
"{",
"$",
"output",
"=",
"array",
"(",
"$",
"this",
"->",
"getLocale",
"(",
")",
"=>",
"$",
"this",
"->",
"data",
")",
";",
"return",
"json_encode",
"(",
"$",
"output",
",",
"JSON_HEX_AMP"... | Serializes the resource into a JSON object
@return string | [
"Serializes",
"the",
"resource",
"into",
"a",
"JSON",
"object"
] | train | https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Resource.php#L165-L169 |
comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Cache/RouterCache.php | RouterCache.dump | public function dump($data, $ttl=null) {
return $this->getCache()
->setNamespace(self::CACHE_NAMESPACE)
->set(self::CACHE_NAME, $data, $ttl === null ? self::DEFAULTTTL : intval($ttl));
} | php | public function dump($data, $ttl=null) {
return $this->getCache()
->setNamespace(self::CACHE_NAMESPACE)
->set(self::CACHE_NAME, $data, $ttl === null ? self::DEFAULTTTL : intval($ttl));
} | [
"public",
"function",
"dump",
"(",
"$",
"data",
",",
"$",
"ttl",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getCache",
"(",
")",
"->",
"setNamespace",
"(",
"self",
"::",
"CACHE_NAMESPACE",
")",
"->",
"set",
"(",
"self",
"::",
"CACHE_NAME",
... | Store the routing table in cache
@return array $data
@return int $ttl
@return bool | [
"Store",
"the",
"routing",
"table",
"in",
"cache"
] | train | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Cache/RouterCache.php#L59-L65 |
braincrafted/arrayquery | src/Braincrafted/ArrayQuery/SelectEvaluation.php | SelectEvaluation.evaluate | public function evaluate($value, $filters)
{
if (false === is_array($filters)) {
$filters = [ $filters ];
}
foreach ($filters as $filter) {
$value = $this->evaluateFilter($value, $filter);
}
return $value;
} | php | public function evaluate($value, $filters)
{
if (false === is_array($filters)) {
$filters = [ $filters ];
}
foreach ($filters as $filter) {
$value = $this->evaluateFilter($value, $filter);
}
return $value;
} | [
"public",
"function",
"evaluate",
"(",
"$",
"value",
",",
"$",
"filters",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"filters",
")",
")",
"{",
"$",
"filters",
"=",
"[",
"$",
"filters",
"]",
";",
"}",
"foreach",
"(",
"$",
"filters",
... | Evaluates the given value with the given filters.
@param mixed $value The value.
@param array $filters The list of filters to apply.
@return mixed The evaluated value.
@throws Braincrafted\ArrayQuery\Exception\UnkownFilterException if a filter does not exist. | [
"Evaluates",
"the",
"given",
"value",
"with",
"the",
"given",
"filters",
"."
] | train | https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/SelectEvaluation.php#L53-L64 |
codeburnerframework/router | src/Collectors/ControllerCollectorTrait.php | ControllerCollectorTrait.controller | public function controller($controller, $prefix = null)
{
$controller = new ReflectionClass($controller);
$prefix = $prefix === null ? $this->getControllerPrefix($controller) : $prefix;
$methods = $controller->getMethods(ReflectionMethod::IS_PUBLIC);
return $this->collectContr... | php | public function controller($controller, $prefix = null)
{
$controller = new ReflectionClass($controller);
$prefix = $prefix === null ? $this->getControllerPrefix($controller) : $prefix;
$methods = $controller->getMethods(ReflectionMethod::IS_PUBLIC);
return $this->collectContr... | [
"public",
"function",
"controller",
"(",
"$",
"controller",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"$",
"controller",
"=",
"new",
"ReflectionClass",
"(",
"$",
"controller",
")",
";",
"$",
"prefix",
"=",
"$",
"prefix",
"===",
"null",
"?",
"$",
"this... | Maps all the controller methods that begins with a HTTP method, and maps the rest of
name as a path. The path will be the method name with slashes before every camelcased
word and without the HTTP method prefix, and the controller name will be used to prefix
the route pattern. e.g. ArticlesController::getCreate will ge... | [
"Maps",
"all",
"the",
"controller",
"methods",
"that",
"begins",
"with",
"a",
"HTTP",
"method",
"and",
"maps",
"the",
"rest",
"of",
"name",
"as",
"a",
"path",
".",
"The",
"path",
"will",
"be",
"the",
"method",
"name",
"with",
"slashes",
"before",
"every"... | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collectors/ControllerCollectorTrait.php#L66-L72 |
codeburnerframework/router | src/Collectors/ControllerCollectorTrait.php | ControllerCollectorTrait.controllers | public function controllers(array $controllers)
{
$group = new Group;
foreach ($controllers as $controller)
$group->set($this->controller($controller));
return $group;
} | php | public function controllers(array $controllers)
{
$group = new Group;
foreach ($controllers as $controller)
$group->set($this->controller($controller));
return $group;
} | [
"public",
"function",
"controllers",
"(",
"array",
"$",
"controllers",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
";",
"foreach",
"(",
"$",
"controllers",
"as",
"$",
"controller",
")",
"$",
"group",
"->",
"set",
"(",
"$",
"this",
"->",
"controller",
... | Maps several controllers at same time.
@param string[] $controllers Controllers name.
@throws \ReflectionException
@return Group | [
"Maps",
"several",
"controllers",
"at",
"same",
"time",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collectors/ControllerCollectorTrait.php#L82-L88 |
codeburnerframework/router | src/Collectors/ControllerCollectorTrait.php | ControllerCollectorTrait.controllerWithoutPrefix | public function controllerWithoutPrefix($controller)
{
$controller = new ReflectionClass($controller);
$methods = $controller->getMethods(ReflectionMethod::IS_PUBLIC);
return $this->collectControllerRoutes($controller, $methods, "/");
} | php | public function controllerWithoutPrefix($controller)
{
$controller = new ReflectionClass($controller);
$methods = $controller->getMethods(ReflectionMethod::IS_PUBLIC);
return $this->collectControllerRoutes($controller, $methods, "/");
} | [
"public",
"function",
"controllerWithoutPrefix",
"(",
"$",
"controller",
")",
"{",
"$",
"controller",
"=",
"new",
"ReflectionClass",
"(",
"$",
"controller",
")",
";",
"$",
"methods",
"=",
"$",
"controller",
"->",
"getMethods",
"(",
"ReflectionMethod",
"::",
"I... | Alias for Collector::controller but maps a controller without using the controller name as prefix.
@param string $controller The controller name
@throws \ReflectionException
@return Group | [
"Alias",
"for",
"Collector",
"::",
"controller",
"but",
"maps",
"a",
"controller",
"without",
"using",
"the",
"controller",
"name",
"as",
"prefix",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collectors/ControllerCollectorTrait.php#L98-L103 |
codeburnerframework/router | src/Collectors/ControllerCollectorTrait.php | ControllerCollectorTrait.controllersWithoutPrefix | public function controllersWithoutPrefix(array $controllers)
{
$group = new Group;
foreach ($controllers as $controller)
$group->set($this->controllerWithoutPrefix($controller));
return $group;
} | php | public function controllersWithoutPrefix(array $controllers)
{
$group = new Group;
foreach ($controllers as $controller)
$group->set($this->controllerWithoutPrefix($controller));
return $group;
} | [
"public",
"function",
"controllersWithoutPrefix",
"(",
"array",
"$",
"controllers",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
";",
"foreach",
"(",
"$",
"controllers",
"as",
"$",
"controller",
")",
"$",
"group",
"->",
"set",
"(",
"$",
"this",
"->",
"co... | Alias for Collector::controllers but maps a controller without using the controller name as prefix.
@param string[] $controllers
@throws \ReflectionException
@return Group | [
"Alias",
"for",
"Collector",
"::",
"controllers",
"but",
"maps",
"a",
"controller",
"without",
"using",
"the",
"controller",
"name",
"as",
"prefix",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collectors/ControllerCollectorTrait.php#L113-L119 |
codeburnerframework/router | src/Collectors/ControllerCollectorTrait.php | ControllerCollectorTrait.collectControllerRoutes | protected function collectControllerRoutes(ReflectionClass $controller, array $methods, $prefix)
{
$group = new Group;
$controllerDefaultStrategy = $this->getAnnotatedStrategy($controller);
foreach ($methods as $method) {
$name = preg_split("~(?=[A-Z])~", $method->name);
... | php | protected function collectControllerRoutes(ReflectionClass $controller, array $methods, $prefix)
{
$group = new Group;
$controllerDefaultStrategy = $this->getAnnotatedStrategy($controller);
foreach ($methods as $method) {
$name = preg_split("~(?=[A-Z])~", $method->name);
... | [
"protected",
"function",
"collectControllerRoutes",
"(",
"ReflectionClass",
"$",
"controller",
",",
"array",
"$",
"methods",
",",
"$",
"prefix",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
";",
"$",
"controllerDefaultStrategy",
"=",
"$",
"this",
"->",
"getAnn... | @param ReflectionClass $controller
@param ReflectionMethod[] $methods
@param string $prefix
@return Group | [
"@param",
"ReflectionClass",
"$controller",
"@param",
"ReflectionMethod",
"[]",
"$methods",
"@param",
"string",
"$prefix"
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collectors/ControllerCollectorTrait.php#L129-L155 |
codeburnerframework/router | src/Collectors/ControllerCollectorTrait.php | ControllerCollectorTrait.getControllerPrefix | protected function getControllerPrefix(ReflectionClass $controller)
{
preg_match("~\@prefix\s([a-zA-Z\\\_]+)~i", (string) $controller->getDocComment(), $prefix);
return isset($prefix[1]) ? $prefix[1] : str_replace("controller", "", strtolower($controller->getShortName()));
} | php | protected function getControllerPrefix(ReflectionClass $controller)
{
preg_match("~\@prefix\s([a-zA-Z\\\_]+)~i", (string) $controller->getDocComment(), $prefix);
return isset($prefix[1]) ? $prefix[1] : str_replace("controller", "", strtolower($controller->getShortName()));
} | [
"protected",
"function",
"getControllerPrefix",
"(",
"ReflectionClass",
"$",
"controller",
")",
"{",
"preg_match",
"(",
"\"~\\@prefix\\s([a-zA-Z\\\\\\_]+)~i\"",
",",
"(",
"string",
")",
"$",
"controller",
"->",
"getDocComment",
"(",
")",
",",
"$",
"prefix",
")",
"... | @param ReflectionClass $controller
@return string | [
"@param",
"ReflectionClass",
"$controller"
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collectors/ControllerCollectorTrait.php#L163-L167 |
activecollab/databasestructure | src/Association/HasManyAssociation.php | HasManyAssociation.buildClassMethods | public function buildClassMethods(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, array &$result)
{
$namespace = $structure->getNamespace();
if ($namespace) {
$namespace = '\\' . ltrim($namespace, '\\');
}
$this->buildGetFinderMeth... | php | public function buildClassMethods(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, array &$result)
{
$namespace = $structure->getNamespace();
if ($namespace) {
$namespace = '\\' . ltrim($namespace, '\\');
}
$this->buildGetFinderMeth... | [
"public",
"function",
"buildClassMethods",
"(",
"StructureInterface",
"$",
"structure",
",",
"TypeInterface",
"$",
"source_type",
",",
"TypeInterface",
"$",
"target_type",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"namespace",
"=",
"$",
"structure",
"->",... | Build class methods.
@param StructureInterface $structure
@param TypeInterface $source_type
@param TypeInterface $target_type
@param array $result | [
"Build",
"class",
"methods",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Association/HasManyAssociation.php#L76-L122 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.hydrate | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
{
try {
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : RolePermissionTableMap::translateFieldName('RoleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->role_id = (null ... | php | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
{
try {
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : RolePermissionTableMap::translateFieldName('RoleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->role_id = (null ... | [
"public",
"function",
"hydrate",
"(",
"$",
"row",
",",
"$",
"startcol",
"=",
"0",
",",
"$",
"rehydrate",
"=",
"false",
",",
"$",
"indexType",
"=",
"TableMap",
"::",
"TYPE_NUM",
")",
"{",
"try",
"{",
"$",
"col",
"=",
"$",
"row",
"[",
"TableMap",
"::... | Hydrates (populates) the object variables with values from the database resultset.
An offset (0-based "start column") is specified so that objects can be hydrated
with a subset of the columns in the resultset rows. This is needed, for example,
for results of JOIN queries where the resultset row includes columns from ... | [
"Hydrates",
"(",
"populates",
")",
"the",
"object",
"variables",
"with",
"values",
"from",
"the",
"database",
"resultset",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L358-L380 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.ensureConsistency | public function ensureConsistency()
{
if ($this->aRole !== null && $this->role_id !== $this->aRole->getId()) {
$this->aRole = null;
}
if ($this->aPermission !== null && $this->permission_id !== $this->aPermission->getId()) {
$this->aPermission = null;
}
} | php | public function ensureConsistency()
{
if ($this->aRole !== null && $this->role_id !== $this->aRole->getId()) {
$this->aRole = null;
}
if ($this->aPermission !== null && $this->permission_id !== $this->aPermission->getId()) {
$this->aPermission = null;
}
} | [
"public",
"function",
"ensureConsistency",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aRole",
"!==",
"null",
"&&",
"$",
"this",
"->",
"role_id",
"!==",
"$",
"this",
"->",
"aRole",
"->",
"getId",
"(",
")",
")",
"{",
"$",
"this",
"->",
"aRole",
"=... | Checks and repairs the internal consistency of the object.
This method is executed after an already-instantiated object is re-hydrated
from the database. It exists to check any foreign keys to make sure that
the objects related to the current object are correct based on foreign key.
You can override this method in t... | [
"Checks",
"and",
"repairs",
"the",
"internal",
"consistency",
"of",
"the",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L395-L403 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.setRoleId | public function setRoleId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->role_id !== $v) {
$this->role_id = $v;
$this->modifiedColumns[RolePermissionTableMap::COL_ROLE_ID] = true;
}
if ($this->aRole !== null && $this->aRole->getId()... | php | public function setRoleId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->role_id !== $v) {
$this->role_id = $v;
$this->modifiedColumns[RolePermissionTableMap::COL_ROLE_ID] = true;
}
if ($this->aRole !== null && $this->aRole->getId()... | [
"public",
"function",
"setRoleId",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"int",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"role_id",
"!==",
"$",
"v",
")",
"{",
"$",
"this",
... | Set the value of [role_id] column.
@param int $v new value
@return $this|\Alchemy\Component\Cerberus\Model\RolePermission The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"role_id",
"]",
"column",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L411-L427 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.setPermissionId | public function setPermissionId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->permission_id !== $v) {
$this->permission_id = $v;
$this->modifiedColumns[RolePermissionTableMap::COL_PERMISSION_ID] = true;
}
if ($this->aPermission !==... | php | public function setPermissionId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->permission_id !== $v) {
$this->permission_id = $v;
$this->modifiedColumns[RolePermissionTableMap::COL_PERMISSION_ID] = true;
}
if ($this->aPermission !==... | [
"public",
"function",
"setPermissionId",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"int",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"permission_id",
"!==",
"$",
"v",
")",
"{",
"$",... | Set the value of [permission_id] column.
@param int $v new value
@return $this|\Alchemy\Component\Cerberus\Model\RolePermission The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"permission_id",
"]",
"column",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L435-L451 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.doSave | protected function doSave(ConnectionInterface $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed t... | php | protected function doSave(ConnectionInterface $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed t... | [
"protected",
"function",
"doSave",
"(",
"ConnectionInterface",
"$",
"con",
")",
"{",
"$",
"affectedRows",
"=",
"0",
";",
"// initialize var to track total num of affected rows",
"if",
"(",
"!",
"$",
"this",
"->",
"alreadyInSave",
")",
"{",
"$",
"this",
"->",
"al... | Performs the work of inserting or updating the row in the database.
If the object is new, it inserts it; otherwise an update is performed.
All related objects are also updated in this method.
@param ConnectionInterface $con
@return int The number of rows affected by this insert/update and any referri... | [
"Performs",
"the",
"work",
"of",
"inserting",
"or",
"updating",
"the",
"row",
"in",
"the",
"database",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L585-L626 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.doInsert | protected function doInsert(ConnectionInterface $con)
{
$modifiedColumns = array();
$index = 0;
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(RolePermissionTableMap::COL_ROLE_ID)) {
$modifiedColumns[':p' . $index++] = ... | php | protected function doInsert(ConnectionInterface $con)
{
$modifiedColumns = array();
$index = 0;
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(RolePermissionTableMap::COL_ROLE_ID)) {
$modifiedColumns[':p' . $index++] = ... | [
"protected",
"function",
"doInsert",
"(",
"ConnectionInterface",
"$",
"con",
")",
"{",
"$",
"modifiedColumns",
"=",
"array",
"(",
")",
";",
"$",
"index",
"=",
"0",
";",
"// check the columns in natural order for more readable SQL queries",
"if",
"(",
"$",
"this",
... | Insert the row in the database.
@param ConnectionInterface $con
@throws PropelException
@see doSave() | [
"Insert",
"the",
"row",
"in",
"the",
"database",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L636-L675 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.toArray | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['RolePermission'][serialize($this->getPrimaryKey())])) {
return '*RECURSION*';
}
$alreadyD... | php | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['RolePermission'][serialize($this->getPrimaryKey())])) {
return '*RECURSION*';
}
$alreadyD... | [
"public",
"function",
"toArray",
"(",
"$",
"keyType",
"=",
"TableMap",
"::",
"TYPE_PHPNAME",
",",
"$",
"includeLazyLoadColumns",
"=",
"true",
",",
"$",
"alreadyDumpedObjects",
"=",
"array",
"(",
")",
",",
"$",
"includeForeignObjects",
"=",
"false",
")",
"{",
... | Exports the object as an array.
You can specify the key type of the array by passing one of the class
type constants.
@param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
Defau... | [
"Exports",
"the",
"object",
"as",
"an",
"array",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L748-L774 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.setByPosition | public function setByPosition($pos, $value)
{
switch ($pos) {
case 0:
$this->setRoleId($value);
break;
case 1:
$this->setPermissionId($value);
break;
} // switch()
return $this;
} | php | public function setByPosition($pos, $value)
{
switch ($pos) {
case 0:
$this->setRoleId($value);
break;
case 1:
$this->setPermissionId($value);
break;
} // switch()
return $this;
} | [
"public",
"function",
"setByPosition",
"(",
"$",
"pos",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"pos",
")",
"{",
"case",
"0",
":",
"$",
"this",
"->",
"setRoleId",
"(",
"$",
"value",
")",
";",
"break",
";",
"case",
"1",
":",
"$",
"this",
... | Sets a field from the object by Position as specified in the xml schema.
Zero-based.
@param int $pos position in xml schema
@param mixed $value field value
@return $this|\Alchemy\Component\Cerberus\Model\RolePermission | [
"Sets",
"a",
"field",
"from",
"the",
"object",
"by",
"Position",
"as",
"specified",
"in",
"the",
"xml",
"schema",
".",
"Zero",
"-",
"based",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L802-L814 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.fromArray | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
{
$keys = RolePermissionTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setRoleId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setPermiss... | php | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
{
$keys = RolePermissionTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setRoleId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setPermiss... | [
"public",
"function",
"fromArray",
"(",
"$",
"arr",
",",
"$",
"keyType",
"=",
"TableMap",
"::",
"TYPE_PHPNAME",
")",
"{",
"$",
"keys",
"=",
"RolePermissionTableMap",
"::",
"getFieldNames",
"(",
"$",
"keyType",
")",
";",
"if",
"(",
"array_key_exists",
"(",
... | Populates the object using an array.
This is particularly useful when populating an object from one of the
request arrays (e.g. $_POST). This method goes through the column
names, checking to see whether a matching key exists in populated
array. If so the setByName() method is called for that column.
You can specify... | [
"Populates",
"the",
"object",
"using",
"an",
"array",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L833-L843 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.buildCriteria | public function buildCriteria()
{
$criteria = new Criteria(RolePermissionTableMap::DATABASE_NAME);
if ($this->isColumnModified(RolePermissionTableMap::COL_ROLE_ID)) {
$criteria->add(RolePermissionTableMap::COL_ROLE_ID, $this->role_id);
}
if ($this->isColumnModified(RoleP... | php | public function buildCriteria()
{
$criteria = new Criteria(RolePermissionTableMap::DATABASE_NAME);
if ($this->isColumnModified(RolePermissionTableMap::COL_ROLE_ID)) {
$criteria->add(RolePermissionTableMap::COL_ROLE_ID, $this->role_id);
}
if ($this->isColumnModified(RoleP... | [
"public",
"function",
"buildCriteria",
"(",
")",
"{",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"RolePermissionTableMap",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"RolePermissionTableMap",
"::",
"COL_ROLE_ID",
"... | Build a Criteria object containing the values of all modified columns in this object.
@return Criteria The Criteria object containing all modified values. | [
"Build",
"a",
"Criteria",
"object",
"containing",
"the",
"values",
"of",
"all",
"modified",
"columns",
"in",
"this",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L874-L886 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.buildPkeyCriteria | public function buildPkeyCriteria()
{
$criteria = new Criteria(RolePermissionTableMap::DATABASE_NAME);
$criteria->add(RolePermissionTableMap::COL_ROLE_ID, $this->role_id);
$criteria->add(RolePermissionTableMap::COL_PERMISSION_ID, $this->permission_id);
return $criteria;
} | php | public function buildPkeyCriteria()
{
$criteria = new Criteria(RolePermissionTableMap::DATABASE_NAME);
$criteria->add(RolePermissionTableMap::COL_ROLE_ID, $this->role_id);
$criteria->add(RolePermissionTableMap::COL_PERMISSION_ID, $this->permission_id);
return $criteria;
} | [
"public",
"function",
"buildPkeyCriteria",
"(",
")",
"{",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"RolePermissionTableMap",
"::",
"DATABASE_NAME",
")",
";",
"$",
"criteria",
"->",
"add",
"(",
"RolePermissionTableMap",
"::",
"COL_ROLE_ID",
",",
"$",
"this",... | Builds a Criteria object containing the primary key for this object.
Unlike buildCriteria() this method includes the primary key values regardless
of whether or not they have been modified.
@throws LogicException if no primary key is defined
@return Criteria The Criteria object containing value(s) for primary key(s)... | [
"Builds",
"a",
"Criteria",
"object",
"containing",
"the",
"primary",
"key",
"for",
"this",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L898-L905 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.hashCode | public function hashCode()
{
$validPk = null !== $this->getRoleId() &&
null !== $this->getPermissionId();
$validPrimaryKeyFKs = 2;
$primaryKeyFKs = [];
//relation role_permission_fk_1ff99e to table role
if ($this->aRole && $hash = spl_object_hash($this->aRole)) ... | php | public function hashCode()
{
$validPk = null !== $this->getRoleId() &&
null !== $this->getPermissionId();
$validPrimaryKeyFKs = 2;
$primaryKeyFKs = [];
//relation role_permission_fk_1ff99e to table role
if ($this->aRole && $hash = spl_object_hash($this->aRole)) ... | [
"public",
"function",
"hashCode",
"(",
")",
"{",
"$",
"validPk",
"=",
"null",
"!==",
"$",
"this",
"->",
"getRoleId",
"(",
")",
"&&",
"null",
"!==",
"$",
"this",
"->",
"getPermissionId",
"(",
")",
";",
"$",
"validPrimaryKeyFKs",
"=",
"2",
";",
"$",
"p... | If the primary key is not null, return the hashcode of the
primary key. Otherwise, return the hash code of the object.
@return int Hashcode | [
"If",
"the",
"primary",
"key",
"is",
"not",
"null",
"return",
"the",
"hashcode",
"of",
"the",
"primary",
"key",
".",
"Otherwise",
"return",
"the",
"hash",
"code",
"of",
"the",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L913-L942 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.copyInto | public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setRoleId($this->getRoleId());
$copyObj->setPermissionId($this->getPermissionId());
if ($makeNew) {
$copyObj->setNew(true);
}
} | php | public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setRoleId($this->getRoleId());
$copyObj->setPermissionId($this->getPermissionId());
if ($makeNew) {
$copyObj->setNew(true);
}
} | [
"public",
"function",
"copyInto",
"(",
"$",
"copyObj",
",",
"$",
"deepCopy",
"=",
"false",
",",
"$",
"makeNew",
"=",
"true",
")",
"{",
"$",
"copyObj",
"->",
"setRoleId",
"(",
"$",
"this",
"->",
"getRoleId",
"(",
")",
")",
";",
"$",
"copyObj",
"->",
... | Sets contents of passed object to values from current object.
If desired, this method can also make copies of all associated (fkey referrers)
objects.
@param object $copyObj An object of \Alchemy\Component\Cerberus\Model\RolePermission (or compatible) type.
@param boolean $deepCopy Whether to also copy all ... | [
"Sets",
"contents",
"of",
"passed",
"object",
"to",
"values",
"from",
"current",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L990-L997 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.setPermission | public function setPermission(ChildPermission $v = null)
{
if ($v === null) {
$this->setPermissionId(NULL);
} else {
$this->setPermissionId($v->getId());
}
$this->aPermission = $v;
// Add binding for other direction of this n:n relationship.
... | php | public function setPermission(ChildPermission $v = null)
{
if ($v === null) {
$this->setPermissionId(NULL);
} else {
$this->setPermissionId($v->getId());
}
$this->aPermission = $v;
// Add binding for other direction of this n:n relationship.
... | [
"public",
"function",
"setPermission",
"(",
"ChildPermission",
"$",
"v",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"v",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setPermissionId",
"(",
"NULL",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"setPermis... | Declares an association between this object and a ChildPermission object.
@param ChildPermission $v
@return $this|\Alchemy\Component\Cerberus\Model\RolePermission The current object (for fluent API support)
@throws PropelException | [
"Declares",
"an",
"association",
"between",
"this",
"object",
"and",
"a",
"ChildPermission",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L1079-L1097 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.getPermission | public function getPermission(ConnectionInterface $con = null)
{
if ($this->aPermission === null && ($this->permission_id !== null)) {
$this->aPermission = ChildPermissionQuery::create()->findPk($this->permission_id, $con);
/* The following can be used additionally to
... | php | public function getPermission(ConnectionInterface $con = null)
{
if ($this->aPermission === null && ($this->permission_id !== null)) {
$this->aPermission = ChildPermissionQuery::create()->findPk($this->permission_id, $con);
/* The following can be used additionally to
... | [
"public",
"function",
"getPermission",
"(",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aPermission",
"===",
"null",
"&&",
"(",
"$",
"this",
"->",
"permission_id",
"!==",
"null",
")",
")",
"{",
"$",
"this",
... | Get the associated ChildPermission object
@param ConnectionInterface $con Optional Connection object.
@return ChildPermission The associated ChildPermission object.
@throws PropelException | [
"Get",
"the",
"associated",
"ChildPermission",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L1107-L1121 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.clear | public function clear()
{
if (null !== $this->aRole) {
$this->aRole->removeRolePermission($this);
}
if (null !== $this->aPermission) {
$this->aPermission->removeRolePermission($this);
}
$this->role_id = null;
$this->permission_id = null;
... | php | public function clear()
{
if (null !== $this->aRole) {
$this->aRole->removeRolePermission($this);
}
if (null !== $this->aPermission) {
$this->aPermission->removeRolePermission($this);
}
$this->role_id = null;
$this->permission_id = null;
... | [
"public",
"function",
"clear",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"aRole",
")",
"{",
"$",
"this",
"->",
"aRole",
"->",
"removeRolePermission",
"(",
"$",
"this",
")",
";",
"}",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
... | Clears the current object, sets all attributes to their default values and removes
outgoing references as well as back-references (from other objects to this one. Results probably in a database
change of those foreign objects when you call `save` there). | [
"Clears",
"the",
"current",
"object",
"sets",
"all",
"attributes",
"to",
"their",
"default",
"values",
"and",
"removes",
"outgoing",
"references",
"as",
"well",
"as",
"back",
"-",
"references",
"(",
"from",
"other",
"objects",
"to",
"this",
"one",
".",
"Resu... | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L1128-L1143 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php | RolePermission.clearAllReferences | public function clearAllReferences($deep = false)
{
if ($deep) {
} // if ($deep)
$this->aRole = null;
$this->aPermission = null;
} | php | public function clearAllReferences($deep = false)
{
if ($deep) {
} // if ($deep)
$this->aRole = null;
$this->aPermission = null;
} | [
"public",
"function",
"clearAllReferences",
"(",
"$",
"deep",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"deep",
")",
"{",
"}",
"// if ($deep)",
"$",
"this",
"->",
"aRole",
"=",
"null",
";",
"$",
"this",
"->",
"aPermission",
"=",
"null",
";",
"}"
] | Resets all references and back-references to other model objects or collections of model objects.
This method is used to reset all php object references (not the actual reference in the database).
Necessary for object serialisation.
@param boolean $deep Whether to also clear the references on all referrer object... | [
"Resets",
"all",
"references",
"and",
"back",
"-",
"references",
"to",
"other",
"model",
"objects",
"or",
"collections",
"of",
"model",
"objects",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/RolePermission.php#L1153-L1160 |
avto-dev/app-version-laravel | src/Commands/VersionCommand.php | VersionCommand.handle | public function handle(AppVersionManagerContract $manager)
{
if ($this->option('refresh')) {
$manager->refresh();
$this->info('Stored in files values updated, files recreated');
} elseif ($build = $this->option('set-build')) {
$manager->setBuild($build);
... | php | public function handle(AppVersionManagerContract $manager)
{
if ($this->option('refresh')) {
$manager->refresh();
$this->info('Stored in files values updated, files recreated');
} elseif ($build = $this->option('set-build')) {
$manager->setBuild($build);
... | [
"public",
"function",
"handle",
"(",
"AppVersionManagerContract",
"$",
"manager",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"option",
"(",
"'refresh'",
")",
")",
"{",
"$",
"manager",
"->",
"refresh",
"(",
")",
";",
"$",
"this",
"->",
"info",
"(",
"'Store... | Execute the console command.
@param AppVersionManagerContract $manager
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/Commands/VersionCommand.php#L32-L49 |
acasademont/wurfl | WURFL/CustomDevice.php | WURFL_CustomDevice.getActualDeviceRootAncestor | public function getActualDeviceRootAncestor()
{
if ($this->actualDeviceRoot) {
return $this;
}
foreach ($this->modelDevices as $modelDevice) {
/* @var WURFL_Xml_ModelDevice $modelDevice */
if ($modelDevice->actualDeviceRoot) {
return $model... | php | public function getActualDeviceRootAncestor()
{
if ($this->actualDeviceRoot) {
return $this;
}
foreach ($this->modelDevices as $modelDevice) {
/* @var WURFL_Xml_ModelDevice $modelDevice */
if ($modelDevice->actualDeviceRoot) {
return $model... | [
"public",
"function",
"getActualDeviceRootAncestor",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"actualDeviceRoot",
")",
"{",
"return",
"$",
"this",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"modelDevices",
"as",
"$",
"modelDevice",
")",
"{",
"/* @var... | Returns the nearest actual device root in the fall back tree. If this device is a device root itself,
it is returned. Some devices have no device roots in their fall back tree, like generic_android, since
no devices above it (itself included) are real devices (actual device roots).
@return WURFL_Xml_ModelDevice | [
"Returns",
"the",
"nearest",
"actual",
"device",
"root",
"in",
"the",
"fall",
"back",
"tree",
".",
"If",
"this",
"device",
"is",
"a",
"device",
"root",
"itself",
"it",
"is",
"returned",
".",
"Some",
"devices",
"have",
"no",
"device",
"roots",
"in",
"thei... | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/CustomDevice.php#L152-L164 |
acasademont/wurfl | WURFL/CustomDevice.php | WURFL_CustomDevice.getAllCapabilities | public function getAllCapabilities()
{
$capabilities = array();
foreach (array_reverse($this->modelDevices) as $modelDevice) {
$capabilities = array_merge($capabilities, $modelDevice->getCapabilities());
}
return $capabilities;
} | php | public function getAllCapabilities()
{
$capabilities = array();
foreach (array_reverse($this->modelDevices) as $modelDevice) {
$capabilities = array_merge($capabilities, $modelDevice->getCapabilities());
}
return $capabilities;
} | [
"public",
"function",
"getAllCapabilities",
"(",
")",
"{",
"$",
"capabilities",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"array_reverse",
"(",
"$",
"this",
"->",
"modelDevices",
")",
"as",
"$",
"modelDevice",
")",
"{",
"$",
"capabilities",
"=",
"array_... | Returns capabilities and their values for the current device
@return array Device capabilities array
@see WURFL_Xml_ModelDevice::getCapabilities() | [
"Returns",
"capabilities",
"and",
"their",
"values",
"for",
"the",
"current",
"device"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/CustomDevice.php#L198-L205 |
activecollab/databasestructure | src/Builder/StructureSql.php | StructureSql.appendToStructureSql | public function appendToStructureSql($statement, $comment = '')
{
if ($structure_sql_path = $this->getStructureSqlPath()) {
$current_content = file_get_contents($structure_sql_path);
if ($current_content) {
$current_content .= "\n\n\n\n";
}
i... | php | public function appendToStructureSql($statement, $comment = '')
{
if ($structure_sql_path = $this->getStructureSqlPath()) {
$current_content = file_get_contents($structure_sql_path);
if ($current_content) {
$current_content .= "\n\n\n\n";
}
i... | [
"public",
"function",
"appendToStructureSql",
"(",
"$",
"statement",
",",
"$",
"comment",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"structure_sql_path",
"=",
"$",
"this",
"->",
"getStructureSqlPath",
"(",
")",
")",
"{",
"$",
"current_content",
"=",
"file_get_con... | Append statement to SQL file.
@param string $statement
@param string $comment | [
"Append",
"statement",
"to",
"SQL",
"file",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/StructureSql.php#L32-L47 |
codeburnerframework/router | src/Collector.php | Collector.set | public function set($method, $pattern, $action)
{
$method = $this->getValidMethod($method);
$patterns = $this->parser->parsePattern($pattern);
$group = new Group;
foreach ($patterns as $pattern)
{
$route = new Route($this, $method, $pattern, $action);
... | php | public function set($method, $pattern, $action)
{
$method = $this->getValidMethod($method);
$patterns = $this->parser->parsePattern($pattern);
$group = new Group;
foreach ($patterns as $pattern)
{
$route = new Route($this, $method, $pattern, $action);
... | [
"public",
"function",
"set",
"(",
"$",
"method",
",",
"$",
"pattern",
",",
"$",
"action",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"getValidMethod",
"(",
"$",
"method",
")",
";",
"$",
"patterns",
"=",
"$",
"this",
"->",
"parser",
"->",
"par... | @param string $method
@param string $pattern
@param callable $action
@throws BadRouteException
@throws MethodNotSupportedException
@return Group | [
"@param",
"string",
"$method",
"@param",
"string",
"$pattern",
"@param",
"callable",
"$action"
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L107-L125 |
codeburnerframework/router | src/Collector.php | Collector.match | public function match(array $methods, $pattern, $action)
{
$group = new Group;
foreach ($methods as $method)
$group->set($this->set($method, $pattern, $action));
return $group;
} | php | public function match(array $methods, $pattern, $action)
{
$group = new Group;
foreach ($methods as $method)
$group->set($this->set($method, $pattern, $action));
return $group;
} | [
"public",
"function",
"match",
"(",
"array",
"$",
"methods",
",",
"$",
"pattern",
",",
"$",
"action",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"$",
"group",
"->",
"set",
"(",
"$",
... | Insert a route into several http methods.
@param string[] $methods
@param string $pattern
@param callable $action
@return Group | [
"Insert",
"a",
"route",
"into",
"several",
"http",
"methods",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L143-L149 |
codeburnerframework/router | src/Collector.php | Collector.any | public function any($pattern, $action)
{
return $this->match(explode(" ", self::HTTP_METHODS), $pattern, $action);
} | php | public function any($pattern, $action)
{
return $this->match(explode(" ", self::HTTP_METHODS), $pattern, $action);
} | [
"public",
"function",
"any",
"(",
"$",
"pattern",
",",
"$",
"action",
")",
"{",
"return",
"$",
"this",
"->",
"match",
"(",
"explode",
"(",
"\" \"",
",",
"self",
"::",
"HTTP_METHODS",
")",
",",
"$",
"pattern",
",",
"$",
"action",
")",
";",
"}"
] | Insert a route into every http method supported.
@param string $pattern
@param callable $action
@return Group | [
"Insert",
"a",
"route",
"into",
"every",
"http",
"method",
"supported",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L160-L163 |
codeburnerframework/router | src/Collector.php | Collector.except | public function except($methods, $pattern, $action)
{
return $this->match(array_diff(explode(" ", self::HTTP_METHODS), (array) $methods), $pattern, $action);
} | php | public function except($methods, $pattern, $action)
{
return $this->match(array_diff(explode(" ", self::HTTP_METHODS), (array) $methods), $pattern, $action);
} | [
"public",
"function",
"except",
"(",
"$",
"methods",
",",
"$",
"pattern",
",",
"$",
"action",
")",
"{",
"return",
"$",
"this",
"->",
"match",
"(",
"array_diff",
"(",
"explode",
"(",
"\" \"",
",",
"self",
"::",
"HTTP_METHODS",
")",
",",
"(",
"array",
... | Insert a route into every http method supported but the given ones.
@param string $methods
@param string $pattern
@param callable $action
@return Group | [
"Insert",
"a",
"route",
"into",
"every",
"http",
"method",
"supported",
"but",
"the",
"given",
"ones",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L175-L178 |
codeburnerframework/router | src/Collector.php | Collector.group | public function group(array $routes)
{
$group = new Group;
foreach ($routes as $route)
$group->set($route);
return $group;
} | php | public function group(array $routes)
{
$group = new Group;
foreach ($routes as $route)
$group->set($route);
return $group;
} | [
"public",
"function",
"group",
"(",
"array",
"$",
"routes",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
";",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"route",
")",
"$",
"group",
"->",
"set",
"(",
"$",
"route",
")",
";",
"return",
"$",
"group",
... | Group all given routes.
@param Route[] $routes
@return Group | [
"Group",
"all",
"given",
"routes",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L187-L193 |
codeburnerframework/router | src/Collector.php | Collector.forget | public function forget($method, $pattern)
{
if (strpos($pattern, "{") === false) {
unset($this->statics[$method][$pattern]);
} else unset($this->dynamics[$this->getDynamicIndex($method, $pattern)][$pattern]);
} | php | public function forget($method, $pattern)
{
if (strpos($pattern, "{") === false) {
unset($this->statics[$method][$pattern]);
} else unset($this->dynamics[$this->getDynamicIndex($method, $pattern)][$pattern]);
} | [
"public",
"function",
"forget",
"(",
"$",
"method",
",",
"$",
"pattern",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"pattern",
",",
"\"{\"",
")",
"===",
"false",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"statics",
"[",
"$",
"method",
"]",
"[",
"$... | Remove a route from collector.
@param string $method
@param string $pattern | [
"Remove",
"a",
"route",
"from",
"collector",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L202-L207 |
codeburnerframework/router | src/Collector.php | Collector.findStaticRoute | public function findStaticRoute($method, $pattern)
{
$method = strtolower($method);
if (isset($this->statics[$method]) && isset($this->statics[$method][$pattern]))
return $this->statics[$method][$pattern];
return false;
} | php | public function findStaticRoute($method, $pattern)
{
$method = strtolower($method);
if (isset($this->statics[$method]) && isset($this->statics[$method][$pattern]))
return $this->statics[$method][$pattern];
return false;
} | [
"public",
"function",
"findStaticRoute",
"(",
"$",
"method",
",",
"$",
"pattern",
")",
"{",
"$",
"method",
"=",
"strtolower",
"(",
"$",
"method",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"statics",
"[",
"$",
"method",
"]",
")",
"&&",
"... | @param string $method
@param string $pattern
@return Route|false | [
"@param",
"string",
"$method",
"@param",
"string",
"$pattern"
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L228-L234 |
codeburnerframework/router | src/Collector.php | Collector.findDynamicRoutes | public function findDynamicRoutes($method, $pattern)
{
$index = $this->getDynamicIndex($method, $pattern);
return isset($this->dynamics[$index]) ? $this->dynamics[$index] : false;
} | php | public function findDynamicRoutes($method, $pattern)
{
$index = $this->getDynamicIndex($method, $pattern);
return isset($this->dynamics[$index]) ? $this->dynamics[$index] : false;
} | [
"public",
"function",
"findDynamicRoutes",
"(",
"$",
"method",
",",
"$",
"pattern",
")",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"getDynamicIndex",
"(",
"$",
"method",
",",
"$",
"pattern",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"dynami... | @param string $method
@param string $pattern
@return array|false | [
"@param",
"string",
"$method",
"@param",
"string",
"$pattern"
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L243-L247 |
codeburnerframework/router | src/Collector.php | Collector.getValidMethod | protected function getValidMethod($method)
{
$method = strtolower($method);
if (strpos(self::HTTP_METHODS, $method) === false) {
throw new MethodNotSupportedException($method);
}
return $method;
} | php | protected function getValidMethod($method)
{
$method = strtolower($method);
if (strpos(self::HTTP_METHODS, $method) === false) {
throw new MethodNotSupportedException($method);
}
return $method;
} | [
"protected",
"function",
"getValidMethod",
"(",
"$",
"method",
")",
"{",
"$",
"method",
"=",
"strtolower",
"(",
"$",
"method",
")",
";",
"if",
"(",
"strpos",
"(",
"self",
"::",
"HTTP_METHODS",
",",
"$",
"method",
")",
"===",
"false",
")",
"{",
"throw",... | Determine if the http method is valid.
@param string $method
@throws MethodNotSupportedException
@return string | [
"Determine",
"if",
"the",
"http",
"method",
"is",
"valid",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L270-L279 |
codeburnerframework/router | src/Collector.php | Collector.setParser | public function setParser(Parser $parser)
{
if (!empty($this->statics) || !empty($this->dynamics)) {
throw new \LogicException("You can't define a route parser after registering a route.");
}
$this->parser = $parser;
return $this;
} | php | public function setParser(Parser $parser)
{
if (!empty($this->statics) || !empty($this->dynamics)) {
throw new \LogicException("You can't define a route parser after registering a route.");
}
$this->parser = $parser;
return $this;
} | [
"public",
"function",
"setParser",
"(",
"Parser",
"$",
"parser",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"statics",
")",
"||",
"!",
"empty",
"(",
"$",
"this",
"->",
"dynamics",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",... | @param Parser $parser
@throws \LogicException
@return self | [
"@param",
"Parser",
"$parser"
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Collector.php#L351-L359 |
axelitus/php-base | src/Traverser.php | Traverser.traverse | final public function traverse(array &$arr)
{
if (!$this->isReady()) {
throw new \RuntimeException("The traverser is not ready, no valid item callback has been set.");
}
return static::run($arr, $this->itemCallback, $this->resultCallback);
} | php | final public function traverse(array &$arr)
{
if (!$this->isReady()) {
throw new \RuntimeException("The traverser is not ready, no valid item callback has been set.");
}
return static::run($arr, $this->itemCallback, $this->resultCallback);
} | [
"final",
"public",
"function",
"traverse",
"(",
"array",
"&",
"$",
"arr",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isReady",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"The traverser is not ready, no valid item callback has been se... | Runs the given array through the Traverser's callbacks.
@param array $arr The array to traverse.
@return array Returns the resulting array. | [
"Runs",
"the",
"given",
"array",
"through",
"the",
"Traverser",
"s",
"callbacks",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Traverser.php#L132-L139 |
axelitus/php-base | src/Traverser.php | Traverser.run | public static function run(array &$arr, callable $itemCallback, callable $resultCallback = null)
{
$result = [];
foreach ($arr as $key => &$value) {
// Run the callback and store the result in a variable so that we allow the key to be modified by the
// callback. Also pass th... | php | public static function run(array &$arr, callable $itemCallback, callable $resultCallback = null)
{
$result = [];
foreach ($arr as $key => &$value) {
// Run the callback and store the result in a variable so that we allow the key to be modified by the
// callback. Also pass th... | [
"public",
"static",
"function",
"run",
"(",
"array",
"&",
"$",
"arr",
",",
"callable",
"$",
"itemCallback",
",",
"callable",
"$",
"resultCallback",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"key"... | Runs the traverser across the given array and executes the item callback into every item of the array.
The traverser also has a result callback to allow for 'macro' result processing.
@param array $arr The array to traverse.
@param callable $itemCallback The item callback to operate into every item.
C... | [
"Runs",
"the",
"traverser",
"across",
"the",
"given",
"array",
"and",
"executes",
"the",
"item",
"callback",
"into",
"every",
"item",
"of",
"the",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Traverser.php#L156-L174 |
gregorybesson/PlaygroundCore | src/Entity/Locale.php | Locale.populate | public function populate($data = array())
{
if (isset($data['name']) && $data['name'] !== null) {
$this->name = $data['name'];
}
if (isset($data['locale']) && $data['locale'] !== null) {
$this->locale = $data['locale'];
}
} | php | public function populate($data = array())
{
if (isset($data['name']) && $data['name'] !== null) {
$this->name = $data['name'];
}
if (isset($data['locale']) && $data['locale'] !== null) {
$this->locale = $data['locale'];
}
} | [
"public",
"function",
"populate",
"(",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'name'",
"]",
")",
"&&",
"$",
"data",
"[",
"'name'",
"]",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"name",
"=",... | Populate from an array.
@param array $data | [
"Populate",
"from",
"an",
"array",
"."
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Entity/Locale.php#L222-L230 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php | ItemPriceCalculator.getValidProductPriceForItem | private function getValidProductPriceForItem($item, $currency)
{
$product = $item->getCalcProduct();
$specialPriceValue = null;
$bulkPriceValue = null;
//get special price
$specialPrice = $this->priceManager->getSpecialPriceForCurrency($product, $currency);
if ($spec... | php | private function getValidProductPriceForItem($item, $currency)
{
$product = $item->getCalcProduct();
$specialPriceValue = null;
$bulkPriceValue = null;
//get special price
$specialPrice = $this->priceManager->getSpecialPriceForCurrency($product, $currency);
if ($spec... | [
"private",
"function",
"getValidProductPriceForItem",
"(",
"$",
"item",
",",
"$",
"currency",
")",
"{",
"$",
"product",
"=",
"$",
"item",
"->",
"getCalcProduct",
"(",
")",
";",
"$",
"specialPriceValue",
"=",
"null",
";",
"$",
"bulkPriceValue",
"=",
"null",
... | Returns the valid product price for item
@param object $item
@param string $currency
@return int | [
"Returns",
"the",
"valid",
"product",
"price",
"for",
"item"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php#L41-L77 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php | ItemPriceCalculator.calculate | public function calculate($item, $currency = null, $useProductsPrice = true)
{
$currency = $this->getCurrency($currency);
// validate item
$this->validateItem($item);
if ($useProductsPrice) {
$priceValue = $this->getValidProductPriceForItem($item, $currency);
} ... | php | public function calculate($item, $currency = null, $useProductsPrice = true)
{
$currency = $this->getCurrency($currency);
// validate item
$this->validateItem($item);
if ($useProductsPrice) {
$priceValue = $this->getValidProductPriceForItem($item, $currency);
} ... | [
"public",
"function",
"calculate",
"(",
"$",
"item",
",",
"$",
"currency",
"=",
"null",
",",
"$",
"useProductsPrice",
"=",
"true",
")",
"{",
"$",
"currency",
"=",
"$",
"this",
"->",
"getCurrency",
"(",
"$",
"currency",
")",
";",
"// validate item",
"$",
... | Calculates the overall total price of an item
@param CalculableBulkPriceItemInterface $item
@param string|null $currency
@param bool|null $useProductsPrice
@return int
@throws PriceCalculationException | [
"Calculates",
"the",
"overall",
"total",
"price",
"of",
"an",
"item"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php#L89-L116 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php | ItemPriceCalculator.validateItem | protected function validateItem($item)
{
// validate not null
$this->validateNotNull('quantity', $item->getCalcQuantity());
// validate discount
$discountPercent = $item->getCalcDiscount();
if ($discountPercent < 0 || $discountPercent > 100) {
throw new PriceCalc... | php | protected function validateItem($item)
{
// validate not null
$this->validateNotNull('quantity', $item->getCalcQuantity());
// validate discount
$discountPercent = $item->getCalcDiscount();
if ($discountPercent < 0 || $discountPercent > 100) {
throw new PriceCalc... | [
"protected",
"function",
"validateItem",
"(",
"$",
"item",
")",
"{",
"// validate not null",
"$",
"this",
"->",
"validateNotNull",
"(",
"'quantity'",
",",
"$",
"item",
"->",
"getCalcQuantity",
"(",
")",
")",
";",
"// validate discount",
"$",
"discountPercent",
"... | Validate item values
@param $item
@throws PriceCalculationException | [
"Validate",
"item",
"values"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php#L139-L149 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php | ItemPriceCalculator.getItemPrice | public function getItemPrice($item, $currency, $useProductPrice = true)
{
$currency = $this->getCurrency($currency);
if ($useProductPrice) {
$priceValue = $this->getValidProductPriceForItem($item, $currency);
} else {
$priceValue = $item->getPrice();
}
... | php | public function getItemPrice($item, $currency, $useProductPrice = true)
{
$currency = $this->getCurrency($currency);
if ($useProductPrice) {
$priceValue = $this->getValidProductPriceForItem($item, $currency);
} else {
$priceValue = $item->getPrice();
}
... | [
"public",
"function",
"getItemPrice",
"(",
"$",
"item",
",",
"$",
"currency",
",",
"$",
"useProductPrice",
"=",
"true",
")",
"{",
"$",
"currency",
"=",
"$",
"this",
"->",
"getCurrency",
"(",
"$",
"currency",
")",
";",
"if",
"(",
"$",
"useProductPrice",
... | Format price
@param CalculableBulkPriceItemInterface $item
@param string $currency
@param bool $useProductPrice
@return string | [
"Format",
"price"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Pricing/ItemPriceCalculator.php#L175-L186 |
dreamcommerce/common-bundle | src/DreamCommerce/Component/Common/Model/ArrayableTrait.php | ArrayableTrait.toArray | public function toArray($object = null): array
{
Assert::nullOrObject($object);
if ($object === null) {
$object = $this;
}
$ignoredProperties = array();
if ($object instanceof ArrayableInterface) {
$ignoredProperties = $object->getIgnoredProperties()... | php | public function toArray($object = null): array
{
Assert::nullOrObject($object);
if ($object === null) {
$object = $this;
}
$ignoredProperties = array();
if ($object instanceof ArrayableInterface) {
$ignoredProperties = $object->getIgnoredProperties()... | [
"public",
"function",
"toArray",
"(",
"$",
"object",
"=",
"null",
")",
":",
"array",
"{",
"Assert",
"::",
"nullOrObject",
"(",
"$",
"object",
")",
";",
"if",
"(",
"$",
"object",
"===",
"null",
")",
"{",
"$",
"object",
"=",
"$",
"this",
";",
"}",
... | @param object|null $object
@return array | [
"@param",
"object|null",
"$object"
] | train | https://github.com/dreamcommerce/common-bundle/blob/adb0850e90e63c3997f10d1ce110bf13a84b63ab/src/DreamCommerce/Component/Common/Model/ArrayableTrait.php#L26-L81 |
discophp/framework | core/twig/tag/CacheNode.php | CacheNode.compile | public function compile(\Twig_Compiler $compiler) {
$duration = $this->getAttribute('duration');
$key = $this->getAttribute('key');
$until = $this->getNode('until');
$if = $this->getNode('if');
$unless = $this->getNode('unless');
if($duration === null){
//1... | php | public function compile(\Twig_Compiler $compiler) {
$duration = $this->getAttribute('duration');
$key = $this->getAttribute('key');
$until = $this->getNode('until');
$if = $this->getNode('if');
$unless = $this->getNode('unless');
if($duration === null){
//1... | [
"public",
"function",
"compile",
"(",
"\\",
"Twig_Compiler",
"$",
"compiler",
")",
"{",
"$",
"duration",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"'duration'",
")",
";",
"$",
"key",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"'key'",
")",
";",
"$... | Provide the functionality for compiling a {{cache}} {{endcache}} tag.
@param \Twig_Compiler $compiler A \Twig_compliler instance.
@return void | [
"Provide",
"the",
"functionality",
"for",
"compiling",
"a",
"{{",
"cache",
"}}",
"{{",
"endcache",
"}}",
"tag",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/twig/tag/CacheNode.php#L24-L104 |
discophp/framework | core/twig/tag/CacheNode.php | CacheNode.duration | private function duration($time){
if(is_numeric($time)){
return $time;
}//if
return (new \DateTime($time))->getTimestamp() - (new \DateTime('now'))->getTimestamp();
} | php | private function duration($time){
if(is_numeric($time)){
return $time;
}//if
return (new \DateTime($time))->getTimestamp() - (new \DateTime('now'))->getTimestamp();
} | [
"private",
"function",
"duration",
"(",
"$",
"time",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"time",
")",
")",
"{",
"return",
"$",
"time",
";",
"}",
"//if",
"return",
"(",
"new",
"\\",
"DateTime",
"(",
"$",
"time",
")",
")",
"->",
"getTimestam... | Convert a potential string date like `+30 days` to seconds.
@param int|string
@return int | [
"Convert",
"a",
"potential",
"string",
"date",
"like",
"+",
"30",
"days",
"to",
"seconds",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/twig/tag/CacheNode.php#L115-L120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.