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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ARCANESOFT/Media | src/Entities/FileCollection.php | FileCollection.exclude | public function exclude(array $patterns)
{
return $this->reject(function ($file) use ($patterns) {
foreach ($patterns as $pattern) {
if (Str::is($pattern, $file['name'])) return true;
}
return false;
});
} | php | public function exclude(array $patterns)
{
return $this->reject(function ($file) use ($patterns) {
foreach ($patterns as $pattern) {
if (Str::is($pattern, $file['name'])) return true;
}
return false;
});
} | [
"public",
"function",
"exclude",
"(",
"array",
"$",
"patterns",
")",
"{",
"return",
"$",
"this",
"->",
"reject",
"(",
"function",
"(",
"$",
"file",
")",
"use",
"(",
"$",
"patterns",
")",
"{",
"foreach",
"(",
"$",
"patterns",
"as",
"$",
"pattern",
")"... | ExcludePattern files with the given patterns.
@param array $patterns
@return self | [
"ExcludePattern",
"files",
"with",
"the",
"given",
"patterns",
"."
] | e98aad52f94e6587fcbf79c56f7bf7072929bfc9 | https://github.com/ARCANESOFT/Media/blob/e98aad52f94e6587fcbf79c56f7bf7072929bfc9/src/Entities/FileCollection.php#L26-L35 | train |
danielgp/common-lib | source/CommonViews.php | CommonViews.setField | private function setField($tableSource, $dtl, $features, $fieldLabel)
{
if ($dtl['COLUMN_NAME'] == 'host') {
$inVl = gethostbyaddr($this->tCmnRequest->server->get('REMOTE_ADDR'));
return [
'label' => '<label for="' . $dtl['COLUMN_NAME'] . '">Numele calculatorului</lab... | php | private function setField($tableSource, $dtl, $features, $fieldLabel)
{
if ($dtl['COLUMN_NAME'] == 'host') {
$inVl = gethostbyaddr($this->tCmnRequest->server->get('REMOTE_ADDR'));
return [
'label' => '<label for="' . $dtl['COLUMN_NAME'] . '">Numele calculatorului</lab... | [
"private",
"function",
"setField",
"(",
"$",
"tableSource",
",",
"$",
"dtl",
",",
"$",
"features",
",",
"$",
"fieldLabel",
")",
"{",
"if",
"(",
"$",
"dtl",
"[",
"'COLUMN_NAME'",
"]",
"==",
"'host'",
")",
"{",
"$",
"inVl",
"=",
"gethostbyaddr",
"(",
"... | Builds field output w. special column name
@param string $tableSource
@param array $dtl
@param array $features
@param string $fieldLabel
@return array | [
"Builds",
"field",
"output",
"w",
".",
"special",
"column",
"name"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonViews.php#L50-L61 | train |
danielgp/common-lib | source/CommonViews.php | CommonViews.setFieldInput | private function setFieldInput($tableSource, $dtl, $features)
{
if ($dtl['COLUMN_NAME'] == 'ChoiceId') {
return '<input type="text" name="ChoiceId" value="'
. $this->tCmnRequest->request->get($dtl['COLUMN_NAME']) . '" />';
}
return $this->setNeededFieldByType(... | php | private function setFieldInput($tableSource, $dtl, $features)
{
if ($dtl['COLUMN_NAME'] == 'ChoiceId') {
return '<input type="text" name="ChoiceId" value="'
. $this->tCmnRequest->request->get($dtl['COLUMN_NAME']) . '" />';
}
return $this->setNeededFieldByType(... | [
"private",
"function",
"setFieldInput",
"(",
"$",
"tableSource",
",",
"$",
"dtl",
",",
"$",
"features",
")",
"{",
"if",
"(",
"$",
"dtl",
"[",
"'COLUMN_NAME'",
"]",
"==",
"'ChoiceId'",
")",
"{",
"return",
"'<input type=\"text\" name=\"ChoiceId\" value=\"'",
".",
... | Builds field output w. another special column name
@param string $tableSource
@param array $dtl
@param array $features
@return string | [
"Builds",
"field",
"output",
"w",
".",
"another",
"special",
"column",
"name"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonViews.php#L71-L78 | train |
danielgp/common-lib | source/CommonViews.php | CommonViews.setFormGenericSingleRecord | protected function setFormGenericSingleRecord($tblSrc, $feat, $hdnInf = [])
{
echo $this->setStringIntoTag('', 'div', ['id' => 'loading']);
$this->setTableCache($tblSrc);
if (strpos($tblSrc, '.') !== false) {
$tblSrc = explode('.', str_replace('`', '', $tblSrc))[1];
}
... | php | protected function setFormGenericSingleRecord($tblSrc, $feat, $hdnInf = [])
{
echo $this->setStringIntoTag('', 'div', ['id' => 'loading']);
$this->setTableCache($tblSrc);
if (strpos($tblSrc, '.') !== false) {
$tblSrc = explode('.', str_replace('`', '', $tblSrc))[1];
}
... | [
"protected",
"function",
"setFormGenericSingleRecord",
"(",
"$",
"tblSrc",
",",
"$",
"feat",
",",
"$",
"hdnInf",
"=",
"[",
"]",
")",
"{",
"echo",
"$",
"this",
"->",
"setStringIntoTag",
"(",
"''",
",",
"'div'",
",",
"[",
"'id'",
"=>",
"'loading'",
"]",
... | Returns a generic form based on a given table
@param string $tblSrc
@param array $feat
@param array $hdnInf
@return string Form to add/modify detail for a single row within a table | [
"Returns",
"a",
"generic",
"form",
"based",
"on",
"a",
"given",
"table"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonViews.php#L89-L105 | train |
danielgp/common-lib | source/CommonViews.php | CommonViews.setNeededField | private function setNeededField($tableSource, $details, $features)
{
if (isset($features['hidden'])) {
if (in_array($details['COLUMN_NAME'], $features['hidden'])) {
return null;
}
}
$fieldLabel = $this->getFieldNameForDisplay($details);
if ($fi... | php | private function setNeededField($tableSource, $details, $features)
{
if (isset($features['hidden'])) {
if (in_array($details['COLUMN_NAME'], $features['hidden'])) {
return null;
}
}
$fieldLabel = $this->getFieldNameForDisplay($details);
if ($fi... | [
"private",
"function",
"setNeededField",
"(",
"$",
"tableSource",
",",
"$",
"details",
",",
"$",
"features",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"features",
"[",
"'hidden'",
"]",
")",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"details",
"[",
"'C... | Analyse the field and returns the proper line 2 use in forms
@param string $tableSource
@param array $details
@param array $features
@return string|array | [
"Analyse",
"the",
"field",
"and",
"returns",
"the",
"proper",
"line",
"2",
"use",
"in",
"forms"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonViews.php#L115-L127 | train |
danielgp/common-lib | source/CommonViews.php | CommonViews.setNeededFieldByType | private function setNeededFieldByType($tblName, $dtls, $features)
{
if (isset($features['special']) && isset($features['special'][$dtls['COLUMN_NAME']])) {
$sOpt = $this->setMySQLquery2Server($features['special'][$dtls['COLUMN_NAME']], 'array_key_value');
return $this->setArrayToSele... | php | private function setNeededFieldByType($tblName, $dtls, $features)
{
if (isset($features['special']) && isset($features['special'][$dtls['COLUMN_NAME']])) {
$sOpt = $this->setMySQLquery2Server($features['special'][$dtls['COLUMN_NAME']], 'array_key_value');
return $this->setArrayToSele... | [
"private",
"function",
"setNeededFieldByType",
"(",
"$",
"tblName",
",",
"$",
"dtls",
",",
"$",
"features",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"features",
"[",
"'special'",
"]",
")",
"&&",
"isset",
"(",
"$",
"features",
"[",
"'special'",
"]",
"[",... | Analyse the field type and returns the proper lines 2 use in forms
@param string $tblName
@param array $dtls
@param array $features
@return string|array | [
"Analyse",
"the",
"field",
"type",
"and",
"returns",
"the",
"proper",
"lines",
"2",
"use",
"in",
"forms"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonViews.php#L137-L144 | train |
danielgp/common-lib | source/CommonViews.php | CommonViews.setViewModernDelete | protected function setViewModernDelete($tbl, $idn)
{
$tMsg = $this->setViewDeleteFeedbacks();
if ($tbl == '') {
$sReturn = $this->setFeedbackModern('error', $tMsg['Confirmation'], $tMsg['Impossible']);
} else {
$this->initializeSprGlbAndSession();
$idFldVa... | php | protected function setViewModernDelete($tbl, $idn)
{
$tMsg = $this->setViewDeleteFeedbacks();
if ($tbl == '') {
$sReturn = $this->setFeedbackModern('error', $tMsg['Confirmation'], $tMsg['Impossible']);
} else {
$this->initializeSprGlbAndSession();
$idFldVa... | [
"protected",
"function",
"setViewModernDelete",
"(",
"$",
"tbl",
",",
"$",
"idn",
")",
"{",
"$",
"tMsg",
"=",
"$",
"this",
"->",
"setViewDeleteFeedbacks",
"(",
")",
";",
"if",
"(",
"$",
"tbl",
"==",
"''",
")",
"{",
"$",
"sReturn",
"=",
"$",
"this",
... | Automatic handler for Record deletion
@param string $tbl
@param string $idn
@return string | [
"Automatic",
"handler",
"for",
"Record",
"deletion"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonViews.php#L189-L205 | train |
LpFactory/NestedSetRoutingBundle | Configuration/PageRouteConfigurationChain.php | PageRouteConfigurationChain.findConfiguration | protected function findConfiguration($value, \Closure $func)
{
/** @var AbstractPageRouteConfiguration $configuration */
foreach ($this->all() as $configuration) {
if ($func($configuration, $value)) {
return $configuration;
}
}
return null;
... | php | protected function findConfiguration($value, \Closure $func)
{
/** @var AbstractPageRouteConfiguration $configuration */
foreach ($this->all() as $configuration) {
if ($func($configuration, $value)) {
return $configuration;
}
}
return null;
... | [
"protected",
"function",
"findConfiguration",
"(",
"$",
"value",
",",
"\\",
"Closure",
"$",
"func",
")",
"{",
"/** @var AbstractPageRouteConfiguration $configuration */",
"foreach",
"(",
"$",
"this",
"->",
"all",
"(",
")",
"as",
"$",
"configuration",
")",
"{",
"... | Find a configuration matching custom criteria
@param string $value
@param callable $func
@return null|AbstractPageRouteConfiguration | [
"Find",
"a",
"configuration",
"matching",
"custom",
"criteria"
] | dc07227a6764e657b7b321827a18127ec18ba214 | https://github.com/LpFactory/NestedSetRoutingBundle/blob/dc07227a6764e657b7b321827a18127ec18ba214/Configuration/PageRouteConfigurationChain.php#L116-L126 | train |
bytic/debugbar | src/DebugBar.php | DebugBar.injectDebugBar | public function injectDebugBar(ResponseInterface $response)
{
$content = $response->getContent();
$renderer = $this->getJavascriptRenderer();
$renderedContent = $this->generateAssetsContent().$renderer->render();
$pos = strripos($content, '</body>');
if (false !== $pos) {
... | php | public function injectDebugBar(ResponseInterface $response)
{
$content = $response->getContent();
$renderer = $this->getJavascriptRenderer();
$renderedContent = $this->generateAssetsContent().$renderer->render();
$pos = strripos($content, '</body>');
if (false !== $pos) {
... | [
"public",
"function",
"injectDebugBar",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"content",
"=",
"$",
"response",
"->",
"getContent",
"(",
")",
";",
"$",
"renderer",
"=",
"$",
"this",
"->",
"getJavascriptRenderer",
"(",
")",
";",
"$",
"ren... | Injects the web debug toolbar
@param Response $response | [
"Injects",
"the",
"web",
"debug",
"toolbar"
] | 3199ade9a8fff866bffc39712bdf78d2dd214e4b | https://github.com/bytic/debugbar/blob/3199ade9a8fff866bffc39712bdf78d2dd214e4b/src/DebugBar.php#L116-L132 | train |
spoom-php/core | src/extension/Application.php | Application.environment | public static function environment( int $severity, array $configuration = [] ) {
// setup error reporting in PHP
$reporting = ~E_ALL;
foreach( self::SEVERITY as $key => $value ) {
if( $key <= $severity ) $reporting |= $value;
}
error_reporting( $reporting );
// setup locale
if( isset... | php | public static function environment( int $severity, array $configuration = [] ) {
// setup error reporting in PHP
$reporting = ~E_ALL;
foreach( self::SEVERITY as $key => $value ) {
if( $key <= $severity ) $reporting |= $value;
}
error_reporting( $reporting );
// setup locale
if( isset... | [
"public",
"static",
"function",
"environment",
"(",
"int",
"$",
"severity",
",",
"array",
"$",
"configuration",
"=",
"[",
"]",
")",
"{",
"// setup error reporting in PHP",
"$",
"reporting",
"=",
"~",
"E_ALL",
";",
"foreach",
"(",
"self",
"::",
"SEVERITY",
"a... | Global setup of the PHP environment
This SHOULD be done before the application...or anything else in the PHP code
@param int $severity Maximum severity level tht should be reported
@param array $configuration | [
"Global",
"setup",
"of",
"the",
"PHP",
"environment"
] | ea7184213352fa2fad7636927a019e5798734e04 | https://github.com/spoom-php/core/blob/ea7184213352fa2fad7636927a019e5798734e04/src/extension/Application.php#L260-L284 | train |
jenskooij/cloudcontrol | src/storage/storage/ImageSetStorage.php | ImageSetStorage.getImageSetBySlug | public function getImageSetBySlug($slug)
{
$imageSet = $this->getImageSet();
foreach ($imageSet as $set) {
if ($set->slug == $slug) {
return $set;
}
}
return null;
} | php | public function getImageSetBySlug($slug)
{
$imageSet = $this->getImageSet();
foreach ($imageSet as $set) {
if ($set->slug == $slug) {
return $set;
}
}
return null;
} | [
"public",
"function",
"getImageSetBySlug",
"(",
"$",
"slug",
")",
"{",
"$",
"imageSet",
"=",
"$",
"this",
"->",
"getImageSet",
"(",
")",
";",
"foreach",
"(",
"$",
"imageSet",
"as",
"$",
"set",
")",
"{",
"if",
"(",
"$",
"set",
"->",
"slug",
"==",
"$... | Get Image by slug
@param $slug
@return \stdClass | [
"Get",
"Image",
"by",
"slug"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/ImageSetStorage.php#L29-L39 | train |
jenskooij/cloudcontrol | src/storage/storage/ImageSetStorage.php | ImageSetStorage.addImageSet | public function addImageSet($postValues)
{
$imageSetObject = ImageSetFactory::createImageSetFromPostValues($postValues);
$imageSet = $this->repository->imageSet;
$imageSet[] = $imageSetObject;
$this->repository->imageSet = $imageSet;
$this->save();
} | php | public function addImageSet($postValues)
{
$imageSetObject = ImageSetFactory::createImageSetFromPostValues($postValues);
$imageSet = $this->repository->imageSet;
$imageSet[] = $imageSetObject;
$this->repository->imageSet = $imageSet;
$this->save();
} | [
"public",
"function",
"addImageSet",
"(",
"$",
"postValues",
")",
"{",
"$",
"imageSetObject",
"=",
"ImageSetFactory",
"::",
"createImageSetFromPostValues",
"(",
"$",
"postValues",
")",
";",
"$",
"imageSet",
"=",
"$",
"this",
"->",
"repository",
"->",
"imageSet",... | Add image set
@param $postValues
@throws \Exception | [
"Add",
"image",
"set"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/ImageSetStorage.php#L48-L57 | train |
jenskooij/cloudcontrol | src/storage/storage/ImageSetStorage.php | ImageSetStorage.saveImageSet | public function saveImageSet($slug, $postValues)
{
$imageSetObject = ImageSetFactory::createImageSetFromPostValues($postValues);
$imageSet = $this->repository->imageSet;
foreach ($imageSet as $key => $set) {
if ($set->slug == $slug) {
$imageSet[$key] = $imageSetO... | php | public function saveImageSet($slug, $postValues)
{
$imageSetObject = ImageSetFactory::createImageSetFromPostValues($postValues);
$imageSet = $this->repository->imageSet;
foreach ($imageSet as $key => $set) {
if ($set->slug == $slug) {
$imageSet[$key] = $imageSetO... | [
"public",
"function",
"saveImageSet",
"(",
"$",
"slug",
",",
"$",
"postValues",
")",
"{",
"$",
"imageSetObject",
"=",
"ImageSetFactory",
"::",
"createImageSetFromPostValues",
"(",
"$",
"postValues",
")",
";",
"$",
"imageSet",
"=",
"$",
"this",
"->",
"repositor... | Save Image Set by it's slug
@param $slug
@param $postValues
@throws \Exception | [
"Save",
"Image",
"Set",
"by",
"it",
"s",
"slug"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/ImageSetStorage.php#L67-L79 | train |
jenskooij/cloudcontrol | src/storage/storage/ImageSetStorage.php | ImageSetStorage.deleteImageSetBySlug | public function deleteImageSetBySlug($slug)
{
$imageSet = $this->getImageSet();
foreach ($imageSet as $key => $set) {
if ($set->slug == $slug) {
unset($imageSet[$key]);
}
}
$imageSet = array_values($imageSet);
$this->repository->imageS... | php | public function deleteImageSetBySlug($slug)
{
$imageSet = $this->getImageSet();
foreach ($imageSet as $key => $set) {
if ($set->slug == $slug) {
unset($imageSet[$key]);
}
}
$imageSet = array_values($imageSet);
$this->repository->imageS... | [
"public",
"function",
"deleteImageSetBySlug",
"(",
"$",
"slug",
")",
"{",
"$",
"imageSet",
"=",
"$",
"this",
"->",
"getImageSet",
"(",
")",
";",
"foreach",
"(",
"$",
"imageSet",
"as",
"$",
"key",
"=>",
"$",
"set",
")",
"{",
"if",
"(",
"$",
"set",
"... | Delete Image Set by its slug
@param $slug
@throws \Exception | [
"Delete",
"Image",
"Set",
"by",
"its",
"slug"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/ImageSetStorage.php#L88-L100 | train |
jenskooij/cloudcontrol | src/storage/storage/ImageSetStorage.php | ImageSetStorage.getSmallestImageSet | public function getSmallestImageSet()
{
$imageSet = $this->getImageSet();
$returnSize = PHP_INT_MAX;
$returnSet = null;
foreach ($imageSet as $set) {
$size = $set->width * $set->height;
if ($size < $returnSize) {
$returnSize = $size;
... | php | public function getSmallestImageSet()
{
$imageSet = $this->getImageSet();
$returnSize = PHP_INT_MAX;
$returnSet = null;
foreach ($imageSet as $set) {
$size = $set->width * $set->height;
if ($size < $returnSize) {
$returnSize = $size;
... | [
"public",
"function",
"getSmallestImageSet",
"(",
")",
"{",
"$",
"imageSet",
"=",
"$",
"this",
"->",
"getImageSet",
"(",
")",
";",
"$",
"returnSize",
"=",
"PHP_INT_MAX",
";",
"$",
"returnSet",
"=",
"null",
";",
"foreach",
"(",
"$",
"imageSet",
"as",
"$",... | Get the image set with the smallest size
@return \stdClass | [
"Get",
"the",
"image",
"set",
"with",
"the",
"smallest",
"size"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/ImageSetStorage.php#L107-L128 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Message.php | Message.setError | public static function setError($prefix = null, $field, $error) {
if(null !== $prefix && false === is_string($prefix)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($prefix)), E_USER_ERROR);
}
if(false === is_string($field)) {
... | php | public static function setError($prefix = null, $field, $error) {
if(null !== $prefix && false === is_string($prefix)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($prefix)), E_USER_ERROR);
}
if(false === is_string($field)) {
... | [
"public",
"static",
"function",
"setError",
"(",
"$",
"prefix",
"=",
"null",
",",
"$",
"field",
",",
"$",
"error",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"prefix",
"&&",
"false",
"===",
"is_string",
"(",
"$",
"prefix",
")",
")",
"{",
"return",
"t... | Sets an error for the current field
@param string $prefix
@param string $field
@param string $error
@return sFire\Validator\Message | [
"Sets",
"an",
"error",
"for",
"the",
"current",
"field"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Message.php#L121-L150 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Message.php | Message.getMessage | public static function getMessage($field, $rule) {
if(false === is_string($field)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($field)), E_USER_ERROR);
}
if(false === is_string($rule)) {
return trigger_error(sprintf('Argumen... | php | public static function getMessage($field, $rule) {
if(false === is_string($field)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($field)), E_USER_ERROR);
}
if(false === is_string($rule)) {
return trigger_error(sprintf('Argumen... | [
"public",
"static",
"function",
"getMessage",
"(",
"$",
"field",
",",
"$",
"rule",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"field",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the ty... | Returns message by field and rule
@param string $field
@param string $rule
@return string | [
"Returns",
"message",
"by",
"field",
"and",
"rule"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Message.php#L159-L172 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Message.php | Message.loadCustom | public static function loadCustom($classname, $namespace, $name) {
if(false === is_string($classname)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($classname)), E_USER_ERROR);
}
if(false === is_string($namespace)) {
return t... | php | public static function loadCustom($classname, $namespace, $name) {
if(false === is_string($classname)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($classname)), E_USER_ERROR);
}
if(false === is_string($namespace)) {
return t... | [
"public",
"static",
"function",
"loadCustom",
"(",
"$",
"classname",
",",
"$",
"namespace",
",",
"$",
"name",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"classname",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argume... | Loads a custom validator class
@param string $classname
@param string $namespace
@param string $name
@return sFire\Validator\Message | [
"Loads",
"a",
"custom",
"validator",
"class"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Message.php#L191-L208 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Message.php | Message.getErrors | public static function getErrors($fullnames = false) {
if(false === is_bool($fullnames)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($fullnames)), E_USER_ERROR);
}
if(true === $fullnames) {
return static :: $errors['full'];... | php | public static function getErrors($fullnames = false) {
if(false === is_bool($fullnames)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($fullnames)), E_USER_ERROR);
}
if(true === $fullnames) {
return static :: $errors['full'];... | [
"public",
"static",
"function",
"getErrors",
"(",
"$",
"fullnames",
"=",
"false",
")",
"{",
"if",
"(",
"false",
"===",
"is_bool",
"(",
"$",
"fullnames",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the typ... | Returns all errors
@param boolean $fullnames
@return array | [
"Returns",
"all",
"errors"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Message.php#L216-L227 | train |
Kris-Kuiper/sFire-Framework | src/Validator/Message.php | Message.addMessage | private static function addMessage($rule, $params) {
if(false === is_string($rule)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($rule)), E_USER_ERROR);
}
if(false === is_array($params)) {
return trigger_error(sprintf('Argume... | php | private static function addMessage($rule, $params) {
if(false === is_string($rule)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($rule)), E_USER_ERROR);
}
if(false === is_array($params)) {
return trigger_error(sprintf('Argume... | [
"private",
"static",
"function",
"addMessage",
"(",
"$",
"rule",
",",
"$",
"params",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"rule",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the t... | Adds a new custom message to current fieldname
@param string $rule
@param array $params | [
"Adds",
"a",
"new",
"custom",
"message",
"to",
"current",
"fieldname"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/Message.php#L235-L257 | train |
koolkode/lexer | src/AbstractTokenBuffer.php | AbstractTokenBuffer.append | public function append($data)
{
if($data instanceof AbstractToken)
{
$this->tokens[] = $data;
}
elseif($data instanceof AbstractTokenContainer)
{
$this->tokens = array_merge($this->tokens, $data->toArray());
}
elseif($data instanceof AbstractTokenCursor)
{
while($data->valid())
{
$this-... | php | public function append($data)
{
if($data instanceof AbstractToken)
{
$this->tokens[] = $data;
}
elseif($data instanceof AbstractTokenContainer)
{
$this->tokens = array_merge($this->tokens, $data->toArray());
}
elseif($data instanceof AbstractTokenCursor)
{
while($data->valid())
{
$this-... | [
"public",
"function",
"append",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"instanceof",
"AbstractToken",
")",
"{",
"$",
"this",
"->",
"tokens",
"[",
"]",
"=",
"$",
"data",
";",
"}",
"elseif",
"(",
"$",
"data",
"instanceof",
"AbstractTokenCont... | Append the given token or token container to the TokenBuffer.
@param mixed $data
@return AbstractTokenBuffer
@throws \InvalidArgumentException | [
"Append",
"the",
"given",
"token",
"or",
"token",
"container",
"to",
"the",
"TokenBuffer",
"."
] | 1f33fb4e95bf3b6b21c63187e503bbe612a1646c | https://github.com/koolkode/lexer/blob/1f33fb4e95bf3b6b21c63187e503bbe612a1646c/src/AbstractTokenBuffer.php#L37-L62 | train |
RhubarbPHP/Module.ImageProcessing | src/ImageMetrics.php | ImageMetrics.commit | public function commit()
{
$this->sourceWidth = $this->frameWidth;
$this->sourceHeight = $this->frameHeight;
$this->offsetX = 0;
$this->offsetY = 0;
$this->scaleWidth = $this->frameWidth;
$this->scaleHeight = $this->frameHeight;
$this->getFocalPoint();
} | php | public function commit()
{
$this->sourceWidth = $this->frameWidth;
$this->sourceHeight = $this->frameHeight;
$this->offsetX = 0;
$this->offsetY = 0;
$this->scaleWidth = $this->frameWidth;
$this->scaleHeight = $this->frameHeight;
$this->getFocalPoint();
} | [
"public",
"function",
"commit",
"(",
")",
"{",
"$",
"this",
"->",
"sourceWidth",
"=",
"$",
"this",
"->",
"frameWidth",
";",
"$",
"this",
"->",
"sourceHeight",
"=",
"$",
"this",
"->",
"frameHeight",
";",
"$",
"this",
"->",
"offsetX",
"=",
"0",
";",
"$... | Resets the image metrics so as to reflect the image should the current settings be applied. | [
"Resets",
"the",
"image",
"metrics",
"so",
"as",
"to",
"reflect",
"the",
"image",
"should",
"the",
"current",
"settings",
"be",
"applied",
"."
] | e980ae6b524ce60f550064257eb7318dce331c1a | https://github.com/RhubarbPHP/Module.ImageProcessing/blob/e980ae6b524ce60f550064257eb7318dce331c1a/src/ImageMetrics.php#L46-L56 | train |
RhubarbPHP/Module.ImageProcessing | src/ImageMetrics.php | ImageMetrics.getFocalPoint | public function getFocalPoint()
{
$scale = $this->sourceWidth / $this->scaleWidth;
$focalX = ( ( $this->frameWidth / 2 ) - $this->offsetX ) * $scale;
$focalY = ( ( $this->frameHeight / 2 ) - $this->offsetY ) * $scale;
return array( $focalX, $focalY );
} | php | public function getFocalPoint()
{
$scale = $this->sourceWidth / $this->scaleWidth;
$focalX = ( ( $this->frameWidth / 2 ) - $this->offsetX ) * $scale;
$focalY = ( ( $this->frameHeight / 2 ) - $this->offsetY ) * $scale;
return array( $focalX, $focalY );
} | [
"public",
"function",
"getFocalPoint",
"(",
")",
"{",
"$",
"scale",
"=",
"$",
"this",
"->",
"sourceWidth",
"/",
"$",
"this",
"->",
"scaleWidth",
";",
"$",
"focalX",
"=",
"(",
"(",
"$",
"this",
"->",
"frameWidth",
"/",
"2",
")",
"-",
"$",
"this",
"-... | Returns an array with the X, Y co-ords of the focal point of the current crop.
The measurement is relative to the original source image. | [
"Returns",
"an",
"array",
"with",
"the",
"X",
"Y",
"co",
"-",
"ords",
"of",
"the",
"focal",
"point",
"of",
"the",
"current",
"crop",
"."
] | e980ae6b524ce60f550064257eb7318dce331c1a | https://github.com/RhubarbPHP/Module.ImageProcessing/blob/e980ae6b524ce60f550064257eb7318dce331c1a/src/ImageMetrics.php#L64-L72 | train |
RhubarbPHP/Module.ImageProcessing | src/ImageMetrics.php | ImageMetrics.setSourceDetails | public function setSourceDetails()
{
if ( !file_exists( $this->sourcePath ) )
{
throw new FileNotFoundException( $this->sourcePath );
}
if ( is_dir( $this->sourcePath ) )
{
throw new FileNotFoundException( $this->sourcePath );
}
$imageDetails = getimagesize( $this->sourcePath );
$this->sourceW... | php | public function setSourceDetails()
{
if ( !file_exists( $this->sourcePath ) )
{
throw new FileNotFoundException( $this->sourcePath );
}
if ( is_dir( $this->sourcePath ) )
{
throw new FileNotFoundException( $this->sourcePath );
}
$imageDetails = getimagesize( $this->sourcePath );
$this->sourceW... | [
"public",
"function",
"setSourceDetails",
"(",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"sourcePath",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"$",
"this",
"->",
"sourcePath",
")",
";",
"}",
"if",
"(",
"is_dir"... | Reads basic information about the metrics of the source image.
@throws FileNotFoundException Thrown if the source image couldn't be found. | [
"Reads",
"basic",
"information",
"about",
"the",
"metrics",
"of",
"the",
"source",
"image",
"."
] | e980ae6b524ce60f550064257eb7318dce331c1a | https://github.com/RhubarbPHP/Module.ImageProcessing/blob/e980ae6b524ce60f550064257eb7318dce331c1a/src/ImageMetrics.php#L99-L125 | train |
RhubarbPHP/Module.ImageProcessing | src/ImageMetrics.php | ImageMetrics.resize | public function resize( $width, $height, $maintainAspect = false, $scaleUp = true )
{
$oldFrameWidth = $this->frameWidth;
$aspectRatio = $this->frameWidth / $this->frameHeight;
if ( $maintainAspect )
{
// Try width first
$newHeight = round( $width / $aspectRatio );
if ( $newHeight > $height )
{
... | php | public function resize( $width, $height, $maintainAspect = false, $scaleUp = true )
{
$oldFrameWidth = $this->frameWidth;
$aspectRatio = $this->frameWidth / $this->frameHeight;
if ( $maintainAspect )
{
// Try width first
$newHeight = round( $width / $aspectRatio );
if ( $newHeight > $height )
{
... | [
"public",
"function",
"resize",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"maintainAspect",
"=",
"false",
",",
"$",
"scaleUp",
"=",
"true",
")",
"{",
"$",
"oldFrameWidth",
"=",
"$",
"this",
"->",
"frameWidth",
";",
"$",
"aspectRatio",
"=",
"$",
... | Resizes the image with the given bounds.
@param mixed $width
@param mixed $height
@param mixed $maintainAspect
@param bool $scaleUp | [
"Resizes",
"the",
"image",
"with",
"the",
"given",
"bounds",
"."
] | e980ae6b524ce60f550064257eb7318dce331c1a | https://github.com/RhubarbPHP/Module.ImageProcessing/blob/e980ae6b524ce60f550064257eb7318dce331c1a/src/ImageMetrics.php#L135-L189 | train |
swokit/utils | src/Coroutine.php | Coroutine.tid | public static function tid(): int
{
if (!ServerUtil::coroutineIsEnabled()) {
return -1;
}
$id = SwCoroutine::getuid();
return self::$idMap[$id] ?? $id;
} | php | public static function tid(): int
{
if (!ServerUtil::coroutineIsEnabled()) {
return -1;
}
$id = SwCoroutine::getuid();
return self::$idMap[$id] ?? $id;
} | [
"public",
"static",
"function",
"tid",
"(",
")",
":",
"int",
"{",
"if",
"(",
"!",
"ServerUtil",
"::",
"coroutineIsEnabled",
"(",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"$",
"id",
"=",
"SwCoroutine",
"::",
"getuid",
"(",
")",
";",
"return",
"s... | get top coroutine id
@return int | [
"get",
"top",
"coroutine",
"id"
] | a91688ee6970e33be14047bf4714da3299796f56 | https://github.com/swokit/utils/blob/a91688ee6970e33be14047bf4714da3299796f56/src/Coroutine.php#L48-L57 | train |
swokit/utils | src/Coroutine.php | Coroutine.create | public static function create(callable $cb)
{
if (!ServerUtil::coroutineIsEnabled()) {
return false;
}
$tid = self::tid();
return SwCoroutine::create(function () use ($cb, $tid) {
$id = SwCoroutine::getuid();
self::$idMap[$id] = $tid;
... | php | public static function create(callable $cb)
{
if (!ServerUtil::coroutineIsEnabled()) {
return false;
}
$tid = self::tid();
return SwCoroutine::create(function () use ($cb, $tid) {
$id = SwCoroutine::getuid();
self::$idMap[$id] = $tid;
... | [
"public",
"static",
"function",
"create",
"(",
"callable",
"$",
"cb",
")",
"{",
"if",
"(",
"!",
"ServerUtil",
"::",
"coroutineIsEnabled",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"tid",
"=",
"self",
"::",
"tid",
"(",
")",
";",
"return",
... | create a child coroutine
@param callable $cb
@return bool|int success return CID, fail return false. | [
"create",
"a",
"child",
"coroutine"
] | a91688ee6970e33be14047bf4714da3299796f56 | https://github.com/swokit/utils/blob/a91688ee6970e33be14047bf4714da3299796f56/src/Coroutine.php#L73-L88 | train |
PenoaksDev/Milky-Framework | src/Milky/Filesystem/FilesystemAdapter.php | FilesystemAdapter.parseVisibility | protected function parseVisibility( $visibility )
{
if ( is_null( $visibility ) )
return null;
switch ( $visibility )
{
case FilesystemContract::VISIBILITY_PUBLIC:
return AdapterInterface::VISIBILITY_PUBLIC;
case FilesystemContract::VISIBILITY_PRIVATE:
return AdapterInterface::VISIBILITY_PRIVAT... | php | protected function parseVisibility( $visibility )
{
if ( is_null( $visibility ) )
return null;
switch ( $visibility )
{
case FilesystemContract::VISIBILITY_PUBLIC:
return AdapterInterface::VISIBILITY_PUBLIC;
case FilesystemContract::VISIBILITY_PRIVATE:
return AdapterInterface::VISIBILITY_PRIVAT... | [
"protected",
"function",
"parseVisibility",
"(",
"$",
"visibility",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"visibility",
")",
")",
"return",
"null",
";",
"switch",
"(",
"$",
"visibility",
")",
"{",
"case",
"FilesystemContract",
"::",
"VISIBILITY_PUBLIC",
... | Parse the given visibility value.
@param string|null $visibility
@return string|null
@throws \InvalidArgumentException | [
"Parse",
"the",
"given",
"visibility",
"value",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Filesystem/FilesystemAdapter.php#L371-L385 | train |
kkthek/diqa-util | src/Util/ParserFunctions/ReadObjectCache.php | ReadObjectCache.readObjectCache | static function readObjectCache(Parser &$parser, $key = '') {
$parser->disableCache ();
$cache = \ObjectCache::getInstance(CACHE_DB);
global $wgDIQAAllowedObjectCacheKeys;
if (!isset($wgDIQAAllowedObjectCacheKeys)
|| !in_array($key, $wgDIQAAllowedObjectCacheKeys)) {
return 'not-a... | php | static function readObjectCache(Parser &$parser, $key = '') {
$parser->disableCache ();
$cache = \ObjectCache::getInstance(CACHE_DB);
global $wgDIQAAllowedObjectCacheKeys;
if (!isset($wgDIQAAllowedObjectCacheKeys)
|| !in_array($key, $wgDIQAAllowedObjectCacheKeys)) {
return 'not-a... | [
"static",
"function",
"readObjectCache",
"(",
"Parser",
"&",
"$",
"parser",
",",
"$",
"key",
"=",
"''",
")",
"{",
"$",
"parser",
"->",
"disableCache",
"(",
")",
";",
"$",
"cache",
"=",
"\\",
"ObjectCache",
"::",
"getInstance",
"(",
"CACHE_DB",
")",
";"... | Read key from ObjectCache | [
"Read",
"key",
"from",
"ObjectCache"
] | df35d16403b5dbf0f7570daded6cfa26814ae7e0 | https://github.com/kkthek/diqa-util/blob/df35d16403b5dbf0f7570daded6cfa26814ae7e0/src/Util/ParserFunctions/ReadObjectCache.php#L18-L38 | train |
covex-nn/JooS | src/JooS/Loader.php | Loader.loadClass | public static function loadClass($className)
{
if (!class_exists($className)) {
$path = self::getPath($className);
$realPath = stream_resolve_include_path($path);
if (file_exists($realPath)) {
require_once($realPath);
return class_exists($className);
}
return false... | php | public static function loadClass($className)
{
if (!class_exists($className)) {
$path = self::getPath($className);
$realPath = stream_resolve_include_path($path);
if (file_exists($realPath)) {
require_once($realPath);
return class_exists($className);
}
return false... | [
"public",
"static",
"function",
"loadClass",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"className",
")",
")",
"{",
"$",
"path",
"=",
"self",
"::",
"getPath",
"(",
"$",
"className",
")",
";",
"$",
"realPath",
"=",
"str... | Loads class.
@param string $className Class Name
@return bool | [
"Loads",
"class",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Loader.php#L21-L37 | train |
covex-nn/JooS | src/JooS/Loader.php | Loader.getPath | public static function getPath($className, $ext = "php")
{
if (substr($className, 0, 1) == "\\") {
$className = substr($className, 1);
}
$delimiters = array("_", "\\");
foreach ($delimiters as $symbol) {
$className = str_replace($symbol, "/", $className);
}
return $className .... | php | public static function getPath($className, $ext = "php")
{
if (substr($className, 0, 1) == "\\") {
$className = substr($className, 1);
}
$delimiters = array("_", "\\");
foreach ($delimiters as $symbol) {
$className = str_replace($symbol, "/", $className);
}
return $className .... | [
"public",
"static",
"function",
"getPath",
"(",
"$",
"className",
",",
"$",
"ext",
"=",
"\"php\"",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"className",
",",
"0",
",",
"1",
")",
"==",
"\"\\\\\"",
")",
"{",
"$",
"className",
"=",
"substr",
"(",
"$",... | Returns class path.
@param string $className Class Name
@param string $ext Extention
@return string | [
"Returns",
"class",
"path",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Loader.php#L47-L58 | train |
covex-nn/JooS | src/JooS/Loader.php | Loader.getClassName | public static function getClassName($prefix, $name, $ucfirst = false)
{
if (substr($prefix, -1, 1) == "\\") {
$className = $prefix;
} else {
$className = $prefix . "_";
}
$className .= $name;
if ($ucfirst) {
$result = "";
$nsPath = explode("\\", $className);
... | php | public static function getClassName($prefix, $name, $ucfirst = false)
{
if (substr($prefix, -1, 1) == "\\") {
$className = $prefix;
} else {
$className = $prefix . "_";
}
$className .= $name;
if ($ucfirst) {
$result = "";
$nsPath = explode("\\", $className);
... | [
"public",
"static",
"function",
"getClassName",
"(",
"$",
"prefix",
",",
"$",
"name",
",",
"$",
"ucfirst",
"=",
"false",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"prefix",
",",
"-",
"1",
",",
"1",
")",
"==",
"\"\\\\\"",
")",
"{",
"$",
"className",
... | Returns className.
@param string $prefix Prefix
@param string $name Name
@param bool $ucfirst First letter - caps
@return string | [
"Returns",
"className",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Loader.php#L69-L105 | train |
OxfordInfoLabs/kinikit-core | src/Util/Logging/CodeTimer.php | CodeTimer.timeFunction | public static function timeFunction($function, $description = null) {
$duration = self::time($function);
Logger::log("Code Block " . ($description ? '"' . $description . '"' : "") . " Executed in " . $duration . " Seconds");
return $duration;
} | php | public static function timeFunction($function, $description = null) {
$duration = self::time($function);
Logger::log("Code Block " . ($description ? '"' . $description . '"' : "") . " Executed in " . $duration . " Seconds");
return $duration;
} | [
"public",
"static",
"function",
"timeFunction",
"(",
"$",
"function",
",",
"$",
"description",
"=",
"null",
")",
"{",
"$",
"duration",
"=",
"self",
"::",
"time",
"(",
"$",
"function",
")",
";",
"Logger",
"::",
"log",
"(",
"\"Code Block \"",
".",
"(",
"... | Time the passed function
@param $function | [
"Time",
"the",
"passed",
"function"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Logging/CodeTimer.php#L19-L26 | train |
OxfordInfoLabs/kinikit-core | src/Util/Logging/CodeTimer.php | CodeTimer.recordFunctionTimingForGroup | public static function recordFunctionTimingForGroup($function, $group) {
$functionTiming = CodeTimer::time($function);
if (isset(CodeTimer::$groupTimings[$group])) {
CodeTimer::$groupTimings[$group] += $functionTiming;
} else {
CodeTimer::$groupTimings[$group] = $functio... | php | public static function recordFunctionTimingForGroup($function, $group) {
$functionTiming = CodeTimer::time($function);
if (isset(CodeTimer::$groupTimings[$group])) {
CodeTimer::$groupTimings[$group] += $functionTiming;
} else {
CodeTimer::$groupTimings[$group] = $functio... | [
"public",
"static",
"function",
"recordFunctionTimingForGroup",
"(",
"$",
"function",
",",
"$",
"group",
")",
"{",
"$",
"functionTiming",
"=",
"CodeTimer",
"::",
"time",
"(",
"$",
"function",
")",
";",
"if",
"(",
"isset",
"(",
"CodeTimer",
"::",
"$",
"grou... | Record the timing of a passed function against a group. All Timings for a group are added up.
@param $function
@param $group | [
"Record",
"the",
"timing",
"of",
"a",
"passed",
"function",
"against",
"a",
"group",
".",
"All",
"Timings",
"for",
"a",
"group",
"are",
"added",
"up",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Logging/CodeTimer.php#L35-L43 | train |
OxfordInfoLabs/kinikit-core | src/Util/Logging/CodeTimer.php | CodeTimer.reportTimingsForGroup | public static function reportTimingsForGroup($group) {
if (isset(CodeTimer::$groupTimings[$group])) {
Logger::log('Group "' . $group . '" Executed in ' . CodeTimer::$groupTimings[$group] . " Seconds");
return CodeTimer::$groupTimings[$group];
} else {
Logger::log('No ... | php | public static function reportTimingsForGroup($group) {
if (isset(CodeTimer::$groupTimings[$group])) {
Logger::log('Group "' . $group . '" Executed in ' . CodeTimer::$groupTimings[$group] . " Seconds");
return CodeTimer::$groupTimings[$group];
} else {
Logger::log('No ... | [
"public",
"static",
"function",
"reportTimingsForGroup",
"(",
"$",
"group",
")",
"{",
"if",
"(",
"isset",
"(",
"CodeTimer",
"::",
"$",
"groupTimings",
"[",
"$",
"group",
"]",
")",
")",
"{",
"Logger",
"::",
"log",
"(",
"'Group \"'",
".",
"$",
"group",
"... | Report timings for a group
@param $group | [
"Report",
"timings",
"for",
"a",
"group"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Logging/CodeTimer.php#L51-L59 | train |
CroudTech/laravel-repositories | src/RepositoryGenerator.php | RepositoryGenerator.makeRepository | protected function makeRepository()
{
$full_path = $this->getFullRepositoryPath();
if (file_exists($full_path)) {
throw new RepositoryExistsException(sprintf('%s file already exists', $full_path));
}
$contract_contents = str_replace(
[
'%%MODEL... | php | protected function makeRepository()
{
$full_path = $this->getFullRepositoryPath();
if (file_exists($full_path)) {
throw new RepositoryExistsException(sprintf('%s file already exists', $full_path));
}
$contract_contents = str_replace(
[
'%%MODEL... | [
"protected",
"function",
"makeRepository",
"(",
")",
"{",
"$",
"full_path",
"=",
"$",
"this",
"->",
"getFullRepositoryPath",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"full_path",
")",
")",
"{",
"throw",
"new",
"RepositoryExistsException",
"(",
"spr... | Make repository file
@method makeRepository
@return string The fully qualified contract name | [
"Make",
"repository",
"file"
] | 3146285be911728fe7b00cf27d2494ad22b773dc | https://github.com/CroudTech/laravel-repositories/blob/3146285be911728fe7b00cf27d2494ad22b773dc/src/RepositoryGenerator.php#L95-L123 | train |
CroudTech/laravel-repositories | src/RepositoryGenerator.php | RepositoryGenerator.makeContract | protected function makeContract()
{
$full_path = $this->getFullContractPath();
if (file_exists($full_path)) {
return true;
}
$contract_contents = str_replace(
[
'%%MODEL_BASENAME%%',
'%%MODEL_NAME%%',
'%%CLASS_NA... | php | protected function makeContract()
{
$full_path = $this->getFullContractPath();
if (file_exists($full_path)) {
return true;
}
$contract_contents = str_replace(
[
'%%MODEL_BASENAME%%',
'%%MODEL_NAME%%',
'%%CLASS_NA... | [
"protected",
"function",
"makeContract",
"(",
")",
"{",
"$",
"full_path",
"=",
"$",
"this",
"->",
"getFullContractPath",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"full_path",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"contract_contents",
... | Make contract file
@method makeContract
@return string The fully qualified contract name | [
"Make",
"contract",
"file"
] | 3146285be911728fe7b00cf27d2494ad22b773dc | https://github.com/CroudTech/laravel-repositories/blob/3146285be911728fe7b00cf27d2494ad22b773dc/src/RepositoryGenerator.php#L131-L156 | train |
p2made/yii2-p2y2-base | helpers/AssetsSettings.php | AssetsSettings.assetsSettings | public static function assetsSettings()
{
if(isset(self::$_assetsSettings)) {
return self::$_assetsSettings;
}
return self::getSettingsBlock(self::BLOCK_NAME);
} | php | public static function assetsSettings()
{
if(isset(self::$_assetsSettings)) {
return self::$_assetsSettings;
}
return self::getSettingsBlock(self::BLOCK_NAME);
} | [
"public",
"static",
"function",
"assetsSettings",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"_assetsSettings",
")",
")",
"{",
"return",
"self",
"::",
"$",
"_assetsSettings",
";",
"}",
"return",
"self",
"::",
"getSettingsBlock",
"(",
"self"... | Get assets settings
@return array | false
@default false | [
"Get",
"assets",
"settings"
] | face3df8794407cdc8178ed64c06cc760c449de2 | https://github.com/p2made/yii2-p2y2-base/blob/face3df8794407cdc8178ed64c06cc760c449de2/helpers/AssetsSettings.php#L62-L69 | train |
p2made/yii2-p2y2-base | helpers/AssetsSettings.php | AssetsSettings.assetsUseStatic | public static function assetsUseStatic()
{
if(isset(self::$_useStatic)) {
return self::$_useStatic;
}
return self::getSettingsItem(
self::$_useStatic,
self::assetsSettings(),
self::USE_STATIC,
self::DEFAULT_USE_STATIC
);
} | php | public static function assetsUseStatic()
{
if(isset(self::$_useStatic)) {
return self::$_useStatic;
}
return self::getSettingsItem(
self::$_useStatic,
self::assetsSettings(),
self::USE_STATIC,
self::DEFAULT_USE_STATIC
);
} | [
"public",
"static",
"function",
"assetsUseStatic",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"_useStatic",
")",
")",
"{",
"return",
"self",
"::",
"$",
"_useStatic",
";",
"}",
"return",
"self",
"::",
"getSettingsItem",
"(",
"self",
"::",
... | Get assetsUseStatic setting - use static resources
@return boolean
@default false | [
"Get",
"assetsUseStatic",
"setting",
"-",
"use",
"static",
"resources"
] | face3df8794407cdc8178ed64c06cc760c449de2 | https://github.com/p2made/yii2-p2y2-base/blob/face3df8794407cdc8178ed64c06cc760c449de2/helpers/AssetsSettings.php#L76-L88 | train |
p2made/yii2-p2y2-base | helpers/AssetsSettings.php | AssetsSettings.assetsStaticEnd | public static function assetsStaticEnd()
{
if(isset(self::$_staticEnd)) {
return self::$_staticEnd;
}
return self::getSettingsItem(
self::$_staticEnd,
self::assetsSettings(),
self::STATIC_END,
self::DEFAULT_STATIC_END
);
} | php | public static function assetsStaticEnd()
{
if(isset(self::$_staticEnd)) {
return self::$_staticEnd;
}
return self::getSettingsItem(
self::$_staticEnd,
self::assetsSettings(),
self::STATIC_END,
self::DEFAULT_STATIC_END
);
} | [
"public",
"static",
"function",
"assetsStaticEnd",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"_staticEnd",
")",
")",
"{",
"return",
"self",
"::",
"$",
"_staticEnd",
";",
"}",
"return",
"self",
"::",
"getSettingsItem",
"(",
"self",
"::",
... | Get assetsStaticEnd setting - static application end
@return array | false
@default false | [
"Get",
"assetsStaticEnd",
"setting",
"-",
"static",
"application",
"end"
] | face3df8794407cdc8178ed64c06cc760c449de2 | https://github.com/p2made/yii2-p2y2-base/blob/face3df8794407cdc8178ed64c06cc760c449de2/helpers/AssetsSettings.php#L95-L107 | train |
InnovaLangues/LexiconBundle | Entity/Lemma.php | Lemma.setCategory | public function setCategory(\Innova\LexiconBundle\Entity\Category $category = null)
{
$this->category = $category;
return $this;
} | php | public function setCategory(\Innova\LexiconBundle\Entity\Category $category = null)
{
$this->category = $category;
return $this;
} | [
"public",
"function",
"setCategory",
"(",
"\\",
"Innova",
"\\",
"LexiconBundle",
"\\",
"Entity",
"\\",
"Category",
"$",
"category",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"category",
"=",
"$",
"category",
";",
"return",
"$",
"this",
";",
"}"
] | Set category.
@param \Innova\LexiconBundle\Entity\Category $category
@return Lemma | [
"Set",
"category",
"."
] | 38684b8a6c9f4636c7eb4d97f793844c2f703cb7 | https://github.com/InnovaLangues/LexiconBundle/blob/38684b8a6c9f4636c7eb4d97f793844c2f703cb7/Entity/Lemma.php#L185-L190 | train |
InnovaLangues/LexiconBundle | Entity/Lemma.php | Lemma.setSubcategory | public function setSubcategory(\Innova\LexiconBundle\Entity\Subcategory $subcategory = null)
{
$this->subcategory = $subcategory;
return $this;
} | php | public function setSubcategory(\Innova\LexiconBundle\Entity\Subcategory $subcategory = null)
{
$this->subcategory = $subcategory;
return $this;
} | [
"public",
"function",
"setSubcategory",
"(",
"\\",
"Innova",
"\\",
"LexiconBundle",
"\\",
"Entity",
"\\",
"Subcategory",
"$",
"subcategory",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"subcategory",
"=",
"$",
"subcategory",
";",
"return",
"$",
"this",
";",
... | Set subcategory.
@param \Innova\LexiconBundle\Entity\Subcategory $subcategory
@return Lemma | [
"Set",
"subcategory",
"."
] | 38684b8a6c9f4636c7eb4d97f793844c2f703cb7 | https://github.com/InnovaLangues/LexiconBundle/blob/38684b8a6c9f4636c7eb4d97f793844c2f703cb7/Entity/Lemma.php#L209-L214 | train |
wearenolte/wp-acf | src/Acf/Transforms/PostObject.php | PostObject.transform_sub_post_fields | public static function transform_sub_post_fields( &$field ) {
if ( is_array( $field['value'] ) ) {
$data = [];
foreach ( $field['value'] as $post_id ) {
$data[] = Acf::get_post_field( $post_id );
}
$field['value'] = $data;
} else {
$field['value'] = Acf::get_post_field( $field['value'] );
}
} | php | public static function transform_sub_post_fields( &$field ) {
if ( is_array( $field['value'] ) ) {
$data = [];
foreach ( $field['value'] as $post_id ) {
$data[] = Acf::get_post_field( $post_id );
}
$field['value'] = $data;
} else {
$field['value'] = Acf::get_post_field( $field['value'] );
}
} | [
"public",
"static",
"function",
"transform_sub_post_fields",
"(",
"&",
"$",
"field",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"field",
"[",
"'value'",
"]",
")",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"field",
"[",
"'value'"... | Transform to get the WP and ACF fields of the sub post.
@param array $field The field.
@return array | [
"Transform",
"to",
"get",
"the",
"WP",
"and",
"ACF",
"fields",
"of",
"the",
"sub",
"post",
"."
] | 2f5093438d637fa0eca42ad6d10f6b433ec078b2 | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf/Transforms/PostObject.php#L31-L41 | train |
koolkode/k2 | src/Kernel/Kernel.php | Kernel.createContainer | protected function createContainer(ContainerModuleLoader $loader, ScopeLoader $scopes)
{
$contextCachePath = $this->cacheDirectory . DIRECTORY_SEPARATOR . $this->contextName;
$cacheFile = $contextCachePath . DIRECTORY_SEPARATOR . 'container.php';
$containerTypeName = __NAMESPACE__ . '\\CompiledContainer';
$... | php | protected function createContainer(ContainerModuleLoader $loader, ScopeLoader $scopes)
{
$contextCachePath = $this->cacheDirectory . DIRECTORY_SEPARATOR . $this->contextName;
$cacheFile = $contextCachePath . DIRECTORY_SEPARATOR . 'container.php';
$containerTypeName = __NAMESPACE__ . '\\CompiledContainer';
$... | [
"protected",
"function",
"createContainer",
"(",
"ContainerModuleLoader",
"$",
"loader",
",",
"ScopeLoader",
"$",
"scopes",
")",
"{",
"$",
"contextCachePath",
"=",
"$",
"this",
"->",
"cacheDirectory",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
"->",
"contextNam... | Create the DI container instance.
@param ScopeLoader $scopes
@return ContainerInterface | [
"Create",
"the",
"DI",
"container",
"instance",
"."
] | c425a1bc7d2f8c567b1b0cc724ca9e8be7087397 | https://github.com/koolkode/k2/blob/c425a1bc7d2f8c567b1b0cc724ca9e8be7087397/src/Kernel/Kernel.php#L486-L538 | train |
koolkode/k2 | src/Kernel/Kernel.php | Kernel.createContainerBuilder | protected function createContainerBuilder()
{
$builder = new ContainerBuilder();
foreach($this->getContainerParams() as $k => $v)
{
$builder->setParameter($k, $v);
}
return $builder;
} | php | protected function createContainerBuilder()
{
$builder = new ContainerBuilder();
foreach($this->getContainerParams() as $k => $v)
{
$builder->setParameter($k, $v);
}
return $builder;
} | [
"protected",
"function",
"createContainerBuilder",
"(",
")",
"{",
"$",
"builder",
"=",
"new",
"ContainerBuilder",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getContainerParams",
"(",
")",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"builder",
... | Create the DI container builder instance.
@return ContainerBuilder | [
"Create",
"the",
"DI",
"container",
"builder",
"instance",
"."
] | c425a1bc7d2f8c567b1b0cc724ca9e8be7087397 | https://github.com/koolkode/k2/blob/c425a1bc7d2f8c567b1b0cc724ca9e8be7087397/src/Kernel/Kernel.php#L545-L555 | train |
koolkode/k2 | src/Kernel/Kernel.php | Kernel.setupInstrumentationProcessor | protected function setupInstrumentationProcessor()
{
$file = $this->cacheDirectory . '/' . $this->contextName . '/instrument.php';
if(is_file($file))
{
$this->instrumentationProcessor = new InstrumentationProcessor($this, require $file);
$this->instrumentationProcessor->registertAutoload();
}
} | php | protected function setupInstrumentationProcessor()
{
$file = $this->cacheDirectory . '/' . $this->contextName . '/instrument.php';
if(is_file($file))
{
$this->instrumentationProcessor = new InstrumentationProcessor($this, require $file);
$this->instrumentationProcessor->registertAutoload();
}
} | [
"protected",
"function",
"setupInstrumentationProcessor",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"cacheDirectory",
".",
"'/'",
".",
"$",
"this",
"->",
"contextName",
".",
"'/instrument.php'",
";",
"if",
"(",
"is_file",
"(",
"$",
"file",
")",
"... | Setup an instrumentation processor that hooks into the autoloader. | [
"Setup",
"an",
"instrumentation",
"processor",
"that",
"hooks",
"into",
"the",
"autoloader",
"."
] | c425a1bc7d2f8c567b1b0cc724ca9e8be7087397 | https://github.com/koolkode/k2/blob/c425a1bc7d2f8c567b1b0cc724ca9e8be7087397/src/Kernel/Kernel.php#L560-L569 | train |
koolkode/k2 | src/Kernel/Kernel.php | Kernel.bindInitialInstances | protected function bindInitialInstances(ContainerInterface $container)
{
foreach($this->komponents as $komponent)
{
$container->bindInstance(get_class($komponent), $komponent);
}
} | php | protected function bindInitialInstances(ContainerInterface $container)
{
foreach($this->komponents as $komponent)
{
$container->bindInstance(get_class($komponent), $komponent);
}
} | [
"protected",
"function",
"bindInitialInstances",
"(",
"ContainerInterface",
"$",
"container",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"komponents",
"as",
"$",
"komponent",
")",
"{",
"$",
"container",
"->",
"bindInstance",
"(",
"get_class",
"(",
"$",
"komp... | Bind initial object instances to the DI container. | [
"Bind",
"initial",
"object",
"instances",
"to",
"the",
"DI",
"container",
"."
] | c425a1bc7d2f8c567b1b0cc724ca9e8be7087397 | https://github.com/koolkode/k2/blob/c425a1bc7d2f8c567b1b0cc724ca9e8be7087397/src/Kernel/Kernel.php#L574-L580 | train |
ARCANESOFT/Backups | src/Services/BackupStatuses.php | BackupStatuses.runBackups | public static function runBackups($disk = null)
{
try {
$backupJob = BackupJobFactory::createFromArray(config('laravel-backup'));
if ( ! is_null($disk)) {
$backupJob->onlyBackupTo($disk);
}
$backupJob->run();
}
catch (\Excepti... | php | public static function runBackups($disk = null)
{
try {
$backupJob = BackupJobFactory::createFromArray(config('laravel-backup'));
if ( ! is_null($disk)) {
$backupJob->onlyBackupTo($disk);
}
$backupJob->run();
}
catch (\Excepti... | [
"public",
"static",
"function",
"runBackups",
"(",
"$",
"disk",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"backupJob",
"=",
"BackupJobFactory",
"::",
"createFromArray",
"(",
"config",
"(",
"'laravel-backup'",
")",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
... | Run the backups.
@param string|null $disk
@return bool | [
"Run",
"the",
"backups",
"."
] | e191f0ccf55c7684173b82b7244fce9c0803bfe0 | https://github.com/ARCANESOFT/Backups/blob/e191f0ccf55c7684173b82b7244fce9c0803bfe0/src/Services/BackupStatuses.php#L50-L66 | train |
ARCANESOFT/Backups | src/Services/BackupStatuses.php | BackupStatuses.clearBackups | public static function clearBackups()
{
try {
$config = config('laravel-backup');
$backupDestinations = BackupDestinationFactory::createFromArray($config['backup']);
$strategy = app($config['cleanup']['strategy']);
$disableNotification = false; // TODO: Cre... | php | public static function clearBackups()
{
try {
$config = config('laravel-backup');
$backupDestinations = BackupDestinationFactory::createFromArray($config['backup']);
$strategy = app($config['cleanup']['strategy']);
$disableNotification = false; // TODO: Cre... | [
"public",
"static",
"function",
"clearBackups",
"(",
")",
"{",
"try",
"{",
"$",
"config",
"=",
"config",
"(",
"'laravel-backup'",
")",
";",
"$",
"backupDestinations",
"=",
"BackupDestinationFactory",
"::",
"createFromArray",
"(",
"$",
"config",
"[",
"'backup'",
... | Clean the backups.
@return bool | [
"Clean",
"the",
"backups",
"."
] | e191f0ccf55c7684173b82b7244fce9c0803bfe0 | https://github.com/ARCANESOFT/Backups/blob/e191f0ccf55c7684173b82b7244fce9c0803bfe0/src/Services/BackupStatuses.php#L73-L91 | train |
itkg/core | src/Itkg/Core/Cache/Adapter/Chain/UseAllStrategy.php | UseAllStrategy.get | public function get(array $adapters, CacheableInterface $item)
{
foreach ($adapters as $adapter) {
if (false !== $value = $adapter->get($item)) {
return $value;
}
}
return false;
} | php | public function get(array $adapters, CacheableInterface $item)
{
foreach ($adapters as $adapter) {
if (false !== $value = $adapter->get($item)) {
return $value;
}
}
return false;
} | [
"public",
"function",
"get",
"(",
"array",
"$",
"adapters",
",",
"CacheableInterface",
"$",
"item",
")",
"{",
"foreach",
"(",
"$",
"adapters",
"as",
"$",
"adapter",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"value",
"=",
"$",
"adapter",
"->",
"get",
... | Get cache from any adapter if contains
@param array $adapters
@param CacheableInterface $item
@throws UnhandledCacheException
@return mixed | [
"Get",
"cache",
"from",
"any",
"adapter",
"if",
"contains"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Cache/Adapter/Chain/UseAllStrategy.php#L37-L47 | train |
itkg/core | src/Itkg/Core/Cache/Adapter/Chain/UseAllStrategy.php | UseAllStrategy.set | public function set(array $adapters, CacheableInterface $item)
{
foreach ($adapters as $adapter) {
$adapter->set($item);
}
} | php | public function set(array $adapters, CacheableInterface $item)
{
foreach ($adapters as $adapter) {
$adapter->set($item);
}
} | [
"public",
"function",
"set",
"(",
"array",
"$",
"adapters",
",",
"CacheableInterface",
"$",
"item",
")",
"{",
"foreach",
"(",
"$",
"adapters",
"as",
"$",
"adapter",
")",
"{",
"$",
"adapter",
"->",
"set",
"(",
"$",
"item",
")",
";",
"}",
"}"
] | Set cache to all adapters
@param array $adapters
@param CacheableInterface $item
@throws UnhandledCacheException
@return void | [
"Set",
"cache",
"to",
"all",
"adapters"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Cache/Adapter/Chain/UseAllStrategy.php#L57-L62 | train |
modulusphp/http | Middleware/MustNotExceedAllowedRequests.php | MustNotExceedAllowedRequests.autoAssign | private function autoAssign($attributes = null)
{
if (!is_array($attributes)) return false;
$this->max = isset($attributes[0]) ? $attributes[0] : $this->max;
$this->minutes = isset($attributes[1]) ? $attributes[1] : 1;
$this->decay = isset($attributes[1]) ? strtotime($attributes[1] . ' minutes'... | php | private function autoAssign($attributes = null)
{
if (!is_array($attributes)) return false;
$this->max = isset($attributes[0]) ? $attributes[0] : $this->max;
$this->minutes = isset($attributes[1]) ? $attributes[1] : 1;
$this->decay = isset($attributes[1]) ? strtotime($attributes[1] . ' minutes'... | [
"private",
"function",
"autoAssign",
"(",
"$",
"attributes",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"attributes",
")",
")",
"return",
"false",
";",
"$",
"this",
"->",
"max",
"=",
"isset",
"(",
"$",
"attributes",
"[",
"0",
"]",
... | Set request attributes
@param array|mixed|null $attributes
@return void | [
"Set",
"request",
"attributes"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Middleware/MustNotExceedAllowedRequests.php#L98-L107 | train |
modulusphp/http | Middleware/MustNotExceedAllowedRequests.php | MustNotExceedAllowedRequests.canProceed | private function canProceed($request) : bool
{
$time = $this->decay - date('s');
if ($request->cookies->has('clusters')) {
$value = $request->cookie('clusters');
$value = $this->hashids->decode($value)[0] - 1;
if ($value == 0) {
$this->withHeaders($request, $value, $time);
... | php | private function canProceed($request) : bool
{
$time = $this->decay - date('s');
if ($request->cookies->has('clusters')) {
$value = $request->cookie('clusters');
$value = $this->hashids->decode($value)[0] - 1;
if ($value == 0) {
$this->withHeaders($request, $value, $time);
... | [
"private",
"function",
"canProceed",
"(",
"$",
"request",
")",
":",
"bool",
"{",
"$",
"time",
"=",
"$",
"this",
"->",
"decay",
"-",
"date",
"(",
"'s'",
")",
";",
"if",
"(",
"$",
"request",
"->",
"cookies",
"->",
"has",
"(",
"'clusters'",
")",
")",
... | Check if request can proceed
@param \Modulus\Http\Request $request
@return bool | [
"Check",
"if",
"request",
"can",
"proceed"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Middleware/MustNotExceedAllowedRequests.php#L115-L140 | train |
RichardTrujilloTorres/validators | src/Validators/Traits/ArrayTrait.php | ArrayTrait.inArray | public function inArray($values, $args, $do, $strict = false)
{
if (!is_callable($do)) {
throw new \InvalidArgumentException('Third argument must be a callable');
}
foreach ($values as $single) {
$result = $do($single, $args);
if ($strict && !$result) {
... | php | public function inArray($values, $args, $do, $strict = false)
{
if (!is_callable($do)) {
throw new \InvalidArgumentException('Third argument must be a callable');
}
foreach ($values as $single) {
$result = $do($single, $args);
if ($strict && !$result) {
... | [
"public",
"function",
"inArray",
"(",
"$",
"values",
",",
"$",
"args",
",",
"$",
"do",
",",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"do",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
... | Performs an operation in a given array.
It stops if 'strict' is set to true and the result of the operation is false.
@param array $values The array
@param mixed $args The arguments to pass to the operation
@param callable $do The operation
@return bool | [
"Performs",
"an",
"operation",
"in",
"a",
"given",
"array",
".",
"It",
"stops",
"if",
"strict",
"is",
"set",
"to",
"true",
"and",
"the",
"result",
"of",
"the",
"operation",
"is",
"false",
"."
] | e29ff479d816c3f8a931bfbefedd0642dc50ea91 | https://github.com/RichardTrujilloTorres/validators/blob/e29ff479d816c3f8a931bfbefedd0642dc50ea91/src/Validators/Traits/ArrayTrait.php#L24-L38 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Loader/Bridge/Form/Type/EntityCollectionType.php | EntityCollectionType.registerLoader | public function registerLoader($alias, $loader)
{
if ($this->hasLoader($alias)) {
throw new \RuntimeException(sprintf('Alias "%s" already used by another form loader', $alias));
}
$this->loaders[$alias] = $loader;
} | php | public function registerLoader($alias, $loader)
{
if ($this->hasLoader($alias)) {
throw new \RuntimeException(sprintf('Alias "%s" already used by another form loader', $alias));
}
$this->loaders[$alias] = $loader;
} | [
"public",
"function",
"registerLoader",
"(",
"$",
"alias",
",",
"$",
"loader",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasLoader",
"(",
"$",
"alias",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'Alias \"%s\" already used... | Register a loader.
@param $alias
@param $loader | [
"Register",
"a",
"loader",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Loader/Bridge/Form/Type/EntityCollectionType.php#L94-L101 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Loader/Bridge/Form/Type/EntityCollectionType.php | EntityCollectionType.getLoader | private function getLoader($alias)
{
if (!$this->hasLoader($alias)) {
throw new \RuntimeException(sprintf('Form loader with alias "%s" not found.', $alias));
}
return $this->loaders[$alias];
} | php | private function getLoader($alias)
{
if (!$this->hasLoader($alias)) {
throw new \RuntimeException(sprintf('Form loader with alias "%s" not found.', $alias));
}
return $this->loaders[$alias];
} | [
"private",
"function",
"getLoader",
"(",
"$",
"alias",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasLoader",
"(",
"$",
"alias",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'Form loader with alias \"%s\" not found.'",
",... | Get a loader by his alias.
@param $alias
@return mixed | [
"Get",
"a",
"loader",
"by",
"his",
"alias",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Loader/Bridge/Form/Type/EntityCollectionType.php#L122-L129 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Map/C2MTableMap.php | C2MTableMap.doInsert | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(C2MTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for ... | php | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(C2MTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for ... | [
"public",
"static",
"function",
"doInsert",
"(",
"$",
"criteria",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"ge... | Performs an INSERT on the database, given a C2M or Criteria object.
@param mixed $criteria Criteria or C2M object containing data that is used to create the INSERT statement.
@param ConnectionInterface $con the ConnectionInterface connection to use
@return mixed The new primary key.
@throws Pro... | [
"Performs",
"an",
"INSERT",
"on",
"the",
"database",
"given",
"a",
"C2M",
"or",
"Criteria",
"object",
"."
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Map/C2MTableMap.php#L464-L485 | train |
asaokamei/ScoreSql | src/Paginate/Pager.php | Pager.loadQuery | protected function loadQuery()
{
if( !isset( $this->session[ $this->saveID ] ) ) {
return;
}
$saved = $this->session[ $this->saveID ];
$this->inputs = array_merge( $saved[ 'inputs' ], $this->inputs );
$this->perPage = $saved[ 'perPage' ];
if( $currP... | php | protected function loadQuery()
{
if( !isset( $this->session[ $this->saveID ] ) ) {
return;
}
$saved = $this->session[ $this->saveID ];
$this->inputs = array_merge( $saved[ 'inputs' ], $this->inputs );
$this->perPage = $saved[ 'perPage' ];
if( $currP... | [
"protected",
"function",
"loadQuery",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"session",
"[",
"$",
"this",
"->",
"saveID",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"saved",
"=",
"$",
"this",
"->",
"session",
"[",
"$",
... | loads query information from saved session. | [
"loads",
"query",
"information",
"from",
"saved",
"session",
"."
] | f1fce28476629e98b3c4c1216859c7f5309de7a1 | https://github.com/asaokamei/ScoreSql/blob/f1fce28476629e98b3c4c1216859c7f5309de7a1/src/Paginate/Pager.php#L111-L124 | train |
asaokamei/ScoreSql | src/Paginate/Pager.php | Pager.saveQuery | protected function saveQuery()
{
$this->session[ $this->saveID ] = [
'perPage' => $this->perPage,
'currPage' => $this->currPage,
'inputs' => $this->inputs,
];
} | php | protected function saveQuery()
{
$this->session[ $this->saveID ] = [
'perPage' => $this->perPage,
'currPage' => $this->currPage,
'inputs' => $this->inputs,
];
} | [
"protected",
"function",
"saveQuery",
"(",
")",
"{",
"$",
"this",
"->",
"session",
"[",
"$",
"this",
"->",
"saveID",
"]",
"=",
"[",
"'perPage'",
"=>",
"$",
"this",
"->",
"perPage",
",",
"'currPage'",
"=>",
"$",
"this",
"->",
"currPage",
",",
"'inputs'"... | saves query information into session. | [
"saves",
"query",
"information",
"into",
"session",
"."
] | f1fce28476629e98b3c4c1216859c7f5309de7a1 | https://github.com/asaokamei/ScoreSql/blob/f1fce28476629e98b3c4c1216859c7f5309de7a1/src/Paginate/Pager.php#L129-L136 | train |
sndsgd/form | src/form/field/ValueField.php | ValueField.setDefaultValue | public function setDefaultValue($defaultValue): FieldInterface
{
if (!is_scalar($defaultValue) && !is_null($defaultValue)) {
throw new \InvalidArgumentException(
"invalid value provided for 'defaultValue'; ".
"expecting either a scalar or null value"
)... | php | public function setDefaultValue($defaultValue): FieldInterface
{
if (!is_scalar($defaultValue) && !is_null($defaultValue)) {
throw new \InvalidArgumentException(
"invalid value provided for 'defaultValue'; ".
"expecting either a scalar or null value"
)... | [
"public",
"function",
"setDefaultValue",
"(",
"$",
"defaultValue",
")",
":",
"FieldInterface",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"defaultValue",
")",
"&&",
"!",
"is_null",
"(",
"$",
"defaultValue",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArg... | Set the default value for the field
@param mixed $defaultValue A scalar value
@return \sndsgd\form\field\ValueField
@throws \InvalidArgumentException | [
"Set",
"the",
"default",
"value",
"for",
"the",
"field"
] | 56b5b9572a8942aea34c97c7c838b871e198e34f | https://github.com/sndsgd/form/blob/56b5b9572a8942aea34c97c7c838b871e198e34f/src/form/field/ValueField.php#L38-L48 | train |
maddoger/yii2-cms-user | backend/controllers/UserController.php | UserController.actionProfile | public function actionProfile()
{
/** @var User $user */
$user = Yii::$app->getUser()->getIdentity();
$model = new MultiModel([
'models' => [
'user' => $user,
'profile' => $user->profile,
],
]);
if ($model->load(Yii::$a... | php | public function actionProfile()
{
/** @var User $user */
$user = Yii::$app->getUser()->getIdentity();
$model = new MultiModel([
'models' => [
'user' => $user,
'profile' => $user->profile,
],
]);
if ($model->load(Yii::$a... | [
"public",
"function",
"actionProfile",
"(",
")",
"{",
"/** @var User $user */",
"$",
"user",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getUser",
"(",
")",
"->",
"getIdentity",
"(",
")",
";",
"$",
"model",
"=",
"new",
"MultiModel",
"(",
"[",
"'models'",
"=>",
... | Updates own profile.
If update is successful, the browser will be redirected to the 'view' page.
@return mixed | [
"Updates",
"own",
"profile",
".",
"If",
"update",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] | 6792d1d0d2c0bf01fe87729985b5659de4c1aac1 | https://github.com/maddoger/yii2-cms-user/blob/6792d1d0d2c0bf01fe87729985b5659de4c1aac1/backend/controllers/UserController.php#L179-L198 | train |
gplcart/cli | controllers/commands/ProductClass.php | ProductClass.cmdGetProductClass | public function cmdGetProductClass()
{
$result = $this->getListProductClass();
$this->outputFormat($result);
$this->outputFormatTableProductClass($result);
$this->output();
} | php | public function cmdGetProductClass()
{
$result = $this->getListProductClass();
$this->outputFormat($result);
$this->outputFormatTableProductClass($result);
$this->output();
} | [
"public",
"function",
"cmdGetProductClass",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListProductClass",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableProductClass",
"(",
... | Callback for "product-class-get" command | [
"Callback",
"for",
"product",
"-",
"class",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/ProductClass.php#L40-L46 | train |
gplcart/cli | controllers/commands/ProductClass.php | ProductClass.cmdDeleteProductClass | public function cmdDeleteProductClass()
{
$id = $this->getParam(0);
$result = null;
if (isset($id)) {
if (empty($id) || !is_numeric($id)) {
$this->errorAndExit($this->text('Invalid argument'));
}
$result = $this->product_class->delete($... | php | public function cmdDeleteProductClass()
{
$id = $this->getParam(0);
$result = null;
if (isset($id)) {
if (empty($id) || !is_numeric($id)) {
$this->errorAndExit($this->text('Invalid argument'));
}
$result = $this->product_class->delete($... | [
"public",
"function",
"cmdDeleteProductClass",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"id",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"... | Callback for "product-class-delete" command | [
"Callback",
"for",
"product",
"-",
"class",
"-",
"delete",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/ProductClass.php#L51-L84 | train |
gplcart/cli | controllers/commands/ProductClass.php | ProductClass.cmdUpdateProductClass | public function cmdUpdateProductClass()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | php | public function cmdUpdateProductClass()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | [
"public",
"function",
"cmdUpdateProductClass",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{"... | Callback for "product-class-update" command | [
"Callback",
"for",
"product",
"-",
"class",
"-",
"update",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/ProductClass.php#L103-L121 | train |
gplcart/cli | controllers/commands/ProductClass.php | ProductClass.addProductClass | protected function addProductClass()
{
if (!$this->isError()) {
$id = $this->product_class->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | php | protected function addProductClass()
{
if (!$this->isError()) {
$id = $this->product_class->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | [
"protected",
"function",
"addProductClass",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"product_class",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
";"... | Add a new product class | [
"Add",
"a",
"new",
"product",
"class"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/ProductClass.php#L176-L185 | train |
gplcart/cli | controllers/commands/ProductClass.php | ProductClass.submitAddProductClass | protected function submitAddProductClass()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('product_class');
$this->addProductClass();
} | php | protected function submitAddProductClass()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('product_class');
$this->addProductClass();
} | [
"protected",
"function",
"submitAddProductClass",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"validateComponent",
"(",
"'product_class'",
")",
";",
"$",
"this",
... | Add a new product class at once | [
"Add",
"a",
"new",
"product",
"class",
"at",
"once"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/ProductClass.php#L201-L206 | train |
gplcart/cli | controllers/commands/ProductClass.php | ProductClass.wizardAddProductClass | protected function wizardAddProductClass()
{
$this->validatePrompt('title', $this->text('Title'), 'product_class');
$this->validatePrompt('status', $this->text('Status'), 'product_class', 0);
$this->validateComponent('product_class');
$this->addProductClass();
} | php | protected function wizardAddProductClass()
{
$this->validatePrompt('title', $this->text('Title'), 'product_class');
$this->validatePrompt('status', $this->text('Status'), 'product_class', 0);
$this->validateComponent('product_class');
$this->addProductClass();
} | [
"protected",
"function",
"wizardAddProductClass",
"(",
")",
"{",
"$",
"this",
"->",
"validatePrompt",
"(",
"'title'",
",",
"$",
"this",
"->",
"text",
"(",
"'Title'",
")",
",",
"'product_class'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
"(",
"'status'",... | Add a new product class step by step | [
"Add",
"a",
"new",
"product",
"class",
"step",
"by",
"step"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/ProductClass.php#L211-L217 | train |
manialib/manialink | src/Manialib/Manialink/Utils.php | Utils.getAlignedPos | final public static function getAlignedPos(Base $object, $newHalign, $newValign)
{
$newPosX = self::getAlignedPosX(
$object->getPosnX(), $object->getRealSizeX(), $object->getHalign(), $newHalign);
$newPosY = self::getAlignedPosY(
$object->getPosnY(), $object->getRealS... | php | final public static function getAlignedPos(Base $object, $newHalign, $newValign)
{
$newPosX = self::getAlignedPosX(
$object->getPosnX(), $object->getRealSizeX(), $object->getHalign(), $newHalign);
$newPosY = self::getAlignedPosY(
$object->getPosnY(), $object->getRealS... | [
"final",
"public",
"static",
"function",
"getAlignedPos",
"(",
"Base",
"$",
"object",
",",
"$",
"newHalign",
",",
"$",
"newValign",
")",
"{",
"$",
"newPosX",
"=",
"self",
"::",
"getAlignedPosX",
"(",
"$",
"object",
"->",
"getPosnX",
"(",
")",
",",
"$",
... | Returns the position of an element in relation to another element and
according to their respective alignments
@param Base Parent element
@param string Horizontal alignement of the element you want to place
@param string Vertical alignement of the element you want to place
@return array Calculated position of the elem... | [
"Returns",
"the",
"position",
"of",
"an",
"element",
"in",
"relation",
"to",
"another",
"element",
"and",
"according",
"to",
"their",
"respective",
"alignments"
] | a24c7979b3aa6b470556e95ba60a76a994bf506c | https://github.com/manialib/manialink/blob/a24c7979b3aa6b470556e95ba60a76a994bf506c/src/Manialib/Manialink/Utils.php#L104-L111 | train |
ekyna/Resource | Search/Elastica/ResourceRepository.php | ResourceRepository.createMatchQuery | protected function createMatchQuery($expression, array $fields = [])
{
if (0 == strlen($expression)) {
return new Query\MatchAll();
}
if (empty($fields)) {
$fields = $this->getDefaultMatchFields();
}
$query = new Query\MultiMatch();
$query
... | php | protected function createMatchQuery($expression, array $fields = [])
{
if (0 == strlen($expression)) {
return new Query\MatchAll();
}
if (empty($fields)) {
$fields = $this->getDefaultMatchFields();
}
$query = new Query\MultiMatch();
$query
... | [
"protected",
"function",
"createMatchQuery",
"(",
"$",
"expression",
",",
"array",
"$",
"fields",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"0",
"==",
"strlen",
"(",
"$",
"expression",
")",
")",
"{",
"return",
"new",
"Query",
"\\",
"MatchAll",
"(",
")",
";... | Creates the match query.
@param string $expression
@param array $fields
@return Query\AbstractQuery | [
"Creates",
"the",
"match",
"query",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Search/Elastica/ResourceRepository.php#L37-L53 | train |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/ImageSizeReducer.php | ImageSizeReducer.writeXML | public function writeXML( \XMLWriter $w, string $elementName = 'ImageSizeReducer' )
{
$w->startElement( $elementName );
$this->writeXMLAttributes( $w );
$w->endElement();
} | php | public function writeXML( \XMLWriter $w, string $elementName = 'ImageSizeReducer' )
{
$w->startElement( $elementName );
$this->writeXMLAttributes( $w );
$w->endElement();
} | [
"public",
"function",
"writeXML",
"(",
"\\",
"XMLWriter",
"$",
"w",
",",
"string",
"$",
"elementName",
"=",
"'ImageSizeReducer'",
")",
"{",
"$",
"w",
"->",
"startElement",
"(",
"$",
"elementName",
")",
";",
"$",
"this",
"->",
"writeXMLAttributes",
"(",
"$"... | Writes all instance options to an XML element.
@param \XMLWriter $w
@param string $elementName | [
"Writes",
"all",
"instance",
"options",
"to",
"an",
"XML",
"element",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/ImageSizeReducer.php#L171-L178 | train |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/ImageSizeReducer.php | ImageSizeReducer.writeXMLAttributes | public function writeXMLAttributes( \XMLWriter $w )
{
switch ( $this->data[ 'type' ] )
{
case ImageSizeReducerType::CROP:
$w->writeAttribute( 'type', 'crop' );
$w->writeAttribute( 'width', $this->data[ 'width' ] );
$w->writeAttribute( 'height', $this->dat... | php | public function writeXMLAttributes( \XMLWriter $w )
{
switch ( $this->data[ 'type' ] )
{
case ImageSizeReducerType::CROP:
$w->writeAttribute( 'type', 'crop' );
$w->writeAttribute( 'width', $this->data[ 'width' ] );
$w->writeAttribute( 'height', $this->dat... | [
"public",
"function",
"writeXMLAttributes",
"(",
"\\",
"XMLWriter",
"$",
"w",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"data",
"[",
"'type'",
"]",
")",
"{",
"case",
"ImageSizeReducerType",
"::",
"CROP",
":",
"$",
"w",
"->",
"writeAttribute",
"(",
"'ty... | Writes all instance options to XML attributes inside the opened XML element.
@param \XMLWriter $w | [
"Writes",
"all",
"instance",
"options",
"to",
"XML",
"attributes",
"inside",
"the",
"opened",
"XML",
"element",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/ImageSizeReducer.php#L185-L219 | train |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/ImageSizeReducer.php | ImageSizeReducer.Create | protected static function Create(
int $type, int $width, int $height, int $gravity = Gravity::MIDDLE_CENTER,
int $portraitLength = 0, int $landscapeLength = 0 )
: ImageSizeReducer
{
switch ( $type )
{
case ImageSizeReducerType::CROP:
if ( $width < 1 )
... | php | protected static function Create(
int $type, int $width, int $height, int $gravity = Gravity::MIDDLE_CENTER,
int $portraitLength = 0, int $landscapeLength = 0 )
: ImageSizeReducer
{
switch ( $type )
{
case ImageSizeReducerType::CROP:
if ( $width < 1 )
... | [
"protected",
"static",
"function",
"Create",
"(",
"int",
"$",
"type",
",",
"int",
"$",
"width",
",",
"int",
"$",
"height",
",",
"int",
"$",
"gravity",
"=",
"Gravity",
"::",
"MIDDLE_CENTER",
",",
"int",
"$",
"portraitLength",
"=",
"0",
",",
"int",
"$",
... | Init an Image size reducer.
@param int $type The the image size reducer type
@param int $width The width of the required resulting image
@param int $height The height of the required resulting image
@param int $gravity The gravity of the cropped image part
@param int $portraitLength
@param int $landscapeLengt... | [
"Init",
"an",
"Image",
"size",
"reducer",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/ImageSizeReducer.php#L636-L708 | train |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/ImageSizeReducer.php | ImageSizeReducer.TryParse | public static function TryParse( $value, &$refReducer = null ) : bool
{
if ( \is_null( $value ) )
{
return false;
}
if ( $value instanceof \SimpleXMLElement )
{
return static::TryParseXmlElement( $value, $refReducer );
}
if ( \is_string( $value ) && ! ... | php | public static function TryParse( $value, &$refReducer = null ) : bool
{
if ( \is_null( $value ) )
{
return false;
}
if ( $value instanceof \SimpleXMLElement )
{
return static::TryParseXmlElement( $value, $refReducer );
}
if ( \is_string( $value ) && ! ... | [
"public",
"static",
"function",
"TryParse",
"(",
"$",
"value",
",",
"&",
"$",
"refReducer",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"\\",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"value",
"i... | Tries to parse the defined value to an ImageSizeReducer instance
@param \SimpleXMLElement|array|string $value
@param \Beluga\Drawing\Image\ImageSizeReducer $refReducer Returns the resulting reducer instance
if the method return TRUE
@return bool | [
"Tries",
"to",
"parse",
"the",
"defined",
"value",
"to",
"an",
"ImageSizeReducer",
"instance"
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/ImageSizeReducer.php#L811-L888 | train |
SlabPHP/database | src/Models/MySQL/Join.php | Join.resolve | public function resolve($databaseResult)
{
$className = $this->className;
try {
$object = new $className();
$this->loader
->mapObjectWithOptions($object, $databaseResult);
$databaseResult->{$this->fieldName} = $object;
} catch (\Exceptio... | php | public function resolve($databaseResult)
{
$className = $this->className;
try {
$object = new $className();
$this->loader
->mapObjectWithOptions($object, $databaseResult);
$databaseResult->{$this->fieldName} = $object;
} catch (\Exceptio... | [
"public",
"function",
"resolve",
"(",
"$",
"databaseResult",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"className",
";",
"try",
"{",
"$",
"object",
"=",
"new",
"$",
"className",
"(",
")",
";",
"$",
"this",
"->",
"loader",
"->",
"mapObjectWith... | Resolve data by splicing in the completed object
@param $databaseResult | [
"Resolve",
"data",
"by",
"splicing",
"in",
"the",
"completed",
"object"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Join.php#L70-L85 | train |
SlabPHP/database | src/Models/MySQL/Join.php | Join.joinOn | public function joinOn($foreignKeyColumn)
{
return 'join ' . $this->getTable() . ' on ' . $this->loader->getPrimaryKey($this->alias) . ' = ' . $foreignKeyColumn . ' ';
} | php | public function joinOn($foreignKeyColumn)
{
return 'join ' . $this->getTable() . ' on ' . $this->loader->getPrimaryKey($this->alias) . ' = ' . $foreignKeyColumn . ' ';
} | [
"public",
"function",
"joinOn",
"(",
"$",
"foreignKeyColumn",
")",
"{",
"return",
"'join '",
".",
"$",
"this",
"->",
"getTable",
"(",
")",
".",
"' on '",
".",
"$",
"this",
"->",
"loader",
"->",
"getPrimaryKey",
"(",
"$",
"this",
"->",
"alias",
")",
"."... | Print out Join SQL
@param $foreignKeyColumn
@return string | [
"Print",
"out",
"Join",
"SQL"
] | d77c38f2260429c6e054633eb0daf3f755c988a9 | https://github.com/SlabPHP/database/blob/d77c38f2260429c6e054633eb0daf3f755c988a9/src/Models/MySQL/Join.php#L113-L116 | train |
PenoaksDev/Milky-Framework | src/Milky/Http/Routing/ResourceRegistrar.php | ResourceRegistrar.prefixedResource | protected function prefixedResource( $name, $controller, array $options )
{
list( $name, $prefix ) = $this->getResourcePrefix( $name );
// We need to extract the base resource from the resource name. Nested resources
// are supported in the framework, but we need to know what name to use for a
// place-holder... | php | protected function prefixedResource( $name, $controller, array $options )
{
list( $name, $prefix ) = $this->getResourcePrefix( $name );
// We need to extract the base resource from the resource name. Nested resources
// are supported in the framework, but we need to know what name to use for a
// place-holder... | [
"protected",
"function",
"prefixedResource",
"(",
"$",
"name",
",",
"$",
"controller",
",",
"array",
"$",
"options",
")",
"{",
"list",
"(",
"$",
"name",
",",
"$",
"prefix",
")",
"=",
"$",
"this",
"->",
"getResourcePrefix",
"(",
"$",
"name",
")",
";",
... | Build a set of prefixed resource routes.
@param string $name
@param string $controller
@param array $options | [
"Build",
"a",
"set",
"of",
"prefixed",
"resource",
"routes",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Http/Routing/ResourceRegistrar.php#L92-L105 | train |
PenoaksDev/Milky-Framework | src/Milky/Http/Routing/ResourceRegistrar.php | ResourceRegistrar.addResourceShow | protected function addResourceShow( $name, $base, $controller, $options )
{
$uri = $this->getResourceUri( $name ) . '/{' . $base . '';
$action = $this->getResourceAction( $name, $controller, 'show', $options );
return $this->router->get( $uri, $action );
} | php | protected function addResourceShow( $name, $base, $controller, $options )
{
$uri = $this->getResourceUri( $name ) . '/{' . $base . '';
$action = $this->getResourceAction( $name, $controller, 'show', $options );
return $this->router->get( $uri, $action );
} | [
"protected",
"function",
"addResourceShow",
"(",
"$",
"name",
",",
"$",
"base",
",",
"$",
"controller",
",",
"$",
"options",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getResourceUri",
"(",
"$",
"name",
")",
".",
"'/{'",
".",
"$",
"base",
".",
... | Add the show method for a resourceful route.
@param string $name
@param string $base
@param string $controller
@param array $options
@return Route | [
"Add",
"the",
"show",
"method",
"for",
"a",
"resourceful",
"route",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Http/Routing/ResourceRegistrar.php#L337-L344 | train |
WesamMikhail/Utils | src/Strings.php | Strings.generateRandomAlphaNumericString | public static function generateRandomAlphaNumericString($length) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen($chars);
$randomChars = array();
for ($i = 0; $i < $length; $i++) {
$randomChars[] = $chars[mt_rand(0, $size - 1)];
... | php | public static function generateRandomAlphaNumericString($length) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen($chars);
$randomChars = array();
for ($i = 0; $i < $length; $i++) {
$randomChars[] = $chars[mt_rand(0, $size - 1)];
... | [
"public",
"static",
"function",
"generateRandomAlphaNumericString",
"(",
"$",
"length",
")",
"{",
"$",
"chars",
"=",
"\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"",
";",
"$",
"size",
"=",
"strlen",
"(",
"$",
"chars",
")",
";",
"$",
"randomChars",... | Generate a random string with repeatable letters.
@param int $length Length of desired random string
@return string Random string | [
"Generate",
"a",
"random",
"string",
"with",
"repeatable",
"letters",
"."
] | 54933740f4500a7a1ebd37c7226cc00bc36e58db | https://github.com/WesamMikhail/Utils/blob/54933740f4500a7a1ebd37c7226cc00bc36e58db/src/Strings.php#L20-L30 | train |
Nicklas766/Comment | src/Comment/Modules/User.php | User.verifyPassword | public function verifyPassword($name, $pass)
{
$this->find("name", $name);
return password_verify($pass, $this->pass);
} | php | public function verifyPassword($name, $pass)
{
$this->find("name", $name);
return password_verify($pass, $this->pass);
} | [
"public",
"function",
"verifyPassword",
"(",
"$",
"name",
",",
"$",
"pass",
")",
"{",
"$",
"this",
"->",
"find",
"(",
"\"name\"",
",",
"$",
"name",
")",
";",
"return",
"password_verify",
"(",
"$",
"pass",
",",
"$",
"this",
"->",
"pass",
")",
";",
"... | Verify the name and the pass, if successful the object contains
all details from the database row.
@param string $name name to check.
@param string $pass the pass to use.
@return boolean true if name and pass matches, else false. | [
"Verify",
"the",
"name",
"and",
"the",
"pass",
"if",
"successful",
"the",
"object",
"contains",
"all",
"details",
"from",
"the",
"database",
"row",
"."
] | 1483eaf1ebb120b8bd6c2a1552c084b3a288ff25 | https://github.com/Nicklas766/Comment/blob/1483eaf1ebb120b8bd6c2a1552c084b3a288ff25/src/Comment/Modules/User.php#L192-L196 | train |
Nicklas766/Comment | src/Comment/Modules/User.php | User.controlAuthority | public function controlAuthority($loggedUser, $name)
{
$this->find("name", $loggedUser);
// IF AUTHORITY == admin, then continue
if ($this->authority != "admin") {
return ($this->name == $name);
}
return true;
} | php | public function controlAuthority($loggedUser, $name)
{
$this->find("name", $loggedUser);
// IF AUTHORITY == admin, then continue
if ($this->authority != "admin") {
return ($this->name == $name);
}
return true;
} | [
"public",
"function",
"controlAuthority",
"(",
"$",
"loggedUser",
",",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"find",
"(",
"\"name\"",
",",
"$",
"loggedUser",
")",
";",
"// IF AUTHORITY == admin, then continue",
"if",
"(",
"$",
"this",
"->",
"authority",
... | Check if a post belongs to user
@return boolean | [
"Check",
"if",
"a",
"post",
"belongs",
"to",
"user"
] | 1483eaf1ebb120b8bd6c2a1552c084b3a288ff25 | https://github.com/Nicklas766/Comment/blob/1483eaf1ebb120b8bd6c2a1552c084b3a288ff25/src/Comment/Modules/User.php#L220-L228 | train |
EvanDarwin/JSend | src/JSendBuilder.php | JSendBuilder.get | public function get()
{
return new JSendResponse($this->status, $this->data, $this->errors, $this->code, $this->message);
} | php | public function get()
{
return new JSendResponse($this->status, $this->data, $this->errors, $this->code, $this->message);
} | [
"public",
"function",
"get",
"(",
")",
"{",
"return",
"new",
"JSendResponse",
"(",
"$",
"this",
"->",
"status",
",",
"$",
"this",
"->",
"data",
",",
"$",
"this",
"->",
"errors",
",",
"$",
"this",
"->",
"code",
",",
"$",
"this",
"->",
"message",
")"... | Returns the built object
@return \EvanDarwin\JSend\JSendResponse
@throws \InvalidArgumentException | [
"Returns",
"the",
"built",
"object"
] | a31f7590e8503590d10012510ffc50a0ef064d02 | https://github.com/EvanDarwin/JSend/blob/a31f7590e8503590d10012510ffc50a0ef064d02/src/JSendBuilder.php#L174-L177 | train |
wevrem/dStruct | src/dConnection.php | dConnection.getStatement | function getStatement($cKey, $sqlCallback, $types, $params) {
// Lazily prepare and cache the statement.
if (!$this->stmtCache[$cKey]) {
if (!($stmt = $this->mysqli->prepare( $sqlCallback instanceof \Closure ? $sqlCallback() : $sqlCallback ))) { throw new \Exception("Statement Error: {$this->mysqli->error}", $th... | php | function getStatement($cKey, $sqlCallback, $types, $params) {
// Lazily prepare and cache the statement.
if (!$this->stmtCache[$cKey]) {
if (!($stmt = $this->mysqli->prepare( $sqlCallback instanceof \Closure ? $sqlCallback() : $sqlCallback ))) { throw new \Exception("Statement Error: {$this->mysqli->error}", $th... | [
"function",
"getStatement",
"(",
"$",
"cKey",
",",
"$",
"sqlCallback",
",",
"$",
"types",
",",
"$",
"params",
")",
"{",
"// Lazily prepare and cache the statement.",
"if",
"(",
"!",
"$",
"this",
"->",
"stmtCache",
"[",
"$",
"cKey",
"]",
")",
"{",
"if",
"... | array and returns the statement ready to execute. | [
"array",
"and",
"returns",
"the",
"statement",
"ready",
"to",
"execute",
"."
] | 6ede2c26a377475f48de043536d1f46e8863d8b3 | https://github.com/wevrem/dStruct/blob/6ede2c26a377475f48de043536d1f46e8863d8b3/src/dConnection.php#L235-L247 | train |
Brainsware/sauce | lib/Sauce/Path.php | Path.check | public static function check ($path, $fd, $rw)
{
if ($fd == 'f') {
if (is_file($path) != true) {
return false;
}
} elseif ($fd == 'd') {
if (is_dir($path) != true) {
return false;
}
} else {
return fa... | php | public static function check ($path, $fd, $rw)
{
if ($fd == 'f') {
if (is_file($path) != true) {
return false;
}
} elseif ($fd == 'd') {
if (is_dir($path) != true) {
return false;
}
} else {
return fa... | [
"public",
"static",
"function",
"check",
"(",
"$",
"path",
",",
"$",
"fd",
",",
"$",
"rw",
")",
"{",
"if",
"(",
"$",
"fd",
"==",
"'f'",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"path",
")",
"!=",
"true",
")",
"{",
"return",
"false",
";",
"}"... | Checks a file or directory existence and readability
@param string $path /path/to/dir/or/file
@param string $fd Either 'f' for file or 'd' for directory.
@param string $rw Either 'w' for a check on writability or 'r' for a check on readability.
@return bool | [
"Checks",
"a",
"file",
"or",
"directory",
"existence",
"and",
"readability"
] | 2294fd27286bf42cfac6d744e242b2bd9eea353d | https://github.com/Brainsware/sauce/blob/2294fd27286bf42cfac6d744e242b2bd9eea353d/lib/Sauce/Path.php#L81-L112 | train |
shazam/easy-config | src/Config.php | Config.loadConfig | public function loadConfig($configFiles)
{
if (!is_array($configFiles)) {
$configFiles = array($configFiles);
}
$this->configFiles = $configFiles;
foreach ($configFiles as $configFile) {
$this->config = array_merge(
$this->config,
... | php | public function loadConfig($configFiles)
{
if (!is_array($configFiles)) {
$configFiles = array($configFiles);
}
$this->configFiles = $configFiles;
foreach ($configFiles as $configFile) {
$this->config = array_merge(
$this->config,
... | [
"public",
"function",
"loadConfig",
"(",
"$",
"configFiles",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"configFiles",
")",
")",
"{",
"$",
"configFiles",
"=",
"array",
"(",
"$",
"configFiles",
")",
";",
"}",
"$",
"this",
"->",
"configFiles",
"=",
... | Sets to the config property the merged content from all the config files.
@param array|string $configFiles | [
"Sets",
"to",
"the",
"config",
"property",
"the",
"merged",
"content",
"from",
"all",
"the",
"config",
"files",
"."
] | 4017fc4c9669abf2fe58cc2ed4dd5dab5d7224a8 | https://github.com/shazam/easy-config/blob/4017fc4c9669abf2fe58cc2ed4dd5dab5d7224a8/src/Config.php#L82-L96 | train |
shazam/easy-config | src/Config.php | Config.fetch | public function fetch(/* $key1, $key2, ... $keyN */)
{
$keys = func_get_args();
$config = $this->config;
foreach ($keys as $key) {
if (isset($config[$key])) {
$config = $config[$key];
} else {
throw new KeyNotFoundException("Key $key n... | php | public function fetch(/* $key1, $key2, ... $keyN */)
{
$keys = func_get_args();
$config = $this->config;
foreach ($keys as $key) {
if (isset($config[$key])) {
$config = $config[$key];
} else {
throw new KeyNotFoundException("Key $key n... | [
"public",
"function",
"fetch",
"(",
"/* $key1, $key2, ... $keyN */",
")",
"{",
"$",
"keys",
"=",
"func_get_args",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
... | Fetches a single value from a key chain of N depth
@return array|mixed
@throws KeyNotFoundException | [
"Fetches",
"a",
"single",
"value",
"from",
"a",
"key",
"chain",
"of",
"N",
"depth"
] | 4017fc4c9669abf2fe58cc2ed4dd5dab5d7224a8 | https://github.com/shazam/easy-config/blob/4017fc4c9669abf2fe58cc2ed4dd5dab5d7224a8/src/Config.php#L111-L125 | train |
shazam/easy-config | src/Config.php | Config.flush | public function flush()
{
if ($this->useCache) {
foreach ($this->configFiles as $configFile) {
if (function_exists('apc_delete')) {
\apc_delete($configFile);
}
}
}
$this->config = array();
} | php | public function flush()
{
if ($this->useCache) {
foreach ($this->configFiles as $configFile) {
if (function_exists('apc_delete')) {
\apc_delete($configFile);
}
}
}
$this->config = array();
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useCache",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"configFiles",
"as",
"$",
"configFile",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'apc_delete'",
")",
")",
"{",
"... | If cache is used, flushes it. Otherwise it just empties config property. | [
"If",
"cache",
"is",
"used",
"flushes",
"it",
".",
"Otherwise",
"it",
"just",
"empties",
"config",
"property",
"."
] | 4017fc4c9669abf2fe58cc2ed4dd5dab5d7224a8 | https://github.com/shazam/easy-config/blob/4017fc4c9669abf2fe58cc2ed4dd5dab5d7224a8/src/Config.php#L140-L150 | train |
shazam/easy-config | src/Config.php | Config.loadConfigFile | private function loadConfigFile($configFile)
{
if ($this->useCache) {
if (function_exists('apc_fetch')) {
$config = apc_fetch($configFile);
} elseif (function_exists('apcu_fetch')) {
$config = apcu_fetch($configFile);
}
if (!em... | php | private function loadConfigFile($configFile)
{
if ($this->useCache) {
if (function_exists('apc_fetch')) {
$config = apc_fetch($configFile);
} elseif (function_exists('apcu_fetch')) {
$config = apcu_fetch($configFile);
}
if (!em... | [
"private",
"function",
"loadConfigFile",
"(",
"$",
"configFile",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useCache",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'apc_fetch'",
")",
")",
"{",
"$",
"config",
"=",
"apc_fetch",
"(",
"$",
"configFile",
")",
... | Loads a config file into config property. If cache is used, first check if the config
file was previously loaded.
@throws FileNotFoundException
@throws InvalidConfigFileException | [
"Loads",
"a",
"config",
"file",
"into",
"config",
"property",
".",
"If",
"cache",
"is",
"used",
"first",
"check",
"if",
"the",
"config",
"file",
"was",
"previously",
"loaded",
"."
] | 4017fc4c9669abf2fe58cc2ed4dd5dab5d7224a8 | https://github.com/shazam/easy-config/blob/4017fc4c9669abf2fe58cc2ed4dd5dab5d7224a8/src/Config.php#L158-L194 | train |
werx/core | src/Controller.php | Controller.initializeRequest | public function initializeRequest($request = null)
{
if (empty($request)) {
$this->request = Request::createFromGlobals();
} else {
$this->request = $request;
}
// Shortcuts to the request object for cleaner syntax.
$this->input = new Input($this->request);
} | php | public function initializeRequest($request = null)
{
if (empty($request)) {
$this->request = Request::createFromGlobals();
} else {
$this->request = $request;
}
// Shortcuts to the request object for cleaner syntax.
$this->input = new Input($this->request);
} | [
"public",
"function",
"initializeRequest",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"request",
")",
")",
"{",
"$",
"this",
"->",
"request",
"=",
"Request",
"::",
"createFromGlobals",
"(",
")",
";",
"}",
"else",
"{",
"... | Get info about the HTTP Request
@var \Symfony\Component\HttpFoundation\Request $request | [
"Get",
"info",
"about",
"the",
"HTTP",
"Request"
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Controller.php#L121-L131 | train |
werx/core | src/Controller.php | Controller.jsonp | public function jsonp($content = [], $jsonCallback = 'callback')
{
$response = new JsonResponse();
$response->setData($content);
$response->setCallback($jsonCallback);
$response->send();
} | php | public function jsonp($content = [], $jsonCallback = 'callback')
{
$response = new JsonResponse();
$response->setData($content);
$response->setCallback($jsonCallback);
$response->send();
} | [
"public",
"function",
"jsonp",
"(",
"$",
"content",
"=",
"[",
"]",
",",
"$",
"jsonCallback",
"=",
"'callback'",
")",
"{",
"$",
"response",
"=",
"new",
"JsonResponse",
"(",
")",
";",
"$",
"response",
"->",
"setData",
"(",
"$",
"content",
")",
";",
"$"... | Send a jsonp response with given content.
@param array $content
@param string $jsonCallback | [
"Send",
"a",
"jsonp",
"response",
"with",
"given",
"content",
"."
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Controller.php#L242-L248 | train |
werx/core | src/Controller.php | Controller.getRequestedController | public function getRequestedController($default = null)
{
if (property_exists($this, 'app') && is_object($this->app) && property_exists($this->app, 'controller')) {
return $this->app->controller;
} elseif (!empty($default)) {
return $default;
} else {
$reflect = new \ReflectionClass($this);
return st... | php | public function getRequestedController($default = null)
{
if (property_exists($this, 'app') && is_object($this->app) && property_exists($this->app, 'controller')) {
return $this->app->controller;
} elseif (!empty($default)) {
return $default;
} else {
$reflect = new \ReflectionClass($this);
return st... | [
"public",
"function",
"getRequestedController",
"(",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"'app'",
")",
"&&",
"is_object",
"(",
"$",
"this",
"->",
"app",
")",
"&&",
"property_exists",
"(",
"$",
"this... | Which controller was requested?
@param null $default
@return null|string | [
"Which",
"controller",
"was",
"requested?"
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Controller.php#L256-L266 | train |
werx/core | src/Controller.php | Controller.getRequestedAction | public function getRequestedAction($default = 'index')
{
if (property_exists($this, 'app') && is_object($this->app) && property_exists($this->app, 'action')) {
return $this->app->action;
} else {
return $default;
}
} | php | public function getRequestedAction($default = 'index')
{
if (property_exists($this, 'app') && is_object($this->app) && property_exists($this->app, 'action')) {
return $this->app->action;
} else {
return $default;
}
} | [
"public",
"function",
"getRequestedAction",
"(",
"$",
"default",
"=",
"'index'",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"'app'",
")",
"&&",
"is_object",
"(",
"$",
"this",
"->",
"app",
")",
"&&",
"property_exists",
"(",
"$",
"this"... | Which action was requested?
@param string $default
@return string | [
"Which",
"action",
"was",
"requested?"
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Controller.php#L274-L281 | train |
AlexyaFramework/Database | Alexya/Database/ORM/Model.php | Model.initialize | public static function initialize(Connection $connection, string $baseNamespace = "\\")
{
self::$_connection = $connection;
self::$_baseNamespace = Str::trailing($baseNamespace, "\\");
} | php | public static function initialize(Connection $connection, string $baseNamespace = "\\")
{
self::$_connection = $connection;
self::$_baseNamespace = Str::trailing($baseNamespace, "\\");
} | [
"public",
"static",
"function",
"initialize",
"(",
"Connection",
"$",
"connection",
",",
"string",
"$",
"baseNamespace",
"=",
"\"\\\\\"",
")",
"{",
"self",
"::",
"$",
"_connection",
"=",
"$",
"connection",
";",
"self",
"::",
"$",
"_baseNamespace",
"=",
"Str"... | Initializes the class.
@param Connection $connection Database connection.
@param string $baseNamespace Base namespace of the ORM classes. | [
"Initializes",
"the",
"class",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/ORM/Model.php#L196-L200 | train |
AlexyaFramework/Database | Alexya/Database/ORM/Model.php | Model.find | public static function find($id, $limit = -1, string $table = "", bool $setRelations = true)
{
$query = new QueryBuilder(self::$_connection);
$model = new static();
$query->select("*");
if($table === "") {
$query->from($model->getTable());
} else {
$... | php | public static function find($id, $limit = -1, string $table = "", bool $setRelations = true)
{
$query = new QueryBuilder(self::$_connection);
$model = new static();
$query->select("*");
if($table === "") {
$query->from($model->getTable());
} else {
$... | [
"public",
"static",
"function",
"find",
"(",
"$",
"id",
",",
"$",
"limit",
"=",
"-",
"1",
",",
"string",
"$",
"table",
"=",
"\"\"",
",",
"bool",
"$",
"setRelations",
"=",
"true",
")",
"{",
"$",
"query",
"=",
"new",
"QueryBuilder",
"(",
"self",
"::"... | Finds and returns one or more record from the database.
@param int|string|array $id Primary key value or `WHERE` clause.
@param int|array $limit Amount of records to retrieve from database,
if `-1` (or empty array) an instance of the Model
class will be returned.
@param string $table ... | [
"Finds",
"and",
"returns",
"one",
"or",
"more",
"record",
"from",
"the",
"database",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/ORM/Model.php#L244-L293 | train |
AlexyaFramework/Database | Alexya/Database/ORM/Model.php | Model.all | public static function all(array $where = [], string $table = "", bool $setRelations = true) : array
{
$query = new QueryBuilder(self::$_connection);
$model = new static();
$query->select("*");
if($table === "") {
$query->from($model->getTable());
} else {
... | php | public static function all(array $where = [], string $table = "", bool $setRelations = true) : array
{
$query = new QueryBuilder(self::$_connection);
$model = new static();
$query->select("*");
if($table === "") {
$query->from($model->getTable());
} else {
... | [
"public",
"static",
"function",
"all",
"(",
"array",
"$",
"where",
"=",
"[",
"]",
",",
"string",
"$",
"table",
"=",
"\"\"",
",",
"bool",
"$",
"setRelations",
"=",
"true",
")",
":",
"array",
"{",
"$",
"query",
"=",
"new",
"QueryBuilder",
"(",
"self",
... | Returns all records from database.
@param array $where Where clause array.
@param string $table Table that will be used to get the records from.
@param bool $setRelations Whether relations should be processed or not.
@return Model[] Records from database. | [
"Returns",
"all",
"records",
"from",
"database",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/ORM/Model.php#L304-L332 | train |
AlexyaFramework/Database | Alexya/Database/ORM/Model.php | Model._setWhere | private static function _setWhere($where, QueryBuilder $query, string $primaryKey = "id") : QueryBuilder
{
if(!is_array($where)) {
return $query->where([
$primaryKey => $where
]);
}
$columns = $where;
unset($columns["ORDER BY"]);
unse... | php | private static function _setWhere($where, QueryBuilder $query, string $primaryKey = "id") : QueryBuilder
{
if(!is_array($where)) {
return $query->where([
$primaryKey => $where
]);
}
$columns = $where;
unset($columns["ORDER BY"]);
unse... | [
"private",
"static",
"function",
"_setWhere",
"(",
"$",
"where",
",",
"QueryBuilder",
"$",
"query",
",",
"string",
"$",
"primaryKey",
"=",
"\"id\"",
")",
":",
"QueryBuilder",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"where",
")",
")",
"{",
"return",
... | Sets the WHERE param to the query.
@param int|array $where WHERE param.
@param QueryBuilder $query Query to build.
@param string $primaryKey Table primary key.
@return QueryBuilder Query object. | [
"Sets",
"the",
"WHERE",
"param",
"to",
"the",
"query",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/ORM/Model.php#L384-L423 | train |
AlexyaFramework/Database | Alexya/Database/ORM/Model.php | Model.set | public function set(string $name, $value)
{
$this->_data[$name] = $value;
if(!is_object($value)) {
$this->_changed[$name] = $value;
}
} | php | public function set(string $name, $value)
{
$this->_data[$name] = $value;
if(!is_object($value)) {
$this->_changed[$name] = $value;
}
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_data",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
... | Sets a column.
@param string $name Column name.
@param string $value Column value. | [
"Sets",
"a",
"column",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/ORM/Model.php#L768-L775 | train |
AlexyaFramework/Database | Alexya/Database/ORM/Model.php | Model.save | public function save()
{
$query = new QueryBuilder(self::$_connection);
if($this->_isInsert) {
$query->insert($this->getTable())
->values($this->_changed);
$id = self::$_connection->insert($query->getQuery());
$this->_data[$this->_primaryKey] =... | php | public function save()
{
$query = new QueryBuilder(self::$_connection);
if($this->_isInsert) {
$query->insert($this->getTable())
->values($this->_changed);
$id = self::$_connection->insert($query->getQuery());
$this->_data[$this->_primaryKey] =... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"query",
"=",
"new",
"QueryBuilder",
"(",
"self",
"::",
"$",
"_connection",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_isInsert",
")",
"{",
"$",
"query",
"->",
"insert",
"(",
"$",
"this",
"->",
"getT... | Saves the changes to the database. | [
"Saves",
"the",
"changes",
"to",
"the",
"database",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/ORM/Model.php#L803-L828 | train |
AlexyaFramework/Database | Alexya/Database/ORM/Model.php | Model.getTable | public function getTable() : string
{
if(!empty($this->_table)) {
return $this->_table;
}
$class = explode("\\", str_replace(self::$_baseNamespace, "", "\\".get_called_class()));
$table = Str::snake(Str::plural($class));
$this->_table = $table;
return $... | php | public function getTable() : string
{
if(!empty($this->_table)) {
return $this->_table;
}
$class = explode("\\", str_replace(self::$_baseNamespace, "", "\\".get_called_class()));
$table = Str::snake(Str::plural($class));
$this->_table = $table;
return $... | [
"public",
"function",
"getTable",
"(",
")",
":",
"string",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_table",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_table",
";",
"}",
"$",
"class",
"=",
"explode",
"(",
"\"\\\\\"",
",",
"str_repl... | Builds and returns table name.
@return string Table name. | [
"Builds",
"and",
"returns",
"table",
"name",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/ORM/Model.php#L835-L847 | train |
AlexyaFramework/Database | Alexya/Database/ORM/Model.php | Model.asArray | public function asArray(bool $decodeJSON = true) : array
{
if(!$decodeJSON) {
return $this->_data;
}
$return = [];
foreach($this->_data as $key => $value) {
$decoded = json_decode($value);
$return[$key] = $decoded;
if(
... | php | public function asArray(bool $decodeJSON = true) : array
{
if(!$decodeJSON) {
return $this->_data;
}
$return = [];
foreach($this->_data as $key => $value) {
$decoded = json_decode($value);
$return[$key] = $decoded;
if(
... | [
"public",
"function",
"asArray",
"(",
"bool",
"$",
"decodeJSON",
"=",
"true",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"decodeJSON",
")",
"{",
"return",
"$",
"this",
"->",
"_data",
";",
"}",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
... | Returns table values.
@param bool $decodeJSON Whether the JSONs should be decoded or not.
@return array Table values. | [
"Returns",
"table",
"values",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/ORM/Model.php#L856-L876 | train |
AlexyaFramework/Database | Alexya/Database/ORM/Model.php | Model.asJSON | public function asJSON() : string
{
$fields = [];
foreach($this->_data as $key => $value) {
if(!is_object($value)) {
$fields[$key] = $value;
}
}
return json_encode($fields);
} | php | public function asJSON() : string
{
$fields = [];
foreach($this->_data as $key => $value) {
if(!is_object($value)) {
$fields[$key] = $value;
}
}
return json_encode($fields);
} | [
"public",
"function",
"asJSON",
"(",
")",
":",
"string",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"value",
")",
")... | Returns values as a JSON.
@return string Encoded JSON. | [
"Returns",
"values",
"as",
"a",
"JSON",
"."
] | 5eb12dc183700ed2357495f4d2c2863ca033eb5a | https://github.com/AlexyaFramework/Database/blob/5eb12dc183700ed2357495f4d2c2863ca033eb5a/Alexya/Database/ORM/Model.php#L883-L894 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.