repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
koolkode/context | src/Bind/Binding.php | Binding.getTarget | public function getTarget()
{
if($this->to === NULL && $this->options | self::TYPE_IMPLEMENTATION)
{
return $this->typeName;
}
return $this->to;
} | php | public function getTarget()
{
if($this->to === NULL && $this->options | self::TYPE_IMPLEMENTATION)
{
return $this->typeName;
}
return $this->to;
} | [
"public",
"function",
"getTarget",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"to",
"===",
"NULL",
"&&",
"$",
"this",
"->",
"options",
"|",
"self",
"::",
"TYPE_IMPLEMENTATION",
")",
"{",
"return",
"$",
"this",
"->",
"typeName",
";",
"}",
"return",
... | Get the target of this binding, eighter a string or a closure.
@return mixed | [
"Get",
"the",
"target",
"of",
"this",
"binding",
"eighter",
"a",
"string",
"or",
"a",
"closure",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/Binding.php#L108-L116 | train |
koolkode/context | src/Bind/Binding.php | Binding.getMarkers | public function getMarkers($marker = NULL)
{
if($marker !== NULL && $this->markers !== NULL)
{
$result = [];
foreach($this->markers as $check)
{
if($check instanceof $marker)
{
$result[] = $check;
}
}
return $result;
}
return (array)$this->markers;
} | php | public function getMarkers($marker = NULL)
{
if($marker !== NULL && $this->markers !== NULL)
{
$result = [];
foreach($this->markers as $check)
{
if($check instanceof $marker)
{
$result[] = $check;
}
}
return $result;
}
return (array)$this->markers;
} | [
"public",
"function",
"getMarkers",
"(",
"$",
"marker",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"marker",
"!==",
"NULL",
"&&",
"$",
"this",
"->",
"markers",
"!==",
"NULL",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"... | Get all markers being set for this binding.
@param string $marker The type of marker to be considerd.
@return array<Marker> | [
"Get",
"all",
"markers",
"being",
"set",
"for",
"this",
"binding",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/Binding.php#L124-L142 | train |
koolkode/context | src/Bind/Binding.php | Binding.toAlias | public function toAlias($typeName)
{
$this->options = self::TYPE_ALIAS;
$this->to = (string)$typeName;
return $this;
} | php | public function toAlias($typeName)
{
$this->options = self::TYPE_ALIAS;
$this->to = (string)$typeName;
return $this;
} | [
"public",
"function",
"toAlias",
"(",
"$",
"typeName",
")",
"{",
"$",
"this",
"->",
"options",
"=",
"self",
"::",
"TYPE_ALIAS",
";",
"$",
"this",
"->",
"to",
"=",
"(",
"string",
")",
"$",
"typeName",
";",
"return",
"$",
"this",
";",
"}"
] | Bind to another binding specified by name.
@param string $typeName
@return Binding | [
"Bind",
"to",
"another",
"binding",
"specified",
"by",
"name",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/Binding.php#L195-L201 | train |
koolkode/context | src/Bind/Binding.php | Binding.scoped | public function scoped(Scope $scope)
{
if($scope instanceof Dependent)
{
$this->scope = NULL;
}
else
{
$this->scope = get_class($scope);
}
return $this;
} | php | public function scoped(Scope $scope)
{
if($scope instanceof Dependent)
{
$this->scope = NULL;
}
else
{
$this->scope = get_class($scope);
}
return $this;
} | [
"public",
"function",
"scoped",
"(",
"Scope",
"$",
"scope",
")",
"{",
"if",
"(",
"$",
"scope",
"instanceof",
"Dependent",
")",
"{",
"$",
"this",
"->",
"scope",
"=",
"NULL",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"scope",
"=",
"get_class",
"(",
"... | Set the scope of the binding according to the binary value of the scope.
@param Scope $scope
@return Binding | [
"Set",
"the",
"scope",
"of",
"the",
"binding",
"according",
"to",
"the",
"binary",
"value",
"of",
"the",
"scope",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/Binding.php#L209-L221 | train |
koolkode/context | src/Bind/Binding.php | Binding.isMarked | public function isMarked($marker)
{
if(empty($this->markers))
{
return false;
}
if($marker instanceof \ReflectionClass)
{
foreach($this->markers as $check)
{
if($marker->isInstance($check))
{
return true;
}
}
}
elseif($marker instanceof Marker)
{
foreach($this->marker... | php | public function isMarked($marker)
{
if(empty($this->markers))
{
return false;
}
if($marker instanceof \ReflectionClass)
{
foreach($this->markers as $check)
{
if($marker->isInstance($check))
{
return true;
}
}
}
elseif($marker instanceof Marker)
{
foreach($this->marker... | [
"public",
"function",
"isMarked",
"(",
"$",
"marker",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"markers",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"marker",
"instanceof",
"\\",
"ReflectionClass",
")",
"{",
"foreach",
"... | Check if the binding has a marker of the given type.
@param mixed $marker Marker instance, reflection class or fully-qualified name of the marker.
@return boolean | [
"Check",
"if",
"the",
"binding",
"has",
"a",
"marker",
"of",
"the",
"given",
"type",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/Binding.php#L242-L281 | train |
koolkode/context | src/Bind/Binding.php | Binding.decorate | public function decorate(\Closure $decorator, $priority = 0)
{
$this->decorators->insert($decorator, $priority);
return $this;
} | php | public function decorate(\Closure $decorator, $priority = 0)
{
$this->decorators->insert($decorator, $priority);
return $this;
} | [
"public",
"function",
"decorate",
"(",
"\\",
"Closure",
"$",
"decorator",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"decorators",
"->",
"insert",
"(",
"$",
"decorator",
",",
"$",
"priority",
")",
";",
"return",
"$",
"this",
";",
"}... | Register a decorator with this binding.
Decorators are custom initializers (created object instance as first argument + any number of additional
params reslved by DI are supported) that must return the decorator object instance.
@param \Closure $decorator
@param integer $priority
@return Binding | [
"Register",
"a",
"decorator",
"with",
"this",
"binding",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/Binding.php#L360-L365 | train |
koolkode/context | src/Bind/Binding.php | Binding.getInitializers | public function getInitializers()
{
$initializers = $this->initializers;
foreach(clone $this->decorators as $decorator)
{
$initializers[] = $decorator;
}
return $initializers;
} | php | public function getInitializers()
{
$initializers = $this->initializers;
foreach(clone $this->decorators as $decorator)
{
$initializers[] = $decorator;
}
return $initializers;
} | [
"public",
"function",
"getInitializers",
"(",
")",
"{",
"$",
"initializers",
"=",
"$",
"this",
"->",
"initializers",
";",
"foreach",
"(",
"clone",
"$",
"this",
"->",
"decorators",
"as",
"$",
"decorator",
")",
"{",
"$",
"initializers",
"[",
"]",
"=",
"$",... | Get all custom initializers of this binding.
@return array<\Closure> | [
"Get",
"all",
"custom",
"initializers",
"of",
"this",
"binding",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/Binding.php#L372-L382 | train |
phpffcms/ffcms-core | src/Helper/Environment.php | Environment.loadAverage | public static function loadAverage()
{
$load = 0;
if (stristr(PHP_OS, 'win')) {
// its not a better solution, but no other way to do this
$cmd = "wmic cpu get loadpercentage /all";
@exec($cmd, $output);
// if output is exist
if ($output) {... | php | public static function loadAverage()
{
$load = 0;
if (stristr(PHP_OS, 'win')) {
// its not a better solution, but no other way to do this
$cmd = "wmic cpu get loadpercentage /all";
@exec($cmd, $output);
// if output is exist
if ($output) {... | [
"public",
"static",
"function",
"loadAverage",
"(",
")",
"{",
"$",
"load",
"=",
"0",
";",
"if",
"(",
"stristr",
"(",
"PHP_OS",
",",
"'win'",
")",
")",
"{",
"// its not a better solution, but no other way to do this",
"$",
"cmd",
"=",
"\"wmic cpu get loadpercentage... | Get load average in percents.
@return string | [
"Get",
"load",
"average",
"in",
"percents",
"."
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/Environment.php#L42-L70 | train |
t3v/t3v_core | Classes/Domain/Model/Traits/FileReferenceTrait.php | FileReferenceTrait.getLocalizedFileReference | protected function getLocalizedFileReference(string $table, string $field) {
if ($this->getSysLanguageUid() > 0) {
$localizedFileReferences = $this->getLocalizedFileReferences($table, $field);
if (!empty($localizedFileReferences)) {
$localizedFileObject = $localizedFileReferences[0]->toArray();... | php | protected function getLocalizedFileReference(string $table, string $field) {
if ($this->getSysLanguageUid() > 0) {
$localizedFileReferences = $this->getLocalizedFileReferences($table, $field);
if (!empty($localizedFileReferences)) {
$localizedFileObject = $localizedFileReferences[0]->toArray();... | [
"protected",
"function",
"getLocalizedFileReference",
"(",
"string",
"$",
"table",
",",
"string",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getSysLanguageUid",
"(",
")",
">",
"0",
")",
"{",
"$",
"localizedFileReferences",
"=",
"$",
"this",
"->... | Gets a localized file reference.
@param string $table The table
@param string $field The field
@return array|null The localized file reference or null if no localized file reference was found | [
"Gets",
"a",
"localized",
"file",
"reference",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Domain/Model/Traits/FileReferenceTrait.php#L19-L43 | train |
t3v/t3v_core | Classes/Domain/Model/Traits/FileReferenceTrait.php | FileReferenceTrait.getLocalizedFileReferences | protected function getLocalizedFileReferences(string $table, string $field) {
if ($this->getSysLanguageUid() > 0) {
return $this->fileRepository->findByRelation($table, $field, $this->getLocalizedUid());
}
return null;
} | php | protected function getLocalizedFileReferences(string $table, string $field) {
if ($this->getSysLanguageUid() > 0) {
return $this->fileRepository->findByRelation($table, $field, $this->getLocalizedUid());
}
return null;
} | [
"protected",
"function",
"getLocalizedFileReferences",
"(",
"string",
"$",
"table",
",",
"string",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getSysLanguageUid",
"(",
")",
">",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"fileRepository",
"->",... | Gets localized file references.
@param string $table The table
@param string $field The field
@return array|null The localized file references or null if no localized file references were found | [
"Gets",
"localized",
"file",
"references",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Domain/Model/Traits/FileReferenceTrait.php#L52-L58 | train |
freialib/hlin.tools | src/Command/Cmdhelp.php | CmdhelpCommand.printp | protected function printp($input, $indent = 0) {
$input = trim($input, "\n\t\r ");
$indentation = str_repeat(' ', $indent);
$this->cli->printf($indentation.wordwrap(str_replace("\n", "\n$indentation", $input), 75 - $indent, "\n$indentation")."\n");
} | php | protected function printp($input, $indent = 0) {
$input = trim($input, "\n\t\r ");
$indentation = str_repeat(' ', $indent);
$this->cli->printf($indentation.wordwrap(str_replace("\n", "\n$indentation", $input), 75 - $indent, "\n$indentation")."\n");
} | [
"protected",
"function",
"printp",
"(",
"$",
"input",
",",
"$",
"indent",
"=",
"0",
")",
"{",
"$",
"input",
"=",
"trim",
"(",
"$",
"input",
",",
"\"\\n\\t\\r \"",
")",
";",
"$",
"indentation",
"=",
"str_repeat",
"(",
"' '",
",",
"$",
"indent",
")",
... | Print paragraph. Anything passed will be trimmed and printed so as to fit
in the limit of 75 characters per line. | [
"Print",
"paragraph",
".",
"Anything",
"passed",
"will",
"be",
"trimmed",
"and",
"printed",
"so",
"as",
"to",
"fit",
"in",
"the",
"limit",
"of",
"75",
"characters",
"per",
"line",
"."
] | 42ad9e9fe081918d2ee5d52b72d174ccdcf7cbe7 | https://github.com/freialib/hlin.tools/blob/42ad9e9fe081918d2ee5d52b72d174ccdcf7cbe7/src/Command/Cmdhelp.php#L85-L89 | train |
ciims/ciims-modules-api | controllers/ContentController.php | ContentController.createNewPost | private function createNewPost()
{
if (!$this->user->role->hasPermission('create'))
throw new CHttpException(403, Yii::t('Api.content', 'You do not have permission to create new entries.'));
$model = new Content;
$model->populate($_POST);
// Return a model instance to work with
if ($model->savePrototyp... | php | private function createNewPost()
{
if (!$this->user->role->hasPermission('create'))
throw new CHttpException(403, Yii::t('Api.content', 'You do not have permission to create new entries.'));
$model = new Content;
$model->populate($_POST);
// Return a model instance to work with
if ($model->savePrototyp... | [
"private",
"function",
"createNewPost",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"user",
"->",
"role",
"->",
"hasPermission",
"(",
"'create'",
")",
")",
"throw",
"new",
"CHttpException",
"(",
"403",
",",
"Yii",
"::",
"t",
"(",
"'Api.content'",
... | Creates a new entry | [
"Creates",
"a",
"new",
"entry"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ContentController.php#L330-L368 | train |
ciims/ciims-modules-api | controllers/ContentController.php | ContentController.updatePost | private function updatePost($id)
{
$model = $this->loadModel($id);
if (!$this->user->role->hasPermission('modify'))
throw new CHttpException(403, Yii::t('Api.content', 'You do not have permission to create new entries.'));
if ($this->user->role->isA('author') || $this->user->role->isA('collaborator'))
$m... | php | private function updatePost($id)
{
$model = $this->loadModel($id);
if (!$this->user->role->hasPermission('modify'))
throw new CHttpException(403, Yii::t('Api.content', 'You do not have permission to create new entries.'));
if ($this->user->role->isA('author') || $this->user->role->isA('collaborator'))
$m... | [
"private",
"function",
"updatePost",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"loadModel",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"user",
"->",
"role",
"->",
"hasPermission",
"(",
"'modify'",
")",
")",
... | Updates an existing entry
@param int $id The Content id | [
"Updates",
"an",
"existing",
"entry"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ContentController.php#L374-L416 | train |
ciims/ciims-modules-api | controllers/ContentController.php | ContentController.loadModel | private function loadModel($id=NULL)
{
if ($id === NULL)
throw new CHttpException(400, Yii::t('Api.content', 'Missing id'));
$model = Content::model()->findByPk($id);
if ($model === NULL)
throw new CHttpException(404, Yii::t('Api.content', 'An entry with the id of {{id}} was not found', array('{{id}}' => ... | php | private function loadModel($id=NULL)
{
if ($id === NULL)
throw new CHttpException(400, Yii::t('Api.content', 'Missing id'));
$model = Content::model()->findByPk($id);
if ($model === NULL)
throw new CHttpException(404, Yii::t('Api.content', 'An entry with the id of {{id}} was not found', array('{{id}}' => ... | [
"private",
"function",
"loadModel",
"(",
"$",
"id",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"id",
"===",
"NULL",
")",
"throw",
"new",
"CHttpException",
"(",
"400",
",",
"Yii",
"::",
"t",
"(",
"'Api.content'",
",",
"'Missing id'",
")",
")",
";",
"$",
... | Retrieves the model
@param int $id The content ID
@return Content | [
"Retrieves",
"the",
"model"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ContentController.php#L423-L433 | train |
ciims/ciims-modules-api | controllers/ContentController.php | ContentController.actionUploadImagePost | public function actionUploadImagePost($id=NULL, $promote = 0)
{
$result = new CiiFileUpload($id, $promote);
return $result->uploadFile();
} | php | public function actionUploadImagePost($id=NULL, $promote = 0)
{
$result = new CiiFileUpload($id, $promote);
return $result->uploadFile();
} | [
"public",
"function",
"actionUploadImagePost",
"(",
"$",
"id",
"=",
"NULL",
",",
"$",
"promote",
"=",
"0",
")",
"{",
"$",
"result",
"=",
"new",
"CiiFileUpload",
"(",
"$",
"id",
",",
"$",
"promote",
")",
";",
"return",
"$",
"result",
"->",
"uploadFile",... | Uploads a video to the site.
@param integer $id The content_id
@param integer $promote Whether or not this image should be a promoted image or not
@return array | [
"Uploads",
"a",
"video",
"to",
"the",
"site",
"."
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/ContentController.php#L441-L445 | train |
black-project/common | src/Common/Application/Form/Transformer/ArrayToDelimitedStringTransformer.php | ArrayToDelimitedStringTransformer.transform | public function transform($array)
{
if (null === $array) {
return '';
}
if (!is_array($array)) {
throw new TransformationFailedException('Expected an array.');
}
foreach ($array as &$value) {
$value = sprintf('%s%s%s',
str... | php | public function transform($array)
{
if (null === $array) {
return '';
}
if (!is_array($array)) {
throw new TransformationFailedException('Expected an array.');
}
foreach ($array as &$value) {
$value = sprintf('%s%s%s',
str... | [
"public",
"function",
"transform",
"(",
"$",
"array",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"array",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"throw",
"new",
"TransformationFailedException",
... | Transforms an array into a delimited string
@param array $array Array to transform
@return string
@throws TransformationFailedException If the given value is not an array | [
"Transforms",
"an",
"array",
"into",
"a",
"delimited",
"string"
] | d1de2aaae75a7ca7997dbe402897c651d9c7412a | https://github.com/black-project/common/blob/d1de2aaae75a7ca7997dbe402897c651d9c7412a/src/Common/Application/Form/Transformer/ArrayToDelimitedStringTransformer.php#L44-L65 | train |
black-project/common | src/Common/Application/Form/Transformer/ArrayToDelimitedStringTransformer.php | ArrayToDelimitedStringTransformer.reverseTransform | public function reverseTransform($string)
{
if (null !== $string && !is_string($string)) {
throw new TransformationFailedException('Expected a string.');
}
$string = trim($string);
if (empty($string)) {
return array();
}
$values = explode($th... | php | public function reverseTransform($string)
{
if (null !== $string && !is_string($string)) {
throw new TransformationFailedException('Expected a string.');
}
$string = trim($string);
if (empty($string)) {
return array();
}
$values = explode($th... | [
"public",
"function",
"reverseTransform",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"string",
"&&",
"!",
"is_string",
"(",
"$",
"string",
")",
")",
"{",
"throw",
"new",
"TransformationFailedException",
"(",
"'Expected a string.'",
")",
";"... | Transforms a delimited string into an array
@param string $string String to transform
@return array
@throws TransformationFailedException If the given value is not a string | [
"Transforms",
"a",
"delimited",
"string",
"into",
"an",
"array"
] | d1de2aaae75a7ca7997dbe402897c651d9c7412a | https://github.com/black-project/common/blob/d1de2aaae75a7ca7997dbe402897c651d9c7412a/src/Common/Application/Form/Transformer/ArrayToDelimitedStringTransformer.php#L76-L98 | train |
railken/lem | src/Concerns/HasPermissions.php | HasPermissions.getPermission | public function getPermission($code)
{
if (!isset($this->permissions[$code])) {
throw new Exceptions\PermissionNotDefinedException($this, $code);
}
return $this->permissions[$code];
} | php | public function getPermission($code)
{
if (!isset($this->permissions[$code])) {
throw new Exceptions\PermissionNotDefinedException($this, $code);
}
return $this->permissions[$code];
} | [
"public",
"function",
"getPermission",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"permissions",
"[",
"$",
"code",
"]",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"PermissionNotDefinedException",
"(",
"$",
"this"... | Retrieve a permission name given code.
@param string $code
@return string | [
"Retrieve",
"a",
"permission",
"name",
"given",
"code",
"."
] | cff1efcd090a9504b2faf5594121885786dea67a | https://github.com/railken/lem/blob/cff1efcd090a9504b2faf5594121885786dea67a/src/Concerns/HasPermissions.php#L16-L23 | train |
romm/configuration_object | Classes/Traits/ConfigurationObject/ArrayConversionTrait.php | ArrayConversionTrait.getObjectPropertiesValues | private function getObjectPropertiesValues($object)
{
$properties = Core::get()->getGettablePropertiesOfObject($object);
$finalProperties = [];
foreach ($properties as $property) {
$finalProperties[$property] = Core::get()->getObjectService()->getObjectProperty($object, $propert... | php | private function getObjectPropertiesValues($object)
{
$properties = Core::get()->getGettablePropertiesOfObject($object);
$finalProperties = [];
foreach ($properties as $property) {
$finalProperties[$property] = Core::get()->getObjectService()->getObjectProperty($object, $propert... | [
"private",
"function",
"getObjectPropertiesValues",
"(",
"$",
"object",
")",
"{",
"$",
"properties",
"=",
"Core",
"::",
"get",
"(",
")",
"->",
"getGettablePropertiesOfObject",
"(",
"$",
"object",
")",
";",
"$",
"finalProperties",
"=",
"[",
"]",
";",
"foreach... | Will return all the accessible properties of the given object instance.
@param object $object
@return array | [
"Will",
"return",
"all",
"the",
"accessible",
"properties",
"of",
"the",
"given",
"object",
"instance",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Traits/ConfigurationObject/ArrayConversionTrait.php#L76-L86 | train |
bheisig/cli | src/App.php | App.invokeStandardCommands | protected function invokeStandardCommands() {
return $this
->addCommand(
'help',
__NAMESPACE__ . '\\Command\\Help',
'Show this help'
)
->addCommand(
'list',
__NAMESPACE__ . '\\Command\\ListCommand... | php | protected function invokeStandardCommands() {
return $this
->addCommand(
'help',
__NAMESPACE__ . '\\Command\\Help',
'Show this help'
)
->addCommand(
'list',
__NAMESPACE__ . '\\Command\\ListCommand... | [
"protected",
"function",
"invokeStandardCommands",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"addCommand",
"(",
"'help'",
",",
"__NAMESPACE__",
".",
"'\\\\Command\\\\Help'",
",",
"'Show this help'",
")",
"->",
"addCommand",
"(",
"'list'",
",",
"__NAMESPACE__",
"... | Invoke standard commands
@return self Returns itself | [
"Invoke",
"standard",
"commands"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L113-L145 | train |
bheisig/cli | src/App.php | App.invokeStandardOptions | protected function invokeStandardOptions() {
return $this
->addOption('c', 'config', self::OPTION_NOT_REQUIRED)
->addOption('h', 'help', self::NO_VALUE)
->addOption(null, 'no-colors', self::NO_VALUE)
->addOption('q', 'quiet', self::NO_VALUE)
->addOptio... | php | protected function invokeStandardOptions() {
return $this
->addOption('c', 'config', self::OPTION_NOT_REQUIRED)
->addOption('h', 'help', self::NO_VALUE)
->addOption(null, 'no-colors', self::NO_VALUE)
->addOption('q', 'quiet', self::NO_VALUE)
->addOptio... | [
"protected",
"function",
"invokeStandardOptions",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"addOption",
"(",
"'c'",
",",
"'config'",
",",
"self",
"::",
"OPTION_NOT_REQUIRED",
")",
"->",
"addOption",
"(",
"'h'",
",",
"'help'",
",",
"self",
"::",
"NO_VALUE"... | Invoke standard options
@return self Returns itself
@throws Exception on error | [
"Invoke",
"standard",
"options"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L154-L163 | train |
bheisig/cli | src/App.php | App.invokeLogging | protected function invokeLogging() {
$this->config['log'] = [
'colorize' => true,
'verbosity' => Log::ALL | ~Log::DEBUG
];
$this->log = new Log();
return $this;
} | php | protected function invokeLogging() {
$this->config['log'] = [
'colorize' => true,
'verbosity' => Log::ALL | ~Log::DEBUG
];
$this->log = new Log();
return $this;
} | [
"protected",
"function",
"invokeLogging",
"(",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'log'",
"]",
"=",
"[",
"'colorize'",
"=>",
"true",
",",
"'verbosity'",
"=>",
"Log",
"::",
"ALL",
"|",
"~",
"Log",
"::",
"DEBUG",
"]",
";",
"$",
"this",
"->",
... | Initialize logger with default values
@return self Returns itself | [
"Initialize",
"logger",
"with",
"default",
"values"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L170-L179 | train |
bheisig/cli | src/App.php | App.addConfigFile | public function addConfigFile($file, $force = false) {
$settings = JSONFile::read($file, $force);
$this->addConfigSettings($settings);
return $this;
} | php | public function addConfigFile($file, $force = false) {
$settings = JSONFile::read($file, $force);
$this->addConfigSettings($settings);
return $this;
} | [
"public",
"function",
"addConfigFile",
"(",
"$",
"file",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"settings",
"=",
"JSONFile",
"::",
"read",
"(",
"$",
"file",
",",
"$",
"force",
")",
";",
"$",
"this",
"->",
"addConfigSettings",
"(",
"$",
"sett... | Parse a JSON file and add its content to the configuration settings
@param string $file File path
@param bool $force If "true" and file is not readable ignore it, otherwise throw an exception. Defaults to
"false".
@return self Returns itself
@throws Exception on error | [
"Parse",
"a",
"JSON",
"file",
"and",
"add",
"its",
"content",
"to",
"the",
"configuration",
"settings"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L192-L198 | train |
bheisig/cli | src/App.php | App.addConfigSettings | public function addConfigSettings(array $settings) {
$this->config = $this->arrayMergeRecursiveOverwrite(
$this->config,
$settings
);
return $this;
} | php | public function addConfigSettings(array $settings) {
$this->config = $this->arrayMergeRecursiveOverwrite(
$this->config,
$settings
);
return $this;
} | [
"public",
"function",
"addConfigSettings",
"(",
"array",
"$",
"settings",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"$",
"this",
"->",
"arrayMergeRecursiveOverwrite",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"settings",
")",
";",
"return",
"$",
"this"... | Add configuration settings
@param array $settings Configuration settings
@return self Returns itself | [
"Add",
"configuration",
"settings"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L207-L214 | train |
bheisig/cli | src/App.php | App.satisfyUserChoice | protected function satisfyUserChoice() {
// <APP NAME> --version:
if (array_key_exists('version', $this->config['options'])) {
$this->executeCommand('version');
$this->close();
}
// <APP NAME> -v:
if (count($this->config['args']) === 2 &&
arra... | php | protected function satisfyUserChoice() {
// <APP NAME> --version:
if (array_key_exists('version', $this->config['options'])) {
$this->executeCommand('version');
$this->close();
}
// <APP NAME> -v:
if (count($this->config['args']) === 2 &&
arra... | [
"protected",
"function",
"satisfyUserChoice",
"(",
")",
"{",
"// <APP NAME> --version:",
"if",
"(",
"array_key_exists",
"(",
"'version'",
",",
"$",
"this",
"->",
"config",
"[",
"'options'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"executeCommand",
"(",
"'versio... | Try to find out what the user wants
@throws Exception on error | [
"Try",
"to",
"find",
"out",
"what",
"the",
"user",
"wants"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L366-L403 | train |
bheisig/cli | src/App.php | App.parseArguments | protected function parseArguments() {
$this->config['arguments'] = [];
$commandFound =false;
for ($index = 0; $index < count($this->config['args']); $index++) {
// Ignore binary name:
if ($index === 0) {
continue;
}
$arg = $this-... | php | protected function parseArguments() {
$this->config['arguments'] = [];
$commandFound =false;
for ($index = 0; $index < count($this->config['args']); $index++) {
// Ignore binary name:
if ($index === 0) {
continue;
}
$arg = $this-... | [
"protected",
"function",
"parseArguments",
"(",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'arguments'",
"]",
"=",
"[",
"]",
";",
"$",
"commandFound",
"=",
"false",
";",
"for",
"(",
"$",
"index",
"=",
"0",
";",
"$",
"index",
"<",
"count",
"(",
"$... | Parse given arguments
@return self Returns itself | [
"Parse",
"given",
"arguments"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L509-L575 | train |
bheisig/cli | src/App.php | App.loadAdditionalConfigFiles | protected function loadAdditionalConfigFiles() {
$additionalConfigFiles = [];
foreach ($this->config['options'] as $option => $value) {
if (in_array($option, ['c', 'config'])) {
switch (gettype($value)) {
case 'string':
$additional... | php | protected function loadAdditionalConfigFiles() {
$additionalConfigFiles = [];
foreach ($this->config['options'] as $option => $value) {
if (in_array($option, ['c', 'config'])) {
switch (gettype($value)) {
case 'string':
$additional... | [
"protected",
"function",
"loadAdditionalConfigFiles",
"(",
")",
"{",
"$",
"additionalConfigFiles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"config",
"[",
"'options'",
"]",
"as",
"$",
"option",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_a... | Parse additional configuration files given as options
@return self Returns itself
@throws Exception on error | [
"Parse",
"additional",
"configuration",
"files",
"given",
"as",
"options"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L652-L689 | train |
bheisig/cli | src/App.php | App.addRuntimeSettings | protected function addRuntimeSettings() {
$newSettings = [];
foreach ($this->config['options'] as $option => $value) {
if (in_array($option, ['s', 'setting'])) {
switch (gettype($value)) {
case 'string':
$newSettings[] = $value;
... | php | protected function addRuntimeSettings() {
$newSettings = [];
foreach ($this->config['options'] as $option => $value) {
if (in_array($option, ['s', 'setting'])) {
switch (gettype($value)) {
case 'string':
$newSettings[] = $value;
... | [
"protected",
"function",
"addRuntimeSettings",
"(",
")",
"{",
"$",
"newSettings",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"config",
"[",
"'options'",
"]",
"as",
"$",
"option",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",
"(",
"... | Look for additional configuration settings given as options
@return self Returns itself
@throws Exception on error | [
"Look",
"for",
"additional",
"configuration",
"settings",
"given",
"as",
"options"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L698-L761 | train |
bheisig/cli | src/App.php | App.buildSettings | protected function buildSettings($keys, $value) {
$result = [];
$index = array_shift($keys);
if (!isset($keys[0])) {
$result[$index] = $value;
} else {
$result[$index] = $this->buildSettings($keys, $value);
}
return $result;
} | php | protected function buildSettings($keys, $value) {
$result = [];
$index = array_shift($keys);
if (!isset($keys[0])) {
$result[$index] = $value;
} else {
$result[$index] = $this->buildSettings($keys, $value);
}
return $result;
} | [
"protected",
"function",
"buildSettings",
"(",
"$",
"keys",
",",
"$",
"value",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"index",
"=",
"array_shift",
"(",
"$",
"keys",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"keys",
"[",
"0",
"]",
... | Create associative array for settings
@param string[] $keys Setting path
@param mixed $value Value
@return array | [
"Create",
"associative",
"array",
"for",
"settings"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L771-L783 | train |
bheisig/cli | src/App.php | App.configureLogger | protected function configureLogger() {
$appNoColor = strtoupper($this->config['composer']['extra']['name']) . '_NOCOLOR';
if (array_key_exists('no-colors', $this->config['options']) ||
getenv('NO_COLOR') !== false ||
getenv($appNoColor) !== false ||
(function_exists(... | php | protected function configureLogger() {
$appNoColor = strtoupper($this->config['composer']['extra']['name']) . '_NOCOLOR';
if (array_key_exists('no-colors', $this->config['options']) ||
getenv('NO_COLOR') !== false ||
getenv($appNoColor) !== false ||
(function_exists(... | [
"protected",
"function",
"configureLogger",
"(",
")",
"{",
"$",
"appNoColor",
"=",
"strtoupper",
"(",
"$",
"this",
"->",
"config",
"[",
"'composer'",
"]",
"[",
"'extra'",
"]",
"[",
"'name'",
"]",
")",
".",
"'_NOCOLOR'",
";",
"if",
"(",
"array_key_exists",
... | Set color handling and verbosity for used logger
Respect environment variables
- "NO_COLOR" (@see https://no-color.org/) and
- "<App name in upper case>_NOCOLOR"
regardless of their values
Also, disable colors if there is no TTY available
(for example, then output is piped to another app)
@return self Returns itself | [
"Set",
"color",
"handling",
"and",
"verbosity",
"for",
"used",
"logger"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L798-L821 | train |
bheisig/cli | src/App.php | App.loadComposerFile | protected function loadComposerFile() {
$composerFile = $this->config['appDir'] . '/composer.json';
if (!is_readable($composerFile)) {
throw new Exception(sprintf(
'Composer file "%s" is missing or not readable',
$composerFile
), ExitApp::RUNTIME_... | php | protected function loadComposerFile() {
$composerFile = $this->config['appDir'] . '/composer.json';
if (!is_readable($composerFile)) {
throw new Exception(sprintf(
'Composer file "%s" is missing or not readable',
$composerFile
), ExitApp::RUNTIME_... | [
"protected",
"function",
"loadComposerFile",
"(",
")",
"{",
"$",
"composerFile",
"=",
"$",
"this",
"->",
"config",
"[",
"'appDir'",
"]",
".",
"'/composer.json'",
";",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"composerFile",
")",
")",
"{",
"throw",
"new",
... | Parse composer.json
@return self Returns itself
@throws Exception on error | [
"Parse",
"composer",
".",
"json"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/App.php#L830-L866 | train |
chalasr/RCHCapistranoBundle | Util/OutputWritableTrait.php | OutputWritableTrait.sayWelcome | public function sayWelcome(OutputInterface $output)
{
$breakline = '';
$output = $this->createBlockTitle($output);
$title = $this->formatAsTitle('RCHCapistranoBundle - Continuous Deployment');
$welcome = array(
$breakline,
$title,
$breakline,
... | php | public function sayWelcome(OutputInterface $output)
{
$breakline = '';
$output = $this->createBlockTitle($output);
$title = $this->formatAsTitle('RCHCapistranoBundle - Continuous Deployment');
$welcome = array(
$breakline,
$title,
$breakline,
... | [
"public",
"function",
"sayWelcome",
"(",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"breakline",
"=",
"''",
";",
"$",
"output",
"=",
"$",
"this",
"->",
"createBlockTitle",
"(",
"$",
"output",
")",
";",
"$",
"title",
"=",
"$",
"this",
"->",
"forma... | Writes stylized welcome message in Output.
@param InputInterface $input
@param OutputInterface $output | [
"Writes",
"stylized",
"welcome",
"message",
"in",
"Output",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Util/OutputWritableTrait.php#L30-L46 | train |
chalasr/RCHCapistranoBundle | Util/OutputWritableTrait.php | OutputWritableTrait.formatAsTitle | protected function formatAsTitle($content)
{
$formatter = $this->getHelper('formatter');
$title = $formatter->formatBlock($content, 'title', true);
return $title;
} | php | protected function formatAsTitle($content)
{
$formatter = $this->getHelper('formatter');
$title = $formatter->formatBlock($content, 'title', true);
return $title;
} | [
"protected",
"function",
"formatAsTitle",
"(",
"$",
"content",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getHelper",
"(",
"'formatter'",
")",
";",
"$",
"title",
"=",
"$",
"formatter",
"->",
"formatBlock",
"(",
"$",
"content",
",",
"'title'",
"... | Formats string as output block title.
@param string $content
@return string | [
"Formats",
"string",
"as",
"output",
"block",
"title",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Util/OutputWritableTrait.php#L63-L69 | train |
TypiCMS/Menulinks | src/Http/Controllers/AdminController.php | AdminController.show | public function show($menu = null, $model = null)
{
return Redirect::route('admin.menus.menulinks.edit', [$menu->id, $model->id]);
} | php | public function show($menu = null, $model = null)
{
return Redirect::route('admin.menus.menulinks.edit', [$menu->id, $model->id]);
} | [
"public",
"function",
"show",
"(",
"$",
"menu",
"=",
"null",
",",
"$",
"model",
"=",
"null",
")",
"{",
"return",
"Redirect",
"::",
"route",
"(",
"'admin.menus.menulinks.edit'",
",",
"[",
"$",
"menu",
"->",
"id",
",",
"$",
"model",
"->",
"id",
"]",
")... | Show resource.
@param $menu
@param $model
@return Redirect | [
"Show",
"resource",
"."
] | 68e0a4067b6d04c8d9933cefacb09637e0d67ce1 | https://github.com/TypiCMS/Menulinks/blob/68e0a4067b6d04c8d9933cefacb09637e0d67ce1/src/Http/Controllers/AdminController.php#L56-L59 | train |
kreta/SimpleApiDocBundle | src/Kreta/SimpleApiDocBundle/Controller/ApiDocController.php | ApiDocController.indexAction | public function indexAction()
{
$extractedDoc = $this->get('kreta_simple_api_doc.extractor.api_doc_extractor')->all();
$htmlContent = $this->get('nelmio_api_doc.formatter.html_formatter')->format($extractedDoc);
return new Response($htmlContent, 200, ['Content-Type' => 'text/html']);
} | php | public function indexAction()
{
$extractedDoc = $this->get('kreta_simple_api_doc.extractor.api_doc_extractor')->all();
$htmlContent = $this->get('nelmio_api_doc.formatter.html_formatter')->format($extractedDoc);
return new Response($htmlContent, 200, ['Content-Type' => 'text/html']);
} | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"$",
"extractedDoc",
"=",
"$",
"this",
"->",
"get",
"(",
"'kreta_simple_api_doc.extractor.api_doc_extractor'",
")",
"->",
"all",
"(",
")",
";",
"$",
"htmlContent",
"=",
"$",
"this",
"->",
"get",
"(",
"'nelm... | The index action.
@return Response | [
"The",
"index",
"action",
"."
] | 786aa9310cdf087253f65f68165a0a0c8ad5c816 | https://github.com/kreta/SimpleApiDocBundle/blob/786aa9310cdf087253f65f68165a0a0c8ad5c816/src/Kreta/SimpleApiDocBundle/Controller/ApiDocController.php#L31-L37 | train |
nicodevs/laito | src/Laito/Router.php | Router.register | public function register($method, $path, $action, $filter = null)
{
// Add leading slash if not present
if (strncmp($path, '/', 1) !== 0) {
$path = '/' . $path;
}
// Add API base url to the path
$path = $this->app->config('url.root') . $path;
// Create a... | php | public function register($method, $path, $action, $filter = null)
{
// Add leading slash if not present
if (strncmp($path, '/', 1) !== 0) {
$path = '/' . $path;
}
// Add API base url to the path
$path = $this->app->config('url.root') . $path;
// Create a... | [
"public",
"function",
"register",
"(",
"$",
"method",
",",
"$",
"path",
",",
"$",
"action",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"// Add leading slash if not present",
"if",
"(",
"strncmp",
"(",
"$",
"path",
",",
"'/'",
",",
"1",
")",
"!==",
"0",... | Register a url
@param string $method Method
@param string $path Route to match
@param array $action Controller and method to execute
@param array $filter Optional filter to execute
@return boolean Success or fail of registration | [
"Register",
"a",
"url"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Router.php#L37-L71 | train |
nicodevs/laito | src/Laito/Router.php | Router.routes | public function routes($method = null)
{
if ($method && isset($this->methods[$method])) {
return $this->routes[$method];
}
return $this->routes;
} | php | public function routes($method = null)
{
if ($method && isset($this->methods[$method])) {
return $this->routes[$method];
}
return $this->routes;
} | [
"public",
"function",
"routes",
"(",
"$",
"method",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"method",
"&&",
"isset",
"(",
"$",
"this",
"->",
"methods",
"[",
"$",
"method",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"routes",
"[",
"$",
"metho... | Retrieve registered routes
@param string $method (Optional) Method specific routes.
@return array Array of routes | [
"Retrieve",
"registered",
"routes"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Router.php#L79-L85 | train |
nicodevs/laito | src/Laito/Router.php | Router.getAction | public function getAction($url)
{
// Current route holder
$current = false;
// Get requested method
$method = $this->app->request->method() ? : 'GET';
$method = strtolower($method);
// Check all routes until one matches
foreach ($this->routes[$method] as $r... | php | public function getAction($url)
{
// Current route holder
$current = false;
// Get requested method
$method = $this->app->request->method() ? : 'GET';
$method = strtolower($method);
// Check all routes until one matches
foreach ($this->routes[$method] as $r... | [
"public",
"function",
"getAction",
"(",
"$",
"url",
")",
"{",
"// Current route holder",
"$",
"current",
"=",
"false",
";",
"// Get requested method",
"$",
"method",
"=",
"$",
"this",
"->",
"app",
"->",
"request",
"->",
"method",
"(",
")",
"?",
":",
"'GET'... | Retrieve model and method to execute
@param string $route Route to match
@return array Action and parameters | [
"Retrieve",
"model",
"and",
"method",
"to",
"execute"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Router.php#L93-L125 | train |
nicodevs/laito | src/Laito/Router.php | Router.resource | public function resource($route, $controller, $filter = null)
{
$this->register('get', $route, [$controller, 'index'], $filter);
$this->register('get', $route . '/{id}', [$controller, 'show'], $filter);
$this->register('post', $route, [$controller, 'store'], $filter);
$this->register... | php | public function resource($route, $controller, $filter = null)
{
$this->register('get', $route, [$controller, 'index'], $filter);
$this->register('get', $route . '/{id}', [$controller, 'show'], $filter);
$this->register('post', $route, [$controller, 'store'], $filter);
$this->register... | [
"public",
"function",
"resource",
"(",
"$",
"route",
",",
"$",
"controller",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"register",
"(",
"'get'",
",",
"$",
"route",
",",
"[",
"$",
"controller",
",",
"'index'",
"]",
",",
"$",
"fil... | Register a resource
@param string $route Route for the resource
@param string $controller Controller name
@param string $filter Optional filter to execute
@return boolean Success or fail of registration | [
"Register",
"a",
"resource"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Router.php#L135-L143 | train |
nicodevs/laito | src/Laito/Router.php | Router.getFilter | public function getFilter($filterName = null)
{
return isset($this->filters[$filterName])? $this->filters[$filterName] : false;
} | php | public function getFilter($filterName = null)
{
return isset($this->filters[$filterName])? $this->filters[$filterName] : false;
} | [
"public",
"function",
"getFilter",
"(",
"$",
"filterName",
"=",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"filters",
"[",
"$",
"filterName",
"]",
")",
"?",
"$",
"this",
"->",
"filters",
"[",
"$",
"filterName",
"]",
":",
"false",
";... | Returns a route filter
@param string $filterName Filter name
@return mixed Registered filter | [
"Returns",
"a",
"route",
"filter"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Router.php#L163-L166 | train |
nicodevs/laito | src/Laito/Router.php | Router.performFilter | public function performFilter($filter)
{
$filter = $this->getFilter($filter);
if (!$filter) {
throw new \Exception('Filter not found', 500);
}
if ($filter instanceof \Closure) {
call_user_func($filter);
return $this->setAppliedFilter($filter);
... | php | public function performFilter($filter)
{
$filter = $this->getFilter($filter);
if (!$filter) {
throw new \Exception('Filter not found', 500);
}
if ($filter instanceof \Closure) {
call_user_func($filter);
return $this->setAppliedFilter($filter);
... | [
"public",
"function",
"performFilter",
"(",
"$",
"filter",
")",
"{",
"$",
"filter",
"=",
"$",
"this",
"->",
"getFilter",
"(",
"$",
"filter",
")",
";",
"if",
"(",
"!",
"$",
"filter",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Filter not found'"... | Performs a filter
@param string $filter Filter name | [
"Performs",
"a",
"filter"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Router.php#L195-L220 | train |
nicodevs/laito | src/Laito/Router.php | Router.group | public function group()
{
// Get arguments
if (func_num_args() === 2) {
list($prefix, $routes) = func_get_args();
$filter = null;
} elseif (func_num_args() === 3) {
list($filter, $prefix, $routes) = func_get_args();
}
// Add leading slash ... | php | public function group()
{
// Get arguments
if (func_num_args() === 2) {
list($prefix, $routes) = func_get_args();
$filter = null;
} elseif (func_num_args() === 3) {
list($filter, $prefix, $routes) = func_get_args();
}
// Add leading slash ... | [
"public",
"function",
"group",
"(",
")",
"{",
"// Get arguments",
"if",
"(",
"func_num_args",
"(",
")",
"===",
"2",
")",
"{",
"list",
"(",
"$",
"prefix",
",",
"$",
"routes",
")",
"=",
"func_get_args",
"(",
")",
";",
"$",
"filter",
"=",
"null",
";",
... | Register a group of routers with a common filter
@param string $filter Filter name
@param string $prefix Prefix for all routes
@param array $routers Routes | [
"Register",
"a",
"group",
"of",
"routers",
"with",
"a",
"common",
"filter"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Router.php#L229-L258 | train |
judus/minimal-database | src/DB.php | DB.get | public static function get($name = 'default')
{
if (!isset(self::$connections[$name])) {
return null;
}
$connector = self::$connections[$name];
return $connector->connection();
} | php | public static function get($name = 'default')
{
if (!isset(self::$connections[$name])) {
return null;
}
$connector = self::$connections[$name];
return $connector->connection();
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"name",
"=",
"'default'",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"connections",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"connector",
"=",
"self",
... | Get a PDO-Connection
@param string $name
@return null | [
"Get",
"a",
"PDO",
"-",
"Connection"
] | e6f8cb46eab41c3f1b6cabe0da5ccd0926727279 | https://github.com/judus/minimal-database/blob/e6f8cb46eab41c3f1b6cabe0da5ccd0926727279/src/DB.php#L55-L64 | train |
WellCommerce/CategoryBundle | Twig/Extension/CategoryExtension.php | CategoryExtension.getCategoriesTree | public function getCategoriesTree($limit = 1000, $orderBy = 'hierarchy', $orderDir = 'asc')
{
return $this->dataset->getResult('tree', [
'limit' => $limit,
'order_by' => $orderBy,
'order_dir' => $orderDir
]);
} | php | public function getCategoriesTree($limit = 1000, $orderBy = 'hierarchy', $orderDir = 'asc')
{
return $this->dataset->getResult('tree', [
'limit' => $limit,
'order_by' => $orderBy,
'order_dir' => $orderDir
]);
} | [
"public",
"function",
"getCategoriesTree",
"(",
"$",
"limit",
"=",
"1000",
",",
"$",
"orderBy",
"=",
"'hierarchy'",
",",
"$",
"orderDir",
"=",
"'asc'",
")",
"{",
"return",
"$",
"this",
"->",
"dataset",
"->",
"getResult",
"(",
"'tree'",
",",
"[",
"'limit'... | Returns categories tree
@param int $limit
@param string $orderBy
@param string $orderDir
@return array | [
"Returns",
"categories",
"tree"
] | 7a23ac678f91d15e86bdff624c4799be7b076e1a | https://github.com/WellCommerce/CategoryBundle/blob/7a23ac678f91d15e86bdff624c4799be7b076e1a/Twig/Extension/CategoryExtension.php#L62-L69 | train |
rzajac/phptools | src/Cli/Colors.php | Colors.getColoredString | public static function getColoredString($string, $foreground_color = '', $background_color = '')
{
$colored_string = '';
// Check if given foreground color exists
if (isset(static::$foreground_colors[$foreground_color])) {
$colored_string .= "\033[".static::$foreground_colors[$f... | php | public static function getColoredString($string, $foreground_color = '', $background_color = '')
{
$colored_string = '';
// Check if given foreground color exists
if (isset(static::$foreground_colors[$foreground_color])) {
$colored_string .= "\033[".static::$foreground_colors[$f... | [
"public",
"static",
"function",
"getColoredString",
"(",
"$",
"string",
",",
"$",
"foreground_color",
"=",
"''",
",",
"$",
"background_color",
"=",
"''",
")",
"{",
"$",
"colored_string",
"=",
"''",
";",
"// Check if given foreground color exists",
"if",
"(",
"is... | Returns colored string.
@param string $string The string to applu color to
@param string $foreground_color The foreground color
@param string $background_color The background color
@return string | [
"Returns",
"colored",
"string",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Cli/Colors.php#L76-L98 | train |
gplcart/device | Main.php | Main.getDeviceType | public function getDeviceType()
{
$device = $this->session->get('device');
if (empty($device)) {
$detector = $this->getLibrary();
if ($detector->isMobile()) {
$device = 'mobile';
} else if ($detector->isTablet()) {
$device = 'tab... | php | public function getDeviceType()
{
$device = $this->session->get('device');
if (empty($device)) {
$detector = $this->getLibrary();
if ($detector->isMobile()) {
$device = 'mobile';
} else if ($detector->isTablet()) {
$device = 'tab... | [
"public",
"function",
"getDeviceType",
"(",
")",
"{",
"$",
"device",
"=",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"'device'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"device",
")",
")",
"{",
"$",
"detector",
"=",
"$",
"this",
"->",
"getLibr... | Returns a device type
@return string | [
"Returns",
"a",
"device",
"type"
] | 288fcbd50cc3a2c7aa74cc0c3410135dcc9b2881 | https://github.com/gplcart/device/blob/288fcbd50cc3a2c7aa74cc0c3410135dcc9b2881/Main.php#L100-L120 | train |
gplcart/device | Main.php | Main.switchTheme | protected function switchTheme(Controller $controller)
{
if (!$controller->isInternalRoute()) {
try {
$device = $this->getDeviceType();
$store_id = $controller->getStoreId();
$settings = $this->module->getSettings('device');
if (... | php | protected function switchTheme(Controller $controller)
{
if (!$controller->isInternalRoute()) {
try {
$device = $this->getDeviceType();
$store_id = $controller->getStoreId();
$settings = $this->module->getSettings('device');
if (... | [
"protected",
"function",
"switchTheme",
"(",
"Controller",
"$",
"controller",
")",
"{",
"if",
"(",
"!",
"$",
"controller",
"->",
"isInternalRoute",
"(",
")",
")",
"{",
"try",
"{",
"$",
"device",
"=",
"$",
"this",
"->",
"getDeviceType",
"(",
")",
";",
"... | Switch the current theme
@param Controller $controller | [
"Switch",
"the",
"current",
"theme"
] | 288fcbd50cc3a2c7aa74cc0c3410135dcc9b2881 | https://github.com/gplcart/device/blob/288fcbd50cc3a2c7aa74cc0c3410135dcc9b2881/Main.php#L142-L163 | train |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/NotifySuperAdministrators/EmailSuperAdministrators.php | EmailSuperAdministrators.sendEmailToSuperAdmins | public function sendEmailToSuperAdmins($subject, $event, $emailBladeFile) {
// Grab the super administrators who need to be notified from the config settting
$superAdminEmails = config('auth_frontend_registration_successful_admins_who_receive_notification_email');
// If there are no super admi... | php | public function sendEmailToSuperAdmins($subject, $event, $emailBladeFile) {
// Grab the super administrators who need to be notified from the config settting
$superAdminEmails = config('auth_frontend_registration_successful_admins_who_receive_notification_email');
// If there are no super admi... | [
"public",
"function",
"sendEmailToSuperAdmins",
"(",
"$",
"subject",
",",
"$",
"event",
",",
"$",
"emailBladeFile",
")",
"{",
"// Grab the super administrators who need to be notified from the config settting",
"$",
"superAdminEmails",
"=",
"config",
"(",
"'auth_frontend_regi... | Send email notifications to the super admins
@param text $subject Email subject
@param object $event Data object from event DTO
@param text $emailBladeFile Full package::path..blade.file
@return void | [
"Send",
"email",
"notifications",
"to",
"the",
"super",
"admins"
] | b5203d596e18e2566e7fdcd3f13868bb44a94c1d | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/NotifySuperAdministrators/EmailSuperAdministrators.php#L54-L92 | train |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/NotifySuperAdministrators/EmailSuperAdministrators.php | EmailSuperAdministrators.isSuperAdministrator | public function isSuperAdministrator($email) {
// get the user id
$userId = $this->findUserIdByEmail($email);
// if there is no user ID for that email, then zero is returned
if ($userId == 0) {
return;
}
// does this user id belong to the usergroup "super ... | php | public function isSuperAdministrator($email) {
// get the user id
$userId = $this->findUserIdByEmail($email);
// if there is no user ID for that email, then zero is returned
if ($userId == 0) {
return;
}
// does this user id belong to the usergroup "super ... | [
"public",
"function",
"isSuperAdministrator",
"(",
"$",
"email",
")",
"{",
"// get the user id",
"$",
"userId",
"=",
"$",
"this",
"->",
"findUserIdByEmail",
"(",
"$",
"email",
")",
";",
"// if there is no user ID for that email, then zero is returned",
"if",
"(",
"$",... | Does this email belong to a super administrator?
@param text $email
@return bool | [
"Does",
"this",
"email",
"belong",
"to",
"a",
"super",
"administrator?"
] | b5203d596e18e2566e7fdcd3f13868bb44a94c1d | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/NotifySuperAdministrators/EmailSuperAdministrators.php#L101-L118 | train |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/NotifySuperAdministrators/EmailSuperAdministrators.php | EmailSuperAdministrators.findUserIdByEmail | public function findUserIdByEmail($email) {
$userId = DB::table('users')
->where('email', $email)
->value('id')
;
if (!$userId) {
return 0;
}
return $userId;
} | php | public function findUserIdByEmail($email) {
$userId = DB::table('users')
->where('email', $email)
->value('id')
;
if (!$userId) {
return 0;
}
return $userId;
} | [
"public",
"function",
"findUserIdByEmail",
"(",
"$",
"email",
")",
"{",
"$",
"userId",
"=",
"DB",
"::",
"table",
"(",
"'users'",
")",
"->",
"where",
"(",
"'email'",
",",
"$",
"email",
")",
"->",
"value",
"(",
"'id'",
")",
";",
"if",
"(",
"!",
"$",
... | Find the user's ID from their email address.
Return 0 if no ID is found.
@param string $email
@return int | [
"Find",
"the",
"user",
"s",
"ID",
"from",
"their",
"email",
"address",
"."
] | b5203d596e18e2566e7fdcd3f13868bb44a94c1d | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/NotifySuperAdministrators/EmailSuperAdministrators.php#L133-L144 | train |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Helpers/NotifySuperAdministrators/EmailSuperAdministrators.php | EmailSuperAdministrators.isUserSuperAdministrator | public function isUserSuperAdministrator($userId) {
$result = DB::table('user_group')
->where('user_id', $userId)
->where('group_id', 3)
->first()
;
if (!$result) {
return false;
}
return true;
} | php | public function isUserSuperAdministrator($userId) {
$result = DB::table('user_group')
->where('user_id', $userId)
->where('group_id', 3)
->first()
;
if (!$result) {
return false;
}
return true;
} | [
"public",
"function",
"isUserSuperAdministrator",
"(",
"$",
"userId",
")",
"{",
"$",
"result",
"=",
"DB",
"::",
"table",
"(",
"'user_group'",
")",
"->",
"where",
"(",
"'user_id'",
",",
"$",
"userId",
")",
"->",
"where",
"(",
"'group_id'",
",",
"3",
")",
... | Does the user belong to the Super Administrator user group?
It is assumed that Super Administrator is ID=3 in the groups database table.
@param int $userId
@return bool | [
"Does",
"the",
"user",
"belong",
"to",
"the",
"Super",
"Administrator",
"user",
"group?"
] | b5203d596e18e2566e7fdcd3f13868bb44a94c1d | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Helpers/NotifySuperAdministrators/EmailSuperAdministrators.php#L154-L166 | train |
martinlindhe/php-debughelper | src/Logger.php | Logger.dbgTime | public static function dbgTime($s)
{
if (getenv('DEBUG') == '1') {
self::printMessage('<' . Carbon::now()->toTimeString() . '> ' . self::withCallsite($s), 'comment');
}
} | php | public static function dbgTime($s)
{
if (getenv('DEBUG') == '1') {
self::printMessage('<' . Carbon::now()->toTimeString() . '> ' . self::withCallsite($s), 'comment');
}
} | [
"public",
"static",
"function",
"dbgTime",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"getenv",
"(",
"'DEBUG'",
")",
"==",
"'1'",
")",
"{",
"self",
"::",
"printMessage",
"(",
"'<'",
".",
"Carbon",
"::",
"now",
"(",
")",
"->",
"toTimeString",
"(",
")",
"."... | Yellow text with current time
@param string $s | [
"Yellow",
"text",
"with",
"current",
"time"
] | 8fde5bbfd77d71f3f0990829f235242232094734 | https://github.com/martinlindhe/php-debughelper/blob/8fde5bbfd77d71f3f0990829f235242232094734/src/Logger.php#L46-L51 | train |
martinlindhe/php-debughelper | src/Logger.php | Logger.nfoTime | public static function nfoTime($s)
{
self::printMessage('<' . Carbon::now()->toTimeString() . '> ' . self::withCallsite($s), 'info');
} | php | public static function nfoTime($s)
{
self::printMessage('<' . Carbon::now()->toTimeString() . '> ' . self::withCallsite($s), 'info');
} | [
"public",
"static",
"function",
"nfoTime",
"(",
"$",
"s",
")",
"{",
"self",
"::",
"printMessage",
"(",
"'<'",
".",
"Carbon",
"::",
"now",
"(",
")",
"->",
"toTimeString",
"(",
")",
".",
"'> '",
".",
"self",
"::",
"withCallsite",
"(",
"$",
"s",
")",
... | Green text with current time
@param string $s | [
"Green",
"text",
"with",
"current",
"time"
] | 8fde5bbfd77d71f3f0990829f235242232094734 | https://github.com/martinlindhe/php-debughelper/blob/8fde5bbfd77d71f3f0990829f235242232094734/src/Logger.php#L57-L60 | train |
martinlindhe/php-debughelper | src/Logger.php | Logger.errTime | public static function errTime($s)
{
self::printMessage('<' . Carbon::now()->toTimeString() . '> ' . self::withCallsite($s), 'error');
} | php | public static function errTime($s)
{
self::printMessage('<' . Carbon::now()->toTimeString() . '> ' . self::withCallsite($s), 'error');
} | [
"public",
"static",
"function",
"errTime",
"(",
"$",
"s",
")",
"{",
"self",
"::",
"printMessage",
"(",
"'<'",
".",
"Carbon",
"::",
"now",
"(",
")",
"->",
"toTimeString",
"(",
")",
".",
"'> '",
".",
"self",
"::",
"withCallsite",
"(",
"$",
"s",
")",
... | White text on red background with current time
@param string $s | [
"White",
"text",
"on",
"red",
"background",
"with",
"current",
"time"
] | 8fde5bbfd77d71f3f0990829f235242232094734 | https://github.com/martinlindhe/php-debughelper/blob/8fde5bbfd77d71f3f0990829f235242232094734/src/Logger.php#L66-L69 | train |
dmitrya2e/filtration-bundle | Filter/Executor/FilterExecutor.php | FilterExecutor.registerHandler | public function registerHandler($handler, $type = false)
{
if (!is_object($handler)) {
throw new FilterExecutorException('Handler must be an object.');
}
if ($type === false) {
// Try to guess handler type by class FQN.
$type = $this->guessHandlerType($ha... | php | public function registerHandler($handler, $type = false)
{
if (!is_object($handler)) {
throw new FilterExecutorException('Handler must be an object.');
}
if ($type === false) {
// Try to guess handler type by class FQN.
$type = $this->guessHandlerType($ha... | [
"public",
"function",
"registerHandler",
"(",
"$",
"handler",
",",
"$",
"type",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"handler",
")",
")",
"{",
"throw",
"new",
"FilterExecutorException",
"(",
"'Handler must be an object.'",
")",
";",... | Registers specific filtration handler.
@param object|mixed $handler Any supported resource, which can handle filtration (QueryBuilder, ...)
@param string|bool $type The type of the handler
@return static
@throws FilterExecutorException on handler errors | [
"Registers",
"specific",
"filtration",
"handler",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Executor/FilterExecutor.php#L83-L110 | train |
dmitrya2e/filtration-bundle | Filter/Executor/FilterExecutor.php | FilterExecutor.registerHandlers | public function registerHandlers(array $handlers)
{
foreach ($handlers as $type => $handler) {
if (!is_string($type)) {
// Probably, non-string $type is a numeric index, which means,
// that the handler array was defined as [ $handler1, $handler2, ... ] without ha... | php | public function registerHandlers(array $handlers)
{
foreach ($handlers as $type => $handler) {
if (!is_string($type)) {
// Probably, non-string $type is a numeric index, which means,
// that the handler array was defined as [ $handler1, $handler2, ... ] without ha... | [
"public",
"function",
"registerHandlers",
"(",
"array",
"$",
"handlers",
")",
"{",
"foreach",
"(",
"$",
"handlers",
"as",
"$",
"type",
"=>",
"$",
"handler",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"// Probably, non-string ... | Registers different filtration handlers.
@param array|object[]|mixed[] $handlers
@return static | [
"Registers",
"different",
"filtration",
"handlers",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Executor/FilterExecutor.php#L119-L133 | train |
dmitrya2e/filtration-bundle | Filter/Executor/FilterExecutor.php | FilterExecutor.applyFilter | protected function applyFilter(FilterInterface $filter, $handler)
{
if (!($filter instanceof CustomApplyFilterInterface) || !is_callable($filter->getApplyFilterFunction())) {
return $filter->applyFilter($handler);
}
return call_user_func($filter->getApplyFilterFunction(), $filte... | php | protected function applyFilter(FilterInterface $filter, $handler)
{
if (!($filter instanceof CustomApplyFilterInterface) || !is_callable($filter->getApplyFilterFunction())) {
return $filter->applyFilter($handler);
}
return call_user_func($filter->getApplyFilterFunction(), $filte... | [
"protected",
"function",
"applyFilter",
"(",
"FilterInterface",
"$",
"filter",
",",
"$",
"handler",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"filter",
"instanceof",
"CustomApplyFilterInterface",
")",
"||",
"!",
"is_callable",
"(",
"$",
"filter",
"->",
"getApplyFilt... | Applies filtration.
If the filter has custom function for filtration applying, than it will be used.
@param FilterInterface|CustomApplyFilterInterface $filter
@param object|mixed $handler Any supported resource, which can handle filtration
@return static | [
"Applies",
"filtration",
".",
"If",
"the",
"filter",
"has",
"custom",
"function",
"for",
"filtration",
"applying",
"than",
"it",
"will",
"be",
"used",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Executor/FilterExecutor.php#L144-L151 | train |
dmitrya2e/filtration-bundle | Filter/Executor/FilterExecutor.php | FilterExecutor.guessHandlerType | protected function guessHandlerType($handler)
{
if (!is_object($handler)) {
return false;
}
foreach ($this->availableHandlerTypes as $type => $classFQN) {
if ($handler instanceof $classFQN) {
return $type;
}
}
return false... | php | protected function guessHandlerType($handler)
{
if (!is_object($handler)) {
return false;
}
foreach ($this->availableHandlerTypes as $type => $classFQN) {
if ($handler instanceof $classFQN) {
return $type;
}
}
return false... | [
"protected",
"function",
"guessHandlerType",
"(",
"$",
"handler",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"handler",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"availableHandlerTypes",
"as",
"$",
"type",
"=>",... | Guesses handler type by handler object class FQN.
Basically, it checks if the handler class name exists in the available handler types.
@param object|mixed $handler Any supported resource, which can handle filtration
@return false|string False if the type can not be guessed | [
"Guesses",
"handler",
"type",
"by",
"handler",
"object",
"class",
"FQN",
".",
"Basically",
"it",
"checks",
"if",
"the",
"handler",
"class",
"name",
"exists",
"in",
"the",
"available",
"handler",
"types",
"."
] | fed5764af4e43871835744fb84957b2a76e9a215 | https://github.com/dmitrya2e/filtration-bundle/blob/fed5764af4e43871835744fb84957b2a76e9a215/Filter/Executor/FilterExecutor.php#L161-L174 | train |
Aviogram/Common | src/Plugin/PluginTrait.php | PluginTrait.getPluginClassByName | protected function getPluginClassByName($name)
{
if (array_key_exists($name, $this->plugins) === false) {
return false;
}
return $this->plugins[$name];
} | php | protected function getPluginClassByName($name)
{
if (array_key_exists($name, $this->plugins) === false) {
return false;
}
return $this->plugins[$name];
} | [
"protected",
"function",
"getPluginClassByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"plugins",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"p... | Returns the class name for the given name
@param string $name
@return string | boolean FALSE when the name could not be found | [
"Returns",
"the",
"class",
"name",
"for",
"the",
"given",
"name"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Plugin/PluginTrait.php#L29-L36 | train |
Aviogram/Common | src/Plugin/PluginTrait.php | PluginTrait.getPlugin | protected function getPlugin($name, callable $constructClosure = null)
{
static $cache = array();
// Check if the plugin is already constructed
if (array_key_exists($name, $cache) === true) {
return $cache[$name];
}
// Fetch the full className
... | php | protected function getPlugin($name, callable $constructClosure = null)
{
static $cache = array();
// Check if the plugin is already constructed
if (array_key_exists($name, $cache) === true) {
return $cache[$name];
}
// Fetch the full className
... | [
"protected",
"function",
"getPlugin",
"(",
"$",
"name",
",",
"callable",
"$",
"constructClosure",
"=",
"null",
")",
"{",
"static",
"$",
"cache",
"=",
"array",
"(",
")",
";",
"// Check if the plugin is already constructed\r",
"if",
"(",
"array_key_exists",
"(",
"... | Method for fetching a singleton instance of a plugin
@param string $name
@param callable $constructClosure
@return object | [
"Method",
"for",
"fetching",
"a",
"singleton",
"instance",
"of",
"a",
"plugin"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Plugin/PluginTrait.php#L46-L80 | train |
danielgp/bank-holidays | source/Romanian.php | Romanian.readTypeFromJsonFileUniversal | protected function readTypeFromJsonFileUniversal($filePath, $fileBaseName)
{
$fName = $filePath . DIRECTORY_SEPARATOR . $fileBaseName . '.min.json';
$fJson = fopen($fName, 'r');
$jSonContent = fread($fJson, filesize($fName));
fclose($fJson);
return json_decode($jS... | php | protected function readTypeFromJsonFileUniversal($filePath, $fileBaseName)
{
$fName = $filePath . DIRECTORY_SEPARATOR . $fileBaseName . '.min.json';
$fJson = fopen($fName, 'r');
$jSonContent = fread($fJson, filesize($fName));
fclose($fJson);
return json_decode($jS... | [
"protected",
"function",
"readTypeFromJsonFileUniversal",
"(",
"$",
"filePath",
",",
"$",
"fileBaseName",
")",
"{",
"$",
"fName",
"=",
"$",
"filePath",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"fileBaseName",
".",
"'.min.json'",
";",
"$",
"fJson",
"=",
"fopen",
"... | returns an array with non-standard holidays from a JSON file
@param string $fileBaseName
@return mixed | [
"returns",
"an",
"array",
"with",
"non",
"-",
"standard",
"holidays",
"from",
"a",
"JSON",
"file"
] | edebfd9d99b836aaff80887442f9a28ee988850b | https://github.com/danielgp/bank-holidays/blob/edebfd9d99b836aaff80887442f9a28ee988850b/source/Romanian.php#L57-L64 | train |
danielgp/bank-holidays | source/Romanian.php | Romanian.setHolidays | public function setHolidays(\DateTime $lngDate, $inclCatholicEaster = false, $inclWorkingHolidays = false)
{
$givenYear = $lngDate->format('Y');
$daying = array_merge($this->setHolidaysOrthodoxEaster($lngDate), $this->setHolidaysFixed($lngDate));
if ($inclWorkingHolidays) {
$d... | php | public function setHolidays(\DateTime $lngDate, $inclCatholicEaster = false, $inclWorkingHolidays = false)
{
$givenYear = $lngDate->format('Y');
$daying = array_merge($this->setHolidaysOrthodoxEaster($lngDate), $this->setHolidaysFixed($lngDate));
if ($inclWorkingHolidays) {
$d... | [
"public",
"function",
"setHolidays",
"(",
"\\",
"DateTime",
"$",
"lngDate",
",",
"$",
"inclCatholicEaster",
"=",
"false",
",",
"$",
"inclWorkingHolidays",
"=",
"false",
")",
"{",
"$",
"givenYear",
"=",
"$",
"lngDate",
"->",
"format",
"(",
"'Y'",
")",
";",
... | List of legal holidays
@param \DateTime $lngDate
@param boolean $inclCatholicEaster
@return array | [
"List",
"of",
"legal",
"holidays"
] | edebfd9d99b836aaff80887442f9a28ee988850b | https://github.com/danielgp/bank-holidays/blob/edebfd9d99b836aaff80887442f9a28ee988850b/source/Romanian.php#L73-L90 | train |
danielgp/bank-holidays | source/Romanian.php | Romanian.setHolidaysOrthodoxEaster | private function setHolidaysOrthodoxEaster(\DateTime $lngDate)
{
$givenYear = $lngDate->format('Y');
$daying = [];
$configPath = __DIR__ . DIRECTORY_SEPARATOR . 'json';
$statmentsArray = $this->readTypeFromJsonFileUniversal($configPath, 'RomanianBankHolidays');
... | php | private function setHolidaysOrthodoxEaster(\DateTime $lngDate)
{
$givenYear = $lngDate->format('Y');
$daying = [];
$configPath = __DIR__ . DIRECTORY_SEPARATOR . 'json';
$statmentsArray = $this->readTypeFromJsonFileUniversal($configPath, 'RomanianBankHolidays');
... | [
"private",
"function",
"setHolidaysOrthodoxEaster",
"(",
"\\",
"DateTime",
"$",
"lngDate",
")",
"{",
"$",
"givenYear",
"=",
"$",
"lngDate",
"->",
"format",
"(",
"'Y'",
")",
";",
"$",
"daying",
"=",
"[",
"]",
";",
"$",
"configPath",
"=",
"__DIR__",
".",
... | List of all Orthodox holidays and Pentecost
@param \DateTime $lngDate
@return array | [
"List",
"of",
"all",
"Orthodox",
"holidays",
"and",
"Pentecost"
] | edebfd9d99b836aaff80887442f9a28ee988850b | https://github.com/danielgp/bank-holidays/blob/edebfd9d99b836aaff80887442f9a28ee988850b/source/Romanian.php#L166-L178 | train |
danielgp/bank-holidays | source/Romanian.php | Romanian.setHolidaysInMonth | public function setHolidaysInMonth(\DateTime $lngDate, $inclCatholicEaster = false)
{
$holidaysInGivenYear = $this->setHolidays($lngDate, $inclCatholicEaster);
$thisMonthDayArray = $this->setMonthAllDaysIntoArray($lngDate);
$holidays = 0;
foreach ($thisMonthDayArray as $... | php | public function setHolidaysInMonth(\DateTime $lngDate, $inclCatholicEaster = false)
{
$holidaysInGivenYear = $this->setHolidays($lngDate, $inclCatholicEaster);
$thisMonthDayArray = $this->setMonthAllDaysIntoArray($lngDate);
$holidays = 0;
foreach ($thisMonthDayArray as $... | [
"public",
"function",
"setHolidaysInMonth",
"(",
"\\",
"DateTime",
"$",
"lngDate",
",",
"$",
"inclCatholicEaster",
"=",
"false",
")",
"{",
"$",
"holidaysInGivenYear",
"=",
"$",
"this",
"->",
"setHolidays",
"(",
"$",
"lngDate",
",",
"$",
"inclCatholicEaster",
"... | returns bank holidays in a given month
@param \DateTime $lngDate
@param boolean $inclCatholicEaster
@return int | [
"returns",
"bank",
"holidays",
"in",
"a",
"given",
"month"
] | edebfd9d99b836aaff80887442f9a28ee988850b | https://github.com/danielgp/bank-holidays/blob/edebfd9d99b836aaff80887442f9a28ee988850b/source/Romanian.php#L187-L198 | train |
danielgp/bank-holidays | source/Romanian.php | Romanian.setMonthAllDaysIntoArray | protected function setMonthAllDaysIntoArray(\DateTime $lngDate)
{
$firstDayGivenMonth = strtotime($lngDate->modify('first day of this month')->format('Y-m-d'));
$lastDayInGivenMonth = strtotime($lngDate->modify('last day of this month')->format('Y-m-d'));
$secondsInOneDay = 24 * 60 * 60... | php | protected function setMonthAllDaysIntoArray(\DateTime $lngDate)
{
$firstDayGivenMonth = strtotime($lngDate->modify('first day of this month')->format('Y-m-d'));
$lastDayInGivenMonth = strtotime($lngDate->modify('last day of this month')->format('Y-m-d'));
$secondsInOneDay = 24 * 60 * 60... | [
"protected",
"function",
"setMonthAllDaysIntoArray",
"(",
"\\",
"DateTime",
"$",
"lngDate",
")",
"{",
"$",
"firstDayGivenMonth",
"=",
"strtotime",
"(",
"$",
"lngDate",
"->",
"modify",
"(",
"'first day of this month'",
")",
"->",
"format",
"(",
"'Y-m-d'",
")",
")... | return an array with all days within a month from a given date
@param \DateTime $lngDate
@return array | [
"return",
"an",
"array",
"with",
"all",
"days",
"within",
"a",
"month",
"from",
"a",
"given",
"date"
] | edebfd9d99b836aaff80887442f9a28ee988850b | https://github.com/danielgp/bank-holidays/blob/edebfd9d99b836aaff80887442f9a28ee988850b/source/Romanian.php#L206-L212 | train |
danielgp/bank-holidays | source/Romanian.php | Romanian.setWorkingDaysInMonth | public function setWorkingDaysInMonth(\DateTime $lngDate, $inclCatholicEaster = false)
{
$holidaysInGivenYear = $this->setHolidays($lngDate, $inclCatholicEaster);
$thisMonthDayArray = $this->setMonthAllDaysIntoArray($lngDate);
$workingDays = 0;
foreach ($thisMonthDayArray a... | php | public function setWorkingDaysInMonth(\DateTime $lngDate, $inclCatholicEaster = false)
{
$holidaysInGivenYear = $this->setHolidays($lngDate, $inclCatholicEaster);
$thisMonthDayArray = $this->setMonthAllDaysIntoArray($lngDate);
$workingDays = 0;
foreach ($thisMonthDayArray a... | [
"public",
"function",
"setWorkingDaysInMonth",
"(",
"\\",
"DateTime",
"$",
"lngDate",
",",
"$",
"inclCatholicEaster",
"=",
"false",
")",
"{",
"$",
"holidaysInGivenYear",
"=",
"$",
"this",
"->",
"setHolidays",
"(",
"$",
"lngDate",
",",
"$",
"inclCatholicEaster",
... | returns working days in a given month
@param \DateTime $lngDate
@param boolean $inclCatholicEaster
@return int | [
"returns",
"working",
"days",
"in",
"a",
"given",
"month"
] | edebfd9d99b836aaff80887442f9a28ee988850b | https://github.com/danielgp/bank-holidays/blob/edebfd9d99b836aaff80887442f9a28ee988850b/source/Romanian.php#L221-L232 | train |
romm/configuration_object | Classes/Legacy/Reflection/ReflectionService.php | ReflectionService.setDataCache | public function setDataCache(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $dataCache)
{
$this->dataCache = $dataCache;
} | php | public function setDataCache(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $dataCache)
{
$this->dataCache = $dataCache;
} | [
"public",
"function",
"setDataCache",
"(",
"\\",
"TYPO3",
"\\",
"CMS",
"\\",
"Core",
"\\",
"Cache",
"\\",
"Frontend",
"\\",
"VariableFrontend",
"$",
"dataCache",
")",
"{",
"$",
"this",
"->",
"dataCache",
"=",
"$",
"dataCache",
";",
"}"
] | Sets the data cache.
The cache must be set before initializing the Reflection Service.
@param \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $dataCache Cache for the Reflection service | [
"Sets",
"the",
"data",
"cache",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Legacy/Reflection/ReflectionService.php#L177-L180 | train |
romm/configuration_object | Classes/Legacy/Reflection/ReflectionService.php | ReflectionService.initialize | public function initialize()
{
if ($this->initialized) {
throw new Exception('The Reflection Service can only be initialized once.', 1232044696);
}
$frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterfa... | php | public function initialize()
{
if ($this->initialized) {
throw new Exception('The Reflection Service can only be initialized once.', 1232044696);
}
$frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterfa... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"initialized",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'The Reflection Service can only be initialized once.'",
",",
"1232044696",
")",
";",
"}",
"$",
"frameworkConfiguration",
"... | Initializes this service
@throws Exception | [
"Initializes",
"this",
"service"
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Legacy/Reflection/ReflectionService.php#L187-L196 | train |
romm/configuration_object | Classes/Legacy/Reflection/ReflectionService.php | ReflectionService.getClassTagsValues | public function getClassTagsValues($className)
{
if (!isset($this->reflectedClassNames[$className])) {
$this->reflectClass($className);
}
if (!isset($this->classTagsValues[$className])) {
return [];
}
return isset($this->classTagsValues[$className]) ? ... | php | public function getClassTagsValues($className)
{
if (!isset($this->reflectedClassNames[$className])) {
$this->reflectClass($className);
}
if (!isset($this->classTagsValues[$className])) {
return [];
}
return isset($this->classTagsValues[$className]) ? ... | [
"public",
"function",
"getClassTagsValues",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reflectedClassNames",
"[",
"$",
"className",
"]",
")",
")",
"{",
"$",
"this",
"->",
"reflectClass",
"(",
"$",
"className",
")",... | Returns all tags and their values the specified class is tagged with
@param string $className Name of the class
@return array An array of tags and their values or an empty array if no tags were found | [
"Returns",
"all",
"tags",
"and",
"their",
"values",
"the",
"specified",
"class",
"is",
"tagged",
"with"
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Legacy/Reflection/ReflectionService.php#L225-L234 | train |
romm/configuration_object | Classes/Legacy/Reflection/ReflectionService.php | ReflectionService.getClassTagValues | public function getClassTagValues($className, $tag)
{
if (!isset($this->reflectedClassNames[$className])) {
$this->reflectClass($className);
}
if (!isset($this->classTagsValues[$className])) {
return [];
}
return isset($this->classTagsValues[$className... | php | public function getClassTagValues($className, $tag)
{
if (!isset($this->reflectedClassNames[$className])) {
$this->reflectClass($className);
}
if (!isset($this->classTagsValues[$className])) {
return [];
}
return isset($this->classTagsValues[$className... | [
"public",
"function",
"getClassTagValues",
"(",
"$",
"className",
",",
"$",
"tag",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reflectedClassNames",
"[",
"$",
"className",
"]",
")",
")",
"{",
"$",
"this",
"->",
"reflectClass",
"(",
"$",... | Returns the values of the specified class tag
@param string $className Name of the class containing the property
@param string $tag Tag to return the values of
@return array An array of values or an empty array if the tag was not found | [
"Returns",
"the",
"values",
"of",
"the",
"specified",
"class",
"tag"
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Legacy/Reflection/ReflectionService.php#L243-L252 | train |
romm/configuration_object | Classes/Legacy/Reflection/ReflectionService.php | ReflectionService.isClassTaggedWith | public function isClassTaggedWith($className, $tag)
{
if ($this->initialized === false) {
return false;
}
if (!isset($this->reflectedClassNames[$className])) {
$this->reflectClass($className);
}
if (!isset($this->classTagsValues[$className])) {
... | php | public function isClassTaggedWith($className, $tag)
{
if ($this->initialized === false) {
return false;
}
if (!isset($this->reflectedClassNames[$className])) {
$this->reflectClass($className);
}
if (!isset($this->classTagsValues[$className])) {
... | [
"public",
"function",
"isClassTaggedWith",
"(",
"$",
"className",
",",
"$",
"tag",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"initialized",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reflect... | Tells if the specified class is tagged with the given tag
@param string $className Name of the class
@param string $tag Tag to check for
@return bool TRUE if the class is tagged with $tag, otherwise FALSE | [
"Tells",
"if",
"the",
"specified",
"class",
"is",
"tagged",
"with",
"the",
"given",
"tag"
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Legacy/Reflection/ReflectionService.php#L401-L413 | train |
romm/configuration_object | Classes/Legacy/Reflection/ReflectionService.php | ReflectionService.getMethodReflection | protected function getMethodReflection($className, $methodName)
{
$this->dataCacheNeedsUpdate = true;
if (!isset($this->methodReflections[$className][$methodName])) {
$this->methodReflections[$className][$methodName] = new MethodReflection($className, $methodName);
}
retu... | php | protected function getMethodReflection($className, $methodName)
{
$this->dataCacheNeedsUpdate = true;
if (!isset($this->methodReflections[$className][$methodName])) {
$this->methodReflections[$className][$methodName] = new MethodReflection($className, $methodName);
}
retu... | [
"protected",
"function",
"getMethodReflection",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
"{",
"$",
"this",
"->",
"dataCacheNeedsUpdate",
"=",
"true",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"methodReflections",
"[",
"$",
"className",... | Returns the Reflection of a method.
@param string $className Name of the class containing the method
@param string $methodName Name of the method to return the Reflection for
@return MethodReflection the method Reflection object | [
"Returns",
"the",
"Reflection",
"of",
"a",
"method",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Legacy/Reflection/ReflectionService.php#L568-L575 | train |
romm/configuration_object | Classes/Legacy/Reflection/ReflectionService.php | ReflectionService.loadFromCache | protected function loadFromCache()
{
$data = $this->dataCache->get($this->cacheIdentifier);
if ($data !== false) {
foreach ($data as $propertyName => $propertyValue) {
$this->{$propertyName} = $propertyValue;
}
}
} | php | protected function loadFromCache()
{
$data = $this->dataCache->get($this->cacheIdentifier);
if ($data !== false) {
foreach ($data as $propertyName => $propertyValue) {
$this->{$propertyName} = $propertyValue;
}
}
} | [
"protected",
"function",
"loadFromCache",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"dataCache",
"->",
"get",
"(",
"$",
"this",
"->",
"cacheIdentifier",
")",
";",
"if",
"(",
"$",
"data",
"!==",
"false",
")",
"{",
"foreach",
"(",
"$",
"data"... | Tries to load the reflection data from this service's cache. | [
"Tries",
"to",
"load",
"the",
"reflection",
"data",
"from",
"this",
"service",
"s",
"cache",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Legacy/Reflection/ReflectionService.php#L580-L588 | train |
romm/configuration_object | Classes/Legacy/Reflection/ReflectionService.php | ReflectionService.saveToCache | protected function saveToCache()
{
if (!is_object($this->dataCache)) {
throw new Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
}
$data = [];
$propertyNames = [
'reflectedClassNames',
'classPropertyNa... | php | protected function saveToCache()
{
if (!is_object($this->dataCache)) {
throw new Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
}
$data = [];
$propertyNames = [
'reflectedClassNames',
'classPropertyNa... | [
"protected",
"function",
"saveToCache",
"(",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"dataCache",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'A cache must be injected before initializing the Reflection Service.'",
",",
"1232044697",
")"... | Exports the internal reflection data into the ReflectionData cache.
@throws Exception | [
"Exports",
"the",
"internal",
"reflection",
"data",
"into",
"the",
"ReflectionData",
"cache",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Legacy/Reflection/ReflectionService.php#L595-L617 | train |
geoffadams/bedrest-core | library/BedRest/Service/Mapping/ServiceMetadata.php | ServiceMetadata.addListener | public function addListener($event, $method)
{
if (!isset($this->listeners[$event])) {
$this->listeners[$event] = array();
}
$this->listeners[$event][] = $method;
} | php | public function addListener($event, $method)
{
if (!isset($this->listeners[$event])) {
$this->listeners[$event] = array();
}
$this->listeners[$event][] = $method;
} | [
"public",
"function",
"addListener",
"(",
"$",
"event",
",",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"event",
"]",
")",
")",
"{",
"$",
"this",
"->",
"listeners",
"[",
"$",
"event",
"]",
"="... | Adds a listener for the specified event.
@param string $event
@param string $method | [
"Adds",
"a",
"listener",
"for",
"the",
"specified",
"event",
"."
] | a77bf8b7492dfbfb720b201f7ec91a4f03417b5c | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Service/Mapping/ServiceMetadata.php#L76-L83 | train |
t3v/t3v_core | Classes/Validation/Validator/AbstractValidator.php | AbstractValidator.addErrorToProperty | protected function addErrorToProperty(string $property, string $key, string $extensionName) {
$errorMessage = LocalizationUtility::translate($key, $extensionName);
$error = $this->objectManager->get(Error::class, $errorMessage, time());
$this->result->forProperty($property)->addError($error);
} | php | protected function addErrorToProperty(string $property, string $key, string $extensionName) {
$errorMessage = LocalizationUtility::translate($key, $extensionName);
$error = $this->objectManager->get(Error::class, $errorMessage, time());
$this->result->forProperty($property)->addError($error);
} | [
"protected",
"function",
"addErrorToProperty",
"(",
"string",
"$",
"property",
",",
"string",
"$",
"key",
",",
"string",
"$",
"extensionName",
")",
"{",
"$",
"errorMessage",
"=",
"LocalizationUtility",
"::",
"translate",
"(",
"$",
"key",
",",
"$",
"extensionNa... | Adds an error to a property.
@param string $property The property
@param string $key The key to reference the error
@param string $extensionName The extension name | [
"Adds",
"an",
"error",
"to",
"a",
"property",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Validation/Validator/AbstractValidator.php#L30-L35 | train |
Vectrex/vxPHP | src/Template/Filter/AnchorHref.php | AnchorHref.filterHrefWithPath | private function filterHrefWithPath($matches) {
static $script;
static $observeRewrite;
static $config;
static $assetsPath;
if(is_null($config)) {
$application = Application::getInstance();
$config = $application->getConfig();
$observeRewrite = $application->getRouter()->getServerSideRewrite();
... | php | private function filterHrefWithPath($matches) {
static $script;
static $observeRewrite;
static $config;
static $assetsPath;
if(is_null($config)) {
$application = Application::getInstance();
$config = $application->getConfig();
$observeRewrite = $application->getRouter()->getServerSideRewrite();
... | [
"private",
"function",
"filterHrefWithPath",
"(",
"$",
"matches",
")",
"{",
"static",
"$",
"script",
";",
"static",
"$",
"observeRewrite",
";",
"static",
"$",
"config",
";",
"static",
"$",
"assetsPath",
";",
"if",
"(",
"is_null",
"(",
"$",
"config",
")",
... | callback to turn href shortcuts into site conform valid URLs
tries to build a path reflecting the position of the page in a nested menu
$foo/bar?baz=1 becomes /level1/level2/foo/bar?baz=1 or index.php/level1/level2/foo/bar?baz=1
@param array $matches
@return string | [
"callback",
"to",
"turn",
"href",
"shortcuts",
"into",
"site",
"conform",
"valid",
"URLs",
"tries",
"to",
"build",
"a",
"path",
"reflecting",
"the",
"position",
"of",
"the",
"page",
"in",
"a",
"nested",
"menu"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Template/Filter/AnchorHref.php#L57-L137 | train |
Vectrex/vxPHP | src/Template/Filter/AnchorHref.php | AnchorHref.filterHref | private function filterHref($matches) {
static $script;
static $observeRewrite;
if(is_null($script)) {
$script = trim(Request::createFromGlobals()->getScriptName(), '/');
}
if(is_null($observeRewrite)) {
$observeRewrite = Application::getInstance()->getRouter()->getServerSideRewrite();
}
... | php | private function filterHref($matches) {
static $script;
static $observeRewrite;
if(is_null($script)) {
$script = trim(Request::createFromGlobals()->getScriptName(), '/');
}
if(is_null($observeRewrite)) {
$observeRewrite = Application::getInstance()->getRouter()->getServerSideRewrite();
}
... | [
"private",
"function",
"filterHref",
"(",
"$",
"matches",
")",
"{",
"static",
"$",
"script",
";",
"static",
"$",
"observeRewrite",
";",
"if",
"(",
"is_null",
"(",
"$",
"script",
")",
")",
"{",
"$",
"script",
"=",
"trim",
"(",
"Request",
"::",
"createFr... | callback to turn href shortcuts into site conform valid URLs
$/foo/bar?baz=1 becomes /foo/bar?baz=1 or index.php/foo/bar?baz=1
@param array $matches
@return string | [
"callback",
"to",
"turn",
"href",
"shortcuts",
"into",
"site",
"conform",
"valid",
"URLs"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Template/Filter/AnchorHref.php#L147-L180 | train |
FlexModel/FlexModelBundle | Twig/FlexModelExtension.php | FlexModelExtension.optionLabelFilter | public function optionLabelFilter($value, $objectName, $fieldName)
{
$fieldConfiguration = $this->flexModel->getField($objectName, $fieldName);
$label = "";
if (is_array($fieldConfiguration)) {
if (isset($fieldConfiguration['options'])) {
if (is_array($value)) {
... | php | public function optionLabelFilter($value, $objectName, $fieldName)
{
$fieldConfiguration = $this->flexModel->getField($objectName, $fieldName);
$label = "";
if (is_array($fieldConfiguration)) {
if (isset($fieldConfiguration['options'])) {
if (is_array($value)) {
... | [
"public",
"function",
"optionLabelFilter",
"(",
"$",
"value",
",",
"$",
"objectName",
",",
"$",
"fieldName",
")",
"{",
"$",
"fieldConfiguration",
"=",
"$",
"this",
"->",
"flexModel",
"->",
"getField",
"(",
"$",
"objectName",
",",
"$",
"fieldName",
")",
";"... | Gets the option label based on the object and field name.
@param string $value
@param string $objectName
@param string $fieldName
@return string $label | [
"Gets",
"the",
"option",
"label",
"based",
"on",
"the",
"object",
"and",
"field",
"name",
"."
] | 7b4720d25b0dc6baf29b1da8ad7c67dfb2686460 | https://github.com/FlexModel/FlexModelBundle/blob/7b4720d25b0dc6baf29b1da8ad7c67dfb2686460/Twig/FlexModelExtension.php#L56-L77 | train |
FlexModel/FlexModelBundle | Twig/FlexModelExtension.php | FlexModelExtension.getLabelForValue | private function getLabelForValue($fieldConfiguration, $value)
{
$label = "";
foreach ($fieldConfiguration['options'] as $option) {
if ($option['value'] == $value) {
$label = $option['label'];
}
}
return $label;
} | php | private function getLabelForValue($fieldConfiguration, $value)
{
$label = "";
foreach ($fieldConfiguration['options'] as $option) {
if ($option['value'] == $value) {
$label = $option['label'];
}
}
return $label;
} | [
"private",
"function",
"getLabelForValue",
"(",
"$",
"fieldConfiguration",
",",
"$",
"value",
")",
"{",
"$",
"label",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"fieldConfiguration",
"[",
"'options'",
"]",
"as",
"$",
"option",
")",
"{",
"if",
"(",
"$",
"opti... | Gets the label for the set value.
@param mixed $fieldConfiguration
@param string $value
@return string $label | [
"Gets",
"the",
"label",
"for",
"the",
"set",
"value",
"."
] | 7b4720d25b0dc6baf29b1da8ad7c67dfb2686460 | https://github.com/FlexModel/FlexModelBundle/blob/7b4720d25b0dc6baf29b1da8ad7c67dfb2686460/Twig/FlexModelExtension.php#L87-L97 | train |
FlexModel/FlexModelBundle | Twig/FlexModelExtension.php | FlexModelExtension.fieldLabelFilter | public function fieldLabelFilter($value, $objectName, $fieldName)
{
$fieldConfiguration = $this->flexModel->getField($objectName, $fieldName);
$label = "";
if (is_array($fieldConfiguration)) {
$label = $fieldConfiguration['label'];
}
return $label;
} | php | public function fieldLabelFilter($value, $objectName, $fieldName)
{
$fieldConfiguration = $this->flexModel->getField($objectName, $fieldName);
$label = "";
if (is_array($fieldConfiguration)) {
$label = $fieldConfiguration['label'];
}
return $label;
} | [
"public",
"function",
"fieldLabelFilter",
"(",
"$",
"value",
",",
"$",
"objectName",
",",
"$",
"fieldName",
")",
"{",
"$",
"fieldConfiguration",
"=",
"$",
"this",
"->",
"flexModel",
"->",
"getField",
"(",
"$",
"objectName",
",",
"$",
"fieldName",
")",
";",... | Gets the field label based on the object and field name.
@param string $objectName
@param string $fieldName
@return string $label | [
"Gets",
"the",
"field",
"label",
"based",
"on",
"the",
"object",
"and",
"field",
"name",
"."
] | 7b4720d25b0dc6baf29b1da8ad7c67dfb2686460 | https://github.com/FlexModel/FlexModelBundle/blob/7b4720d25b0dc6baf29b1da8ad7c67dfb2686460/Twig/FlexModelExtension.php#L107-L117 | train |
rutger-speksnijder/restphp | src/RestPHP/Request/RequestFactory.php | RequestFactory.build | public function build($type)
{
if (!isset($this->types[$type])) {
throw new \Exception("Unknown request type.");
}
return new $this->types[$type]();
} | php | public function build($type)
{
if (!isset($this->types[$type])) {
throw new \Exception("Unknown request type.");
}
return new $this->types[$type]();
} | [
"public",
"function",
"build",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"types",
"[",
"$",
"type",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Unknown request type.\"",
")",
";",
"}",
"return",
... | Builds the request object.
@param string $type The type of request to build.
@throws Exception Throws an exception for unknown request types.
@return \RestPHP\Request The created object. | [
"Builds",
"the",
"request",
"object",
"."
] | 326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d | https://github.com/rutger-speksnijder/restphp/blob/326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d/src/RestPHP/Request/RequestFactory.php#L51-L57 | train |
Finesse/QueryScribe | src/PostProcessors/AbstractProcessor.php | AbstractProcessor.processQuery | protected function processQuery(Query $query, $context): Query
{
$queryProperties = [];
// Table
$queryProperties['table'] = $this->processTable($query->table, $context);
// Select
foreach ($query->select as $alias => $select) {
$queryProperties['select'][$alias... | php | protected function processQuery(Query $query, $context): Query
{
$queryProperties = [];
// Table
$queryProperties['table'] = $this->processTable($query->table, $context);
// Select
foreach ($query->select as $alias => $select) {
$queryProperties['select'][$alias... | [
"protected",
"function",
"processQuery",
"(",
"Query",
"$",
"query",
",",
"$",
"context",
")",
":",
"Query",
"{",
"$",
"queryProperties",
"=",
"[",
"]",
";",
"// Table",
"$",
"queryProperties",
"[",
"'table'",
"]",
"=",
"$",
"this",
"->",
"processTable",
... | Processes a Query object. DOES NOT change the given query or it's components by the link but may return it.
@param Query $query
@param mixed $context The processing context
@return Query | [
"Processes",
"a",
"Query",
"object",
".",
"DOES",
"NOT",
"change",
"the",
"given",
"query",
"or",
"it",
"s",
"components",
"by",
"the",
"link",
"but",
"may",
"return",
"it",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/PostProcessors/AbstractProcessor.php#L67-L129 | train |
Finesse/QueryScribe | src/PostProcessors/AbstractProcessor.php | AbstractProcessor.processTable | protected function processTable($table, $context)
{
if (is_string($table)) {
return $this->processTableName($table, $context);
} else {
return $this->processSubQuery($table, $context);
}
} | php | protected function processTable($table, $context)
{
if (is_string($table)) {
return $this->processTableName($table, $context);
} else {
return $this->processSubQuery($table, $context);
}
} | [
"protected",
"function",
"processTable",
"(",
"$",
"table",
",",
"$",
"context",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"table",
")",
")",
"{",
"return",
"$",
"this",
"->",
"processTableName",
"(",
"$",
"table",
",",
"$",
"context",
")",
";",
"}... | Processes a table name or table subquery
@param Query|StatementInterface|string $table
@param mixed $context The processing context
@return Query|StatementInterface|string | [
"Processes",
"a",
"table",
"name",
"or",
"table",
"subquery"
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/PostProcessors/AbstractProcessor.php#L138-L145 | train |
Finesse/QueryScribe | src/PostProcessors/AbstractProcessor.php | AbstractProcessor.processSelect | protected function processSelect($select, $context)
{
if ($select instanceof Aggregate) {
$column = $this->processColumnOrSubQuery($select->column, $context);
if ($column === $select->column) {
return $select;
} else {
return new Aggregate(... | php | protected function processSelect($select, $context)
{
if ($select instanceof Aggregate) {
$column = $this->processColumnOrSubQuery($select->column, $context);
if ($column === $select->column) {
return $select;
} else {
return new Aggregate(... | [
"protected",
"function",
"processSelect",
"(",
"$",
"select",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"select",
"instanceof",
"Aggregate",
")",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"processColumnOrSubQuery",
"(",
"$",
"select",
"->",
"column"... | Processes a single select column.
@param string|Aggregate|Query|StatementInterface $select
@param mixed $context The processing context
@return string|Aggregate|Query|StatementInterface | [
"Processes",
"a",
"single",
"select",
"column",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/PostProcessors/AbstractProcessor.php#L165-L177 | train |
Finesse/QueryScribe | src/PostProcessors/AbstractProcessor.php | AbstractProcessor.processColumnOrSubQuery | protected function processColumnOrSubQuery($column, $context)
{
if (is_string($column)) {
return $this->processColumnName($column, $context);
}
return $this->processSubQuery($column, $context);
} | php | protected function processColumnOrSubQuery($column, $context)
{
if (is_string($column)) {
return $this->processColumnName($column, $context);
}
return $this->processSubQuery($column, $context);
} | [
"protected",
"function",
"processColumnOrSubQuery",
"(",
"$",
"column",
",",
"$",
"context",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"column",
")",
")",
"{",
"return",
"$",
"this",
"->",
"processColumnName",
"(",
"$",
"column",
",",
"$",
"context",
"... | Processes a "column or subquery" value.
@param string|Query|StatementInterface $column
@param mixed $context The processing context
@return string|Query|StatementInterface | [
"Processes",
"a",
"column",
"or",
"subquery",
"value",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/PostProcessors/AbstractProcessor.php#L186-L193 | train |
Finesse/QueryScribe | src/PostProcessors/AbstractProcessor.php | AbstractProcessor.processSubQuery | protected function processSubQuery($subQuery, $context)
{
if ($subQuery instanceof Query) {
return $this->processQuery($subQuery, $context);
}
return $subQuery;
} | php | protected function processSubQuery($subQuery, $context)
{
if ($subQuery instanceof Query) {
return $this->processQuery($subQuery, $context);
}
return $subQuery;
} | [
"protected",
"function",
"processSubQuery",
"(",
"$",
"subQuery",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"subQuery",
"instanceof",
"Query",
")",
"{",
"return",
"$",
"this",
"->",
"processQuery",
"(",
"$",
"subQuery",
",",
"$",
"context",
")",
";"... | Processes a subquery. Not-subquery values are just passed through.
@param Query|StatementInterface $subQuery
@param mixed $context The processing context
@return Query|StatementInterface | [
"Processes",
"a",
"subquery",
".",
"Not",
"-",
"subquery",
"values",
"are",
"just",
"passed",
"through",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/PostProcessors/AbstractProcessor.php#L226-L233 | train |
Finesse/QueryScribe | src/PostProcessors/AbstractProcessor.php | AbstractProcessor.processInsert | protected function processInsert($row, $context)
{
if ($row instanceof InsertFromSelect) {
return $this->processInsertFromSelect($row, $context);
}
$newRow = [];
foreach ($row as $column => $value) {
$column = $this->processColumnName($column, $context);
... | php | protected function processInsert($row, $context)
{
if ($row instanceof InsertFromSelect) {
return $this->processInsertFromSelect($row, $context);
}
$newRow = [];
foreach ($row as $column => $value) {
$column = $this->processColumnName($column, $context);
... | [
"protected",
"function",
"processInsert",
"(",
"$",
"row",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"row",
"instanceof",
"InsertFromSelect",
")",
"{",
"return",
"$",
"this",
"->",
"processInsertFromSelect",
"(",
"$",
"row",
",",
"$",
"context",
")",
... | Processes a single insert statement.
@param mixed[]|Query[]|StatementInterface[]|InsertFromSelect $row
@param mixed $context The processing context
@return mixed[]|Query[]|StatementInterface[]|InsertFromSelect | [
"Processes",
"a",
"single",
"insert",
"statement",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/PostProcessors/AbstractProcessor.php#L242-L255 | train |
Finesse/QueryScribe | src/PostProcessors/AbstractProcessor.php | AbstractProcessor.processInsertFromSelect | protected function processInsertFromSelect(InsertFromSelect $row, $context): InsertFromSelect
{
if ($row->columns === null) {
$columns = null;
} else {
$columns = [];
foreach ($row->columns as $index => $column) {
$columns[$index] = $this->processC... | php | protected function processInsertFromSelect(InsertFromSelect $row, $context): InsertFromSelect
{
if ($row->columns === null) {
$columns = null;
} else {
$columns = [];
foreach ($row->columns as $index => $column) {
$columns[$index] = $this->processC... | [
"protected",
"function",
"processInsertFromSelect",
"(",
"InsertFromSelect",
"$",
"row",
",",
"$",
"context",
")",
":",
"InsertFromSelect",
"{",
"if",
"(",
"$",
"row",
"->",
"columns",
"===",
"null",
")",
"{",
"$",
"columns",
"=",
"null",
";",
"}",
"else",... | Processes a single "insert from select" statement.
@param InsertFromSelect $row
@param mixed $context The processing context
@return InsertFromSelect | [
"Processes",
"a",
"single",
"insert",
"from",
"select",
"statement",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/PostProcessors/AbstractProcessor.php#L264-L281 | train |
Finesse/QueryScribe | src/PostProcessors/AbstractProcessor.php | AbstractProcessor.processJoin | protected function processJoin(Join $join, $context): Join
{
$table = $this->processTable($join->table, $context);
$criteria = [];
foreach ($join->criteria as $index => $criterion) {
$criteria[$index] = $this->processCriterion($criterion, $context);
}
if ($table ... | php | protected function processJoin(Join $join, $context): Join
{
$table = $this->processTable($join->table, $context);
$criteria = [];
foreach ($join->criteria as $index => $criterion) {
$criteria[$index] = $this->processCriterion($criterion, $context);
}
if ($table ... | [
"protected",
"function",
"processJoin",
"(",
"Join",
"$",
"join",
",",
"$",
"context",
")",
":",
"Join",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"processTable",
"(",
"$",
"join",
"->",
"table",
",",
"$",
"context",
")",
";",
"$",
"criteria",
"=",
... | Processes a single join.
@param Join $join
@param mixed $context The processing context
@return Join | [
"Processes",
"a",
"single",
"join",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/PostProcessors/AbstractProcessor.php#L290-L303 | train |
Finesse/QueryScribe | src/PostProcessors/AbstractProcessor.php | AbstractProcessor.processOrder | protected function processOrder($order, $context)
{
if ($order instanceof Order || $order instanceof OrderByIsNull) {
$column = $this->processColumnOrSubQuery($order->column, $context);
if ($column === $order->column) {
return $order;
} elseif ($order ins... | php | protected function processOrder($order, $context)
{
if ($order instanceof Order || $order instanceof OrderByIsNull) {
$column = $this->processColumnOrSubQuery($order->column, $context);
if ($column === $order->column) {
return $order;
} elseif ($order ins... | [
"protected",
"function",
"processOrder",
"(",
"$",
"order",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"order",
"instanceof",
"Order",
"||",
"$",
"order",
"instanceof",
"OrderByIsNull",
")",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"processColumnOrS... | Processes a single order statement.
@param Order|OrderByIsNull|ExplicitOrder|string $order
@param mixed $context The processing context
@return Order|string | [
"Processes",
"a",
"single",
"order",
"statement",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/PostProcessors/AbstractProcessor.php#L409-L439 | train |
bseddon/XPath20 | Iterator/ChildNodeIterator.php | ChildNodeIterator.skip | private function skip( $nav )
{
if ( $this->excludeComments && $nav->getNodeType() == XML_COMMENT_NODE )
{
$this->commentsSkipped++;
}
return ( $this->excludeComments && $nav->getNodeType() == XML_COMMENT_NODE ) ||
( $this->excludeWhitespace && $nav->IsWhitespaceNode() );
} | php | private function skip( $nav )
{
if ( $this->excludeComments && $nav->getNodeType() == XML_COMMENT_NODE )
{
$this->commentsSkipped++;
}
return ( $this->excludeComments && $nav->getNodeType() == XML_COMMENT_NODE ) ||
( $this->excludeWhitespace && $nav->IsWhitespaceNode() );
} | [
"private",
"function",
"skip",
"(",
"$",
"nav",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"excludeComments",
"&&",
"$",
"nav",
"->",
"getNodeType",
"(",
")",
"==",
"XML_COMMENT_NODE",
")",
"{",
"$",
"this",
"->",
"commentsSkipped",
"++",
";",
"}",
"retur... | Check whether to skip this node
@param XPathNavigator $nav
@return boolean | [
"Check",
"whether",
"to",
"skip",
"this",
"node"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Iterator/ChildNodeIterator.php#L112-L120 | train |
eureka-framework/component-http | src/Http/Data.php | Data.get | public function get($name = null, $default = null)
{
$value = null;
if (null === $name) {
$value = $this->data;
} elseif (isset($this->data[$name])) {
$value = $this->data[$name];
} elseif (null !== $default) {
$value = $default;
} else {
... | php | public function get($name = null, $default = null)
{
$value = null;
if (null === $name) {
$value = $this->data;
} elseif (isset($this->data[$name])) {
$value = $this->data[$name];
} elseif (null !== $default) {
$value = $default;
} else {
... | [
"public",
"function",
"get",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"data",
";",
"}",
"... | Get request data.
@param string $name
@param mixed $default
@return mixed Value
@throws \Exception | [
"Get",
"request",
"data",
"."
] | 698c3b73581a9703a9c932890c57e50f8774607a | https://github.com/eureka-framework/component-http/blob/698c3b73581a9703a9c932890c57e50f8774607a/src/Http/Data.php#L53-L68 | train |
kitpages/KitpagesChainBundle | Step/StepAbstract.php | StepAbstract.getRenderedParameter | public function getRenderedParameter($key, $escaper = null)
{
$subject = $this->getParameter($key);
preg_match_all('/{{([a-zA-Z0-9\.\-\_]+)}}/', $subject, $matches);
$parameterList = $matches[1];
foreach ($parameterList as $parameterKey) {
$val = $this->getParameter($para... | php | public function getRenderedParameter($key, $escaper = null)
{
$subject = $this->getParameter($key);
preg_match_all('/{{([a-zA-Z0-9\.\-\_]+)}}/', $subject, $matches);
$parameterList = $matches[1];
foreach ($parameterList as $parameterKey) {
$val = $this->getParameter($para... | [
"public",
"function",
"getRenderedParameter",
"(",
"$",
"key",
",",
"$",
"escaper",
"=",
"null",
")",
"{",
"$",
"subject",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"$",
"key",
")",
";",
"preg_match_all",
"(",
"'/{{([a-zA-Z0-9\\.\\-\\_]+)}}/'",
",",
"$",
... | used to transform a value in a parameter.
ex :
$parameterList['foo'] = 'ls {{fileName}} {{bar}}';
$parameterList['fileName'] = '/tmp/titi';
// $parameterList['bar'] is undefined
=> $this->getRenderedParameter('foo', function ($str) { strtoupper($str); } );
Result : ls /TMP/TITI
@param $key
@param callable $escaper
@... | [
"used",
"to",
"transform",
"a",
"value",
"in",
"a",
"parameter",
"."
] | f884d1875b6a6b6b9c66e161884cc3a2c1edc0e6 | https://github.com/kitpages/KitpagesChainBundle/blob/f884d1875b6a6b6b9c66e161884cc3a2c1edc0e6/Step/StepAbstract.php#L54-L71 | train |
Innmind/Math | src/Polynom/Polynom.php | Polynom.withDegree | public function withDegree(Integer $degree, Number $coeff): self
{
$degrees = $this->degrees->put(
$degree->value(),
new Degree($degree, $coeff)
);
return new self(
$this->intercept,
...$degrees->values()
);
} | php | public function withDegree(Integer $degree, Number $coeff): self
{
$degrees = $this->degrees->put(
$degree->value(),
new Degree($degree, $coeff)
);
return new self(
$this->intercept,
...$degrees->values()
);
} | [
"public",
"function",
"withDegree",
"(",
"Integer",
"$",
"degree",
",",
"Number",
"$",
"coeff",
")",
":",
"self",
"{",
"$",
"degrees",
"=",
"$",
"this",
"->",
"degrees",
"->",
"put",
"(",
"$",
"degree",
"->",
"value",
"(",
")",
",",
"new",
"Degree",
... | Create a new polynom with this added degree
@param Integer $degree
@param Number $coeff
@return self | [
"Create",
"a",
"new",
"polynom",
"with",
"this",
"added",
"degree"
] | ac9ad4dd1852c145e90f5edc0f38a873b125a50b | https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Polynom/Polynom.php#L44-L55 | train |
Innmind/Math | src/Polynom/Polynom.php | Polynom.derived | public function derived(Number $x, Number $limit = null): Number
{
$limit = $limit ?? Tangent::limit();
return divide(
subtract(
$this(add($x, $limit)),
$this($x)
),
$limit
);
} | php | public function derived(Number $x, Number $limit = null): Number
{
$limit = $limit ?? Tangent::limit();
return divide(
subtract(
$this(add($x, $limit)),
$this($x)
),
$limit
);
} | [
"public",
"function",
"derived",
"(",
"Number",
"$",
"x",
",",
"Number",
"$",
"limit",
"=",
"null",
")",
":",
"Number",
"{",
"$",
"limit",
"=",
"$",
"limit",
"??",
"Tangent",
"::",
"limit",
"(",
")",
";",
"return",
"divide",
"(",
"subtract",
"(",
"... | Compute the derived number of x
@param Number $x
@param Number|null $limit Value that tend to 0 (default to 0.000000000001)
@return Number | [
"Compute",
"the",
"derived",
"number",
"of",
"x"
] | ac9ad4dd1852c145e90f5edc0f38a873b125a50b | https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Polynom/Polynom.php#L121-L132 | train |
TiMESPLiNTER/gphpio | src/RPi.php | RPi.getGPIOPins | public function getGPIOPins()
{
if(true === in_array($this->revision, ['a01041', 'a21041', 'a22042'], true)) {
// Pi 2 revs
return range(2, 27);
}
if(true === in_array($this->revision, ['a02082', 'a22082', 'a32082'], true)) {
// Pi 3 revs
return range(2, 27);
}
// Pi 1 revs
return [0, 1, 4, 7... | php | public function getGPIOPins()
{
if(true === in_array($this->revision, ['a01041', 'a21041', 'a22042'], true)) {
// Pi 2 revs
return range(2, 27);
}
if(true === in_array($this->revision, ['a02082', 'a22082', 'a32082'], true)) {
// Pi 3 revs
return range(2, 27);
}
// Pi 1 revs
return [0, 1, 4, 7... | [
"public",
"function",
"getGPIOPins",
"(",
")",
"{",
"if",
"(",
"true",
"===",
"in_array",
"(",
"$",
"this",
"->",
"revision",
",",
"[",
"'a01041'",
",",
"'a21041'",
",",
"'a22042'",
"]",
",",
"true",
")",
")",
"{",
"// Pi 2 revs",
"return",
"range",
"(... | Get the valid GPIO pin map
@return array | [
"Get",
"the",
"valid",
"GPIO",
"pin",
"map"
] | afde198a37dcf9f1558313cfcd29b813e6d746a8 | https://github.com/TiMESPLiNTER/gphpio/blob/afde198a37dcf9f1558313cfcd29b813e6d746a8/src/RPi.php#L64-L78 | train |
TiMESPLiNTER/gphpio | src/RPi.php | RPi.getName | public function getName()
{
if(false === isset(self::$modelNameMap[$this->revision])) {
return 'unknown';
}
return self::$modelNameMap[$this->revision];
} | php | public function getName()
{
if(false === isset(self::$modelNameMap[$this->revision])) {
return 'unknown';
}
return self::$modelNameMap[$this->revision];
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"isset",
"(",
"self",
"::",
"$",
"modelNameMap",
"[",
"$",
"this",
"->",
"revision",
"]",
")",
")",
"{",
"return",
"'unknown'",
";",
"}",
"return",
"self",
"::",
"$",
"modelNa... | Get the revision name
@return string | [
"Get",
"the",
"revision",
"name"
] | afde198a37dcf9f1558313cfcd29b813e6d746a8 | https://github.com/TiMESPLiNTER/gphpio/blob/afde198a37dcf9f1558313cfcd29b813e6d746a8/src/RPi.php#L85-L92 | train |
linuxjuggler/lumen-make | src/Commands/ModelMakeCommand.php | ModelMakeCommand.createFactory | protected function createFactory()
{
$factory = Str::studly(class_basename($this->argument('name')));
$this->call('make:factory', [
'name' => "{$factory}Factory",
'--model' => $this->argument('name'),
]);
} | php | protected function createFactory()
{
$factory = Str::studly(class_basename($this->argument('name')));
$this->call('make:factory', [
'name' => "{$factory}Factory",
'--model' => $this->argument('name'),
]);
} | [
"protected",
"function",
"createFactory",
"(",
")",
"{",
"$",
"factory",
"=",
"Str",
"::",
"studly",
"(",
"class_basename",
"(",
"$",
"this",
"->",
"argument",
"(",
"'name'",
")",
")",
")",
";",
"$",
"this",
"->",
"call",
"(",
"'make:factory'",
",",
"[... | Create a model factory for the model. | [
"Create",
"a",
"model",
"factory",
"for",
"the",
"model",
"."
] | 80e794f78957ea56770a1b27c0f7160d0b7ea76d | https://github.com/linuxjuggler/lumen-make/blob/80e794f78957ea56770a1b27c0f7160d0b7ea76d/src/Commands/ModelMakeCommand.php#L64-L72 | train |
itcreator/custom-cmf | Module/Captcha/src/Cmf/Captcha/Captcha.php | Captcha.generateCode | public function generateCode()
{
$this->digits[0] = rand(0, 9);
$this->digits[1] = rand(0, 9);
$this->digits[2] = rand(0, 9);
$this->digits[3] = rand(0, 9);
$this->digits[4] = rand(0, 9);
$this->value = $this->digits[0] * 10000 + $this->digits[1] * 1000;
$this... | php | public function generateCode()
{
$this->digits[0] = rand(0, 9);
$this->digits[1] = rand(0, 9);
$this->digits[2] = rand(0, 9);
$this->digits[3] = rand(0, 9);
$this->digits[4] = rand(0, 9);
$this->value = $this->digits[0] * 10000 + $this->digits[1] * 1000;
$this... | [
"public",
"function",
"generateCode",
"(",
")",
"{",
"$",
"this",
"->",
"digits",
"[",
"0",
"]",
"=",
"rand",
"(",
"0",
",",
"9",
")",
";",
"$",
"this",
"->",
"digits",
"[",
"1",
"]",
"=",
"rand",
"(",
"0",
",",
"9",
")",
";",
"$",
"this",
... | generate captcha value
@return Captcha | [
"generate",
"captcha",
"value"
] | 42fc0535dfa0f641856f06673f6ab596b2020c40 | https://github.com/itcreator/custom-cmf/blob/42fc0535dfa0f641856f06673f6ab596b2020c40/Module/Captcha/src/Cmf/Captcha/Captcha.php#L40-L53 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.