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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
miaoxing/plugin | src/Service/V.php | V.addRule | public function addRule($name, $args)
{
$this->options['rules'][$this->lastKey][$name] = $args;
$this->lastRule = $name;
return $this;
} | php | public function addRule($name, $args)
{
$this->options['rules'][$this->lastKey][$name] = $args;
$this->lastRule = $name;
return $this;
} | [
"public",
"function",
"addRule",
"(",
"$",
"name",
",",
"$",
"args",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'rules'",
"]",
"[",
"$",
"this",
"->",
"lastKey",
"]",
"[",
"$",
"name",
"]",
"=",
"$",
"args",
";",
"$",
"this",
"->",
"lastRule",... | Add rule for current field
@param string $name
@param mixed $args
@return $this | [
"Add",
"rule",
"for",
"current",
"field"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/V.php#L364-L370 | train |
danielgp/common-lib | source/MySQLiByDanielGPqueries.php | MySQLiByDanielGPqueries.getForeignKeysQuery | protected function getForeignKeysQuery($value)
{
$flt = [
'TABLE_SCHEMA' => $value['REFERENCED_TABLE_SCHEMA'],
'TABLE_NAME' => $value['REFERENCED_TABLE_NAME'],
'DATA_TYPE' => ['char', 'varchar', 'text'],
];
if (array_key_exists('LIMIT', $value)) {
... | php | protected function getForeignKeysQuery($value)
{
$flt = [
'TABLE_SCHEMA' => $value['REFERENCED_TABLE_SCHEMA'],
'TABLE_NAME' => $value['REFERENCED_TABLE_NAME'],
'DATA_TYPE' => ['char', 'varchar', 'text'],
];
if (array_key_exists('LIMIT', $value)) {
... | [
"protected",
"function",
"getForeignKeysQuery",
"(",
"$",
"value",
")",
"{",
"$",
"flt",
"=",
"[",
"'TABLE_SCHEMA'",
"=>",
"$",
"value",
"[",
"'REFERENCED_TABLE_SCHEMA'",
"]",
",",
"'TABLE_NAME'",
"=>",
"$",
"value",
"[",
"'REFERENCED_TABLE_NAME'",
"]",
",",
"... | prepares the query to detect FKs
@param array $value
@return string | [
"prepares",
"the",
"query",
"to",
"detect",
"FKs"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPqueries.php#L62-L73 | train |
danielgp/common-lib | source/MySQLiByDanielGPqueries.php | MySQLiByDanielGPqueries.sManageDynamicFilters | private function sManageDynamicFilters($filterArray = null, $tableToApplyFilterTo = '')
{
if (is_null($filterArray)) {
return '';
}
$fltr = [];
unset($filterArray['LIMIT']);
foreach ($filterArray as $key => $value) {
$fltr[] = '`' . $tableToApplyFilter... | php | private function sManageDynamicFilters($filterArray = null, $tableToApplyFilterTo = '')
{
if (is_null($filterArray)) {
return '';
}
$fltr = [];
unset($filterArray['LIMIT']);
foreach ($filterArray as $key => $value) {
$fltr[] = '`' . $tableToApplyFilter... | [
"private",
"function",
"sManageDynamicFilters",
"(",
"$",
"filterArray",
"=",
"null",
",",
"$",
"tableToApplyFilterTo",
"=",
"''",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"filterArray",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"fltr",
"=",
"[",
... | Internal function to manage the filters passed to the query
@param null|array $filterArray
@param string $tableToApplyFilterTo
@return string | [
"Internal",
"function",
"to",
"manage",
"the",
"filters",
"passed",
"to",
"the",
"query"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPqueries.php#L124-L135 | train |
danielgp/common-lib | source/MySQLiByDanielGPqueries.php | MySQLiByDanielGPqueries.setArrayLineArrayToFilter | private function setArrayLineArrayToFilter($key, $value, $referenceTable)
{
$filters2 = implode(', ', array_diff($value, ['']));
if ($filters2 != '') {
return '(' . $referenceTable . '`' . $key . '` IN ("'
. str_replace(',', '","', str_replace(["'", '"'], '', $filters2)) ... | php | private function setArrayLineArrayToFilter($key, $value, $referenceTable)
{
$filters2 = implode(', ', array_diff($value, ['']));
if ($filters2 != '') {
return '(' . $referenceTable . '`' . $key . '` IN ("'
. str_replace(',', '","', str_replace(["'", '"'], '', $filters2)) ... | [
"private",
"function",
"setArrayLineArrayToFilter",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"referenceTable",
")",
"{",
"$",
"filters2",
"=",
"implode",
"(",
"', '",
",",
"array_diff",
"(",
"$",
"value",
",",
"[",
"''",
"]",
")",
")",
";",
"if",
... | Builds an filter string from pair of key and value, where value is array
@param string $key
@param array $value
@param string $referenceTable
@return string | [
"Builds",
"an",
"filter",
"string",
"from",
"pair",
"of",
"key",
"and",
"value",
"where",
"value",
"is",
"array"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPqueries.php#L272-L280 | train |
danielgp/common-lib | source/MySQLiByDanielGPqueries.php | MySQLiByDanielGPqueries.setArrayLineToFilter | private function setArrayLineToFilter($key, $value)
{
$fTemp = '=';
if ((substr($value, 0, 1) == '%') && (substr($value, -1) == '%')) {
$fTemp = 'LIKE';
}
return '(`' . $key . '` ' . $fTemp . '"' . $value . '")';
} | php | private function setArrayLineToFilter($key, $value)
{
$fTemp = '=';
if ((substr($value, 0, 1) == '%') && (substr($value, -1) == '%')) {
$fTemp = 'LIKE';
}
return '(`' . $key . '` ' . $fTemp . '"' . $value . '")';
} | [
"private",
"function",
"setArrayLineToFilter",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"fTemp",
"=",
"'='",
";",
"if",
"(",
"(",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"1",
")",
"==",
"'%'",
")",
"&&",
"(",
"substr",
"(",
"$",
"... | Builds an filter string from pair of key and value, none array
@param string $key
@param int|float|string $value
@return string | [
"Builds",
"an",
"filter",
"string",
"from",
"pair",
"of",
"key",
"and",
"value",
"none",
"array"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPqueries.php#L289-L296 | train |
anime-db/catalog-bundle | src/Controller/PluginController.php | PluginController.installedAction | public function installedAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse('AnimeDbAppBundle:Plugin');
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
/* @var $rep EntityRep... | php | public function installedAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse('AnimeDbAppBundle:Plugin');
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
/* @var $rep EntityRep... | [
"public",
"function",
"installedAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getCacheTimeKeeper",
"(",
")",
"->",
"getResponse",
"(",
"'AnimeDbAppBundle:Plugin'",
")",
";",
"// response was not modified for this request"... | Installed plugins.
@param Request $request
@return Response | [
"Installed",
"plugins",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/PluginController.php#L38-L52 | train |
anime-db/catalog-bundle | src/Controller/PluginController.php | PluginController.storeAction | public function storeAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse([], self::CACHE_LIFETIME);
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
$plugins = [];
$dat... | php | public function storeAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse([], self::CACHE_LIFETIME);
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
$plugins = [];
$dat... | [
"public",
"function",
"storeAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getCacheTimeKeeper",
"(",
")",
"->",
"getResponse",
"(",
"[",
"]",
",",
"self",
"::",
"CACHE_LIFETIME",
")",
";",
"// response was not mo... | Store of plugins.
@param Request $request
@return Response | [
"Store",
"of",
"plugins",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/PluginController.php#L61-L86 | train |
koolkode/context | src/Locator/BindingServiceLocator.php | BindingServiceLocator.getIterator | public function getIterator()
{
if($this->shared)
{
foreach($this->bindings as $key => $binding)
{
if(empty($this->bound[$key]))
{
$this->bound[$key] = $this->container->getBound($binding);
}
}
return new \ArrayIterator($this->bound);
}
$bound = [];
foreach($this->bindi... | php | public function getIterator()
{
if($this->shared)
{
foreach($this->bindings as $key => $binding)
{
if(empty($this->bound[$key]))
{
$this->bound[$key] = $this->container->getBound($binding);
}
}
return new \ArrayIterator($this->bound);
}
$bound = [];
foreach($this->bindi... | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shared",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"bindings",
"as",
"$",
"key",
"=>",
"$",
"binding",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"bo... | Provides an iterator on top of all registered services, obtaining the iterator triggers
loading of ALL registered services from the DI container.
@return \ArrayIterator<string, object> | [
"Provides",
"an",
"iterator",
"on",
"top",
"of",
"all",
"registered",
"services",
"obtaining",
"the",
"iterator",
"triggers",
"loading",
"of",
"ALL",
"registered",
"services",
"from",
"the",
"DI",
"container",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Locator/BindingServiceLocator.php#L87-L110 | train |
koolkode/context | src/Locator/BindingServiceLocator.php | BindingServiceLocator.registerService | public function registerService(BindingInterface $binding, $name = NULL)
{
$key = ($name === NULL) ? $binding->getTypeName() : (string)$name;
if(isset($this->bindings[$key]))
{
throw new DuplicateServiceRegistrationException(sprintf('Service "%s" is already registered', $key));
}
$this->bindings[$ke... | php | public function registerService(BindingInterface $binding, $name = NULL)
{
$key = ($name === NULL) ? $binding->getTypeName() : (string)$name;
if(isset($this->bindings[$key]))
{
throw new DuplicateServiceRegistrationException(sprintf('Service "%s" is already registered', $key));
}
$this->bindings[$ke... | [
"public",
"function",
"registerService",
"(",
"BindingInterface",
"$",
"binding",
",",
"$",
"name",
"=",
"NULL",
")",
"{",
"$",
"key",
"=",
"(",
"$",
"name",
"===",
"NULL",
")",
"?",
"$",
"binding",
"->",
"getTypeName",
"(",
")",
":",
"(",
"string",
... | Register a binding in the locator, will use the name of the bound type when no
name for the service is given.
@param BindingInterface $binding The binding being used to load the service.
@param string $name Optional name of the registered service.
@throws DuplicateServiceRegistrationException | [
"Register",
"a",
"binding",
"in",
"the",
"locator",
"will",
"use",
"the",
"name",
"of",
"the",
"bound",
"type",
"when",
"no",
"name",
"for",
"the",
"service",
"is",
"given",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Locator/BindingServiceLocator.php#L149-L159 | train |
hamjoint/mustard-media | src/lib/Http/Controllers/MediaController.php | MediaController.getPhoto | public function getPhoto($photoId, $size = 'large')
{
$photo = Photo::findOrFail($photoId);
switch ($size) {
case 'large':
return response()->download(storage_path().'/app/'.$photo->pathLarge);
case 'small':
return response()->download(storage... | php | public function getPhoto($photoId, $size = 'large')
{
$photo = Photo::findOrFail($photoId);
switch ($size) {
case 'large':
return response()->download(storage_path().'/app/'.$photo->pathLarge);
case 'small':
return response()->download(storage... | [
"public",
"function",
"getPhoto",
"(",
"$",
"photoId",
",",
"$",
"size",
"=",
"'large'",
")",
"{",
"$",
"photo",
"=",
"Photo",
"::",
"findOrFail",
"(",
"$",
"photoId",
")",
";",
"switch",
"(",
"$",
"size",
")",
"{",
"case",
"'large'",
":",
"return",
... | Return a photo as a response.
@param int $photoId
@param string $size
@return \Illuminate\Http\Response | [
"Return",
"a",
"photo",
"as",
"a",
"response",
"."
] | d3c799dbc3578e1e1022bb4eccae7a20e285ba06 | https://github.com/hamjoint/mustard-media/blob/d3c799dbc3578e1e1022bb4eccae7a20e285ba06/src/lib/Http/Controllers/MediaController.php#L38-L50 | train |
Horat1us/array-js-prototype | src/Collection.php | Collection.getLength | public function getLength()
{
if (!$this->container) {
return 0;
}
$count = count($this->container);
$keys = array_keys($this->container);
return (array_keys($this->container) === range(0, $count - 1))
? $count
: max($keys);
} | php | public function getLength()
{
if (!$this->container) {
return 0;
}
$count = count($this->container);
$keys = array_keys($this->container);
return (array_keys($this->container) === range(0, $count - 1))
? $count
: max($keys);
} | [
"public",
"function",
"getLength",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
")",
"{",
"return",
"0",
";",
"}",
"$",
"count",
"=",
"count",
"(",
"$",
"this",
"->",
"container",
")",
";",
"$",
"keys",
"=",
"array_keys",
"(",
"... | Copying JS-like .length behavior
@return integer|string | [
"Copying",
"JS",
"-",
"like",
".",
"length",
"behavior"
] | 2dd6843eb221f81c2488237f164fdd392e98147a | https://github.com/Horat1us/array-js-prototype/blob/2dd6843eb221f81c2488237f164fdd392e98147a/src/Collection.php#L80-L91 | train |
oyepez003/YepsuaRADBundle | Controller/CRUDController.php | CRUDController.crudShow | public function crudShow(Request $request, $id)
{
try{
$entity = $this->throwEntityNotFoundException($this->getRepository()->find($id));
$form = $this->createDeleteForm($id)->createView();
return $this->commonsResponseVars(compact('entity','form'));
}catch(\... | php | public function crudShow(Request $request, $id)
{
try{
$entity = $this->throwEntityNotFoundException($this->getRepository()->find($id));
$form = $this->createDeleteForm($id)->createView();
return $this->commonsResponseVars(compact('entity','form'));
}catch(\... | [
"public",
"function",
"crudShow",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"throwEntityNotFoundException",
"(",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"find",
"(",
"$",
"i... | Finds and displays an entity.
@param \Symfony\Component\HttpFoundation\Request $request
@param type $id
@return type | [
"Finds",
"and",
"displays",
"an",
"entity",
"."
] | 5e8c79f49201d5b2ba9487f16624a3f245941672 | https://github.com/oyepez003/YepsuaRADBundle/blob/5e8c79f49201d5b2ba9487f16624a3f245941672/Controller/CRUDController.php#L113-L124 | train |
oyepez003/YepsuaRADBundle | Controller/CRUDController.php | CRUDController.crudUpdate | public function crudUpdate(Request $request, $id)
{
try{
$entity = $this->throwEntityNotFoundException($this->getRepository()->find($id));
$form = $this->createForm($this->getEntityType(), $entity);
$form->submit($request);
$page = static::EDIT_V... | php | public function crudUpdate(Request $request, $id)
{
try{
$entity = $this->throwEntityNotFoundException($this->getRepository()->find($id));
$form = $this->createForm($this->getEntityType(), $entity);
$form->submit($request);
$page = static::EDIT_V... | [
"public",
"function",
"crudUpdate",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"throwEntityNotFoundException",
"(",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"find",
"(",
"$",
... | Edits an existing entity.
@param \Symfony\Component\HttpFoundation\Request $request
@param type $id
@return type | [
"Edits",
"an",
"existing",
"entity",
"."
] | 5e8c79f49201d5b2ba9487f16624a3f245941672 | https://github.com/oyepez003/YepsuaRADBundle/blob/5e8c79f49201d5b2ba9487f16624a3f245941672/Controller/CRUDController.php#L154-L178 | train |
libreworks/caridea-dao | src/Exception/Translator/MongoDb.php | MongoDb.translate | public static function translate(\Exception $e): \Exception
{
if ($e instanceof \MongoDB\Driver\Exception\ConnectionException ||
$e instanceof \MongoDB\Driver\Exception\ExecutionTimeoutException) {
return new \Caridea\Dao\Exception\Unreachable("System unreachable or connection ti... | php | public static function translate(\Exception $e): \Exception
{
if ($e instanceof \MongoDB\Driver\Exception\ConnectionException ||
$e instanceof \MongoDB\Driver\Exception\ExecutionTimeoutException) {
return new \Caridea\Dao\Exception\Unreachable("System unreachable or connection ti... | [
"public",
"static",
"function",
"translate",
"(",
"\\",
"Exception",
"$",
"e",
")",
":",
"\\",
"Exception",
"{",
"if",
"(",
"$",
"e",
"instanceof",
"\\",
"MongoDB",
"\\",
"Driver",
"\\",
"Exception",
"\\",
"ConnectionException",
"||",
"$",
"e",
"instanceof... | Translates a MongoDB exception.
@param \Exception $e The exception to translate
@return \Exception The exception to use | [
"Translates",
"a",
"MongoDB",
"exception",
"."
] | 22c2fc81f63050ad23f7b0c40e430ff026e1e767 | https://github.com/libreworks/caridea-dao/blob/22c2fc81f63050ad23f7b0c40e430ff026e1e767/src/Exception/Translator/MongoDb.php#L37-L57 | train |
mtils/cmsable | src/Cmsable/Translation/Translator.php | Translator.overwrite | public function overwrite($key, $message=null)
{
if (!is_array($key)) {
$this->overwrites[$key] = $message;
return $this;
}
foreach ($key as $k=>$v) {
$this->overwrite($k, $v);
}
return $this;
} | php | public function overwrite($key, $message=null)
{
if (!is_array($key)) {
$this->overwrites[$key] = $message;
return $this;
}
foreach ($key as $k=>$v) {
$this->overwrite($k, $v);
}
return $this;
} | [
"public",
"function",
"overwrite",
"(",
"$",
"key",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"overwrites",
"[",
"$",
"key",
"]",
"=",
"$",
"message",
";",
"return",... | Overwrite one or more lang keys
@param string|array $key
@param mixed $message (optional)
@return self | [
"Overwrite",
"one",
"or",
"more",
"lang",
"keys"
] | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Translation/Translator.php#L69-L81 | train |
yuncms/yii2-article | frontend/controllers/ArticleController.php | ArticleController.findModelByUUID | protected function findModelByUUID($uuid)
{
if (($model = Article::findOne(['uuid' => $uuid])) != null) {
return $model;
}
throw new NotFoundHttpException(Yii::t('yii', 'The requested page does not exist'));
} | php | protected function findModelByUUID($uuid)
{
if (($model = Article::findOne(['uuid' => $uuid])) != null) {
return $model;
}
throw new NotFoundHttpException(Yii::t('yii', 'The requested page does not exist'));
} | [
"protected",
"function",
"findModelByUUID",
"(",
"$",
"uuid",
")",
"{",
"if",
"(",
"(",
"$",
"model",
"=",
"Article",
"::",
"findOne",
"(",
"[",
"'uuid'",
"=>",
"$",
"uuid",
"]",
")",
")",
"!=",
"null",
")",
"{",
"return",
"$",
"model",
";",
"}",
... | Finds the Article model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.
@param string $uuid
@return Article the loaded model
@throws NotFoundHttpException if the model cannot be found | [
"Finds",
"the",
"Article",
"model",
"based",
"on",
"its",
"primary",
"key",
"value",
".",
"If",
"the",
"model",
"is",
"not",
"found",
"a",
"404",
"HTTP",
"exception",
"will",
"be",
"thrown",
"."
] | 177ec4d3d143b2f2a69bce760e873485cf3df192 | https://github.com/yuncms/yii2-article/blob/177ec4d3d143b2f2a69bce760e873485cf3df192/frontend/controllers/ArticleController.php#L240-L246 | train |
nicodevs/laito | src/Laito/Session/Tokens/FileTokens.php | FileTokens.get | public function get($hash = null)
{
// If the hash is not received, get it from the request
$hash = $hash?: $this->app->request->token();
// Determine token path
$path = $this->path($hash);
// Abort if the session does not exist
if (!file_exists($path)) {
... | php | public function get($hash = null)
{
// If the hash is not received, get it from the request
$hash = $hash?: $this->app->request->token();
// Determine token path
$path = $this->path($hash);
// Abort if the session does not exist
if (!file_exists($path)) {
... | [
"public",
"function",
"get",
"(",
"$",
"hash",
"=",
"null",
")",
"{",
"// If the hash is not received, get it from the request",
"$",
"hash",
"=",
"$",
"hash",
"?",
":",
"$",
"this",
"->",
"app",
"->",
"request",
"->",
"token",
"(",
")",
";",
"// Determine t... | Gets the token data
@param string $hash Token hash
@return array|bool Token data or false | [
"Gets",
"the",
"token",
"data"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Session/Tokens/FileTokens.php#L32-L53 | train |
nicodevs/laito | src/Laito/Session/Tokens/FileTokens.php | FileTokens.create | public function create($data = [])
{
// Create a random hash
$hash = $this->hash();
// Store the file in the tokens storage
$data = array_merge($data, ['token' => $hash, 'timestamp' => time()]);
$stored = file_put_contents($this->path($hash), json_encode($data));
//... | php | public function create($data = [])
{
// Create a random hash
$hash = $this->hash();
// Store the file in the tokens storage
$data = array_merge($data, ['token' => $hash, 'timestamp' => time()]);
$stored = file_put_contents($this->path($hash), json_encode($data));
//... | [
"public",
"function",
"create",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"// Create a random hash",
"$",
"hash",
"=",
"$",
"this",
"->",
"hash",
"(",
")",
";",
"// Store the file in the tokens storage",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"data",
... | Creates a token
@param array $data Data to store
@return Token data | [
"Creates",
"a",
"token"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Session/Tokens/FileTokens.php#L61-L72 | train |
nicodevs/laito | src/Laito/Session/Tokens/FileTokens.php | FileTokens.update | public function update($hash = null, $data)
{
// If the hash is not received, get it from the request
$hash = $hash?: $this->app->request->token();
// Update the file in the tokens storage
$token = $this->get($hash);
$data = array_merge_recursive($token, $data);
$sto... | php | public function update($hash = null, $data)
{
// If the hash is not received, get it from the request
$hash = $hash?: $this->app->request->token();
// Update the file in the tokens storage
$token = $this->get($hash);
$data = array_merge_recursive($token, $data);
$sto... | [
"public",
"function",
"update",
"(",
"$",
"hash",
"=",
"null",
",",
"$",
"data",
")",
"{",
"// If the hash is not received, get it from the request",
"$",
"hash",
"=",
"$",
"hash",
"?",
":",
"$",
"this",
"->",
"app",
"->",
"request",
"->",
"token",
"(",
")... | Updates a token
@param string $hash Token hash
@param array $data Data to store
@return Token data | [
"Updates",
"a",
"token"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Session/Tokens/FileTokens.php#L81-L93 | train |
nicodevs/laito | src/Laito/Session/Tokens/FileTokens.php | FileTokens.destroy | public function destroy($hash = null)
{
// If the hash is not received, get it from the request
$hash = $hash?: $this->app->request->token();
// Abort if the file does not exist
$path = $this->path($hash);
if (!file_exists($path)) {
return true;
}
... | php | public function destroy($hash = null)
{
// If the hash is not received, get it from the request
$hash = $hash?: $this->app->request->token();
// Abort if the file does not exist
$path = $this->path($hash);
if (!file_exists($path)) {
return true;
}
... | [
"public",
"function",
"destroy",
"(",
"$",
"hash",
"=",
"null",
")",
"{",
"// If the hash is not received, get it from the request",
"$",
"hash",
"=",
"$",
"hash",
"?",
":",
"$",
"this",
"->",
"app",
"->",
"request",
"->",
"token",
"(",
")",
";",
"// Abort i... | Destroys a token
@param string $hash Token hash
@return bool Success or failure | [
"Destroys",
"a",
"token"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Session/Tokens/FileTokens.php#L101-L120 | train |
TuumPHP/Web | src/Stack/Dispatcher.php | Dispatcher.prepare | private function prepare($route)
{
$this->route = $route;
$this->setBeforeFilter($route->before());
$this->setAfterRelease($route->after());
} | php | private function prepare($route)
{
$this->route = $route;
$this->setBeforeFilter($route->before());
$this->setAfterRelease($route->after());
} | [
"private",
"function",
"prepare",
"(",
"$",
"route",
")",
"{",
"$",
"this",
"->",
"route",
"=",
"$",
"route",
";",
"$",
"this",
"->",
"setBeforeFilter",
"(",
"$",
"route",
"->",
"before",
"(",
")",
")",
";",
"$",
"this",
"->",
"setAfterRelease",
"(",... | prepares before filters and after releases from route.
@param Route $route | [
"prepares",
"before",
"filters",
"and",
"after",
"releases",
"from",
"route",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Stack/Dispatcher.php#L78-L83 | train |
translationexchange/tml-php-clientsdk | library/Tr8n/LanguageContext.php | LanguageContext.fallbackRule | function fallbackRule() {
if (!isset($this->fallback_rule)) {
foreach($this->rules as $key => $rule) {
if ($rule->isFallback()) {
$this->fallback_rule = $rule;
}
}
}
return $this->fallback_rule;
} | php | function fallbackRule() {
if (!isset($this->fallback_rule)) {
foreach($this->rules as $key => $rule) {
if ($rule->isFallback()) {
$this->fallback_rule = $rule;
}
}
}
return $this->fallback_rule;
} | [
"function",
"fallbackRule",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fallback_rule",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"as",
"$",
"key",
"=>",
"$",
"rule",
")",
"{",
"if",
"(",
"$",
"rule",
"->",
... | Fallback rule usually has a key of "other", but that may not be necessary in all cases.
@return mixed | [
"Fallback",
"rule",
"usually",
"has",
"a",
"key",
"of",
"other",
"but",
"that",
"may",
"not",
"be",
"necessary",
"in",
"all",
"cases",
"."
] | fe51473824e62cfd883c6aa0c6a3783a16ce8425 | https://github.com/translationexchange/tml-php-clientsdk/blob/fe51473824e62cfd883c6aa0c6a3783a16ce8425/library/Tr8n/LanguageContext.php#L119-L129 | train |
sokil/CommandBusBundle | src/CommandBus/CommandHandlerServiceResolver.php | CommandHandlerServiceResolver.get | public function get($handlerServiceId)
{
$handler = $this->container->get($handlerServiceId);
if (!$handler instanceof CommandHandlerInterface) {
throw new \InvalidArgumentException('Handler must be instance if ' . CommandHandlerInterface::class);
}
return $handler;
... | php | public function get($handlerServiceId)
{
$handler = $this->container->get($handlerServiceId);
if (!$handler instanceof CommandHandlerInterface) {
throw new \InvalidArgumentException('Handler must be instance if ' . CommandHandlerInterface::class);
}
return $handler;
... | [
"public",
"function",
"get",
"(",
"$",
"handlerServiceId",
")",
"{",
"$",
"handler",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"$",
"handlerServiceId",
")",
";",
"if",
"(",
"!",
"$",
"handler",
"instanceof",
"CommandHandlerInterface",
")",
"{"... | Get command handler
@param string $handlerServiceId
@return CommandHandlerInterface | [
"Get",
"command",
"handler"
] | 7cfdd5f1e8a77f0620b94dd5214091a2159a143d | https://github.com/sokil/CommandBusBundle/blob/7cfdd5f1e8a77f0620b94dd5214091a2159a143d/src/CommandBus/CommandHandlerServiceResolver.php#L30-L39 | train |
eureka-framework/component-cache | src/Cache/CacheFactory.php | CacheFactory.engine | protected static function engine()
{
$engine = '';
foreach (static::$engines as $name => $function) {
if ($function === null || function_exists($function)) {
$engine = $name;
break;
}
}
return $engine;
} | php | protected static function engine()
{
$engine = '';
foreach (static::$engines as $name => $function) {
if ($function === null || function_exists($function)) {
$engine = $name;
break;
}
}
return $engine;
} | [
"protected",
"static",
"function",
"engine",
"(",
")",
"{",
"$",
"engine",
"=",
"''",
";",
"foreach",
"(",
"static",
"::",
"$",
"engines",
"as",
"$",
"name",
"=>",
"$",
"function",
")",
"{",
"if",
"(",
"$",
"function",
"===",
"null",
"||",
"function_... | Get name of php Cache engine used.
@return string engine | [
"Get",
"name",
"of",
"php",
"Cache",
"engine",
"used",
"."
] | c110441ac7bb20edd2ecd8162f4302596d875785 | https://github.com/eureka-framework/component-cache/blob/c110441ac7bb20edd2ecd8162f4302596d875785/src/Cache/CacheFactory.php#L36-L48 | train |
eureka-framework/component-cache | src/Cache/CacheFactory.php | CacheFactory.build | public static function build($engine = null, $namespace = '\Eureka\Component\Cache')
{
if (null === $engine) {
$engine = static::engine();
}
if (empty(static::$instances[$engine])) {
$class = $namespace . '\\' . 'CacheWrapper' . $engine;
s... | php | public static function build($engine = null, $namespace = '\Eureka\Component\Cache')
{
if (null === $engine) {
$engine = static::engine();
}
if (empty(static::$instances[$engine])) {
$class = $namespace . '\\' . 'CacheWrapper' . $engine;
s... | [
"public",
"static",
"function",
"build",
"(",
"$",
"engine",
"=",
"null",
",",
"$",
"namespace",
"=",
"'\\Eureka\\Component\\Cache'",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"engine",
")",
"{",
"$",
"engine",
"=",
"static",
"::",
"engine",
"(",
")",
"... | Instantiate Cache Wrapper object & return it.
@param string $engine Class name of the engine to use.
@param string $namespace
@return CacheWrapperAbstract | [
"Instantiate",
"Cache",
"Wrapper",
"object",
"&",
"return",
"it",
"."
] | c110441ac7bb20edd2ecd8162f4302596d875785 | https://github.com/eureka-framework/component-cache/blob/c110441ac7bb20edd2ecd8162f4302596d875785/src/Cache/CacheFactory.php#L58-L70 | train |
Kris-Kuiper/sFire-Framework | src/Translation/Translation.php | Translation.translate | public static function translate($key, $params = [], $language = null, Viewmodel $viewmodel = null) {
$identifier = null;
if(null !== $viewmodel) {
$identifier = static :: load($viewmodel);
}
if(null === $key) {
$key = '';
}
//Check if key is a string
if(false === is_string($key))... | php | public static function translate($key, $params = [], $language = null, Viewmodel $viewmodel = null) {
$identifier = null;
if(null !== $viewmodel) {
$identifier = static :: load($viewmodel);
}
if(null === $key) {
$key = '';
}
//Check if key is a string
if(false === is_string($key))... | [
"public",
"static",
"function",
"translate",
"(",
"$",
"key",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"language",
"=",
"null",
",",
"Viewmodel",
"$",
"viewmodel",
"=",
"null",
")",
"{",
"$",
"identifier",
"=",
"null",
";",
"if",
"(",
"null",
"... | Translate text based on a key
@param string $key
@param array $params
@param string $language
@param sFire\MVC\Viewmodel $viewmodel
@return string | [
"Translate",
"text",
"based",
"on",
"a",
"key"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Translation/Translation.php#L41-L94 | train |
Kris-Kuiper/sFire-Framework | src/Translation/Translation.php | Translation.load | public static function load($source) {
if(false === is_string($source) && false === $source instanceof Viewmodel) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or instance of sFire\MVC\Viewmodel, "%s" given', __METHOD__, gettype($source)), E_USER_ERROR);
}
$file =... | php | public static function load($source) {
if(false === is_string($source) && false === $source instanceof Viewmodel) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or instance of sFire\MVC\Viewmodel, "%s" given', __METHOD__, gettype($source)), E_USER_ERROR);
}
$file =... | [
"public",
"static",
"function",
"load",
"(",
"$",
"source",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"source",
")",
"&&",
"false",
"===",
"$",
"source",
"instanceof",
"Viewmodel",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(... | Loads a new translation file
@param string|sFire\MVC\Viewmodel $source
@return string | [
"Loads",
"a",
"new",
"translation",
"file"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Translation/Translation.php#L102-L135 | train |
Kris-Kuiper/sFire-Framework | src/Translation/Translation.php | Translation.cache | private static function cache(File $cache, File $file) {
if(false === isset(static :: $translations[$cache -> entity() -> getName()])) {
$parse = true;
if(true === $cache -> exists()) {
if($cache -> entity() -> getModificationTime() >= $file -> entity() -> getModificationTime()) {
$par... | php | private static function cache(File $cache, File $file) {
if(false === isset(static :: $translations[$cache -> entity() -> getName()])) {
$parse = true;
if(true === $cache -> exists()) {
if($cache -> entity() -> getModificationTime() >= $file -> entity() -> getModificationTime()) {
$par... | [
"private",
"static",
"function",
"cache",
"(",
"File",
"$",
"cache",
",",
"File",
"$",
"file",
")",
"{",
"if",
"(",
"false",
"===",
"isset",
"(",
"static",
"::",
"$",
"translations",
"[",
"$",
"cache",
"->",
"entity",
"(",
")",
"->",
"getName",
"(",
... | Returns cache if exists, otherwise the translation cache file is created, filled with content and returned
@param sFire\System\File $cache
@param sFire\System\File $file | [
"Returns",
"cache",
"if",
"exists",
"otherwise",
"the",
"translation",
"cache",
"file",
"is",
"created",
"filled",
"with",
"content",
"and",
"returned"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Translation/Translation.php#L166-L188 | train |
Kris-Kuiper/sFire-Framework | src/Translation/Translation.php | Translation.parse | private static function parse(File $file) {
$lines = explode("\n", $file -> getContent());
$languages = [];
foreach($lines as $index => $line) {
$line = trim($line);
if('' === $line) {
continue;
}
//Check for language format
preg_match('#^\[([a-z_\-0-9]+)\]#i', $line, $... | php | private static function parse(File $file) {
$lines = explode("\n", $file -> getContent());
$languages = [];
foreach($lines as $index => $line) {
$line = trim($line);
if('' === $line) {
continue;
}
//Check for language format
preg_match('#^\[([a-z_\-0-9]+)\]#i', $line, $... | [
"private",
"static",
"function",
"parse",
"(",
"File",
"$",
"file",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"file",
"->",
"getContent",
"(",
")",
")",
";",
"$",
"languages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"lines"... | Parses a translation file and converts it into an array
@param sFire\System\File $file
@return array | [
"Parses",
"a",
"translation",
"file",
"and",
"converts",
"it",
"into",
"an",
"array"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Translation/Translation.php#L196-L236 | train |
itkg/core | src/Itkg/Core/Command/DatabaseUpdate/ReleaseChecker.php | ReleaseChecker.check | public function check(array $scripts, array $rollbacks)
{
$this->checkScripts($scripts, $rollbacks);
foreach ($scripts as $k => $script) {
$this->checkScript($script, $rollbacks[$k]);
}
} | php | public function check(array $scripts, array $rollbacks)
{
$this->checkScripts($scripts, $rollbacks);
foreach ($scripts as $k => $script) {
$this->checkScript($script, $rollbacks[$k]);
}
} | [
"public",
"function",
"check",
"(",
"array",
"$",
"scripts",
",",
"array",
"$",
"rollbacks",
")",
"{",
"$",
"this",
"->",
"checkScripts",
"(",
"$",
"scripts",
",",
"$",
"rollbacks",
")",
";",
"foreach",
"(",
"$",
"scripts",
"as",
"$",
"k",
"=>",
"$",... | Check a release scripts & rollbacks
and each script separately
@param array $scripts
@param array $rollbacks
@throws \RuntimeException
@throws \LogicException
@throws \InvalidArgumentException | [
"Check",
"a",
"release",
"scripts",
"&",
"rollbacks",
"and",
"each",
"script",
"separately"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseUpdate/ReleaseChecker.php#L35-L43 | train |
bandama-framework/bandama-framework | src/Configuration.php | Configuration.get | public function get($key) {
if (isset($this->settings[$key])) {
return $this->settings[$key];
}
return null;
} | php | public function get($key) {
if (isset($this->settings[$key])) {
return $this->settings[$key];
}
return null;
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"settings",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"settings",
"[",
"$",
"key",
"]",
";",
"}",
"return",
"null",
";",... | Get configuration parameter by key if exists else return null
@return mixed | [
"Get",
"configuration",
"parameter",
"by",
"key",
"if",
"exists",
"else",
"return",
"null"
] | 234ed703baf9e31268941c9d5f6d5e004cc53066 | https://github.com/bandama-framework/bandama-framework/blob/234ed703baf9e31268941c9d5f6d5e004cc53066/src/Configuration.php#L54-L60 | train |
gplcart/cli | controllers/commands/FieldValue.php | FieldValue.cmdGetFieldValue | public function cmdGetFieldValue()
{
$result = $this->getListFieldValue();
$this->outputFormat($result);
$this->outputFormatTableFieldValue($result);
$this->output();
} | php | public function cmdGetFieldValue()
{
$result = $this->getListFieldValue();
$this->outputFormat($result);
$this->outputFormatTableFieldValue($result);
$this->output();
} | [
"public",
"function",
"cmdGetFieldValue",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListFieldValue",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableFieldValue",
"(",
"$",... | Callback for "field-value-get" command | [
"Callback",
"for",
"field",
"-",
"value",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/FieldValue.php#L40-L46 | train |
gplcart/cli | controllers/commands/FieldValue.php | FieldValue.cmdDeleteFieldValue | public function cmdDeleteFieldValue()
{
$id = $this->getParam(0);
if (empty($id) || !is_numeric($id)) {
$this->errorAndExit($this->text('Invalid command'));
}
if ($this->getParam('field')) {
$deleted = $count = 0;
foreach ($this->field_value->get... | php | public function cmdDeleteFieldValue()
{
$id = $this->getParam(0);
if (empty($id) || !is_numeric($id)) {
$this->errorAndExit($this->text('Invalid command'));
}
if ($this->getParam('field')) {
$deleted = $count = 0;
foreach ($this->field_value->get... | [
"public",
"function",
"cmdDeleteFieldValue",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
"||",
"!",
"is_numeric",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"... | Callback for "field-value-delete" command | [
"Callback",
"for",
"field",
"-",
"value",
"-",
"delete",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/FieldValue.php#L51-L77 | train |
gplcart/cli | controllers/commands/FieldValue.php | FieldValue.cmdUpdateFieldValue | public function cmdUpdateFieldValue()
{
$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 cmdUpdateFieldValue()
{
$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",
"cmdUpdateFieldValue",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{",
... | Callback for "field-value-update" command | [
"Callback",
"for",
"field",
"-",
"value",
"-",
"update",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/FieldValue.php#L96-L114 | train |
gplcart/cli | controllers/commands/FieldValue.php | FieldValue.getListFieldValue | protected function getListFieldValue()
{
$id = $this->getParam(0);
if (!isset($id)) {
return $this->field_value->getList(array('limit' => $this->getLimit()));
}
if ($this->getParam('field')) {
return $this->field_value->getList(array('field_id' => $id, 'limi... | php | protected function getListFieldValue()
{
$id = $this->getParam(0);
if (!isset($id)) {
return $this->field_value->getList(array('limit' => $this->getLimit()));
}
if ($this->getParam('field')) {
return $this->field_value->getList(array('field_id' => $id, 'limi... | [
"protected",
"function",
"getListFieldValue",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"field_value",
"->",
"getList",
"("... | Returns an array of field values
@return array | [
"Returns",
"an",
"array",
"of",
"field",
"values"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/FieldValue.php#L120-L143 | train |
gplcart/cli | controllers/commands/FieldValue.php | FieldValue.addFieldValue | protected function addFieldValue()
{
if (!$this->isError()) {
$id = $this->field_value->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | php | protected function addFieldValue()
{
if (!$this->isError()) {
$id = $this->field_value->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | [
"protected",
"function",
"addFieldValue",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"field_value",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
";",
... | Add a new field value | [
"Add",
"a",
"new",
"field",
"value"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/FieldValue.php#L177-L186 | train |
gplcart/cli | controllers/commands/FieldValue.php | FieldValue.submitAddFieldValue | protected function submitAddFieldValue()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('field_value');
$this->addFieldValue();
} | php | protected function submitAddFieldValue()
{
$this->setSubmitted(null, $this->getParam());
$this->validateComponent('field_value');
$this->addFieldValue();
} | [
"protected",
"function",
"submitAddFieldValue",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"validateComponent",
"(",
"'field_value'",
")",
";",
"$",
"this",
"-... | Add a new field value at once | [
"Add",
"a",
"new",
"field",
"value",
"at",
"once"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/FieldValue.php#L202-L207 | train |
gplcart/cli | controllers/commands/FieldValue.php | FieldValue.wizardAddFieldValue | protected function wizardAddFieldValue()
{
// Required
$this->validatePrompt('title', $this->text('Title'), 'field_value');
$this->validatePrompt('field_id', $this->text('Field ID'), 'field_value');
// Optional
$this->validatePrompt('color', $this->text('Color'), 'field_valu... | php | protected function wizardAddFieldValue()
{
// Required
$this->validatePrompt('title', $this->text('Title'), 'field_value');
$this->validatePrompt('field_id', $this->text('Field ID'), 'field_value');
// Optional
$this->validatePrompt('color', $this->text('Color'), 'field_valu... | [
"protected",
"function",
"wizardAddFieldValue",
"(",
")",
"{",
"// Required",
"$",
"this",
"->",
"validatePrompt",
"(",
"'title'",
",",
"$",
"this",
"->",
"text",
"(",
"'Title'",
")",
",",
"'field_value'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
"(",
... | Add a new field value step by step | [
"Add",
"a",
"new",
"field",
"value",
"step",
"by",
"step"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/FieldValue.php#L212-L224 | train |
Dhii/stringable-helper-base | src/StringableJoinCapableTrait.php | StringableJoinCapableTrait._stringableJoin | protected function _stringableJoin($parts, $delim)
{
$parts = $this->_normalizeIterable($parts);
$i = 0;
$result = '';
foreach ($parts as $_part) {
try {
$_part = $this->_normalizeString($_part);
} catch (InvalidArgumentException $e) {
... | php | protected function _stringableJoin($parts, $delim)
{
$parts = $this->_normalizeIterable($parts);
$i = 0;
$result = '';
foreach ($parts as $_part) {
try {
$_part = $this->_normalizeString($_part);
} catch (InvalidArgumentException $e) {
... | [
"protected",
"function",
"_stringableJoin",
"(",
"$",
"parts",
",",
"$",
"delim",
")",
"{",
"$",
"parts",
"=",
"$",
"this",
"->",
"_normalizeIterable",
"(",
"$",
"parts",
")",
";",
"$",
"i",
"=",
"0",
";",
"$",
"result",
"=",
"''",
";",
"foreach",
... | Joins a list of parts using a delimiter.
@param array|stdClass|Traversable $parts The list of parts to join.
@param string|Stringable $delim The delimiter to use for joining.
@throws InvalidArgumentException If the list of parts or the delimiter is invalid.
@throws OutOfRangeException If one of the part... | [
"Joins",
"a",
"list",
"of",
"parts",
"using",
"a",
"delimiter",
"."
] | 904254409800710665135a751659b59d140a2b40 | https://github.com/Dhii/stringable-helper-base/blob/904254409800710665135a751659b59d140a2b40/src/StringableJoinCapableTrait.php#L30-L51 | train |
Subscribo/dependencyresolver | src/Subscribo/DependencyResolver/DependencyResolver.php | DependencyResolver.reorder | public static function reorder(array $data, array $order, $throwExceptionIfKeyNotFound = false, $throwExceptionIfExtraData = false) {
$result = array();
foreach($order as $orderedKey) {
if (array_key_exists($orderedKey, $data)) {
$result[$orderedKey] = $data[$orderedKey];
... | php | public static function reorder(array $data, array $order, $throwExceptionIfKeyNotFound = false, $throwExceptionIfExtraData = false) {
$result = array();
foreach($order as $orderedKey) {
if (array_key_exists($orderedKey, $data)) {
$result[$orderedKey] = $data[$orderedKey];
... | [
"public",
"static",
"function",
"reorder",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"order",
",",
"$",
"throwExceptionIfKeyNotFound",
"=",
"false",
",",
"$",
"throwExceptionIfExtraData",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
"... | Orders data based on order of values in order array
@param array $data
@param array $order
@param bool $throwExceptionIfKeyNotFound
@param bool $throwExceptionIfExtraData
@return array
@throws \Subscribo\DependencyResolver\KeyNotFoundException may be thrown, if key is not found in data
@throws \Subscribo\DependencyRes... | [
"Orders",
"data",
"based",
"on",
"order",
"of",
"values",
"in",
"order",
"array"
] | c345569ca497b6d7e2ade4a93eb19bb535b8b857 | https://github.com/Subscribo/dependencyresolver/blob/c345569ca497b6d7e2ade4a93eb19bb535b8b857/src/Subscribo/DependencyResolver/DependencyResolver.php#L89-L109 | train |
rawphp/RawBase | lib/Model.php | Model.init | public function init( $config = NULL )
{
parent::init( $config );
if ( isset( $config[ 'id' ] ) )
{
$this->id = ( int )$config[ 'id' ];
}
$this->doAction( self::ON_MODEL_INIT_ACTION );
} | php | public function init( $config = NULL )
{
parent::init( $config );
if ( isset( $config[ 'id' ] ) )
{
$this->id = ( int )$config[ 'id' ];
}
$this->doAction( self::ON_MODEL_INIT_ACTION );
} | [
"public",
"function",
"init",
"(",
"$",
"config",
"=",
"NULL",
")",
"{",
"parent",
"::",
"init",
"(",
"$",
"config",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"(",
"int",
... | Initialises the model.
@param array $config configuration array
@action ON_MODEL_INIT_ACTION | [
"Initialises",
"the",
"model",
"."
] | 509843f6338bbd8323b685d0ed5e80717a54c2ff | https://github.com/rawphp/RawBase/blob/509843f6338bbd8323b685d0ed5e80717a54c2ff/lib/Model.php#L61-L71 | train |
prolic/HumusMvc | src/HumusMvc/Navigation/Service/NavigationFactory.php | NavigationFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Config');
$navigationConfig = $config['navigation'];
$navigation = new Navigation($navigationConfig);
return $navigation;
} | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Config');
$navigationConfig = $config['navigation'];
$navigation = new Navigation($navigationConfig);
return $navigation;
} | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"'Config'",
")",
";",
"$",
"navigationConfig",
"=",
"$",
"config",
"[",
"'navigation'",
"]",
";... | Create navigation service
@param ServiceLocatorInterface $serviceLocator
@return Navigation | [
"Create",
"navigation",
"service"
] | 09e8c6422d84b57745cc643047e10761be2a21a7 | https://github.com/prolic/HumusMvc/blob/09e8c6422d84b57745cc643047e10761be2a21a7/src/HumusMvc/Navigation/Service/NavigationFactory.php#L38-L44 | train |
eureka-framework/component-orm | src/Orm/Column.php | Column.getProperty | public function getProperty()
{
return '
/**
* @var ' . $this->getType()->getType() . ' $' . $this->getPropertyName() . '
*/
protected $' . $this->getPropertyName() . ' = ' . $this->getDefault(true) . ';';
} | php | public function getProperty()
{
return '
/**
* @var ' . $this->getType()->getType() . ' $' . $this->getPropertyName() . '
*/
protected $' . $this->getPropertyName() . ' = ' . $this->getDefault(true) . ';';
} | [
"public",
"function",
"getProperty",
"(",
")",
"{",
"return",
"'\n /**\n * @var '",
".",
"$",
"this",
"->",
"getType",
"(",
")",
"->",
"getType",
"(",
")",
".",
"' $'",
".",
"$",
"this",
"->",
"getPropertyName",
"(",
")",
".",
"'\n */\n protect... | Get property declaration.
@return string | [
"Get",
"property",
"declaration",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Column.php#L78-L85 | train |
eureka-framework/component-orm | src/Orm/Column.php | Column.getGetter | public function getGetter()
{
return '
/**
* Get value for field "' . $this->getName() . '"
*
* @return ' . $this->getType()->getType() . '
*/
public function ' . $this->getMethodNameGet() . '()
{
return $this->' . $this->getPropertyName() . ';
}';
} | php | public function getGetter()
{
return '
/**
* Get value for field "' . $this->getName() . '"
*
* @return ' . $this->getType()->getType() . '
*/
public function ' . $this->getMethodNameGet() . '()
{
return $this->' . $this->getPropertyName() . ';
}';
} | [
"public",
"function",
"getGetter",
"(",
")",
"{",
"return",
"'\n /**\n * Get value for field \"'",
".",
"$",
"this",
"->",
"getName",
"(",
")",
".",
"'\"\n *\n * @return '",
".",
"$",
"this",
"->",
"getType",
"(",
")",
"->",
"getType",
"(",
")",
... | Get method getter.
@return string | [
"Get",
"method",
"getter",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Column.php#L92-L104 | train |
eureka-framework/component-orm | src/Orm/Column.php | Column.getSetter | public function getSetter()
{
$varname = '$' . $this->getPropertyName();
$autoinc = '';
$cast = $this->getType()->getCastMethod() . ' ';
if ($this->isNullable()) {
$forceCast = $varname . ' = (' . $varname . ' === null ? ' . $varname . ' : ' . $cast . $varname . ');';... | php | public function getSetter()
{
$varname = '$' . $this->getPropertyName();
$autoinc = '';
$cast = $this->getType()->getCastMethod() . ' ';
if ($this->isNullable()) {
$forceCast = $varname . ' = (' . $varname . ' === null ? ' . $varname . ' : ' . $cast . $varname . ');';... | [
"public",
"function",
"getSetter",
"(",
")",
"{",
"$",
"varname",
"=",
"'$'",
".",
"$",
"this",
"->",
"getPropertyName",
"(",
")",
";",
"$",
"autoinc",
"=",
"''",
";",
"$",
"cast",
"=",
"$",
"this",
"->",
"getType",
"(",
")",
"->",
"getCastMethod",
... | Get method setter.
@return string | [
"Get",
"method",
"setter",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Column.php#L111-L159 | train |
eureka-framework/component-orm | src/Orm/Column.php | Column.getName | public function getName($withoutPrefix = false)
{
$name = $this->name;
if ($withoutPrefix && stripos($name, $this->dbPrefix) === 0) {
$name = substr($name, strlen($this->dbPrefix));
}
return $name;
} | php | public function getName($withoutPrefix = false)
{
$name = $this->name;
if ($withoutPrefix && stripos($name, $this->dbPrefix) === 0) {
$name = substr($name, strlen($this->dbPrefix));
}
return $name;
} | [
"public",
"function",
"getName",
"(",
"$",
"withoutPrefix",
"=",
"false",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"name",
";",
"if",
"(",
"$",
"withoutPrefix",
"&&",
"stripos",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"dbPrefix",
")",
"===",
... | Get name.
Can remove table prefix.
@param bool $withoutPrefix
@return string | [
"Get",
"name",
".",
"Can",
"remove",
"table",
"prefix",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Column.php#L168-L176 | train |
eureka-framework/component-orm | src/Orm/Column.php | Column.setData | protected function setData(\stdClass $column)
{
$this->setName($column->Field);
$this->setIsPrimaryKey(($column->Key === 'PRI'));
$this->setIsKey(!empty($column->Key));
$this->setType($column->Type);
$this->setIsNullable(($column->Null === 'YES'));
$this->setDefault($... | php | protected function setData(\stdClass $column)
{
$this->setName($column->Field);
$this->setIsPrimaryKey(($column->Key === 'PRI'));
$this->setIsKey(!empty($column->Key));
$this->setType($column->Type);
$this->setIsNullable(($column->Null === 'YES'));
$this->setDefault($... | [
"protected",
"function",
"setData",
"(",
"\\",
"stdClass",
"$",
"column",
")",
"{",
"$",
"this",
"->",
"setName",
"(",
"$",
"column",
"->",
"Field",
")",
";",
"$",
"this",
"->",
"setIsPrimaryKey",
"(",
"(",
"$",
"column",
"->",
"Key",
"===",
"'PRI'",
... | Set column data from db query
@param \stdClass $column
@return self | [
"Set",
"column",
"data",
"from",
"db",
"query"
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Column.php#L264-L275 | train |
eureka-framework/component-orm | src/Orm/Column.php | Column.getMethodNameGet | public function getMethodNameGet()
{
$methodName = str_replace(' ', '', ucwords(str_replace(array(
'_is_', '_has_', '_in_', '_',
), ' ', strtolower($this->getName(true)))));
$type = $this->getType();
switch (true) {
case ($type instanceof Type\TypeBool) && s... | php | public function getMethodNameGet()
{
$methodName = str_replace(' ', '', ucwords(str_replace(array(
'_is_', '_has_', '_in_', '_',
), ' ', strtolower($this->getName(true)))));
$type = $this->getType();
switch (true) {
case ($type instanceof Type\TypeBool) && s... | [
"public",
"function",
"getMethodNameGet",
"(",
")",
"{",
"$",
"methodName",
"=",
"str_replace",
"(",
"' '",
",",
"''",
",",
"ucwords",
"(",
"str_replace",
"(",
"array",
"(",
"'_is_'",
",",
"'_has_'",
",",
"'_in_'",
",",
"'_'",
",",
")",
",",
"' '",
","... | Get method name for getter.
@return string | [
"Get",
"method",
"name",
"for",
"getter",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Column.php#L302-L326 | train |
eureka-framework/component-orm | src/Orm/Column.php | Column.setExtra | protected function setExtra($extra)
{
if (empty($extra)) {
return $this;
}
switch ($extra) {
case 'auto_increment':
$this->isAutoIncrement = true;
break;
}
return $this;
} | php | protected function setExtra($extra)
{
if (empty($extra)) {
return $this;
}
switch ($extra) {
case 'auto_increment':
$this->isAutoIncrement = true;
break;
}
return $this;
} | [
"protected",
"function",
"setExtra",
"(",
"$",
"extra",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"extra",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"switch",
"(",
"$",
"extra",
")",
"{",
"case",
"'auto_increment'",
":",
"$",
"this",
"->",
"isA... | Set extra info.
@param string $extra
@return self | [
"Set",
"extra",
"info",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Column.php#L430-L443 | train |
eureka-framework/component-orm | src/Orm/Column.php | Column.getCheck | protected function getCheck()
{
$check = array(0 => '', 1 => '');
$type = $this->getType();
switch ($type->getType()) {
case 'int':
case 'float':
if ($type->isUnsigned()) {
$check[1] = '\UnderflowException';
$c... | php | protected function getCheck()
{
$check = array(0 => '', 1 => '');
$type = $this->getType();
switch ($type->getType()) {
case 'int':
case 'float':
if ($type->isUnsigned()) {
$check[1] = '\UnderflowException';
$c... | [
"protected",
"function",
"getCheck",
"(",
")",
"{",
"$",
"check",
"=",
"array",
"(",
"0",
"=>",
"''",
",",
"1",
"=>",
"''",
")",
";",
"$",
"type",
"=",
"$",
"this",
"->",
"getType",
"(",
")",
";",
"switch",
"(",
"$",
"type",
"->",
"getType",
"(... | Get check condition for numeric values & underflow if necessary.
@return string | [
"Get",
"check",
"condition",
"for",
"numeric",
"values",
"&",
"underflow",
"if",
"necessary",
"."
] | bce48121d26c4e923534f9dc70da597634184316 | https://github.com/eureka-framework/component-orm/blob/bce48121d26c4e923534f9dc70da597634184316/src/Orm/Column.php#L450-L469 | train |
SimpleAPI/Core | sources/Router.php | Router.run | public function run($url = null, $method = null)
{
$route = $this->altoRouter->match($url, $method);
if (!$route) {
throw new NotFoundException(((isset($_SERVER['REQUEST_URI']) && !empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : (($url != null) ? $url : "/")) . " is not reach... | php | public function run($url = null, $method = null)
{
$route = $this->altoRouter->match($url, $method);
if (!$route) {
throw new NotFoundException(((isset($_SERVER['REQUEST_URI']) && !empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : (($url != null) ? $url : "/")) . " is not reach... | [
"public",
"function",
"run",
"(",
"$",
"url",
"=",
"null",
",",
"$",
"method",
"=",
"null",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"altoRouter",
"->",
"match",
"(",
"$",
"url",
",",
"$",
"method",
")",
";",
"if",
"(",
"!",
"$",
"route"... | This function runs the router and call the apropriate | [
"This",
"function",
"runs",
"the",
"router",
"and",
"call",
"the",
"apropriate"
] | 4545f1e8f2242832d4b3dc9bb59541a086a01188 | https://github.com/SimpleAPI/Core/blob/4545f1e8f2242832d4b3dc9bb59541a086a01188/sources/Router.php#L94-L114 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.filterByFiles | public function filterByFiles($files = null, $comparison = null)
{
if (is_array($files)) {
$useMinMax = false;
if (isset($files['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_FILES, $files['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | php | public function filterByFiles($files = null, $comparison = null)
{
if (is_array($files)) {
$useMinMax = false;
if (isset($files['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_FILES, $files['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | [
"public",
"function",
"filterByFiles",
"(",
"$",
"files",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"files",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"files... | Filter the query on the files column
Example usage:
<code>
$query->filterByFiles(1234); // WHERE files = 1234
$query->filterByFiles(array(12, 34)); // WHERE files IN (12, 34)
$query->filterByFiles(array('min' => 12)); // WHERE files > 12
</code>
@param mixed $files The value to use as filter.
Use scalar values fo... | [
"Filter",
"the",
"query",
"on",
"the",
"files",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L501-L522 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.filterBySubcats | public function filterBySubcats($subcats = null, $comparison = null)
{
if (is_array($subcats)) {
$useMinMax = false;
if (isset($subcats['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_SUBCATS, $subcats['min'], Criteria::GREATER_EQUAL);
$useMinMax... | php | public function filterBySubcats($subcats = null, $comparison = null)
{
if (is_array($subcats)) {
$useMinMax = false;
if (isset($subcats['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_SUBCATS, $subcats['min'], Criteria::GREATER_EQUAL);
$useMinMax... | [
"public",
"function",
"filterBySubcats",
"(",
"$",
"subcats",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"subcats",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
... | Filter the query on the subcats column
Example usage:
<code>
$query->filterBySubcats(1234); // WHERE subcats = 1234
$query->filterBySubcats(array(12, 34)); // WHERE subcats IN (12, 34)
$query->filterBySubcats(array('min' => 12)); // WHERE subcats > 12
</code>
@param mixed $subcats The value to use as filter.
Use ... | [
"Filter",
"the",
"query",
"on",
"the",
"subcats",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L542-L563 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.filterBySize | public function filterBySize($size = null, $comparison = null)
{
if (is_array($size)) {
$useMinMax = false;
if (isset($size['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_SIZE, $size['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | php | public function filterBySize($size = null, $comparison = null)
{
if (is_array($size)) {
$useMinMax = false;
if (isset($size['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_SIZE, $size['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | [
"public",
"function",
"filterBySize",
"(",
"$",
"size",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"size",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"size",
... | Filter the query on the size column
Example usage:
<code>
$query->filterBySize(1234); // WHERE size = 1234
$query->filterBySize(array(12, 34)); // WHERE size IN (12, 34)
$query->filterBySize(array('min' => 12)); // WHERE size > 12
</code>
@param mixed $size The value to use as filter.
Use scalar values for equali... | [
"Filter",
"the",
"query",
"on",
"the",
"size",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L624-L645 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.filterByHidden | public function filterByHidden($hidden = null, $comparison = null)
{
if (is_string($hidden)) {
$hidden = in_array(strtolower($hidden), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CategoryTableMap::COL_HIDDEN, $hidden, $comparison... | php | public function filterByHidden($hidden = null, $comparison = null)
{
if (is_string($hidden)) {
$hidden = in_array(strtolower($hidden), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CategoryTableMap::COL_HIDDEN, $hidden, $comparison... | [
"public",
"function",
"filterByHidden",
"(",
"$",
"hidden",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"hidden",
")",
")",
"{",
"$",
"hidden",
"=",
"in_array",
"(",
"strtolower",
"(",
"$",
"hidden",
... | Filter the query on the hidden column
Example usage:
<code>
$query->filterByHidden(true); // WHERE hidden = true
$query->filterByHidden('yes'); // WHERE hidden = true
</code>
@param boolean|string $hidden The value to use as filter.
Non-boolean arguments are converted using the following rules:
* 1, '1', 'true', ... | [
"Filter",
"the",
"query",
"on",
"the",
"hidden",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L665-L672 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.filterByTreeLeft | public function filterByTreeLeft($treeLeft = null, $comparison = null)
{
if (is_array($treeLeft)) {
$useMinMax = false;
if (isset($treeLeft['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_TREE_LEFT, $treeLeft['min'], Criteria::GREATER_EQUAL);
$us... | php | public function filterByTreeLeft($treeLeft = null, $comparison = null)
{
if (is_array($treeLeft)) {
$useMinMax = false;
if (isset($treeLeft['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_TREE_LEFT, $treeLeft['min'], Criteria::GREATER_EQUAL);
$us... | [
"public",
"function",
"filterByTreeLeft",
"(",
"$",
"treeLeft",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"treeLeft",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",... | Filter the query on the tree_left column
Example usage:
<code>
$query->filterByTreeLeft(1234); // WHERE tree_left = 1234
$query->filterByTreeLeft(array(12, 34)); // WHERE tree_left IN (12, 34)
$query->filterByTreeLeft(array('min' => 12)); // WHERE tree_left > 12
</code>
@param mixed $treeLeft The value to use as ... | [
"Filter",
"the",
"query",
"on",
"the",
"tree_left",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L778-L799 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.filterByTreeRight | public function filterByTreeRight($treeRight = null, $comparison = null)
{
if (is_array($treeRight)) {
$useMinMax = false;
if (isset($treeRight['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_TREE_RIGHT, $treeRight['min'], Criteria::GREATER_EQUAL);
... | php | public function filterByTreeRight($treeRight = null, $comparison = null)
{
if (is_array($treeRight)) {
$useMinMax = false;
if (isset($treeRight['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_TREE_RIGHT, $treeRight['min'], Criteria::GREATER_EQUAL);
... | [
"public",
"function",
"filterByTreeRight",
"(",
"$",
"treeRight",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"treeRight",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"... | Filter the query on the tree_right column
Example usage:
<code>
$query->filterByTreeRight(1234); // WHERE tree_right = 1234
$query->filterByTreeRight(array(12, 34)); // WHERE tree_right IN (12, 34)
$query->filterByTreeRight(array('min' => 12)); // WHERE tree_right > 12
</code>
@param mixed $treeRight The value to... | [
"Filter",
"the",
"query",
"on",
"the",
"tree_right",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L819-L840 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.filterByTreeLevel | public function filterByTreeLevel($treeLevel = null, $comparison = null)
{
if (is_array($treeLevel)) {
$useMinMax = false;
if (isset($treeLevel['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_TREE_LEVEL, $treeLevel['min'], Criteria::GREATER_EQUAL);
... | php | public function filterByTreeLevel($treeLevel = null, $comparison = null)
{
if (is_array($treeLevel)) {
$useMinMax = false;
if (isset($treeLevel['min'])) {
$this->addUsingAlias(CategoryTableMap::COL_TREE_LEVEL, $treeLevel['min'], Criteria::GREATER_EQUAL);
... | [
"public",
"function",
"filterByTreeLevel",
"(",
"$",
"treeLevel",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"treeLevel",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"... | Filter the query on the tree_level column
Example usage:
<code>
$query->filterByTreeLevel(1234); // WHERE tree_level = 1234
$query->filterByTreeLevel(array(12, 34)); // WHERE tree_level IN (12, 34)
$query->filterByTreeLevel(array('min' => 12)); // WHERE tree_level > 12
</code>
@param mixed $treeLevel The value to... | [
"Filter",
"the",
"query",
"on",
"the",
"tree_level",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L860-L881 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.filterBySource | public function filterBySource($source, $comparison = null)
{
if ($source instanceof \Attogram\SharedMedia\Orm\Source) {
return $this
->addUsingAlias(CategoryTableMap::COL_SOURCE_ID, $source->getId(), $comparison);
} elseif ($source instanceof ObjectCollection) {
... | php | public function filterBySource($source, $comparison = null)
{
if ($source instanceof \Attogram\SharedMedia\Orm\Source) {
return $this
->addUsingAlias(CategoryTableMap::COL_SOURCE_ID, $source->getId(), $comparison);
} elseif ($source instanceof ObjectCollection) {
... | [
"public",
"function",
"filterBySource",
"(",
"$",
"source",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"source",
"instanceof",
"\\",
"Attogram",
"\\",
"SharedMedia",
"\\",
"Orm",
"\\",
"Source",
")",
"{",
"return",
"$",
"this",
"->",
... | Filter the query by a related \Attogram\SharedMedia\Orm\Source object
@param \Attogram\SharedMedia\Orm\Source|ObjectCollection $source The related object(s) to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@throws \Propel\Runtime\Exception\PropelExcepti... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"Attogram",
"\\",
"SharedMedia",
"\\",
"Orm",
"\\",
"Source",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L893-L908 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.filterByC2M | public function filterByC2M($c2M, $comparison = null)
{
if ($c2M instanceof \Attogram\SharedMedia\Orm\C2M) {
return $this
->addUsingAlias(CategoryTableMap::COL_ID, $c2M->getCategoryId(), $comparison);
} elseif ($c2M instanceof ObjectCollection) {
return $this
... | php | public function filterByC2M($c2M, $comparison = null)
{
if ($c2M instanceof \Attogram\SharedMedia\Orm\C2M) {
return $this
->addUsingAlias(CategoryTableMap::COL_ID, $c2M->getCategoryId(), $comparison);
} elseif ($c2M instanceof ObjectCollection) {
return $this
... | [
"public",
"function",
"filterByC2M",
"(",
"$",
"c2M",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"c2M",
"instanceof",
"\\",
"Attogram",
"\\",
"SharedMedia",
"\\",
"Orm",
"\\",
"C2M",
")",
"{",
"return",
"$",
"this",
"->",
"addUsingA... | Filter the query by a related \Attogram\SharedMedia\Orm\C2M object
@param \Attogram\SharedMedia\Orm\C2M|ObjectCollection $c2M the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildCategoryQuery The current query, for fluid int... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"Attogram",
"\\",
"SharedMedia",
"\\",
"Orm",
"\\",
"C2M",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L968-L981 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.descendantsOf | public function descendantsOf(ChildCategory $category)
{
return $this
->addUsingAlias(ChildCategory::LEFT_COL, $category->getLeftValue(), Criteria::GREATER_THAN)
->addUsingAlias(ChildCategory::LEFT_COL, $category->getRightValue(), Criteria::LESS_THAN);
} | php | public function descendantsOf(ChildCategory $category)
{
return $this
->addUsingAlias(ChildCategory::LEFT_COL, $category->getLeftValue(), Criteria::GREATER_THAN)
->addUsingAlias(ChildCategory::LEFT_COL, $category->getRightValue(), Criteria::LESS_THAN);
} | [
"public",
"function",
"descendantsOf",
"(",
"ChildCategory",
"$",
"category",
")",
"{",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ChildCategory",
"::",
"LEFT_COL",
",",
"$",
"category",
"->",
"getLeftValue",
"(",
")",
",",
"Criteria",
"::",
"GREATER_... | Filter the query to restrict the result to descendants of an object
@param ChildCategory $category The object to use for descendant search
@return $this|ChildCategoryQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"to",
"restrict",
"the",
"result",
"to",
"descendants",
"of",
"an",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1258-L1263 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.childrenOf | public function childrenOf(ChildCategory $category)
{
return $this
->descendantsOf($category)
->addUsingAlias(ChildCategory::LEVEL_COL, $category->getLevel() + 1, Criteria::EQUAL);
} | php | public function childrenOf(ChildCategory $category)
{
return $this
->descendantsOf($category)
->addUsingAlias(ChildCategory::LEVEL_COL, $category->getLevel() + 1, Criteria::EQUAL);
} | [
"public",
"function",
"childrenOf",
"(",
"ChildCategory",
"$",
"category",
")",
"{",
"return",
"$",
"this",
"->",
"descendantsOf",
"(",
"$",
"category",
")",
"->",
"addUsingAlias",
"(",
"ChildCategory",
"::",
"LEVEL_COL",
",",
"$",
"category",
"->",
"getLevel"... | Filter the query to restrict the result to children of an object
@param ChildCategory $category The object to use for child search
@return $this|ChildCategoryQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"to",
"restrict",
"the",
"result",
"to",
"children",
"of",
"an",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1287-L1292 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.siblingsOf | public function siblingsOf(ChildCategory $category, ConnectionInterface $con = null)
{
if ($category->isRoot()) {
return $this->
add(ChildCategory::LEVEL_COL, '1<>1', Criteria::CUSTOM);
} else {
return $this
->childrenOf($category->getParent($c... | php | public function siblingsOf(ChildCategory $category, ConnectionInterface $con = null)
{
if ($category->isRoot()) {
return $this->
add(ChildCategory::LEVEL_COL, '1<>1', Criteria::CUSTOM);
} else {
return $this
->childrenOf($category->getParent($c... | [
"public",
"function",
"siblingsOf",
"(",
"ChildCategory",
"$",
"category",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"category",
"->",
"isRoot",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"add",
"(",
"ChildCateg... | Filter the query to restrict the result to siblings of an object.
The result does not include the object passed as parameter.
@param ChildCategory $category The object to use for sibling search
@param ConnectionInterface $con Connection to use.
@return $this|ChildCategoryQuery The current query, for fluid... | [
"Filter",
"the",
"query",
"to",
"restrict",
"the",
"result",
"to",
"siblings",
"of",
"an",
"object",
".",
"The",
"result",
"does",
"not",
"include",
"the",
"object",
"passed",
"as",
"parameter",
"."
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1303-L1313 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.ancestorsOf | public function ancestorsOf(ChildCategory $category)
{
return $this
->addUsingAlias(ChildCategory::LEFT_COL, $category->getLeftValue(), Criteria::LESS_THAN)
->addUsingAlias(ChildCategory::RIGHT_COL, $category->getRightValue(), Criteria::GREATER_THAN);
} | php | public function ancestorsOf(ChildCategory $category)
{
return $this
->addUsingAlias(ChildCategory::LEFT_COL, $category->getLeftValue(), Criteria::LESS_THAN)
->addUsingAlias(ChildCategory::RIGHT_COL, $category->getRightValue(), Criteria::GREATER_THAN);
} | [
"public",
"function",
"ancestorsOf",
"(",
"ChildCategory",
"$",
"category",
")",
"{",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ChildCategory",
"::",
"LEFT_COL",
",",
"$",
"category",
"->",
"getLeftValue",
"(",
")",
",",
"Criteria",
"::",
"LESS_THAN"... | Filter the query to restrict the result to ancestors of an object
@param ChildCategory $category The object to use for ancestors search
@return $this|ChildCategoryQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"to",
"restrict",
"the",
"result",
"to",
"ancestors",
"of",
"an",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1322-L1327 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.orderByBranch | public function orderByBranch($reverse = false)
{
if ($reverse) {
return $this
->addDescendingOrderByColumn(ChildCategory::LEFT_COL);
} else {
return $this
->addAscendingOrderByColumn(ChildCategory::LEFT_COL);
}
} | php | public function orderByBranch($reverse = false)
{
if ($reverse) {
return $this
->addDescendingOrderByColumn(ChildCategory::LEFT_COL);
} else {
return $this
->addAscendingOrderByColumn(ChildCategory::LEFT_COL);
}
} | [
"public",
"function",
"orderByBranch",
"(",
"$",
"reverse",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"reverse",
")",
"{",
"return",
"$",
"this",
"->",
"addDescendingOrderByColumn",
"(",
"ChildCategory",
"::",
"LEFT_COL",
")",
";",
"}",
"else",
"{",
"return"... | Order the result by branch, i.e. natural tree order
@param bool $reverse if true, reverses the order
@return $this|ChildCategoryQuery The current query, for fluid interface | [
"Order",
"the",
"result",
"by",
"branch",
"i",
".",
"e",
".",
"natural",
"tree",
"order"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1351-L1360 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.orderByLevel | public function orderByLevel($reverse = false)
{
if ($reverse) {
return $this
->addDescendingOrderByColumn(ChildCategory::LEVEL_COL)
->addDescendingOrderByColumn(ChildCategory::LEFT_COL);
} else {
return $this
->addAscendingOrde... | php | public function orderByLevel($reverse = false)
{
if ($reverse) {
return $this
->addDescendingOrderByColumn(ChildCategory::LEVEL_COL)
->addDescendingOrderByColumn(ChildCategory::LEFT_COL);
} else {
return $this
->addAscendingOrde... | [
"public",
"function",
"orderByLevel",
"(",
"$",
"reverse",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"reverse",
")",
"{",
"return",
"$",
"this",
"->",
"addDescendingOrderByColumn",
"(",
"ChildCategory",
"::",
"LEVEL_COL",
")",
"->",
"addDescendingOrderByColumn",
... | Order the result by level, the closer to the root first
@param bool $reverse if true, reverses the order
@return $this|ChildCategoryQuery The current query, for fluid interface | [
"Order",
"the",
"result",
"by",
"level",
"the",
"closer",
"to",
"the",
"root",
"first"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1369-L1380 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.findRoot | public function findRoot(ConnectionInterface $con = null)
{
return $this
->addUsingAlias(ChildCategory::LEFT_COL, 1, Criteria::EQUAL)
->findOne($con);
} | php | public function findRoot(ConnectionInterface $con = null)
{
return $this
->addUsingAlias(ChildCategory::LEFT_COL, 1, Criteria::EQUAL)
->findOne($con);
} | [
"public",
"function",
"findRoot",
"(",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"ChildCategory",
"::",
"LEFT_COL",
",",
"1",
",",
"Criteria",
"::",
"EQUAL",
")",
"->",
"findOne",
"(",
"$",... | Returns the root node for the tree
@param ConnectionInterface $con Connection to use.
@return ChildCategory The tree root object | [
"Returns",
"the",
"root",
"node",
"for",
"the",
"tree"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1389-L1394 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.retrieveRoot | static public function retrieveRoot(ConnectionInterface $con = null)
{
$c = new Criteria(CategoryTableMap::DATABASE_NAME);
$c->add(ChildCategory::LEFT_COL, 1, Criteria::EQUAL);
return ChildCategoryQuery::create(null, $c)->findOne($con);
} | php | static public function retrieveRoot(ConnectionInterface $con = null)
{
$c = new Criteria(CategoryTableMap::DATABASE_NAME);
$c->add(ChildCategory::LEFT_COL, 1, Criteria::EQUAL);
return ChildCategoryQuery::create(null, $c)->findOne($con);
} | [
"static",
"public",
"function",
"retrieveRoot",
"(",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"c",
"=",
"new",
"Criteria",
"(",
"CategoryTableMap",
"::",
"DATABASE_NAME",
")",
";",
"$",
"c",
"->",
"add",
"(",
"ChildCategory",
"::",
"L... | Returns the root node for a given scope
@param ConnectionInterface $con Connection to use.
@return ChildCategory Propel object for root node | [
"Returns",
"the",
"root",
"node",
"for",
"a",
"given",
"scope"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1416-L1422 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.retrieveTree | static public function retrieveTree(Criteria $criteria = null, ConnectionInterface $con = null)
{
if (null === $criteria) {
$criteria = new Criteria(CategoryTableMap::DATABASE_NAME);
}
$criteria->addAscendingOrderByColumn(ChildCategory::LEFT_COL);
return ChildCategoryQue... | php | static public function retrieveTree(Criteria $criteria = null, ConnectionInterface $con = null)
{
if (null === $criteria) {
$criteria = new Criteria(CategoryTableMap::DATABASE_NAME);
}
$criteria->addAscendingOrderByColumn(ChildCategory::LEFT_COL);
return ChildCategoryQue... | [
"static",
"public",
"function",
"retrieveTree",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"criteria",
")",
"{",
"$",
"criteria",
"=",
"new",
"Criteria",
"(... | Returns the whole tree node for a given scope
@param Criteria $criteria Optional Criteria to filter the query
@param ConnectionInterface $con Connection to use.
@return ChildCategory[]|ObjectCollection|mixed the list of results, formatted by the current formatter | [
"Returns",
"the",
"whole",
"tree",
"node",
"for",
"a",
"given",
"scope"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1431-L1439 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.isValid | static public function isValid(ChildCategory $node = null)
{
if (is_object($node) && $node->getRightValue() > $node->getLeftValue()) {
return true;
} else {
return false;
}
} | php | static public function isValid(ChildCategory $node = null)
{
if (is_object($node) && $node->getRightValue() > $node->getLeftValue()) {
return true;
} else {
return false;
}
} | [
"static",
"public",
"function",
"isValid",
"(",
"ChildCategory",
"$",
"node",
"=",
"null",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"node",
")",
"&&",
"$",
"node",
"->",
"getRightValue",
"(",
")",
">",
"$",
"node",
"->",
"getLeftValue",
"(",
")",
... | Tests if node is valid
@param ChildCategory $node Propel object for src node
@return bool | [
"Tests",
"if",
"node",
"is",
"valid"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1447-L1454 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php | CategoryQuery.updateLoadedNodes | static public function updateLoadedNodes($prune = null, ConnectionInterface $con = null)
{
if (Propel::isInstancePoolingEnabled()) {
$keys = array();
/** @var $obj ChildCategory */
foreach (CategoryTableMap::$instances as $obj) {
if (!$prune || !$prune->eq... | php | static public function updateLoadedNodes($prune = null, ConnectionInterface $con = null)
{
if (Propel::isInstancePoolingEnabled()) {
$keys = array();
/** @var $obj ChildCategory */
foreach (CategoryTableMap::$instances as $obj) {
if (!$prune || !$prune->eq... | [
"static",
"public",
"function",
"updateLoadedNodes",
"(",
"$",
"prune",
"=",
"null",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"Propel",
"::",
"isInstancePoolingEnabled",
"(",
")",
")",
"{",
"$",
"keys",
"=",
"array",
"(",
... | Reload all already loaded nodes to sync them with updated db
@param ChildCategory $prune Object to prune from the update
@param ConnectionInterface $con Connection to use. | [
"Reload",
"all",
"already",
"loaded",
"nodes",
"to",
"sync",
"them",
"with",
"updated",
"db"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/CategoryQuery.php#L1542-L1572 | train |
vukbgit/PHPCraft.Subject | src/Traits/Images.php | Images.resizeImage | protected function resizeImage($path, $width, $height)
{
$this->images->open('Gd',$path);
$this->images->resize($width, $height);
} | php | protected function resizeImage($path, $width, $height)
{
$this->images->open('Gd',$path);
$this->images->resize($width, $height);
} | [
"protected",
"function",
"resizeImage",
"(",
"$",
"path",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"this",
"->",
"images",
"->",
"open",
"(",
"'Gd'",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"images",
"->",
"resize",
"(",
"$",
... | resizes an image
@param string $path
@param int $width
@param int $height | [
"resizes",
"an",
"image"
] | a43ad7868098ff1e7bda6819547ea64f9a853732 | https://github.com/vukbgit/PHPCraft.Subject/blob/a43ad7868098ff1e7bda6819547ea64f9a853732/src/Traits/Images.php#L51-L55 | train |
titledk/silverstripe-identity | code/Identity.php | Identity.get_colors | public static function get_colors($type = 'hex')
{
$cached = self::$colorsCached;
if (isset($cached[$type])) return $cached[$type];
$colors = Config::inst()->get('Identity', 'colors');
if ($type == 'rgb') {
$rgbColors = [];
foreach ($colors as $name => $c) {
... | php | public static function get_colors($type = 'hex')
{
$cached = self::$colorsCached;
if (isset($cached[$type])) return $cached[$type];
$colors = Config::inst()->get('Identity', 'colors');
if ($type == 'rgb') {
$rgbColors = [];
foreach ($colors as $name => $c) {
... | [
"public",
"static",
"function",
"get_colors",
"(",
"$",
"type",
"=",
"'hex'",
")",
"{",
"$",
"cached",
"=",
"self",
"::",
"$",
"colorsCached",
";",
"if",
"(",
"isset",
"(",
"$",
"cached",
"[",
"$",
"type",
"]",
")",
")",
"return",
"$",
"cached",
"[... | Identify colors in either hex or rgb
@param string $type
@return array | [
"Identify",
"colors",
"in",
"either",
"hex",
"or",
"rgb"
] | 27cf7edd6bdb2d220b718bafba6b2959243d23cf | https://github.com/titledk/silverstripe-identity/blob/27cf7edd6bdb2d220b718bafba6b2959243d23cf/code/Identity.php#L23-L38 | train |
titledk/silverstripe-identity | code/Identity.php | Identity.hex2rgb | public static function hex2rgb($hex)
{
$hex = str_replace("#", "", $hex);
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
return "$r,$g,$b";
} | php | public static function hex2rgb($hex)
{
$hex = str_replace("#", "", $hex);
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
return "$r,$g,$b";
} | [
"public",
"static",
"function",
"hex2rgb",
"(",
"$",
"hex",
")",
"{",
"$",
"hex",
"=",
"str_replace",
"(",
"\"#\"",
",",
"\"\"",
",",
"$",
"hex",
")",
";",
"$",
"r",
"=",
"hexdec",
"(",
"substr",
"(",
"$",
"hex",
",",
"0",
",",
"2",
")",
")",
... | Helper for converting a color to rbg
@param $hex
@return string | [
"Helper",
"for",
"converting",
"a",
"color",
"to",
"rbg"
] | 27cf7edd6bdb2d220b718bafba6b2959243d23cf | https://github.com/titledk/silverstripe-identity/blob/27cf7edd6bdb2d220b718bafba6b2959243d23cf/code/Identity.php#L45-L52 | train |
zarathustra323/modlr-data | src/Zarathustra/ModlrData/Resource/Collection.php | Collection.getResourceTypes | public function getResourceTypes()
{
$types = [];
foreach ($this as $entity) {
$types[] = $entity->getType();
}
return array_unique($types);
} | php | public function getResourceTypes()
{
$types = [];
foreach ($this as $entity) {
$types[] = $entity->getType();
}
return array_unique($types);
} | [
"public",
"function",
"getResourceTypes",
"(",
")",
"{",
"$",
"types",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"entity",
")",
"{",
"$",
"types",
"[",
"]",
"=",
"$",
"entity",
"->",
"getType",
"(",
")",
";",
"}",
"return",
"arr... | Gets a unique list of all entity types assigned to this collection.
@return array | [
"Gets",
"a",
"unique",
"list",
"of",
"all",
"entity",
"types",
"assigned",
"to",
"this",
"collection",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Resource/Collection.php#L45-L52 | train |
Nicofuma/phpbb-ext-webprofiler | phpbb/profiler/profiler_listener.php | profiler_listener.on_common | public function on_common()
{
if (substr($GLOBALS['request']->server('SCRIPT_NAME'), -7) === 'app.php')
{
return;
}
try {
$this->request_stack->push($this->symfony_request);
$this->dispatcher->dispatch(KernelEvents::REQUEST,
new GetResponseEvent(
$this->http_kernel,
$this->request_stac... | php | public function on_common()
{
if (substr($GLOBALS['request']->server('SCRIPT_NAME'), -7) === 'app.php')
{
return;
}
try {
$this->request_stack->push($this->symfony_request);
$this->dispatcher->dispatch(KernelEvents::REQUEST,
new GetResponseEvent(
$this->http_kernel,
$this->request_stac... | [
"public",
"function",
"on_common",
"(",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"GLOBALS",
"[",
"'request'",
"]",
"->",
"server",
"(",
"'SCRIPT_NAME'",
")",
",",
"-",
"7",
")",
"===",
"'app.php'",
")",
"{",
"return",
";",
"}",
"try",
"{",
"$",
"th... | Emulate the kernel request event | [
"Emulate",
"the",
"kernel",
"request",
"event"
] | 5f52e2b67f5b8278af18907615f30ffe20f4802c | https://github.com/Nicofuma/phpbb-ext-webprofiler/blob/5f52e2b67f5b8278af18907615f30ffe20f4802c/phpbb/profiler/profiler_listener.php#L56-L76 | train |
Nicofuma/phpbb-ext-webprofiler | phpbb/profiler/profiler_listener.php | profiler_listener.on_garbage_collection | public function on_garbage_collection()
{
if (substr($GLOBALS['request']->server('SCRIPT_NAME'), -7) === 'app.php')
{
return;
}
// An Exception is throw because the TraceableEventDispatcher
// stop all the events when KernelEvents::RESPONSE is trigger.
// But because we are emulating the event through ... | php | public function on_garbage_collection()
{
if (substr($GLOBALS['request']->server('SCRIPT_NAME'), -7) === 'app.php')
{
return;
}
// An Exception is throw because the TraceableEventDispatcher
// stop all the events when KernelEvents::RESPONSE is trigger.
// But because we are emulating the event through ... | [
"public",
"function",
"on_garbage_collection",
"(",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"GLOBALS",
"[",
"'request'",
"]",
"->",
"server",
"(",
"'SCRIPT_NAME'",
")",
",",
"-",
"7",
")",
"===",
"'app.php'",
")",
"{",
"return",
";",
"}",
"// An Excepti... | Emulate the kernel response event | [
"Emulate",
"the",
"kernel",
"response",
"event"
] | 5f52e2b67f5b8278af18907615f30ffe20f4802c | https://github.com/Nicofuma/phpbb-ext-webprofiler/blob/5f52e2b67f5b8278af18907615f30ffe20f4802c/phpbb/profiler/profiler_listener.php#L81-L164 | train |
Nicofuma/phpbb-ext-webprofiler | phpbb/profiler/profiler_listener.php | profiler_listener.onKernelResponse | public function onKernelResponse(FilterResponseEvent $event)
{
$result = parent::onKernelResponse($event);
$content = ob_get_contents();
if ($this->request_stack->getCurrentRequest()->getMethod() === 'POST' && empty($content))
{
$event->stopPropagation();
}
return $result;
} | php | public function onKernelResponse(FilterResponseEvent $event)
{
$result = parent::onKernelResponse($event);
$content = ob_get_contents();
if ($this->request_stack->getCurrentRequest()->getMethod() === 'POST' && empty($content))
{
$event->stopPropagation();
}
return $result;
} | [
"public",
"function",
"onKernelResponse",
"(",
"FilterResponseEvent",
"$",
"event",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"onKernelResponse",
"(",
"$",
"event",
")",
";",
"$",
"content",
"=",
"ob_get_contents",
"(",
")",
";",
"if",
"(",
"$",
"this"... | Avoid the injection of the toolbar
@param FilterResponseEvent $event | [
"Avoid",
"the",
"injection",
"of",
"the",
"toolbar"
] | 5f52e2b67f5b8278af18907615f30ffe20f4802c | https://github.com/Nicofuma/phpbb-ext-webprofiler/blob/5f52e2b67f5b8278af18907615f30ffe20f4802c/phpbb/profiler/profiler_listener.php#L184-L195 | train |
acgrid/phprofiling | src/Item.php | Item.& | public function &refScopeStatistic($scope)
{
if(!isset($this->statistics[$scope])) $this->statistics[$scope] = [];
return $this->statistics[$scope];
} | php | public function &refScopeStatistic($scope)
{
if(!isset($this->statistics[$scope])) $this->statistics[$scope] = [];
return $this->statistics[$scope];
} | [
"public",
"function",
"&",
"refScopeStatistic",
"(",
"$",
"scope",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"statistics",
"[",
"$",
"scope",
"]",
")",
")",
"$",
"this",
"->",
"statistics",
"[",
"$",
"scope",
"]",
"=",
"[",
"]",
... | Return a reference for batch editing.
Do not replace the whole variable into non-array value!
@param string $scope
@return array | [
"Return",
"a",
"reference",
"for",
"batch",
"editing",
".",
"Do",
"not",
"replace",
"the",
"whole",
"variable",
"into",
"non",
"-",
"array",
"value!"
] | 537aaad74892848060646c2764e8c85232daceae | https://github.com/acgrid/phprofiling/blob/537aaad74892848060646c2764e8c85232daceae/src/Item.php#L140-L144 | train |
squareproton/Bond | src/Bond/Di/Configurator.php | Configurator.load | public function load()
{
$output = [];
$args = func_get_args();
foreach( $args as $arg ) {
if( is_array($arg) ) {
$output = array_merge(
call_user_func_array( [$this, 'load'], $arg ),
$output
);
}... | php | public function load()
{
$output = [];
$args = func_get_args();
foreach( $args as $arg ) {
if( is_array($arg) ) {
$output = array_merge(
call_user_func_array( [$this, 'load'], $arg ),
$output
);
}... | [
"public",
"function",
"load",
"(",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"arg",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"arg",
")",
")",
"{",
... | Load a collection of assets into the Di container.
Provides a whole load of syntatic sugar so you can basically pass this a combination of arrays, assets, multiple args, ... whatever
The actual work is done by loadHandler
@return mixed[]. Array of the individual assets loaded. | [
"Load",
"a",
"collection",
"of",
"assets",
"into",
"the",
"Di",
"container",
".",
"Provides",
"a",
"whole",
"load",
"of",
"syntatic",
"sugar",
"so",
"you",
"can",
"basically",
"pass",
"this",
"a",
"combination",
"of",
"arrays",
"assets",
"multiple",
"args",
... | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Di/Configurator.php#L59-L75 | train |
reliv/rcm-config | src/Model/ConfigModel.php | ConfigModel.getList | public function getList()
{
$category = $this->getCategory();
$list = $this->getCategoryConfig($category);
foreach ($list as $context => $config) {
$list[$context] = $this->getAll($context);
}
return $list;
} | php | public function getList()
{
$category = $this->getCategory();
$list = $this->getCategoryConfig($category);
foreach ($list as $context => $config) {
$list[$context] = $this->getAll($context);
}
return $list;
} | [
"public",
"function",
"getList",
"(",
")",
"{",
"$",
"category",
"=",
"$",
"this",
"->",
"getCategory",
"(",
")",
";",
"$",
"list",
"=",
"$",
"this",
"->",
"getCategoryConfig",
"(",
"$",
"category",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
... | Get All config entries
@return array | [
"Get",
"All",
"config",
"entries"
] | 3e8cdea57a8688b06997ce1b167b8410bccac09e | https://github.com/reliv/rcm-config/blob/3e8cdea57a8688b06997ce1b167b8410bccac09e/src/Model/ConfigModel.php#L94-L105 | train |
irfantoor/engine | src/Engine.php | Engine.classname | public function classname($id)
{
# todo -- returns null class instead of null
return isset($this->classes[$id]) ? $this->classes[$id] : null;
} | php | public function classname($id)
{
# todo -- returns null class instead of null
return isset($this->classes[$id]) ? $this->classes[$id] : null;
} | [
"public",
"function",
"classname",
"(",
"$",
"id",
")",
"{",
"# todo -- returns null class instead of null",
"return",
"isset",
"(",
"$",
"this",
"->",
"classes",
"[",
"$",
"id",
"]",
")",
"?",
"$",
"this",
"->",
"classes",
"[",
"$",
"id",
"]",
":",
"nul... | Returns the default or configured classname with namespace
@param string $id
@return string | [
"Returns",
"the",
"default",
"or",
"configured",
"classname",
"with",
"namespace"
] | 4d2d221add749f75100d0b4ffe1488cdbf7af5d3 | https://github.com/irfantoor/engine/blob/4d2d221add749f75100d0b4ffe1488cdbf7af5d3/src/Engine.php#L158-L162 | train |
irfantoor/engine | src/Engine.php | Engine.run | function run()
{
$request = $this->getServerRequest();
$response = $this->getResponse();
$uri = $request->getUri();
$basepath = $uri->getBasePath();
$args = explode('/', htmlspecialchars($basepath));
$response = $this->process($request, $response, $args);
... | php | function run()
{
$request = $this->getServerRequest();
$response = $this->getResponse();
$uri = $request->getUri();
$basepath = $uri->getBasePath();
$args = explode('/', htmlspecialchars($basepath));
$response = $this->process($request, $response, $args);
... | [
"function",
"run",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getServerRequest",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"getResponse",
"(",
")",
";",
"$",
"uri",
"=",
"$",
"request",
"->",
"getUri",
"(",
")",
";",
"$... | Runs the engine, the processes the request | [
"Runs",
"the",
"engine",
"the",
"processes",
"the",
"request"
] | 4d2d221add749f75100d0b4ffe1488cdbf7af5d3 | https://github.com/irfantoor/engine/blob/4d2d221add749f75100d0b4ffe1488cdbf7af5d3/src/Engine.php#L168-L179 | train |
OUTRAGElib/psr7-file-stream | lib/Stream.php | Stream.setFilePointer | public function setFilePointer($pointer)
{
if(!is_resource($pointer))
throw new InvalidArgumentException("Invalid type - not a file resource");
$this->pointer = $pointer;
# and now to set everything up...
$metadata = stream_get_meta_data($this->pointer);
# can this stream be read from?
if(isset... | php | public function setFilePointer($pointer)
{
if(!is_resource($pointer))
throw new InvalidArgumentException("Invalid type - not a file resource");
$this->pointer = $pointer;
# and now to set everything up...
$metadata = stream_get_meta_data($this->pointer);
# can this stream be read from?
if(isset... | [
"public",
"function",
"setFilePointer",
"(",
"$",
"pointer",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"pointer",
")",
")",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Invalid type - not a file resource\"",
")",
";",
"$",
"this",
"->",
"pointer"... | Set the file pointer | [
"Set",
"the",
"file",
"pointer"
] | 8da9ecad1e4190f31f8776aeadd9c7db41107f68 | https://github.com/OUTRAGElib/psr7-file-stream/blob/8da9ecad1e4190f31f8776aeadd9c7db41107f68/lib/Stream.php#L46-L115 | train |
libreworks/caridea-auth | src/Adapter/MongoDb.php | MongoDb.getResults | protected function getResults(string $username, ServerRequestInterface $request): \MongoDB\Driver\Cursor
{
$q = new \MongoDB\Driver\Query(
array_merge($this->query, [($this->fieldUser) => $username]),
['projection' => [($this->fieldUser) => true, ($this->fieldPass) => true]]
... | php | protected function getResults(string $username, ServerRequestInterface $request): \MongoDB\Driver\Cursor
{
$q = new \MongoDB\Driver\Query(
array_merge($this->query, [($this->fieldUser) => $username]),
['projection' => [($this->fieldUser) => true, ($this->fieldPass) => true]]
... | [
"protected",
"function",
"getResults",
"(",
"string",
"$",
"username",
",",
"ServerRequestInterface",
"$",
"request",
")",
":",
"\\",
"MongoDB",
"\\",
"Driver",
"\\",
"Cursor",
"{",
"$",
"q",
"=",
"new",
"\\",
"MongoDB",
"\\",
"Driver",
"\\",
"Query",
"(",... | Queries the MongoDB collection.
@param string $username The username to use for parameter binding
@param ServerRequestInterface $request The Server Request message (to use for additional parameter binding)
@return \MongoDB\Driver\Cursor The results cursor | [
"Queries",
"the",
"MongoDB",
"collection",
"."
] | 1bf965c57716942b18ca3204629f6bda99cf876a | https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Adapter/MongoDb.php#L119-L126 | train |
libreworks/caridea-auth | src/Adapter/MongoDb.php | MongoDb.fetchResult | protected function fetchResult(\MongoDB\Driver\Cursor $results, string $username): \stdClass
{
$values = $results->toArray();
if (count($values) > 1) {
throw new \Caridea\Auth\Exception\UsernameAmbiguous($username);
} elseif (count($values) == 0) {
throw new \Caridea\... | php | protected function fetchResult(\MongoDB\Driver\Cursor $results, string $username): \stdClass
{
$values = $results->toArray();
if (count($values) > 1) {
throw new \Caridea\Auth\Exception\UsernameAmbiguous($username);
} elseif (count($values) == 0) {
throw new \Caridea\... | [
"protected",
"function",
"fetchResult",
"(",
"\\",
"MongoDB",
"\\",
"Driver",
"\\",
"Cursor",
"$",
"results",
",",
"string",
"$",
"username",
")",
":",
"\\",
"stdClass",
"{",
"$",
"values",
"=",
"$",
"results",
"->",
"toArray",
"(",
")",
";",
"if",
"("... | Fetches a single result from the Mongo Cursor.
@param \MongoCursor $results The results
@param string $username The attempted username (for Exception purposes)
@return \stdClass A single MongoDB document
@throws \Caridea\Auth\Exception\UsernameAmbiguous If there is more than 1 result
@throws \Caridea\Auth\Exception\Us... | [
"Fetches",
"a",
"single",
"result",
"from",
"the",
"Mongo",
"Cursor",
"."
] | 1bf965c57716942b18ca3204629f6bda99cf876a | https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Adapter/MongoDb.php#L137-L146 | train |
native5/native5-sdk-client-php | src/Native5/Sessions/CachedSessionHandler.php | CachedSessionHandler.destroy | public function destroy($sessionId)
{
$sql = 'DELETE from tbl_sessions where SESSION_ID=:SESSID';
$delete = $this->_db->prepare($sql);
$delete->execute(array(':SESSID' => $sessionId));
$this->_cache->delete($sessionId);
return true;
} | php | public function destroy($sessionId)
{
$sql = 'DELETE from tbl_sessions where SESSION_ID=:SESSID';
$delete = $this->_db->prepare($sql);
$delete->execute(array(':SESSID' => $sessionId));
$this->_cache->delete($sessionId);
return true;
} | [
"public",
"function",
"destroy",
"(",
"$",
"sessionId",
")",
"{",
"$",
"sql",
"=",
"'DELETE from tbl_sessions where SESSION_ID=:SESSID'",
";",
"$",
"delete",
"=",
"$",
"this",
"->",
"_db",
"->",
"prepare",
"(",
"$",
"sql",
")",
";",
"$",
"delete",
"->",
"e... | destroy Destroying the session deletes it from the cache as
well as the backend database.
@param mixed $sessionId The session id
@access public
@return void | [
"destroy",
"Destroying",
"the",
"session",
"deletes",
"it",
"from",
"the",
"cache",
"as",
"well",
"as",
"the",
"backend",
"database",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Sessions/CachedSessionHandler.php#L78-L87 | train |
native5/native5-sdk-client-php | src/Native5/Sessions/CachedSessionHandler.php | CachedSessionHandler.gc | public function gc($lifetime)
{
$sql = 'DELETE from tbl_sessions where LAST_ACCESSED < DATE_SUB(NOW(), INTERVAL :LIFETIME SECOND)';
$delete = $this->_db->prepare($sql);
$count = $delete->execute(array(':LIFETIME' => $lifetime));
return true;
} | php | public function gc($lifetime)
{
$sql = 'DELETE from tbl_sessions where LAST_ACCESSED < DATE_SUB(NOW(), INTERVAL :LIFETIME SECOND)';
$delete = $this->_db->prepare($sql);
$count = $delete->execute(array(':LIFETIME' => $lifetime));
return true;
} | [
"public",
"function",
"gc",
"(",
"$",
"lifetime",
")",
"{",
"$",
"sql",
"=",
"'DELETE from tbl_sessions where LAST_ACCESSED < DATE_SUB(NOW(), INTERVAL :LIFETIME SECOND)'",
";",
"$",
"delete",
"=",
"$",
"this",
"->",
"_db",
"->",
"prepare",
"(",
"$",
"sql",
")",
";... | Garbage collection causes all expired sessions to be deleted.
@param mixed $lifetime The max-lifetime of the session.
@access public
@return void | [
"Garbage",
"collection",
"causes",
"all",
"expired",
"sessions",
"to",
"be",
"deleted",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Sessions/CachedSessionHandler.php#L98-L106 | train |
native5/native5-sdk-client-php | src/Native5/Sessions/CachedSessionHandler.php | CachedSessionHandler.open | public function open($savePath, $sessionName)
{
$sql = 'INSERT INTO tbl_sessions (SESSION_ID, SESSION_DATA) values (:SESSID, :SESSDATA) ON DUPLICATE KEY UPDATE LAST_ACCESSED=NOW()';
$stmt = $this->_db->prepare($sql);
$stmt->execute(array(':SESSID' => session_id(), ':SESSDATA' => ''));
... | php | public function open($savePath, $sessionName)
{
$sql = 'INSERT INTO tbl_sessions (SESSION_ID, SESSION_DATA) values (:SESSID, :SESSDATA) ON DUPLICATE KEY UPDATE LAST_ACCESSED=NOW()';
$stmt = $this->_db->prepare($sql);
$stmt->execute(array(':SESSID' => session_id(), ':SESSDATA' => ''));
... | [
"public",
"function",
"open",
"(",
"$",
"savePath",
",",
"$",
"sessionName",
")",
"{",
"$",
"sql",
"=",
"'INSERT INTO tbl_sessions (SESSION_ID, SESSION_DATA) values (:SESSID, :SESSDATA) ON DUPLICATE KEY UPDATE LAST_ACCESSED=NOW()'",
";",
"$",
"stmt",
"=",
"$",
"this",
"->",... | open Opening the session causes an insert into the sessions table.
@param mixed $savePath SavePath, relevant only while persisting to disk.
@param mixed $sessionName SessionName
@access public
@return void | [
"open",
"Opening",
"the",
"session",
"causes",
"an",
"insert",
"into",
"the",
"sessions",
"table",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Sessions/CachedSessionHandler.php#L118-L124 | train |
xZ1mEFx/yii2-base | db/ActiveRecord.php | ActiveRecord.lockTables | public static function lockTables($table = NULL, $blockType = 'WRITE')
{
$sql = "LOCK TABLES ";
if ($table === NULL) {
$sql .= self::tableName() . " $blockType";
} else {
$tmpSql = '';
foreach ((is_array($table) ? $table : [$table]) as $key => $value) {
... | php | public static function lockTables($table = NULL, $blockType = 'WRITE')
{
$sql = "LOCK TABLES ";
if ($table === NULL) {
$sql .= self::tableName() . " $blockType";
} else {
$tmpSql = '';
foreach ((is_array($table) ? $table : [$table]) as $key => $value) {
... | [
"public",
"static",
"function",
"lockTables",
"(",
"$",
"table",
"=",
"NULL",
",",
"$",
"blockType",
"=",
"'WRITE'",
")",
"{",
"$",
"sql",
"=",
"\"LOCK TABLES \"",
";",
"if",
"(",
"$",
"table",
"===",
"NULL",
")",
"{",
"$",
"sql",
".=",
"self",
"::",... | Lock DB tables
@param null|string|array $table Examples:
'table_name'
or 'table_name tn'
or ['table_name_1 tn1', 'table_name_2', 'tn3'=>'table_name_3']
@param string $blockType 'WRITE'|'READ' | [
"Lock",
"DB",
"tables"
] | f6633c08ccccb7eb5ac000dfae0db26cb2e0a76a | https://github.com/xZ1mEFx/yii2-base/blob/f6633c08ccccb7eb5ac000dfae0db26cb2e0a76a/db/ActiveRecord.php#L22-L39 | train |
phpffcms/ffcms-core | src/Debug/Manager.php | Manager.renderOut | public function renderOut()
{
foreach (Error::all() as $file => $error) {
foreach ($error as $line) {
$this->addMessage('Template error: ' . $line . '(' . $file . ')', 'error');
}
}
return $this->render->render();
} | php | public function renderOut()
{
foreach (Error::all() as $file => $error) {
foreach ($error as $line) {
$this->addMessage('Template error: ' . $line . '(' . $file . ')', 'error');
}
}
return $this->render->render();
} | [
"public",
"function",
"renderOut",
"(",
")",
"{",
"foreach",
"(",
"Error",
"::",
"all",
"(",
")",
"as",
"$",
"file",
"=>",
"$",
"error",
")",
"{",
"foreach",
"(",
"$",
"error",
"as",
"$",
"line",
")",
"{",
"$",
"this",
"->",
"addMessage",
"(",
"'... | Render debug bar code
@return string | [
"Render",
"debug",
"bar",
"code"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Debug/Manager.php#L48-L56 | train |
phpffcms/ffcms-core | src/Debug/Manager.php | Manager.addException | public function addException($e)
{
if ($e instanceof \Exception) {
try {
$this->bar->getCollector('exceptions')->addException($e);
} catch (\Exception $ie) {
} // mute exceptions there
}
} | php | public function addException($e)
{
if ($e instanceof \Exception) {
try {
$this->bar->getCollector('exceptions')->addException($e);
} catch (\Exception $ie) {
} // mute exceptions there
}
} | [
"public",
"function",
"addException",
"(",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"e",
"instanceof",
"\\",
"Exception",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"bar",
"->",
"getCollector",
"(",
"'exceptions'",
")",
"->",
"addException",
"(",
"$",
"e",
... | Add exception into debug bar and stop execute
@param \Exception $e | [
"Add",
"exception",
"into",
"debug",
"bar",
"and",
"stop",
"execute"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Debug/Manager.php#L62-L70 | train |
phpffcms/ffcms-core | src/Debug/Manager.php | Manager.addMessage | public function addMessage($m, $type = 'info')
{
if (!Any::isStr($m) || !Any::isStr($type)) {
return;
}
$m = App::$Security->secureHtml($m);
try {
$mCollector = $this->bar->getCollector('messages');
if (method_exists($mCollector, $type)) {
... | php | public function addMessage($m, $type = 'info')
{
if (!Any::isStr($m) || !Any::isStr($type)) {
return;
}
$m = App::$Security->secureHtml($m);
try {
$mCollector = $this->bar->getCollector('messages');
if (method_exists($mCollector, $type)) {
... | [
"public",
"function",
"addMessage",
"(",
"$",
"m",
",",
"$",
"type",
"=",
"'info'",
")",
"{",
"if",
"(",
"!",
"Any",
"::",
"isStr",
"(",
"$",
"m",
")",
"||",
"!",
"Any",
"::",
"isStr",
"(",
"$",
"type",
")",
")",
"{",
"return",
";",
"}",
"$",... | Add message into debug bar
@param string $m
@param string $type | [
"Add",
"message",
"into",
"debug",
"bar"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Debug/Manager.php#L77-L92 | train |
vpg/titon.utility | src/Titon/Utility/Converter.php | Converter.autobox | public static function autobox($value) {
if (is_numeric($value)) {
if (strpos($value, '.') !== false) {
return (float) $value;
} else {
return (int) $value;
}
} else if (is_bool($value)) {
return (bool) $value;
} e... | php | public static function autobox($value) {
if (is_numeric($value)) {
if (strpos($value, '.') !== false) {
return (float) $value;
} else {
return (int) $value;
}
} else if (is_bool($value)) {
return (bool) $value;
} e... | [
"public",
"static",
"function",
"autobox",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"value",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"return",
"(",
"float",
")",
"$"... | Autobox a value by type casting it.
@param mixed $value
@return mixed | [
"Autobox",
"a",
"value",
"by",
"type",
"casting",
"it",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Converter.php#L43-L59 | train |
vpg/titon.utility | src/Titon/Utility/Converter.php | Converter.isJson | public static function isJson($data) {
if (!is_string($data) || empty($data)) {
return false;
}
$json = @json_decode($data, true);
return (json_last_error() === JSON_ERROR_NONE && $json !== null);
} | php | public static function isJson($data) {
if (!is_string($data) || empty($data)) {
return false;
}
$json = @json_decode($data, true);
return (json_last_error() === JSON_ERROR_NONE && $json !== null);
} | [
"public",
"static",
"function",
"isJson",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"data",
")",
"||",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"json",
"=",
"@",
"json_decode",
"(",
"$",... | Check to see if data passed is a JSON object.
@param mixed $data
@return bool | [
"Check",
"to",
"see",
"if",
"data",
"passed",
"is",
"a",
"JSON",
"object",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Converter.php#L125-L133 | train |
vpg/titon.utility | src/Titon/Utility/Converter.php | Converter.isSerialized | public static function isSerialized($data) {
if (!is_string($data) || empty($data)) {
return false;
}
return (@unserialize($data) !== false);
} | php | public static function isSerialized($data) {
if (!is_string($data) || empty($data)) {
return false;
}
return (@unserialize($data) !== false);
} | [
"public",
"static",
"function",
"isSerialized",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"data",
")",
"||",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"@",
"unserialize",
"(",
"$"... | Check to see if data passed has been serialized.
@param mixed $data
@return bool | [
"Check",
"to",
"see",
"if",
"data",
"passed",
"has",
"been",
"serialized",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Converter.php#L151-L157 | train |
vpg/titon.utility | src/Titon/Utility/Converter.php | Converter.isXml | public static function isXml($data) {
// Do manually checks on the string since HHVM blows up
if (!is_string($data) || substr($data, 0, 5) !== '<?xml') {
return false;
}
return (@simplexml_load_string($data) instanceof SimpleXMLElement);
} | php | public static function isXml($data) {
// Do manually checks on the string since HHVM blows up
if (!is_string($data) || substr($data, 0, 5) !== '<?xml') {
return false;
}
return (@simplexml_load_string($data) instanceof SimpleXMLElement);
} | [
"public",
"static",
"function",
"isXml",
"(",
"$",
"data",
")",
"{",
"// Do manually checks on the string since HHVM blows up",
"if",
"(",
"!",
"is_string",
"(",
"$",
"data",
")",
"||",
"substr",
"(",
"$",
"data",
",",
"0",
",",
"5",
")",
"!==",
"'<?xml'",
... | Check to see if data passed is an XML document.
@param mixed $data
@return bool | [
"Check",
"to",
"see",
"if",
"data",
"passed",
"is",
"an",
"XML",
"document",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Converter.php#L165-L172 | train |
jenskooij/cloudcontrol | src/components/cms/BaseRouting.php | BaseRouting.route | public function route()
{
$this->dashboardRouting($this->relativeCmsUri);
$this->logOffRouting($this->request, $this->relativeCmsUri);
$this->apiRouting($this->relativeCmsUri);
$this->documentRouting($this->userRights, $this->relativeCmsUri);
$this->valuelistsRouting($this->u... | php | public function route()
{
$this->dashboardRouting($this->relativeCmsUri);
$this->logOffRouting($this->request, $this->relativeCmsUri);
$this->apiRouting($this->relativeCmsUri);
$this->documentRouting($this->userRights, $this->relativeCmsUri);
$this->valuelistsRouting($this->u... | [
"public",
"function",
"route",
"(",
")",
"{",
"$",
"this",
"->",
"dashboardRouting",
"(",
"$",
"this",
"->",
"relativeCmsUri",
")",
";",
"$",
"this",
"->",
"logOffRouting",
"(",
"$",
"this",
"->",
"request",
",",
"$",
"this",
"->",
"relativeCmsUri",
")",... | Call the different routing methods
@throws \Exception | [
"Call",
"the",
"different",
"routing",
"methods"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/components/cms/BaseRouting.php#L58-L71 | train |
Mandarin-Medien/MMCmfContentBundle | Templating/TemplateManager.php | TemplateManager.getTemplate | public function getTemplate(TemplatableNodeInterface $node)
{
$template = $node->getTemplate();
if (!$template) {
$meta = $this->manager->getClassMetadata(get_class($node));
if (!empty($this->templates[$meta->name]) && count($this->templates[$meta->name]) > 0)
... | php | public function getTemplate(TemplatableNodeInterface $node)
{
$template = $node->getTemplate();
if (!$template) {
$meta = $this->manager->getClassMetadata(get_class($node));
if (!empty($this->templates[$meta->name]) && count($this->templates[$meta->name]) > 0)
... | [
"public",
"function",
"getTemplate",
"(",
"TemplatableNodeInterface",
"$",
"node",
")",
"{",
"$",
"template",
"=",
"$",
"node",
"->",
"getTemplate",
"(",
")",
";",
"if",
"(",
"!",
"$",
"template",
")",
"{",
"$",
"meta",
"=",
"$",
"this",
"->",
"manager... | get the assigned template of the given TemplatableNodeInterface
handles the template selection if no template is assigned
@param TemplatableNodeInterface $node
@return mixed|string | [
"get",
"the",
"assigned",
"template",
"of",
"the",
"given",
"TemplatableNodeInterface",
"handles",
"the",
"template",
"selection",
"if",
"no",
"template",
"is",
"assigned"
] | 503ab31cef3ce068f767de5b72f833526355b726 | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/Templating/TemplateManager.php#L84-L105 | train |
Mandarin-Medien/MMCmfContentBundle | Templating/TemplateManager.php | TemplateManager.getBundleNameFromEntity | protected static function getBundleNameFromEntity($entityNamespace, $bundles)
{
$dataBaseNamespace = substr($entityNamespace, 0, strpos($entityNamespace, '\\Entity'));
foreach ($bundles as $type => $bundle) {
$bundleRefClass = new \ReflectionClass($bundle);
if ($bundleRefCla... | php | protected static function getBundleNameFromEntity($entityNamespace, $bundles)
{
$dataBaseNamespace = substr($entityNamespace, 0, strpos($entityNamespace, '\\Entity'));
foreach ($bundles as $type => $bundle) {
$bundleRefClass = new \ReflectionClass($bundle);
if ($bundleRefCla... | [
"protected",
"static",
"function",
"getBundleNameFromEntity",
"(",
"$",
"entityNamespace",
",",
"$",
"bundles",
")",
"{",
"$",
"dataBaseNamespace",
"=",
"substr",
"(",
"$",
"entityNamespace",
",",
"0",
",",
"strpos",
"(",
"$",
"entityNamespace",
",",
"'\\\\Entit... | Get the bundle name from an Entity namespace
@param $entityNamespace
@param $bundles
@return string|null | [
"Get",
"the",
"bundle",
"name",
"from",
"an",
"Entity",
"namespace"
] | 503ab31cef3ce068f767de5b72f833526355b726 | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/Templating/TemplateManager.php#L114-L126 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.