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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
timostamm/url-builder | src/UrlQuery.php | UrlQuery.remove | public function remove($key)
{
$this->validateKey($key);
if ($this->has($key)) {
unset($this->params[$key]);
return true;
} else {
return false;
}
} | php | public function remove($key)
{
$this->validateKey($key);
if ($this->has($key)) {
unset($this->params[$key]);
return true;
} else {
return false;
}
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"validateKey",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"params",
"[",
"$",
... | Return all parameters with the given key.
@param string $key
@return boolean True if the parameter existed. | [
"Return",
"all",
"parameters",
"with",
"the",
"given",
"key",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlQuery.php#L81-L90 | train |
timostamm/url-builder | src/UrlQuery.php | UrlQuery.replace | public function replace(array $new)
{
foreach ($new as $key => $values) {
$this->validateKey($key);
if (! is_array($values)) {
$values = $new[$key] = [
$values
];
}
foreach ($values as $v) {
$this->validateValue($v);
}
}
foreach ($new as $key => $values) {
$this->setArray($key,... | php | public function replace(array $new)
{
foreach ($new as $key => $values) {
$this->validateKey($key);
if (! is_array($values)) {
$values = $new[$key] = [
$values
];
}
foreach ($values as $v) {
$this->validateValue($v);
}
}
foreach ($new as $key => $values) {
$this->setArray($key,... | [
"public",
"function",
"replace",
"(",
"array",
"$",
"new",
")",
"{",
"foreach",
"(",
"$",
"new",
"as",
"$",
"key",
"=>",
"$",
"values",
")",
"{",
"$",
"this",
"->",
"validateKey",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
... | Sets several new parameters, replacing the old values if already present.
The provided array must be associative with the parameter keys as array
keys and parameter values as array values.
The array values may be either a string (to set a single parameter value)
or an array (to set multiple parameter values).
@param... | [
"Sets",
"several",
"new",
"parameters",
"replacing",
"the",
"old",
"values",
"if",
"already",
"present",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlQuery.php#L103-L119 | train |
timostamm/url-builder | src/UrlQuery.php | UrlQuery.getArray | public function getArray($key)
{
$this->validateKey($key);
return $this->has($key) ? $this->params[$key] : [];
} | php | public function getArray($key)
{
$this->validateKey($key);
return $this->has($key) ? $this->params[$key] : [];
} | [
"public",
"function",
"getArray",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"validateKey",
"(",
"$",
"key",
")",
";",
"return",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
"?",
"$",
"this",
"->",
"params",
"[",
"$",
"key",
"]",
":",
"["... | Returns all values of the parameters with the given key.
If no parameter with the given key exists, an empty array is returned.
@param string $key
@return array | [
"Returns",
"all",
"values",
"of",
"the",
"parameters",
"with",
"the",
"given",
"key",
".",
"If",
"no",
"parameter",
"with",
"the",
"given",
"key",
"exists",
"an",
"empty",
"array",
"is",
"returned",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlQuery.php#L140-L144 | train |
timostamm/url-builder | src/UrlQuery.php | UrlQuery.toArray | public function toArray($onlyFirst = false)
{
$r = [];
foreach ($this->params as $key => $values) {
$r[$key] = $onlyFirst ? $values[0] : $values;
}
return $r;
} | php | public function toArray($onlyFirst = false)
{
$r = [];
foreach ($this->params as $key => $values) {
$r[$key] = $onlyFirst ? $values[0] : $values;
}
return $r;
} | [
"public",
"function",
"toArray",
"(",
"$",
"onlyFirst",
"=",
"false",
")",
"{",
"$",
"r",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"params",
"as",
"$",
"key",
"=>",
"$",
"values",
")",
"{",
"$",
"r",
"[",
"$",
"key",
"]",
"=",
"... | Get all parameters as an associative array with the parameter keys as array keys.
Returns either only the first values of the parameters, or all values of the parameters.
@param boolean $onlyFirst
@return array | [
"Get",
"all",
"parameters",
"as",
"an",
"associative",
"array",
"with",
"the",
"parameter",
"keys",
"as",
"array",
"keys",
".",
"Returns",
"either",
"only",
"the",
"first",
"values",
"of",
"the",
"parameters",
"or",
"all",
"values",
"of",
"the",
"parameters"... | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlQuery.php#L153-L160 | train |
timostamm/url-builder | src/UrlQuery.php | UrlQuery.count | public function count($key = null)
{
if (is_null($key)) {
return count($this->params);
}
return count($this->getArray($key));
} | php | public function count($key = null)
{
if (is_null($key)) {
return count($this->params);
}
return count($this->getArray($key));
} | [
"public",
"function",
"count",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"return",
"count",
"(",
"$",
"this",
"->",
"params",
")",
";",
"}",
"return",
"count",
"(",
"$",
"this",
"->",
"getArray"... | Counts the parameters.
Parameter keys that appear multiple times count as one array parameter.
If the $key parameter is used, the number of values of this parameter are counted.
@param string $key
@return int | [
"Counts",
"the",
"parameters",
".",
"Parameter",
"keys",
"that",
"appear",
"multiple",
"times",
"count",
"as",
"one",
"array",
"parameter",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlQuery.php#L182-L188 | train |
lrezek/Arachnid | src/LRezek/Arachnid/Meta/Property.php | Property.isProperty | function isProperty()
{
//Get the annotation index
$i = $this->getAnnotationIndex(self::PROPERTY);
//If the property annotation is on here
if($i >= 0)
{
//Set the format (Date, JSON, scalar, etc)
$this->format = $this->annotations[$i]->format;
... | php | function isProperty()
{
//Get the annotation index
$i = $this->getAnnotationIndex(self::PROPERTY);
//If the property annotation is on here
if($i >= 0)
{
//Set the format (Date, JSON, scalar, etc)
$this->format = $this->annotations[$i]->format;
... | [
"function",
"isProperty",
"(",
")",
"{",
"//Get the annotation index",
"$",
"i",
"=",
"$",
"this",
"->",
"getAnnotationIndex",
"(",
"self",
"::",
"PROPERTY",
")",
";",
"//If the property annotation is on here",
"if",
"(",
"$",
"i",
">=",
"0",
")",
"{",
"//Set ... | Checks if this property is indeed a property.
@return bool | [
"Checks",
"if",
"this",
"property",
"is",
"indeed",
"a",
"property",
"."
] | fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a | https://github.com/lrezek/Arachnid/blob/fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a/src/LRezek/Arachnid/Meta/Property.php#L112-L132 | train |
lrezek/Arachnid | src/LRezek/Arachnid/Meta/Property.php | Property.getValue | function getValue($entity)
{
$raw = $this->property->getValue($entity);
switch ($this->format)
{
case 'scalar':
return $raw;
//Serialize classes and arrays before putting them in the DB
case 'object':
case 'array':
... | php | function getValue($entity)
{
$raw = $this->property->getValue($entity);
switch ($this->format)
{
case 'scalar':
return $raw;
//Serialize classes and arrays before putting them in the DB
case 'object':
case 'array':
... | [
"function",
"getValue",
"(",
"$",
"entity",
")",
"{",
"$",
"raw",
"=",
"$",
"this",
"->",
"property",
"->",
"getValue",
"(",
"$",
"entity",
")",
";",
"switch",
"(",
"$",
"this",
"->",
"format",
")",
"{",
"case",
"'scalar'",
":",
"return",
"$",
"raw... | Gets this property's value in the given entity.
@param Relation|Node $entity The entity to get the value from.
@return mixed The property value. | [
"Gets",
"this",
"property",
"s",
"value",
"in",
"the",
"given",
"entity",
"."
] | fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a | https://github.com/lrezek/Arachnid/blob/fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a/src/LRezek/Arachnid/Meta/Property.php#L160-L195 | train |
lrezek/Arachnid | src/LRezek/Arachnid/Meta/Property.php | Property.setValue | function setValue($entity, $value)
{
switch ($this->format)
{
case 'scalar':
$this->property->setValue($entity, $value);
break;
//Unserialize classes and arrays before putting them back in the entity.
case 'object':
cas... | php | function setValue($entity, $value)
{
switch ($this->format)
{
case 'scalar':
$this->property->setValue($entity, $value);
break;
//Unserialize classes and arrays before putting them back in the entity.
case 'object':
cas... | [
"function",
"setValue",
"(",
"$",
"entity",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"format",
")",
"{",
"case",
"'scalar'",
":",
"$",
"this",
"->",
"property",
"->",
"setValue",
"(",
"$",
"entity",
",",
"$",
"value",
")",
";"... | Sets this property's value in the given entity.
@param Relation|Node $entity The entity to set the property of.
@param mixed $value The value to set it to. | [
"Sets",
"this",
"property",
"s",
"value",
"in",
"the",
"given",
"entity",
"."
] | fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a | https://github.com/lrezek/Arachnid/blob/fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a/src/LRezek/Arachnid/Meta/Property.php#L203-L233 | train |
lrezek/Arachnid | src/LRezek/Arachnid/Meta/Property.php | Property.matches | function matches($names)
{
//Check every argument supplied
foreach (func_get_args() as $name)
{
//Check for any possible match
if (
0 === strcasecmp($name, $this->name) ||
0 === strcasecmp($name, $this->property->getName()) ||
... | php | function matches($names)
{
//Check every argument supplied
foreach (func_get_args() as $name)
{
//Check for any possible match
if (
0 === strcasecmp($name, $this->name) ||
0 === strcasecmp($name, $this->property->getName()) ||
... | [
"function",
"matches",
"(",
"$",
"names",
")",
"{",
"//Check every argument supplied",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"name",
")",
"{",
"//Check for any possible match",
"if",
"(",
"0",
"===",
"strcasecmp",
"(",
"$",
"name",
",",
"$",
... | Checks if a supplied name matches this property's name.
@param mixed $names List of names to check.
@return bool | [
"Checks",
"if",
"a",
"supplied",
"name",
"matches",
"this",
"property",
"s",
"name",
"."
] | fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a | https://github.com/lrezek/Arachnid/blob/fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a/src/LRezek/Arachnid/Meta/Property.php#L251-L268 | train |
lrezek/Arachnid | src/LRezek/Arachnid/Meta/Property.php | Property.validateAnnotations | private function validateAnnotations()
{
//Count annotations in the annotation namespace, ignore annotations not in our namespace
$count = 0;
foreach($this->annotations as $a)
{
//If you find the namespace in the class name, add to count
if(strrpos(get_class($... | php | private function validateAnnotations()
{
//Count annotations in the annotation namespace, ignore annotations not in our namespace
$count = 0;
foreach($this->annotations as $a)
{
//If you find the namespace in the class name, add to count
if(strrpos(get_class($... | [
"private",
"function",
"validateAnnotations",
"(",
")",
"{",
"//Count annotations in the annotation namespace, ignore annotations not in our namespace",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"annotations",
"as",
"$",
"a",
")",
"{",
"//If you fi... | Validates the annotation combination on a property.
@throws Exception If the combination is invalid in some way. | [
"Validates",
"the",
"annotation",
"combination",
"on",
"a",
"property",
"."
] | fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a | https://github.com/lrezek/Arachnid/blob/fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a/src/LRezek/Arachnid/Meta/Property.php#L285-L330 | train |
lrezek/Arachnid | src/LRezek/Arachnid/Meta/Property.php | Property.getAnnotationIndex | private function getAnnotationIndex($name)
{
for($i = 0; $i < count($this->annotations); $i++)
{
if($this->annotations[$i] instanceof $name)
{
return $i;
}
}
return -1;
} | php | private function getAnnotationIndex($name)
{
for($i = 0; $i < count($this->annotations); $i++)
{
if($this->annotations[$i] instanceof $name)
{
return $i;
}
}
return -1;
} | [
"private",
"function",
"getAnnotationIndex",
"(",
"$",
"name",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
"this",
"->",
"annotations",
")",
";",
"$",
"i",
"++",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"anno... | Gets the index of a annotation with the value specified, or -1 if it's not in the annotations array.
@param String $name The annotation class.
@return int The index of the annotation in the annotations array(). | [
"Gets",
"the",
"index",
"of",
"a",
"annotation",
"with",
"the",
"value",
"specified",
"or",
"-",
"1",
"if",
"it",
"s",
"not",
"in",
"the",
"annotations",
"array",
"."
] | fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a | https://github.com/lrezek/Arachnid/blob/fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a/src/LRezek/Arachnid/Meta/Property.php#L338-L349 | train |
PhoxPHP/Glider | src/Model/Uses/Record.php | Record.update | protected function update($keyValue=null, String $key, String $table, Array $properties=[])
{
if (isset($properties[$key])) {
unset($properties[$key]);
}
$this->queryBuilder()->where(
$key, $keyValue
)->update($table, $properties);
} | php | protected function update($keyValue=null, String $key, String $table, Array $properties=[])
{
if (isset($properties[$key])) {
unset($properties[$key]);
}
$this->queryBuilder()->where(
$key, $keyValue
)->update($table, $properties);
} | [
"protected",
"function",
"update",
"(",
"$",
"keyValue",
"=",
"null",
",",
"String",
"$",
"key",
",",
"String",
"$",
"table",
",",
"Array",
"$",
"properties",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"properties",
"[",
"$",
"key",
"]"... | Updates an existing record in the database table.
@param $keyValue <Mixed>
@param $key <String>
@param $table <String>
@param $properties <Array>
@access protected
@return <void> | [
"Updates",
"an",
"existing",
"record",
"in",
"the",
"database",
"table",
"."
] | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Model/Uses/Record.php#L115-L125 | train |
bruno-barros/w.eloquent-framework | src/weloquent/Core/Globaljs/GlobalJs.php | GlobalJs.add | public function add($index, $data = null, $toAdmin = false)
{
if (!$this->has($index))
{
$this->data = Arr::add($this->data, $index, $data);
$this->metas = Arr::add($this->metas, $this->firstIndex($index), ['admin' => $toAdmin]);
}
return $this;
} | php | public function add($index, $data = null, $toAdmin = false)
{
if (!$this->has($index))
{
$this->data = Arr::add($this->data, $index, $data);
$this->metas = Arr::add($this->metas, $this->firstIndex($index), ['admin' => $toAdmin]);
}
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"index",
",",
"$",
"data",
"=",
"null",
",",
"$",
"toAdmin",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"index",
")",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"Arr",
"::... | Append new data
@param string $index Unique identifier
@param null $data
@param bool $toAdmin If show on admin environment
@return $this | [
"Append",
"new",
"data"
] | d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd | https://github.com/bruno-barros/w.eloquent-framework/blob/d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd/src/weloquent/Core/Globaljs/GlobalJs.php#L49-L59 | train |
bruno-barros/w.eloquent-framework | src/weloquent/Core/Globaljs/GlobalJs.php | GlobalJs.toJson | public function toJson($admin = false)
{
$data = $this->prepareDataToJson($admin);
if (count($data) == 0)
{
return '{}';
}
return json_encode($data);
} | php | public function toJson($admin = false)
{
$data = $this->prepareDataToJson($admin);
if (count($data) == 0)
{
return '{}';
}
return json_encode($data);
} | [
"public",
"function",
"toJson",
"(",
"$",
"admin",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"prepareDataToJson",
"(",
"$",
"admin",
")",
";",
"if",
"(",
"count",
"(",
"$",
"data",
")",
"==",
"0",
")",
"{",
"return",
"'{}'",
";... | Return the data as JSON
@param bool $admin
@return string|void | [
"Return",
"the",
"data",
"as",
"JSON"
] | d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd | https://github.com/bruno-barros/w.eloquent-framework/blob/d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd/src/weloquent/Core/Globaljs/GlobalJs.php#L128-L138 | train |
hummer2k/ConLayout | src/Layout/Layout.php | Layout.load | public function load()
{
if (false === $this->isLoaded) {
$this->getEventManager()->trigger(
__FUNCTION__ . '.pre',
$this,
[]
);
$this->generate();
$this->injectBlocks();
$this->isLoaded = true;
... | php | public function load()
{
if (false === $this->isLoaded) {
$this->getEventManager()->trigger(
__FUNCTION__ . '.pre',
$this,
[]
);
$this->generate();
$this->injectBlocks();
$this->isLoaded = true;
... | [
"public",
"function",
"load",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"isLoaded",
")",
"{",
"$",
"this",
"->",
"getEventManager",
"(",
")",
"->",
"trigger",
"(",
"__FUNCTION__",
".",
"'.pre'",
",",
"$",
"this",
",",
"[",
"]",
"... | inject blocks into the root view model
@return LayoutInterface | [
"inject",
"blocks",
"into",
"the",
"root",
"view",
"model"
] | 15e472eaabc9b23ec6a5547524874e30d95e8d3e | https://github.com/hummer2k/ConLayout/blob/15e472eaabc9b23ec6a5547524874e30d95e8d3e/src/Layout/Layout.php#L97-L117 | train |
hummer2k/ConLayout | src/Layout/Layout.php | Layout.isAllowed | private function isAllowed($blockId, ModelInterface $block)
{
$result = $this->getEventManager()->trigger(
__FUNCTION__,
$this,
[
'block_id' => $blockId,
'block' => $block
]
);
if ($result->stopped()) {
... | php | private function isAllowed($blockId, ModelInterface $block)
{
$result = $this->getEventManager()->trigger(
__FUNCTION__,
$this,
[
'block_id' => $blockId,
'block' => $block
]
);
if ($result->stopped()) {
... | [
"private",
"function",
"isAllowed",
"(",
"$",
"blockId",
",",
"ModelInterface",
"$",
"block",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getEventManager",
"(",
")",
"->",
"trigger",
"(",
"__FUNCTION__",
",",
"$",
"this",
",",
"[",
"'block_id'",
"=... | Determines whether a block should be allowed given certain parameters
@param string $blockId
@param ModelInterface $block
@return bool | [
"Determines",
"whether",
"a",
"block",
"should",
"be",
"allowed",
"given",
"certain",
"parameters"
] | 15e472eaabc9b23ec6a5547524874e30d95e8d3e | https://github.com/hummer2k/ConLayout/blob/15e472eaabc9b23ec6a5547524874e30d95e8d3e/src/Layout/Layout.php#L175-L189 | train |
hummer2k/ConLayout | src/Layout/Layout.php | Layout.addBlock | public function addBlock($blockId, ModelInterface $block)
{
$this->blockPool->add($blockId, $block);
return $this;
} | php | public function addBlock($blockId, ModelInterface $block)
{
$this->blockPool->add($blockId, $block);
return $this;
} | [
"public",
"function",
"addBlock",
"(",
"$",
"blockId",
",",
"ModelInterface",
"$",
"block",
")",
"{",
"$",
"this",
"->",
"blockPool",
"->",
"add",
"(",
"$",
"blockId",
",",
"$",
"block",
")",
";",
"return",
"$",
"this",
";",
"}"
] | adds a block to the registry
@param string $blockId
@param ModelInterface $block
@return LayoutInterface | [
"adds",
"a",
"block",
"to",
"the",
"registry"
] | 15e472eaabc9b23ec6a5547524874e30d95e8d3e | https://github.com/hummer2k/ConLayout/blob/15e472eaabc9b23ec6a5547524874e30d95e8d3e/src/Layout/Layout.php#L198-L202 | train |
oliwierptak/Everon1 | src/Everon/Domain/Repository.php | Repository.prepareDataForEntity | protected function prepareDataForEntity(array $data)
{
/**
* @var \Everon\DataMapper\Interfaces\Schema\Column $Column
*/
foreach ($this->getMapper()->getTable()->getColumns() as $name => $Column) {
if (array_key_exists($name, $data) === false) {
if ($Col... | php | protected function prepareDataForEntity(array $data)
{
/**
* @var \Everon\DataMapper\Interfaces\Schema\Column $Column
*/
foreach ($this->getMapper()->getTable()->getColumns() as $name => $Column) {
if (array_key_exists($name, $data) === false) {
if ($Col... | [
"protected",
"function",
"prepareDataForEntity",
"(",
"array",
"$",
"data",
")",
"{",
"/**\n * @var \\Everon\\DataMapper\\Interfaces\\Schema\\Column $Column\n */",
"foreach",
"(",
"$",
"this",
"->",
"getMapper",
"(",
")",
"->",
"getTable",
"(",
")",
"->",
... | Makes sure data defined in the Entity is in proper format and all keys are set
@param array $data
@return array
@throws \Everon\Exception\Domain | [
"Makes",
"sure",
"data",
"defined",
"in",
"the",
"Entity",
"is",
"in",
"proper",
"format",
"and",
"all",
"keys",
"are",
"set"
] | ac93793d1fa517a8394db5f00062f1925dc218a3 | https://github.com/oliwierptak/Everon1/blob/ac93793d1fa517a8394db5f00062f1925dc218a3/src/Everon/Domain/Repository.php#L62-L83 | train |
open-orchestra/open-orchestra-display-bundle | DisplayBundle/DisplayBlock/Strategies/SubMenuStrategy.php | SubMenuStrategy.getNodes | protected function getNodes(ReadBlockInterface $block)
{
$nodes = null;
$nodeName = $block->getAttribute('nodeName');
$siteId = $this->currentSiteManager->getSiteId();
if (!is_null($nodeName)) {
$nodes = $this->nodeRepository->getSubMenu($nodeName, $block->getAttribute('... | php | protected function getNodes(ReadBlockInterface $block)
{
$nodes = null;
$nodeName = $block->getAttribute('nodeName');
$siteId = $this->currentSiteManager->getSiteId();
if (!is_null($nodeName)) {
$nodes = $this->nodeRepository->getSubMenu($nodeName, $block->getAttribute('... | [
"protected",
"function",
"getNodes",
"(",
"ReadBlockInterface",
"$",
"block",
")",
"{",
"$",
"nodes",
"=",
"null",
";",
"$",
"nodeName",
"=",
"$",
"block",
"->",
"getAttribute",
"(",
"'nodeName'",
")",
";",
"$",
"siteId",
"=",
"$",
"this",
"->",
"current... | Get nodes to display
@param ReadBlockInterface $block
@return array | [
"Get",
"nodes",
"to",
"display"
] | 0e59e8686dac2d8408b57b63b975b4e5a1aa9472 | https://github.com/open-orchestra/open-orchestra-display-bundle/blob/0e59e8686dac2d8408b57b63b975b4e5a1aa9472/DisplayBundle/DisplayBlock/Strategies/SubMenuStrategy.php#L103-L115 | train |
theloopyewe/ravelry-api.php | src/RavelryApi/ServiceClient.php | ServiceClient.defaultCommandFactory | public static function defaultCommandFactory(Description $description)
{
return function (
$name,
array $args = [],
GuzzleClientInterface $client
) use ($description) {
$operation = null;
if ($description->hasOperation($name)) {
... | php | public static function defaultCommandFactory(Description $description)
{
return function (
$name,
array $args = [],
GuzzleClientInterface $client
) use ($description) {
$operation = null;
if ($description->hasOperation($name)) {
... | [
"public",
"static",
"function",
"defaultCommandFactory",
"(",
"Description",
"$",
"description",
")",
"{",
"return",
"function",
"(",
"$",
"name",
",",
"array",
"$",
"args",
"=",
"[",
"]",
",",
"GuzzleClientInterface",
"$",
"client",
")",
"use",
"(",
"$",
... | We're overriding this to support operation-specific requestion options.
Currently this is for disabling `auth` on specific operations. | [
"We",
"re",
"overriding",
"this",
"to",
"support",
"operation",
"-",
"specific",
"requestion",
"options",
".",
"Currently",
"this",
"is",
"for",
"disabling",
"auth",
"on",
"specific",
"operations",
"."
] | 4dacae056e15cf5fd4e236b79843d0736db1e885 | https://github.com/theloopyewe/ravelry-api.php/blob/4dacae056e15cf5fd4e236b79843d0736db1e885/src/RavelryApi/ServiceClient.php#L20-L48 | train |
theloopyewe/ravelry-api.php | src/RavelryApi/ServiceClient.php | ServiceClient.processConfig | protected function processConfig(array $config)
{
$config['command_factory'] = self::defaultCommandFactory($this->getDescription());
// we'll add our own patched processor after this
parent::processConfig(
array_merge(
$config,
[
... | php | protected function processConfig(array $config)
{
$config['command_factory'] = self::defaultCommandFactory($this->getDescription());
// we'll add our own patched processor after this
parent::processConfig(
array_merge(
$config,
[
... | [
"protected",
"function",
"processConfig",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"config",
"[",
"'command_factory'",
"]",
"=",
"self",
"::",
"defaultCommandFactory",
"(",
"$",
"this",
"->",
"getDescription",
"(",
")",
")",
";",
"// we'll add our own patched... | We're overriding this to use our command factory from above and to use
custom objects for API results. | [
"We",
"re",
"overriding",
"this",
"to",
"use",
"our",
"command",
"factory",
"from",
"above",
"and",
"to",
"use",
"custom",
"objects",
"for",
"API",
"results",
"."
] | 4dacae056e15cf5fd4e236b79843d0736db1e885 | https://github.com/theloopyewe/ravelry-api.php/blob/4dacae056e15cf5fd4e236b79843d0736db1e885/src/RavelryApi/ServiceClient.php#L54-L76 | train |
cyberspectrum/i18n-contao | src/Mapping/Terminal42ChangeLanguage/ArticleContentMap.php | ArticleContentMap.mapElements | private function mapElements(array $elements, array $mainElements, array &$map, array &$inverse): void
{
foreach ($elements as $index => $element) {
$elementId = (int) $element['id'];
if (!array_key_exists($index, $mainElements)) {
$this->logger->warning(
... | php | private function mapElements(array $elements, array $mainElements, array &$map, array &$inverse): void
{
foreach ($elements as $index => $element) {
$elementId = (int) $element['id'];
if (!array_key_exists($index, $mainElements)) {
$this->logger->warning(
... | [
"private",
"function",
"mapElements",
"(",
"array",
"$",
"elements",
",",
"array",
"$",
"mainElements",
",",
"array",
"&",
"$",
"map",
",",
"array",
"&",
"$",
"inverse",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"elements",
"as",
"$",
"index",
"=>",
... | Map the passed elements.
@param array $elements The elements to map.
@param array $mainElements The main elements.
@param array $map The map to store elements to.
@param array $inverse The inverse map.
@return void | [
"Map",
"the",
"passed",
"elements",
"."
] | 038cf6ea9c609a734d7476fba256bc4b0db236b7 | https://github.com/cyberspectrum/i18n-contao/blob/038cf6ea9c609a734d7476fba256bc4b0db236b7/src/Mapping/Terminal42ChangeLanguage/ArticleContentMap.php#L91-L123 | train |
aryelgois/medools-router | src/Controller.php | Controller.authenticate | public function authenticate(string $auth)
{
if ($this->router === null) {
return;
}
try {
$response = $this->router->authenticate($auth, 'Basic');
if (!($response instanceof Response)) {
$response = new Response;
$response... | php | public function authenticate(string $auth)
{
if ($this->router === null) {
return;
}
try {
$response = $this->router->authenticate($auth, 'Basic');
if (!($response instanceof Response)) {
$response = new Response;
$response... | [
"public",
"function",
"authenticate",
"(",
"string",
"$",
"auth",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"router",
"===",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"router",
"->",
"authenticate",
"(",... | Authenticates a Basic Authorization Header
When successful, a JWT is sent. It must be used for Bearer Authentication
with other routes
If the authentication is disabled, a 204 response is sent
@param string $auth Request Authorization Header | [
"Authenticates",
"a",
"Basic",
"Authorization",
"Header"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Controller.php#L72-L88 | train |
aryelgois/medools-router | src/Controller.php | Controller.run | public function run(
string $method,
string $uri,
array $headers,
string $body
) {
if ($this->router === null) {
return;
}
try {
$response = $this->router->run($method, $uri, $headers, $body);
if ($response !== null) {
... | php | public function run(
string $method,
string $uri,
array $headers,
string $body
) {
if ($this->router === null) {
return;
}
try {
$response = $this->router->run($method, $uri, $headers, $body);
if ($response !== null) {
... | [
"public",
"function",
"run",
"(",
"string",
"$",
"method",
",",
"string",
"$",
"uri",
",",
"array",
"$",
"headers",
",",
"string",
"$",
"body",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"router",
"===",
"null",
")",
"{",
"return",
";",
"}",
"try",
... | Runs the Router and outputs the Response
@param string $method Requested HTTP method
@param string $uri Requested URI
@param array $headers Request Headers
@param string $body Request Body | [
"Runs",
"the",
"Router",
"and",
"outputs",
"the",
"Response"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Controller.php#L98-L116 | train |
acacha/forge-publish | src/Console/Commands/PublishAssignment.php | PublishAssignment.createAssignment | protected function createAssignment()
{
$url = config('forge-publish.url') . config('forge-publish.store_assignment_uri');
try {
$response = $this->http->post($url, [
'form_params' => [
'name' => $this->assignmentName,
'repository_u... | php | protected function createAssignment()
{
$url = config('forge-publish.url') . config('forge-publish.store_assignment_uri');
try {
$response = $this->http->post($url, [
'form_params' => [
'name' => $this->assignmentName,
'repository_u... | [
"protected",
"function",
"createAssignment",
"(",
")",
"{",
"$",
"url",
"=",
"config",
"(",
"'forge-publish.url'",
")",
".",
"config",
"(",
"'forge-publish.store_assignment_uri'",
")",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"http",
"->",
"... | Create assignment.
@return array|mixed | [
"Create",
"assignment",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/PublishAssignment.php#L139-L164 | train |
PHPColibri/framework | Database/Concrete/MySQL/Connection.php | Connection.close | public function close()
{
if ( ! $this->link->close()) {
throw new DbException('can\'t close database connection: ' . $this->link->error, $this->link->errno);
}
return true;
} | php | public function close()
{
if ( ! $this->link->close()) {
throw new DbException('can\'t close database connection: ' . $this->link->error, $this->link->errno);
}
return true;
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"link",
"->",
"close",
"(",
")",
")",
"{",
"throw",
"new",
"DbException",
"(",
"'can\\'t close database connection: '",
".",
"$",
"this",
"->",
"link",
"->",
"error",
",",
... | Closes the connection.
@return bool
@throws \Colibri\Database\DbException | [
"Closes",
"the",
"connection",
"."
] | 7e5b77141da5e5e7c63afc83592671321ac52f36 | https://github.com/PHPColibri/framework/blob/7e5b77141da5e5e7c63afc83592671321ac52f36/Database/Concrete/MySQL/Connection.php#L54-L61 | train |
SpoonX/SxBootstrap | src/SxBootstrap/View/Helper/Bootstrap/FormColorPicker.php | FormColorPicker.assembleComponent | protected function assembleComponent($element)
{
$options = $this->getOptions();
$element = parent::__invoke($element);
$component = sprintf(
'<div style="padding: 0;" class="input-append color %s" data-color="%s" data-color-format="%s">%s',
$options['class'],
... | php | protected function assembleComponent($element)
{
$options = $this->getOptions();
$element = parent::__invoke($element);
$component = sprintf(
'<div style="padding: 0;" class="input-append color %s" data-color="%s" data-color-format="%s">%s',
$options['class'],
... | [
"protected",
"function",
"assembleComponent",
"(",
"$",
"element",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"$",
"element",
"=",
"parent",
"::",
"__invoke",
"(",
"$",
"element",
")",
";",
"$",
"component",
"=",
"sp... | Put together the colorpicker component.
@param Zend\Form\Element $element | [
"Put",
"together",
"the",
"colorpicker",
"component",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/View/Helper/Bootstrap/FormColorPicker.php#L72-L88 | train |
SpoonX/SxBootstrap | src/SxBootstrap/View/Helper/Bootstrap/FormColorPicker.php | FormColorPicker.prepareElement | protected function prepareElement($element)
{
$options = $this->getOptions();
$currClass = $element->getAttribute('class');
$class = $currClass . (null !== $currClass ? ' ' : '') . $options['class'];
$element->setAttributes(array(
'class' => $class,
... | php | protected function prepareElement($element)
{
$options = $this->getOptions();
$currClass = $element->getAttribute('class');
$class = $currClass . (null !== $currClass ? ' ' : '') . $options['class'];
$element->setAttributes(array(
'class' => $class,
... | [
"protected",
"function",
"prepareElement",
"(",
"$",
"element",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"$",
"currClass",
"=",
"$",
"element",
"->",
"getAttribute",
"(",
"'class'",
")",
";",
"$",
"class",
"=",
"$"... | Prepare the element by applying all changes to it required for the colorpicker.
@param Zend\Form\Element\Element $element
@return Zend\Form\View\Helper\FormInput | [
"Prepare",
"the",
"element",
"by",
"applying",
"all",
"changes",
"to",
"it",
"required",
"for",
"the",
"colorpicker",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/View/Helper/Bootstrap/FormColorPicker.php#L97-L110 | train |
SpoonX/SxBootstrap | src/SxBootstrap/View/Helper/Bootstrap/FormColorPicker.php | FormColorPicker.setOptions | protected function setOptions($options)
{
$options = array_merge(array(
'format' => 'hex',
'invoke_inline' => false,
'include_dependencies' => false,
'as_component' => false,
'class' => 'colorpicker'... | php | protected function setOptions($options)
{
$options = array_merge(array(
'format' => 'hex',
'invoke_inline' => false,
'include_dependencies' => false,
'as_component' => false,
'class' => 'colorpicker'... | [
"protected",
"function",
"setOptions",
"(",
"$",
"options",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"array",
"(",
"'format'",
"=>",
"'hex'",
",",
"'invoke_inline'",
"=>",
"false",
",",
"'include_dependencies'",
"=>",
"false",
",",
"'as_component'",
... | Set the options for the colorpicker.
@param array $options
@return array The options.
@throws Exception\InvalidArgumentException | [
"Set",
"the",
"options",
"for",
"the",
"colorpicker",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/View/Helper/Bootstrap/FormColorPicker.php#L145-L172 | train |
SpoonX/SxBootstrap | src/SxBootstrap/View/Helper/Bootstrap/FormColorPicker.php | FormColorPicker.includeDependencies | protected function includeDependencies()
{
$view = $this->getView();
$view->headScript()->appendFile($view->basePath() . '/js/bootstrap-colorpicker.js');
$view->headLink()->prependStylesheet($view->basePath() . '/css/colorpicker.css');
} | php | protected function includeDependencies()
{
$view = $this->getView();
$view->headScript()->appendFile($view->basePath() . '/js/bootstrap-colorpicker.js');
$view->headLink()->prependStylesheet($view->basePath() . '/css/colorpicker.css');
} | [
"protected",
"function",
"includeDependencies",
"(",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"$",
"view",
"->",
"headScript",
"(",
")",
"->",
"appendFile",
"(",
"$",
"view",
"->",
"basePath",
"(",
")",
".",
"'/js/bootst... | Include the colorpicker dependencies. | [
"Include",
"the",
"colorpicker",
"dependencies",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/View/Helper/Bootstrap/FormColorPicker.php#L190-L195 | train |
antaresproject/translations | src/Processor/Publisher.php | Publisher.publish | public function publish($language)
{
$translations = $this->getTranslationGroups($language->translations);
foreach ($translations as $area => $groups) {
foreach ($groups as $group => $items) {
if (!isset($this->hints[$group])) {
continue;
... | php | public function publish($language)
{
$translations = $this->getTranslationGroups($language->translations);
foreach ($translations as $area => $groups) {
foreach ($groups as $group => $items) {
if (!isset($this->hints[$group])) {
continue;
... | [
"public",
"function",
"publish",
"(",
"$",
"language",
")",
"{",
"$",
"translations",
"=",
"$",
"this",
"->",
"getTranslationGroups",
"(",
"$",
"language",
"->",
"translations",
")",
";",
"foreach",
"(",
"$",
"translations",
"as",
"$",
"area",
"=>",
"$",
... | publish translations from database
@param \Illuminate\Database\Eloquent\Model $language
@return boolean | [
"publish",
"translations",
"from",
"database"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Processor/Publisher.php#L65-L79 | train |
antaresproject/translations | src/Processor/Publisher.php | Publisher.putGitignore | protected function putGitignore($area)
{
$target = resource_path(implode(DIRECTORY_SEPARATOR, ['lang', $area, '.gitignore']));
if (!file_exists($target)) {
return $this->filesystem->put($target, "*\n!.gitignore");
}
return true;
} | php | protected function putGitignore($area)
{
$target = resource_path(implode(DIRECTORY_SEPARATOR, ['lang', $area, '.gitignore']));
if (!file_exists($target)) {
return $this->filesystem->put($target, "*\n!.gitignore");
}
return true;
} | [
"protected",
"function",
"putGitignore",
"(",
"$",
"area",
")",
"{",
"$",
"target",
"=",
"resource_path",
"(",
"implode",
"(",
"DIRECTORY_SEPARATOR",
",",
"[",
"'lang'",
",",
"$",
"area",
",",
"'.gitignore'",
"]",
")",
")",
";",
"if",
"(",
"!",
"file_exi... | Puts gitignore file in lang directory
@param String $area
@return boolean | [
"Puts",
"gitignore",
"file",
"in",
"lang",
"directory"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Processor/Publisher.php#L87-L94 | train |
antaresproject/translations | src/Processor/Publisher.php | Publisher.getResourcePath | protected function getResourcePath($locale, $area, $group)
{
$path = resource_path(implode(DIRECTORY_SEPARATOR, ['lang', $area, $group, $locale]));
if ($this->filesystem->exists($path)) {
$this->filesystem->cleanDirectory($path);
} else {
$this->filesystem->makeDirect... | php | protected function getResourcePath($locale, $area, $group)
{
$path = resource_path(implode(DIRECTORY_SEPARATOR, ['lang', $area, $group, $locale]));
if ($this->filesystem->exists($path)) {
$this->filesystem->cleanDirectory($path);
} else {
$this->filesystem->makeDirect... | [
"protected",
"function",
"getResourcePath",
"(",
"$",
"locale",
",",
"$",
"area",
",",
"$",
"group",
")",
"{",
"$",
"path",
"=",
"resource_path",
"(",
"implode",
"(",
"DIRECTORY_SEPARATOR",
",",
"[",
"'lang'",
",",
"$",
"area",
",",
"$",
"group",
",",
... | Gets resource path
@param String $locale
@param String $area
@param String $group
@return String | [
"Gets",
"resource",
"path"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Processor/Publisher.php#L104-L113 | train |
antaresproject/translations | src/Processor/Publisher.php | Publisher.publishTranslations | protected function publishTranslations($path, array $items)
{
foreach ($items as $filename => $translations) {
$content = "<?php
/**
* Part of the Antares package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD Lice... | php | protected function publishTranslations($path, array $items)
{
foreach ($items as $filename => $translations) {
$content = "<?php
/**
* Part of the Antares package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD Lice... | [
"protected",
"function",
"publishTranslations",
"(",
"$",
"path",
",",
"array",
"$",
"items",
")",
"{",
"foreach",
"(",
"$",
"items",
"as",
"$",
"filename",
"=>",
"$",
"translations",
")",
"{",
"$",
"content",
"=",
"\"<?php\n\n/**\n * Part of the Antares package... | writing translations to files
@param String $path
@param array $items
@return boolean | [
"writing",
"translations",
"to",
"files"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Processor/Publisher.php#L122-L150 | train |
antaresproject/translations | src/Processor/Publisher.php | Publisher.getTranslationGroups | protected function getTranslationGroups(Collection $list)
{
$groups = [];
foreach ($list as $model) {
if (!isset($groups[$model->area][$model->group])) {
$groups[$model->area][$model->group] = [];
}
$groups[$model->area][$model->group] = Arr::add($... | php | protected function getTranslationGroups(Collection $list)
{
$groups = [];
foreach ($list as $model) {
if (!isset($groups[$model->area][$model->group])) {
$groups[$model->area][$model->group] = [];
}
$groups[$model->area][$model->group] = Arr::add($... | [
"protected",
"function",
"getTranslationGroups",
"(",
"Collection",
"$",
"list",
")",
"{",
"$",
"groups",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"model",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"groups",
"[",
"$",
"model",
... | grouping translations by component name
@param Collection $list
@return array | [
"grouping",
"translations",
"by",
"component",
"name"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Processor/Publisher.php#L158-L168 | train |
factorio-item-browser/api-client | src/Service/EndpointService.php | EndpointService.getEndpointForRequest | public function getEndpointForRequest(RequestInterface $request): EndpointInterface
{
$requestClass = get_class($request);
if (!isset($this->endpointsByRequestClass[$requestClass])) {
throw new UnsupportedRequestException($requestClass);
}
return $this->endpointsByReques... | php | public function getEndpointForRequest(RequestInterface $request): EndpointInterface
{
$requestClass = get_class($request);
if (!isset($this->endpointsByRequestClass[$requestClass])) {
throw new UnsupportedRequestException($requestClass);
}
return $this->endpointsByReques... | [
"public",
"function",
"getEndpointForRequest",
"(",
"RequestInterface",
"$",
"request",
")",
":",
"EndpointInterface",
"{",
"$",
"requestClass",
"=",
"get_class",
"(",
"$",
"request",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"endpointsByReque... | Returns the endpoint for the request.
@param RequestInterface $request
@return EndpointInterface
@throws UnsupportedRequestException | [
"Returns",
"the",
"endpoint",
"for",
"the",
"request",
"."
] | ebda897483bd537c310a17ff868ca40c0568f728 | https://github.com/factorio-item-browser/api-client/blob/ebda897483bd537c310a17ff868ca40c0568f728/src/Service/EndpointService.php#L42-L50 | train |
anklimsk/cakephp-console-installer | Console/Helper/WaitingShellHelper.php | WaitingShellHelper._getAnimateChar | protected function _getAnimateChar() {
if ($this->_animateCharNum >= count($this->_animateChars)) {
$this->_animateCharNum = 0;
}
return $this->_animateChars[$this->_animateCharNum++];
} | php | protected function _getAnimateChar() {
if ($this->_animateCharNum >= count($this->_animateChars)) {
$this->_animateCharNum = 0;
}
return $this->_animateChars[$this->_animateCharNum++];
} | [
"protected",
"function",
"_getAnimateChar",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_animateCharNum",
">=",
"count",
"(",
"$",
"this",
"->",
"_animateChars",
")",
")",
"{",
"$",
"this",
"->",
"_animateCharNum",
"=",
"0",
";",
"}",
"return",
"$",
... | Get char for animate
@return string | [
"Get",
"char",
"for",
"animate"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Console/Helper/WaitingShellHelper.php#L58-L64 | train |
anklimsk/cakephp-console-installer | Console/Helper/WaitingShellHelper.php | WaitingShellHelper.animateMessage | public function animateMessage() {
if (!$this->_showMessage) {
$this->_showMessage = true;
$this->_animateCharNum = 0;
$msg = $this->_getWaitMsg();
$msg .= ' ' . $this->_getAnimateChar();
$this->_consoleOutput->write($msg, 0);
} else {
$msg = $this->_getAnimateChar();
$this->_consoleOutput->ove... | php | public function animateMessage() {
if (!$this->_showMessage) {
$this->_showMessage = true;
$this->_animateCharNum = 0;
$msg = $this->_getWaitMsg();
$msg .= ' ' . $this->_getAnimateChar();
$this->_consoleOutput->write($msg, 0);
} else {
$msg = $this->_getAnimateChar();
$this->_consoleOutput->ove... | [
"public",
"function",
"animateMessage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_showMessage",
")",
"{",
"$",
"this",
"->",
"_showMessage",
"=",
"true",
";",
"$",
"this",
"->",
"_animateCharNum",
"=",
"0",
";",
"$",
"msg",
"=",
"$",
"this"... | Print message 'Please wait...' and animate char on console
@return void | [
"Print",
"message",
"Please",
"wait",
"...",
"and",
"animate",
"char",
"on",
"console"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Console/Helper/WaitingShellHelper.php#L82-L93 | train |
anklimsk/cakephp-console-installer | Console/Helper/WaitingShellHelper.php | WaitingShellHelper.hideMessage | public function hideMessage() {
if (!$this->_showMessage) {
return;
}
$msg = $this->_getWaitMsg();
$msg .= ' x';
$this->_consoleOutput->write(str_repeat("\x08", mb_strlen($msg)), 0);
$this->_showMessage = false;
} | php | public function hideMessage() {
if (!$this->_showMessage) {
return;
}
$msg = $this->_getWaitMsg();
$msg .= ' x';
$this->_consoleOutput->write(str_repeat("\x08", mb_strlen($msg)), 0);
$this->_showMessage = false;
} | [
"public",
"function",
"hideMessage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_showMessage",
")",
"{",
"return",
";",
"}",
"$",
"msg",
"=",
"$",
"this",
"->",
"_getWaitMsg",
"(",
")",
";",
"$",
"msg",
".=",
"' x'",
";",
"$",
"this",
"->... | Hide message 'Please wait...' on console
@return void | [
"Hide",
"message",
"Please",
"wait",
"...",
"on",
"console"
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Console/Helper/WaitingShellHelper.php#L100-L109 | train |
as3io/modlr | src/Models/Embeds/HasMany.php | HasMany.areDirty | public function areDirty()
{
if (true === parent::areDirty()) {
return true;
}
foreach ($this->getOriginalAll() as $collection) {
if (true === $collection->isDirty()) {
return true;
}
}
return false;
} | php | public function areDirty()
{
if (true === parent::areDirty()) {
return true;
}
foreach ($this->getOriginalAll() as $collection) {
if (true === $collection->isDirty()) {
return true;
}
}
return false;
} | [
"public",
"function",
"areDirty",
"(",
")",
"{",
"if",
"(",
"true",
"===",
"parent",
"::",
"areDirty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"getOriginalAll",
"(",
")",
"as",
"$",
"collection",
")",
"{",
... | Extended to also check for dirty states of has-many Collections.
{@inheritDoc} | [
"Extended",
"to",
"also",
"check",
"for",
"dirty",
"states",
"of",
"has",
"-",
"many",
"Collections",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Models/Embeds/HasMany.php#L20-L31 | train |
as3io/modlr | src/Models/Embeds/HasMany.php | HasMany.calculateChangeSet | public function calculateChangeSet()
{
$set = [];
foreach ($this->getOriginalAll() as $key => $collection) {
if (false === $collection->isDirty()) {
continue;
}
$set[$key] = $collection->calculateChangeSet();
}
return $set;
} | php | public function calculateChangeSet()
{
$set = [];
foreach ($this->getOriginalAll() as $key => $collection) {
if (false === $collection->isDirty()) {
continue;
}
$set[$key] = $collection->calculateChangeSet();
}
return $set;
} | [
"public",
"function",
"calculateChangeSet",
"(",
")",
"{",
"$",
"set",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getOriginalAll",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"collection",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"collection... | Overwritten to account for collection change sets.
{@inheritDoc} | [
"Overwritten",
"to",
"account",
"for",
"collection",
"change",
"sets",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Models/Embeds/HasMany.php#L54-L64 | train |
YiMAproject/yimaWidgetator | src/yimaWidgetator/AbstractWidgetHelper.php | AbstractWidgetHelper.addWidget | function addWidget($region, $widget, $priority = 0)
{
if (!$this->rBoxContainer) {
$sm = $this->getServiceLocator()->getServiceLocator();
$rBoxContainer = $sm->get('yimaWidgetator.Widgetizer.Container');
$this->rBoxContainer = $rBoxContainer;
}
$this->r... | php | function addWidget($region, $widget, $priority = 0)
{
if (!$this->rBoxContainer) {
$sm = $this->getServiceLocator()->getServiceLocator();
$rBoxContainer = $sm->get('yimaWidgetator.Widgetizer.Container');
$this->rBoxContainer = $rBoxContainer;
}
$this->r... | [
"function",
"addWidget",
"(",
"$",
"region",
",",
"$",
"widget",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"rBoxContainer",
")",
"{",
"$",
"sm",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"getSer... | Add Widget To Region Box Container
@param $region
@param $widget
@param int $priority
@return $this | [
"Add",
"Widget",
"To",
"Region",
"Box",
"Container"
] | 332bc9318e6ceaec918147b30317da2f5b3d2636 | https://github.com/YiMAproject/yimaWidgetator/blob/332bc9318e6ceaec918147b30317da2f5b3d2636/src/yimaWidgetator/AbstractWidgetHelper.php#L59-L71 | train |
YiMAproject/yimaWidgetator | src/yimaWidgetator/AbstractWidgetHelper.php | AbstractWidgetHelper.getWidgetManager | function getWidgetManager()
{
if (! $this->widgetManager) {
$sm = $this->getServiceLocator()->getServiceLocator();
$widgetManager = $sm->get('yimaWidgetator.WidgetManager');
if (!($widgetManager instanceof WidgetManager)
|| !($widgetManager instanceof Abstr... | php | function getWidgetManager()
{
if (! $this->widgetManager) {
$sm = $this->getServiceLocator()->getServiceLocator();
$widgetManager = $sm->get('yimaWidgetator.WidgetManager');
if (!($widgetManager instanceof WidgetManager)
|| !($widgetManager instanceof Abstr... | [
"function",
"getWidgetManager",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"widgetManager",
")",
"{",
"$",
"sm",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"getServiceLocator",
"(",
")",
";",
"$",
"widgetManager",
"=",
"$",
"sm... | Get Widget Manager
@throws \Exception
@return WidgetManager | [
"Get",
"Widget",
"Manager"
] | 332bc9318e6ceaec918147b30317da2f5b3d2636 | https://github.com/YiMAproject/yimaWidgetator/blob/332bc9318e6ceaec918147b30317da2f5b3d2636/src/yimaWidgetator/AbstractWidgetHelper.php#L79-L97 | train |
znframework/package-hypertext | Table.php | Table.cell | public function cell(Int $spacing, Int $padding) : Table
{
$this->attr['cellspacing'] = $spacing;
$this->attr['cellpadding'] = $padding;
return $this;
} | php | public function cell(Int $spacing, Int $padding) : Table
{
$this->attr['cellspacing'] = $spacing;
$this->attr['cellpadding'] = $padding;
return $this;
} | [
"public",
"function",
"cell",
"(",
"Int",
"$",
"spacing",
",",
"Int",
"$",
"padding",
")",
":",
"Table",
"{",
"$",
"this",
"->",
"attr",
"[",
"'cellspacing'",
"]",
"=",
"$",
"spacing",
";",
"$",
"this",
"->",
"attr",
"[",
"'cellpadding'",
"]",
"=",
... | Sets table cell
@param int $spacing
@param int $padding
@return Table | [
"Sets",
"table",
"cell"
] | 12bbc3bd47a2fae735f638a3e01cc82c1b9c9005 | https://github.com/znframework/package-hypertext/blob/12bbc3bd47a2fae735f638a3e01cc82c1b9c9005/Table.php#L74-L80 | train |
znframework/package-hypertext | Table.php | Table.border | public function border(Int $border, String $color = NULL) : Table
{
$this->attr['border'] = $border;
if( ! empty($color) )
{
$this->attr['bordercolor'] = $color;
}
return $this;
} | php | public function border(Int $border, String $color = NULL) : Table
{
$this->attr['border'] = $border;
if( ! empty($color) )
{
$this->attr['bordercolor'] = $color;
}
return $this;
} | [
"public",
"function",
"border",
"(",
"Int",
"$",
"border",
",",
"String",
"$",
"color",
"=",
"NULL",
")",
":",
"Table",
"{",
"$",
"this",
"->",
"attr",
"[",
"'border'",
"]",
"=",
"$",
"border",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"color",
")"... | Sets table border
@param int $border
@param string $color = NULL
@return Table | [
"Sets",
"table",
"border"
] | 12bbc3bd47a2fae735f638a3e01cc82c1b9c9005 | https://github.com/znframework/package-hypertext/blob/12bbc3bd47a2fae735f638a3e01cc82c1b9c9005/Table.php#L90-L100 | train |
znframework/package-hypertext | Table.php | Table.size | public function size(Int $width, Int $height) : Table
{
$this->attr['width'] = $width;
$this->attr['height'] = $height;
return $this;
} | php | public function size(Int $width, Int $height) : Table
{
$this->attr['width'] = $width;
$this->attr['height'] = $height;
return $this;
} | [
"public",
"function",
"size",
"(",
"Int",
"$",
"width",
",",
"Int",
"$",
"height",
")",
":",
"Table",
"{",
"$",
"this",
"->",
"attr",
"[",
"'width'",
"]",
"=",
"$",
"width",
";",
"$",
"this",
"->",
"attr",
"[",
"'height'",
"]",
"=",
"$",
"height"... | Sets table size
@param int $width
@param int $height
@return Table | [
"Sets",
"table",
"size"
] | 12bbc3bd47a2fae735f638a3e01cc82c1b9c9005 | https://github.com/znframework/package-hypertext/blob/12bbc3bd47a2fae735f638a3e01cc82c1b9c9005/Table.php#L110-L116 | train |
znframework/package-hypertext | Table.php | Table.style | public function style(Array $attributes) : Table
{
$attribute = '';
foreach( $attributes as $key => $values )
{
if( is_numeric($key) )
{
$key = $values;
}
$attribute .= ' '.$key.':'.$values.';';
}
$this->attr[... | php | public function style(Array $attributes) : Table
{
$attribute = '';
foreach( $attributes as $key => $values )
{
if( is_numeric($key) )
{
$key = $values;
}
$attribute .= ' '.$key.':'.$values.';';
}
$this->attr[... | [
"public",
"function",
"style",
"(",
"Array",
"$",
"attributes",
")",
":",
"Table",
"{",
"$",
"attribute",
"=",
"''",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"values",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
... | Sets table style attribute
@param array $attributes
@return Table | [
"Sets",
"table",
"style",
"attribute"
] | 12bbc3bd47a2fae735f638a3e01cc82c1b9c9005 | https://github.com/znframework/package-hypertext/blob/12bbc3bd47a2fae735f638a3e01cc82c1b9c9005/Table.php#L125-L142 | train |
schpill/thin | src/Form.php | Form.buildLabel | public static function buildLabel($name, $label = '', $required = false)
{
$out = '';
if (!empty($label)) {
$class = 'control-label';
$requiredLabel = '.req';
$requiredSuffix = '<span class="required"><i class="icon-asterisk"></i></span>';... | php | public static function buildLabel($name, $label = '', $required = false)
{
$out = '';
if (!empty($label)) {
$class = 'control-label';
$requiredLabel = '.req';
$requiredSuffix = '<span class="required"><i class="icon-asterisk"></i></span>';... | [
"public",
"static",
"function",
"buildLabel",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"required",
"=",
"false",
")",
"{",
"$",
"out",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"label",
")",
")",
"{",
"$",
"class",
"="... | Builds the label html
@param string $name The name of the html field
@param string $label The label name
@param boolean $required
@return string | [
"Builds",
"the",
"label",
"html"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Form.php#L122-L142 | train |
schpill/thin | src/Form.php | Form.buildWrapper | private static function buildWrapper($field, $name, $label = '', $checkbox = false, $required)
{
$getter = 'get' . Inflector::camelize($name);
$error = null;
$actual = Session::instance('ThinForm')->getActual();
if (null !== $actual) {
$error = $a... | php | private static function buildWrapper($field, $name, $label = '', $checkbox = false, $required)
{
$getter = 'get' . Inflector::camelize($name);
$error = null;
$actual = Session::instance('ThinForm')->getActual();
if (null !== $actual) {
$error = $a... | [
"private",
"static",
"function",
"buildWrapper",
"(",
"$",
"field",
",",
"$",
"name",
",",
"$",
"label",
"=",
"''",
",",
"$",
"checkbox",
"=",
"false",
",",
"$",
"required",
")",
"{",
"$",
"getter",
"=",
"'get'",
".",
"Inflector",
"::",
"camelize",
"... | Builds the Twitter Bootstrap control wrapper
@param string $field The html for the field
@param string $name The name of the field
@param string $label The label name
@param boolean $checkbox
@return string | [
"Builds",
"the",
"Twitter",
"Bootstrap",
"control",
"wrapper"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Form.php#L153-L185 | train |
jtallant/skimpy-engine | src/File/ContentFile.php | ContentFile.getDate | public function getDate()
{
if (false === $this->frontMatter->has('date')) {
# Defaults to last modified
return (new DateTime)->setTimestamp($this->file->getMTime());
}
$date = $this->frontMatter->getDate();
if ($date instanceof DateTime) {
retur... | php | public function getDate()
{
if (false === $this->frontMatter->has('date')) {
# Defaults to last modified
return (new DateTime)->setTimestamp($this->file->getMTime());
}
$date = $this->frontMatter->getDate();
if ($date instanceof DateTime) {
retur... | [
"public",
"function",
"getDate",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"frontMatter",
"->",
"has",
"(",
"'date'",
")",
")",
"{",
"# Defaults to last modified",
"return",
"(",
"new",
"DateTime",
")",
"->",
"setTimestamp",
"(",
"$",
... | Front matter date or filemtime
@return DateTime | [
"Front",
"matter",
"date",
"or",
"filemtime"
] | 2fce5bc16f8745e54fd66a1c291fcea47fc1b4b2 | https://github.com/jtallant/skimpy-engine/blob/2fce5bc16f8745e54fd66a1c291fcea47fc1b4b2/src/File/ContentFile.php#L108-L122 | train |
jtallant/skimpy-engine | src/File/ContentFile.php | ContentFile.getUri | public function getUri()
{
if ($this->isIndex()) {
return $this->getUriPath();
}
$path = $this->getUriPath().DIRECTORY_SEPARATOR.$this->getFilename();
return trim($path, DIRECTORY_SEPARATOR);
} | php | public function getUri()
{
if ($this->isIndex()) {
return $this->getUriPath();
}
$path = $this->getUriPath().DIRECTORY_SEPARATOR.$this->getFilename();
return trim($path, DIRECTORY_SEPARATOR);
} | [
"public",
"function",
"getUri",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isIndex",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getUriPath",
"(",
")",
";",
"}",
"$",
"path",
"=",
"$",
"this",
"->",
"getUriPath",
"(",
")",
".",
"DIRECTOR... | URI to the content based on directory path
# Directory | URI
------------------------------------
foo/bar/baz.md | foo/bar/baz
Files named index.md do not use the filename in the URI:
index.md => /
foo/index.md => foo/
foo/bar/index.md => foo/bar/index
@return string | [
"URI",
"to",
"the",
"content",
"based",
"on",
"directory",
"path"
] | 2fce5bc16f8745e54fd66a1c291fcea47fc1b4b2 | https://github.com/jtallant/skimpy-engine/blob/2fce5bc16f8745e54fd66a1c291fcea47fc1b4b2/src/File/ContentFile.php#L188-L197 | train |
jtallant/skimpy-engine | src/File/ContentFile.php | ContentFile.getUriPath | protected function getUriPath()
{
$path = dirname($this->getPathFromContent());
$parts = explode(DIRECTORY_SEPARATOR, $path);
$uriParts = array_filter($parts, function ($dirname) {
return false === $this->isTopLevel();
});
return trim(implode(DIRECTORY_SEPARATOR... | php | protected function getUriPath()
{
$path = dirname($this->getPathFromContent());
$parts = explode(DIRECTORY_SEPARATOR, $path);
$uriParts = array_filter($parts, function ($dirname) {
return false === $this->isTopLevel();
});
return trim(implode(DIRECTORY_SEPARATOR... | [
"protected",
"function",
"getUriPath",
"(",
")",
"{",
"$",
"path",
"=",
"dirname",
"(",
"$",
"this",
"->",
"getPathFromContent",
"(",
")",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"DIRECTORY_SEPARATOR",
",",
"$",
"path",
")",
";",
"$",
"uriParts",
... | Returns the URI parts to the Entry up to but not including
the slug, based on the file location.
@return string | [
"Returns",
"the",
"URI",
"parts",
"to",
"the",
"Entry",
"up",
"to",
"but",
"not",
"including",
"the",
"slug",
"based",
"on",
"the",
"file",
"location",
"."
] | 2fce5bc16f8745e54fd66a1c291fcea47fc1b4b2 | https://github.com/jtallant/skimpy-engine/blob/2fce5bc16f8745e54fd66a1c291fcea47fc1b4b2/src/File/ContentFile.php#L257-L267 | train |
crisu83/yii-consoletools | commands/EnvironmentCommand.php | EnvironmentCommand.run | public function run($args)
{
if (!isset($args[0])) {
$this->usageError('The environment id is not specified.');
}
$id = $args[0];
$this->flush();
echo "\nCopying environment files... \n";
$environmentPath = $this->basePath . '/' . $this->environmentsDir ... | php | public function run($args)
{
if (!isset($args[0])) {
$this->usageError('The environment id is not specified.');
}
$id = $args[0];
$this->flush();
echo "\nCopying environment files... \n";
$environmentPath = $this->basePath . '/' . $this->environmentsDir ... | [
"public",
"function",
"run",
"(",
"$",
"args",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"args",
"[",
"0",
"]",
")",
")",
"{",
"$",
"this",
"->",
"usageError",
"(",
"'The environment id is not specified.'",
")",
";",
"}",
"$",
"id",
"=",
"$",
"a... | Changes the current environment.
@param array $args the command-line arguments.
@throws CException if the environment path does not exist. | [
"Changes",
"the",
"current",
"environment",
"."
] | 53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc | https://github.com/crisu83/yii-consoletools/blob/53bcb1bcdd33b9ef79034ff9c0d5bbfb3f971afc/commands/EnvironmentCommand.php#L44-L62 | train |
MovingImage24/VM6ApiClient | lib/ApiClient/AbstractApiClient.php | AbstractApiClient.getChannelList | private function getChannelList()
{
if (empty($this->channelList)) {
$response = $this->makeRequest('GET', 'get_rubric_object_list.json', []);
$this->channelList = $this->deserialize($response->getBody()->getContents(), ChannelList::class);
}
return $this->channelLis... | php | private function getChannelList()
{
if (empty($this->channelList)) {
$response = $this->makeRequest('GET', 'get_rubric_object_list.json', []);
$this->channelList = $this->deserialize($response->getBody()->getContents(), ChannelList::class);
}
return $this->channelLis... | [
"private",
"function",
"getChannelList",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"channelList",
")",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"makeRequest",
"(",
"'GET'",
",",
"'get_rubric_object_list.json'",
",",
"[",
"]",
"... | Returns ChannelList containing all channels belonging to the video manager.
@return ChannelList | [
"Returns",
"ChannelList",
"containing",
"all",
"channels",
"belonging",
"to",
"the",
"video",
"manager",
"."
] | 84e6510fa0fb71cfbb42ea9f23775f681c266fac | https://github.com/MovingImage24/VM6ApiClient/blob/84e6510fa0fb71cfbb42ea9f23775f681c266fac/lib/ApiClient/AbstractApiClient.php#L49-L57 | train |
MovingImage24/VM6ApiClient | lib/ApiClient/AbstractApiClient.php | AbstractApiClient.getChannelIdsInclusiveSubChannels | private function getChannelIdsInclusiveSubChannels($channelIds)
{
$subChannelIds = [];
foreach ($channelIds as $channelId) {
$subChannels = $this->getChannelList()->getChildren($channelId);
$subChannelIds = array_merge($subChannelIds, $subChannels->map(function (Channel $cha... | php | private function getChannelIdsInclusiveSubChannels($channelIds)
{
$subChannelIds = [];
foreach ($channelIds as $channelId) {
$subChannels = $this->getChannelList()->getChildren($channelId);
$subChannelIds = array_merge($subChannelIds, $subChannels->map(function (Channel $cha... | [
"private",
"function",
"getChannelIdsInclusiveSubChannels",
"(",
"$",
"channelIds",
")",
"{",
"$",
"subChannelIds",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"channelIds",
"as",
"$",
"channelId",
")",
"{",
"$",
"subChannels",
"=",
"$",
"this",
"->",
"getChann... | Returns an array containing all channel IDs inclusive sub channels.
@param $channelIds
@return array | [
"Returns",
"an",
"array",
"containing",
"all",
"channel",
"IDs",
"inclusive",
"sub",
"channels",
"."
] | 84e6510fa0fb71cfbb42ea9f23775f681c266fac | https://github.com/MovingImage24/VM6ApiClient/blob/84e6510fa0fb71cfbb42ea9f23775f681c266fac/lib/ApiClient/AbstractApiClient.php#L74-L88 | train |
chilimatic/chilimatic-framework | lib/http/Request.php | Request.init | public function init($param)
{
if (empty($param)) return false;
$this->header = '';
$param_list = new ParamList();
foreach ($param as $key => $value) {
if (property_exists($this, $key)) $this->$key = $value;
elseif (property_exists($param_list, strtolower(s... | php | public function init($param)
{
if (empty($param)) return false;
$this->header = '';
$param_list = new ParamList();
foreach ($param as $key => $value) {
if (property_exists($this, $key)) $this->$key = $value;
elseif (property_exists($param_list, strtolower(s... | [
"public",
"function",
"init",
"(",
"$",
"param",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"param",
")",
")",
"return",
"false",
";",
"$",
"this",
"->",
"header",
"=",
"''",
";",
"$",
"param_list",
"=",
"new",
"ParamList",
"(",
")",
";",
"foreach",
... | set the parameters
@param $param
@return bool | [
"set",
"the",
"parameters"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/http/Request.php#L124-L146 | train |
acacha/forge-publish | src/Console/Commands/Traits/ItFetchesSites.php | ItFetchesSites.getSiteByName | protected function getSiteByName($sites, $site_name)
{
$site_found = collect($sites)->filter(function ($site) use ($site_name) {
return $site->name === $site_name;
})->first();
if ($site_found) {
return $site_found;
}
return null;
} | php | protected function getSiteByName($sites, $site_name)
{
$site_found = collect($sites)->filter(function ($site) use ($site_name) {
return $site->name === $site_name;
})->first();
if ($site_found) {
return $site_found;
}
return null;
} | [
"protected",
"function",
"getSiteByName",
"(",
"$",
"sites",
",",
"$",
"site_name",
")",
"{",
"$",
"site_found",
"=",
"collect",
"(",
"$",
"sites",
")",
"->",
"filter",
"(",
"function",
"(",
"$",
"site",
")",
"use",
"(",
"$",
"site_name",
")",
"{",
"... | Get forge site from sites by name.
@param $sites
@param $site_id
@return mixed | [
"Get",
"forge",
"site",
"from",
"sites",
"by",
"name",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/Traits/ItFetchesSites.php#L40-L50 | train |
acacha/forge-publish | src/Console/Commands/Traits/ItFetchesSites.php | ItFetchesSites.getSite | protected function getSite($sites, $site_id)
{
$site_found = collect($sites)->filter(function ($site) use ($site_id) {
return $site->id === $site_id;
})->first();
if ($site_found) {
return $site_found;
}
return null;
} | php | protected function getSite($sites, $site_id)
{
$site_found = collect($sites)->filter(function ($site) use ($site_id) {
return $site->id === $site_id;
})->first();
if ($site_found) {
return $site_found;
}
return null;
} | [
"protected",
"function",
"getSite",
"(",
"$",
"sites",
",",
"$",
"site_id",
")",
"{",
"$",
"site_found",
"=",
"collect",
"(",
"$",
"sites",
")",
"->",
"filter",
"(",
"function",
"(",
"$",
"site",
")",
"use",
"(",
"$",
"site_id",
")",
"{",
"return",
... | Get forge site from sites.
@param $sites
@param $site_id
@return mixed | [
"Get",
"forge",
"site",
"from",
"sites",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/Traits/ItFetchesSites.php#L59-L69 | train |
acacha/forge-publish | src/Console/Commands/Traits/ItFetchesSites.php | ItFetchesSites.getSiteName | protected function getSiteName($sites, $site_id)
{
if ($site = $this->getSite($sites, $site_id)) {
return $site->name;
}
return null;
} | php | protected function getSiteName($sites, $site_id)
{
if ($site = $this->getSite($sites, $site_id)) {
return $site->name;
}
return null;
} | [
"protected",
"function",
"getSiteName",
"(",
"$",
"sites",
",",
"$",
"site_id",
")",
"{",
"if",
"(",
"$",
"site",
"=",
"$",
"this",
"->",
"getSite",
"(",
"$",
"sites",
",",
"$",
"site_id",
")",
")",
"{",
"return",
"$",
"site",
"->",
"name",
";",
... | Get forge site name from site id.
@param $sites
@param $site_id
@return mixed | [
"Get",
"forge",
"site",
"name",
"from",
"site",
"id",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/Traits/ItFetchesSites.php#L78-L84 | train |
acacha/forge-publish | src/Console/Commands/Traits/ItFetchesSites.php | ItFetchesSites.getSiteId | protected function getSiteId($sites, $site_name)
{
if ($site = $this->getSiteByName($sites, $site_name)) {
return $site->id;
}
return null;
} | php | protected function getSiteId($sites, $site_name)
{
if ($site = $this->getSiteByName($sites, $site_name)) {
return $site->id;
}
return null;
} | [
"protected",
"function",
"getSiteId",
"(",
"$",
"sites",
",",
"$",
"site_name",
")",
"{",
"if",
"(",
"$",
"site",
"=",
"$",
"this",
"->",
"getSiteByName",
"(",
"$",
"sites",
",",
"$",
"site_name",
")",
")",
"{",
"return",
"$",
"site",
"->",
"id",
"... | Get forge site id from site name.
@param $sites
@param $site_name
@return mixed | [
"Get",
"forge",
"site",
"id",
"from",
"site",
"name",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/Traits/ItFetchesSites.php#L93-L99 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Helper/Quote/Item.php | Radial_Core_Helper_Quote_Item.isItemInventoried | public function isItemInventoried(Mage_Sales_Model_Quote_Item $item)
{
// never consider a child product as inventoried, allow the parent deal
// with inventory and let the child not need to worry about it as the parent
// will be the item to keep track of qty being ordered.
// Both ... | php | public function isItemInventoried(Mage_Sales_Model_Quote_Item $item)
{
// never consider a child product as inventoried, allow the parent deal
// with inventory and let the child not need to worry about it as the parent
// will be the item to keep track of qty being ordered.
// Both ... | [
"public",
"function",
"isItemInventoried",
"(",
"Mage_Sales_Model_Quote_Item",
"$",
"item",
")",
"{",
"// never consider a child product as inventoried, allow the parent deal",
"// with inventory and let the child not need to worry about it as the parent",
"// will be the item to keep track of... | Test if the item needs to have its quantity checked for available
inventory.
@param Mage_Sales_Model_Quote_Item $item The item to check
@return bool True if inventory is managed, false if not | [
"Test",
"if",
"the",
"item",
"needs",
"to",
"have",
"its",
"quantity",
"checked",
"for",
"available",
"inventory",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Helper/Quote/Item.php#L32-L59 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Helper/Quote/Item.php | Radial_Core_Helper_Quote_Item.isManagedStock | protected function isManagedStock(Mage_CatalogInventory_Model_Stock_Item $stock)
{
return (
($this->_config->isBackorderable || (int) $stock->getBackorders() === Mage_CatalogInventory_Model_Stock::BACKORDERS_NO)
&& $stock->getManageStock() > 0
);
} | php | protected function isManagedStock(Mage_CatalogInventory_Model_Stock_Item $stock)
{
return (
($this->_config->isBackorderable || (int) $stock->getBackorders() === Mage_CatalogInventory_Model_Stock::BACKORDERS_NO)
&& $stock->getManageStock() > 0
);
} | [
"protected",
"function",
"isManagedStock",
"(",
"Mage_CatalogInventory_Model_Stock_Item",
"$",
"stock",
")",
"{",
"return",
"(",
"(",
"$",
"this",
"->",
"_config",
"->",
"isBackorderable",
"||",
"(",
"int",
")",
"$",
"stock",
"->",
"getBackorders",
"(",
")",
"... | If the inventory configuration allow order item to be backorderable simply check if the
Manage stock for the item is greater than zero. Otherwise, if the inventory configuration
do not allow order items to be backorderable, then ensure the item is not backorder and has
manage stock.
@param Mage_CatalogInventory_Model... | [
"If",
"the",
"inventory",
"configuration",
"allow",
"order",
"item",
"to",
"be",
"backorderable",
"simply",
"check",
"if",
"the",
"Manage",
"stock",
"for",
"the",
"item",
"is",
"greater",
"than",
"zero",
".",
"Otherwise",
"if",
"the",
"inventory",
"configurati... | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Helper/Quote/Item.php#L70-L76 | train |
silvercommerce/contact-admin | src/model/Contact.php | Contact.getTagsList | public function getTagsList()
{
$return = "";
$tags = $this->Tags()->column("Title");
$this->extend("updateTagsList", $tags);
return implode(
$this->config()->list_seperator,
$tags
);
} | php | public function getTagsList()
{
$return = "";
$tags = $this->Tags()->column("Title");
$this->extend("updateTagsList", $tags);
return implode(
$this->config()->list_seperator,
$tags
);
} | [
"public",
"function",
"getTagsList",
"(",
")",
"{",
"$",
"return",
"=",
"\"\"",
";",
"$",
"tags",
"=",
"$",
"this",
"->",
"Tags",
"(",
")",
"->",
"column",
"(",
"\"Title\"",
")",
";",
"$",
"this",
"->",
"extend",
"(",
"\"updateTagsList\"",
",",
"$",
... | Generate as string of tag titles seperated by a comma
@return string | [
"Generate",
"as",
"string",
"of",
"tag",
"titles",
"seperated",
"by",
"a",
"comma"
] | 32cbc2ef2589f93f9dd1796e5db2f11ad15d888c | https://github.com/silvercommerce/contact-admin/blob/32cbc2ef2589f93f9dd1796e5db2f11ad15d888c/src/model/Contact.php#L243-L254 | train |
silvercommerce/contact-admin | src/model/Contact.php | Contact.getListsList | public function getListsList()
{
$return = "";
$list = $this->Lists()->column("Title");
$this->extend("updateListsList", $tags);
return implode(
$this->config()->list_seperator,
$list
);
} | php | public function getListsList()
{
$return = "";
$list = $this->Lists()->column("Title");
$this->extend("updateListsList", $tags);
return implode(
$this->config()->list_seperator,
$list
);
} | [
"public",
"function",
"getListsList",
"(",
")",
"{",
"$",
"return",
"=",
"\"\"",
";",
"$",
"list",
"=",
"$",
"this",
"->",
"Lists",
"(",
")",
"->",
"column",
"(",
"\"Title\"",
")",
";",
"$",
"this",
"->",
"extend",
"(",
"\"updateListsList\"",
",",
"$... | Generate as string of list titles seperated by a comma
@return string | [
"Generate",
"as",
"string",
"of",
"list",
"titles",
"seperated",
"by",
"a",
"comma"
] | 32cbc2ef2589f93f9dd1796e5db2f11ad15d888c | https://github.com/silvercommerce/contact-admin/blob/32cbc2ef2589f93f9dd1796e5db2f11ad15d888c/src/model/Contact.php#L261-L272 | train |
silvercommerce/contact-admin | src/model/Contact.php | Contact.onBeforeDelete | public function onBeforeDelete()
{
parent::onBeforeDelete();
// Delete all locations attached to this order
foreach ($this->Locations() as $item) {
$item->delete();
}
// Delete all notes attached to this order
foreach ($this->Notes() as $item) {
... | php | public function onBeforeDelete()
{
parent::onBeforeDelete();
// Delete all locations attached to this order
foreach ($this->Locations() as $item) {
$item->delete();
}
// Delete all notes attached to this order
foreach ($this->Notes() as $item) {
... | [
"public",
"function",
"onBeforeDelete",
"(",
")",
"{",
"parent",
"::",
"onBeforeDelete",
"(",
")",
";",
"// Delete all locations attached to this order",
"foreach",
"(",
"$",
"this",
"->",
"Locations",
"(",
")",
"as",
"$",
"item",
")",
"{",
"$",
"item",
"->",
... | Cleanup DB on removal | [
"Cleanup",
"DB",
"on",
"removal"
] | 32cbc2ef2589f93f9dd1796e5db2f11ad15d888c | https://github.com/silvercommerce/contact-admin/blob/32cbc2ef2589f93f9dd1796e5db2f11ad15d888c/src/model/Contact.php#L513-L526 | train |
nyeholt/silverstripe-performant | code/services/SiteDataService.php | SiteDataService.getPrivateNodes | protected function getPrivateNodes() {
if (!Member::currentUserID()) {
return array();
}
$groups = Member::currentUser()->Groups()->column();
if (!count($groups)) {
return $groups;
}
$fields = $this->queryFields();
$query = new SQLQuery($fields, '"'.$this->baseClass.'"');
$query = $query->setOrd... | php | protected function getPrivateNodes() {
if (!Member::currentUserID()) {
return array();
}
$groups = Member::currentUser()->Groups()->column();
if (!count($groups)) {
return $groups;
}
$fields = $this->queryFields();
$query = new SQLQuery($fields, '"'.$this->baseClass.'"');
$query = $query->setOrd... | [
"protected",
"function",
"getPrivateNodes",
"(",
")",
"{",
"if",
"(",
"!",
"Member",
"::",
"currentUserID",
"(",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"groups",
"=",
"Member",
"::",
"currentUser",
"(",
")",
"->",
"Groups",
"(",
"... | Get private nodes, assuming SilverStripe's default perm structure
@return SS_Query | [
"Get",
"private",
"nodes",
"assuming",
"SilverStripe",
"s",
"default",
"perm",
"structure"
] | 2c9d2570ddf4a43ced38487184da4de453a4863c | https://github.com/nyeholt/silverstripe-performant/blob/2c9d2570ddf4a43ced38487184da4de453a4863c/code/services/SiteDataService.php#L158-L185 | train |
nyeholt/silverstripe-performant | code/services/SiteDataService.php | SiteDataService.createMenuNode | public function createMenuNode($data) {
$cls = $this->itemClass;
$node = $cls::create($data, $this);
$this->items[$node->ID] = $node;
return $node;
} | php | public function createMenuNode($data) {
$cls = $this->itemClass;
$node = $cls::create($data, $this);
$this->items[$node->ID] = $node;
return $node;
} | [
"public",
"function",
"createMenuNode",
"(",
"$",
"data",
")",
"{",
"$",
"cls",
"=",
"$",
"this",
"->",
"itemClass",
";",
"$",
"node",
"=",
"$",
"cls",
"::",
"create",
"(",
"$",
"data",
",",
"$",
"this",
")",
";",
"$",
"this",
"->",
"items",
"[",... | Creates a menu item from an array of data
@param array $data
@returns MenuItem | [
"Creates",
"a",
"menu",
"item",
"from",
"an",
"array",
"of",
"data"
] | 2c9d2570ddf4a43ced38487184da4de453a4863c | https://github.com/nyeholt/silverstripe-performant/blob/2c9d2570ddf4a43ced38487184da4de453a4863c/code/services/SiteDataService.php#L235-L240 | train |
airbornfoxx/commandcenter | src/Flyingfoxx/CommandCenter/MainCommandTranslator.php | MainCommandTranslator.toHandler | public function toHandler($command)
{
$class = get_class($command);
$offset = ($this->positionAt('Command', $class)) ?: $this->positionAt('Request', $class);
$handlerClass = substr_replace($class, 'Handler', $offset);
if (!class_exists($handlerClass)) {
$message = "Comma... | php | public function toHandler($command)
{
$class = get_class($command);
$offset = ($this->positionAt('Command', $class)) ?: $this->positionAt('Request', $class);
$handlerClass = substr_replace($class, 'Handler', $offset);
if (!class_exists($handlerClass)) {
$message = "Comma... | [
"public",
"function",
"toHandler",
"(",
"$",
"command",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"command",
")",
";",
"$",
"offset",
"=",
"(",
"$",
"this",
"->",
"positionAt",
"(",
"'Command'",
",",
"$",
"class",
")",
")",
"?",
":",
"$",... | Translate a command to its respective handler.
@param $command
@return mixed
@throws HandlerNotRegisteredException | [
"Translate",
"a",
"command",
"to",
"its",
"respective",
"handler",
"."
] | ee4f8d0981c69f8cd3410793988def4d809fdaa6 | https://github.com/airbornfoxx/commandcenter/blob/ee4f8d0981c69f8cd3410793988def4d809fdaa6/src/Flyingfoxx/CommandCenter/MainCommandTranslator.php#L19-L31 | train |
airbornfoxx/commandcenter | src/Flyingfoxx/CommandCenter/MainCommandTranslator.php | MainCommandTranslator.toValidator | public function toValidator($command)
{
$class = get_class($command);
$offset = ($this->positionAt('Command', $class)) ?: $this->positionAt('Request', $class);
return substr_replace($class, 'Validator', $offset);
} | php | public function toValidator($command)
{
$class = get_class($command);
$offset = ($this->positionAt('Command', $class)) ?: $this->positionAt('Request', $class);
return substr_replace($class, 'Validator', $offset);
} | [
"public",
"function",
"toValidator",
"(",
"$",
"command",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"command",
")",
";",
"$",
"offset",
"=",
"(",
"$",
"this",
"->",
"positionAt",
"(",
"'Command'",
",",
"$",
"class",
")",
")",
"?",
":",
"$... | Translate a command to its respective validator.
@param $command
@return mixed | [
"Translate",
"a",
"command",
"to",
"its",
"respective",
"validator",
"."
] | ee4f8d0981c69f8cd3410793988def4d809fdaa6 | https://github.com/airbornfoxx/commandcenter/blob/ee4f8d0981c69f8cd3410793988def4d809fdaa6/src/Flyingfoxx/CommandCenter/MainCommandTranslator.php#L39-L45 | train |
antaresproject/translations | src/Http/Breadcrumb/Breadcrumb.php | Breadcrumb.onTranslationList | public function onTranslationList()
{
$this->breadcrumbs->register('translations', function($breadcrumbs) {
$breadcrumbs->push('Translations', handles('antares::translations/index/' . area()));
});
$this->shareOnView('translations');
} | php | public function onTranslationList()
{
$this->breadcrumbs->register('translations', function($breadcrumbs) {
$breadcrumbs->push('Translations', handles('antares::translations/index/' . area()));
});
$this->shareOnView('translations');
} | [
"public",
"function",
"onTranslationList",
"(",
")",
"{",
"$",
"this",
"->",
"breadcrumbs",
"->",
"register",
"(",
"'translations'",
",",
"function",
"(",
"$",
"breadcrumbs",
")",
"{",
"$",
"breadcrumbs",
"->",
"push",
"(",
"'Translations'",
",",
"handles",
... | on translations list | [
"on",
"translations",
"list"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Http/Breadcrumb/Breadcrumb.php#L33-L40 | train |
antaresproject/translations | src/Http/Breadcrumb/Breadcrumb.php | Breadcrumb.onLanguageAdd | public function onLanguageAdd()
{
$this->onTranslationList();
$this->breadcrumbs->register('languages', function($breadcrumbs) {
$breadcrumbs->parent('translations');
$breadcrumbs->push('Languages', handles('antares::translations/languages/index'));
});
$this-... | php | public function onLanguageAdd()
{
$this->onTranslationList();
$this->breadcrumbs->register('languages', function($breadcrumbs) {
$breadcrumbs->parent('translations');
$breadcrumbs->push('Languages', handles('antares::translations/languages/index'));
});
$this-... | [
"public",
"function",
"onLanguageAdd",
"(",
")",
"{",
"$",
"this",
"->",
"onTranslationList",
"(",
")",
";",
"$",
"this",
"->",
"breadcrumbs",
"->",
"register",
"(",
"'languages'",
",",
"function",
"(",
"$",
"breadcrumbs",
")",
"{",
"$",
"breadcrumbs",
"->... | on language add | [
"on",
"language",
"add"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Http/Breadcrumb/Breadcrumb.php#L45-L57 | train |
antaresproject/translations | src/Http/Breadcrumb/Breadcrumb.php | Breadcrumb.onImportTranslations | public function onImportTranslations()
{
$this->onTranslationList();
$this->breadcrumbs->register('translations-import', function($breadcrumbs) {
$breadcrumbs->parent('translations');
$breadcrumbs->push('Import translations');
});
$this->shareOnView('translati... | php | public function onImportTranslations()
{
$this->onTranslationList();
$this->breadcrumbs->register('translations-import', function($breadcrumbs) {
$breadcrumbs->parent('translations');
$breadcrumbs->push('Import translations');
});
$this->shareOnView('translati... | [
"public",
"function",
"onImportTranslations",
"(",
")",
"{",
"$",
"this",
"->",
"onTranslationList",
"(",
")",
";",
"$",
"this",
"->",
"breadcrumbs",
"->",
"register",
"(",
"'translations-import'",
",",
"function",
"(",
"$",
"breadcrumbs",
")",
"{",
"$",
"br... | on import translations | [
"on",
"import",
"translations"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Http/Breadcrumb/Breadcrumb.php#L62-L70 | train |
antaresproject/translations | src/Http/Breadcrumb/Breadcrumb.php | Breadcrumb.onLanguagesList | public function onLanguagesList()
{
$this->breadcrumbs->register('translations', function($breadcrumbs) {
$breadcrumbs->push('Translations', handles('antares::translations/index/' . area()), ['force_link' => true]);
});
$this->shareOnView('translations');
} | php | public function onLanguagesList()
{
$this->breadcrumbs->register('translations', function($breadcrumbs) {
$breadcrumbs->push('Translations', handles('antares::translations/index/' . area()), ['force_link' => true]);
});
$this->shareOnView('translations');
} | [
"public",
"function",
"onLanguagesList",
"(",
")",
"{",
"$",
"this",
"->",
"breadcrumbs",
"->",
"register",
"(",
"'translations'",
",",
"function",
"(",
"$",
"breadcrumbs",
")",
"{",
"$",
"breadcrumbs",
"->",
"push",
"(",
"'Translations'",
",",
"handles",
"(... | On languages list | [
"On",
"languages",
"list"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Http/Breadcrumb/Breadcrumb.php#L75-L82 | train |
WellCommerce/CatalogBundle | Controller/Admin/AttributeController.php | AttributeController.ajaxIndexAction | public function ajaxIndexAction(Request $request): Response
{
if (!$request->isXmlHttpRequest()) {
return $this->redirectToAction('index');
}
$attributeGroupId = (int)$request->request->get('id');
$attributeGroup = $this->getManager()->findAttributeGroup($attri... | php | public function ajaxIndexAction(Request $request): Response
{
if (!$request->isXmlHttpRequest()) {
return $this->redirectToAction('index');
}
$attributeGroupId = (int)$request->request->get('id');
$attributeGroup = $this->getManager()->findAttributeGroup($attri... | [
"public",
"function",
"ajaxIndexAction",
"(",
"Request",
"$",
"request",
")",
":",
"Response",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"redirectToAction",
"(",
"'index'",
")",
";",
"... | Ajax action for listing attributes in variants editor
@param Request $request
@return Response | [
"Ajax",
"action",
"for",
"listing",
"attributes",
"in",
"variants",
"editor"
] | b1809190298f6c6c04c472dbfd763c1ad0b68630 | https://github.com/WellCommerce/CatalogBundle/blob/b1809190298f6c6c04c472dbfd763c1ad0b68630/Controller/Admin/AttributeController.php#L35-L47 | train |
WellCommerce/CatalogBundle | Controller/Admin/AttributeController.php | AttributeController.ajaxAddAction | public function ajaxAddAction(Request $request): Response
{
if (!$request->isXmlHttpRequest()) {
return $this->redirectToAction('index');
}
$attributeName = $request->request->get('name');
$attributeGroupId = (int)$request->request->get('set');
... | php | public function ajaxAddAction(Request $request): Response
{
if (!$request->isXmlHttpRequest()) {
return $this->redirectToAction('index');
}
$attributeName = $request->request->get('name');
$attributeGroupId = (int)$request->request->get('set');
... | [
"public",
"function",
"ajaxAddAction",
"(",
"Request",
"$",
"request",
")",
":",
"Response",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"redirectToAction",
"(",
"'index'",
")",
";",
"}"... | Adds new attribute value using ajax request
@param Request $request
@return Response | [
"Adds",
"new",
"attribute",
"value",
"using",
"ajax",
"request"
] | b1809190298f6c6c04c472dbfd763c1ad0b68630 | https://github.com/WellCommerce/CatalogBundle/blob/b1809190298f6c6c04c472dbfd763c1ad0b68630/Controller/Admin/AttributeController.php#L56-L78 | train |
twistor/flysystem-memory-adapter | src/MemoryAdapter.php | MemoryAdapter.createFromPath | public static function createFromPath($path)
{
if (!is_dir($path) || !is_readable($path)) {
throw new \LogicException(sprintf('%s does not exist or is not readable.', $path));
}
return static::createFromFilesystem(new Filesystem(new Local($path)));
} | php | public static function createFromPath($path)
{
if (!is_dir($path) || !is_readable($path)) {
throw new \LogicException(sprintf('%s does not exist or is not readable.', $path));
}
return static::createFromFilesystem(new Filesystem(new Local($path)));
} | [
"public",
"static",
"function",
"createFromPath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
"||",
"!",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'%... | Creates a Memory adapter from a filesystem folder.
@param string $path The path to the folder.
@return MemoryAdapter A new memory adapter. | [
"Creates",
"a",
"Memory",
"adapter",
"from",
"a",
"filesystem",
"folder",
"."
] | 614f184d855135c1d55b1a579feabaf577de62b1 | https://github.com/twistor/flysystem-memory-adapter/blob/614f184d855135c1d55b1a579feabaf577de62b1/src/MemoryAdapter.php#L37-L44 | train |
twistor/flysystem-memory-adapter | src/MemoryAdapter.php | MemoryAdapter.createFromFilesystem | public static function createFromFilesystem(FilesystemInterface $filesystem)
{
$filesystem->addPlugin(new ListWith());
$adapter = new static();
$config = new Config();
foreach ($filesystem->listWith(['timestamp', 'visibility'], '', true) as $meta) {
if ($meta['type'] ==... | php | public static function createFromFilesystem(FilesystemInterface $filesystem)
{
$filesystem->addPlugin(new ListWith());
$adapter = new static();
$config = new Config();
foreach ($filesystem->listWith(['timestamp', 'visibility'], '', true) as $meta) {
if ($meta['type'] ==... | [
"public",
"static",
"function",
"createFromFilesystem",
"(",
"FilesystemInterface",
"$",
"filesystem",
")",
"{",
"$",
"filesystem",
"->",
"addPlugin",
"(",
"new",
"ListWith",
"(",
")",
")",
";",
"$",
"adapter",
"=",
"new",
"static",
"(",
")",
";",
"$",
"co... | Creates a Memory adapter from a Flysystem filesystem.
@param FilesystemInterface $filesystem The Flysystem filesystem.
@return self A new memory adapter. | [
"Creates",
"a",
"Memory",
"adapter",
"from",
"a",
"Flysystem",
"filesystem",
"."
] | 614f184d855135c1d55b1a579feabaf577de62b1 | https://github.com/twistor/flysystem-memory-adapter/blob/614f184d855135c1d55b1a579feabaf577de62b1/src/MemoryAdapter.php#L53-L72 | train |
twistor/flysystem-memory-adapter | src/MemoryAdapter.php | MemoryAdapter.emptyDirectory | protected function emptyDirectory($directory)
{
foreach ($this->doListContents($directory, true) as $path) {
$this->deletePath($path);
}
} | php | protected function emptyDirectory($directory)
{
foreach ($this->doListContents($directory, true) as $path) {
$this->deletePath($path);
}
} | [
"protected",
"function",
"emptyDirectory",
"(",
"$",
"directory",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"doListContents",
"(",
"$",
"directory",
",",
"true",
")",
"as",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"deletePath",
"(",
"$",
"path",
")... | Empties a directory.
@param string $directory | [
"Empties",
"a",
"directory",
"."
] | 614f184d855135c1d55b1a579feabaf577de62b1 | https://github.com/twistor/flysystem-memory-adapter/blob/614f184d855135c1d55b1a579feabaf577de62b1/src/MemoryAdapter.php#L313-L318 | train |
twistor/flysystem-memory-adapter | src/MemoryAdapter.php | MemoryAdapter.ensureSubDirs | protected function ensureSubDirs($directory, Config $config = null)
{
$config = $config ?: new Config();
return $this->createDir(Util::dirname($directory), $config);
} | php | protected function ensureSubDirs($directory, Config $config = null)
{
$config = $config ?: new Config();
return $this->createDir(Util::dirname($directory), $config);
} | [
"protected",
"function",
"ensureSubDirs",
"(",
"$",
"directory",
",",
"Config",
"$",
"config",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"$",
"config",
"?",
":",
"new",
"Config",
"(",
")",
";",
"return",
"$",
"this",
"->",
"createDir",
"(",
"Util",
... | Ensures that the sub-directories of a directory exist.
@param string $directory The directory.
@param Config|null $config Optionl configuration.
@return bool True on success, false on failure. | [
"Ensures",
"that",
"the",
"sub",
"-",
"directories",
"of",
"a",
"directory",
"exist",
"."
] | 614f184d855135c1d55b1a579feabaf577de62b1 | https://github.com/twistor/flysystem-memory-adapter/blob/614f184d855135c1d55b1a579feabaf577de62b1/src/MemoryAdapter.php#L328-L333 | train |
twistor/flysystem-memory-adapter | src/MemoryAdapter.php | MemoryAdapter.getFileKeys | protected function getFileKeys($path, array $keys)
{
if (!$this->hasFile($path)) {
return false;
}
return $this->getKeys($path, $keys);
} | php | protected function getFileKeys($path, array $keys)
{
if (!$this->hasFile($path)) {
return false;
}
return $this->getKeys($path, $keys);
} | [
"protected",
"function",
"getFileKeys",
"(",
"$",
"path",
",",
"array",
"$",
"keys",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasFile",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"getKeys",
"(",
... | Returns the keys for a file.
@param string $path
@param array $keys
@return array|false | [
"Returns",
"the",
"keys",
"for",
"a",
"file",
"."
] | 614f184d855135c1d55b1a579feabaf577de62b1 | https://github.com/twistor/flysystem-memory-adapter/blob/614f184d855135c1d55b1a579feabaf577de62b1/src/MemoryAdapter.php#L343-L350 | train |
twistor/flysystem-memory-adapter | src/MemoryAdapter.php | MemoryAdapter.getKeys | protected function getKeys($path, array $keys)
{
if (!$this->has($path)) {
return false;
}
$return = [];
foreach ($keys as $key) {
if ($key === 'path') {
$return[$key] = $path;
continue;
}
$return[$key]... | php | protected function getKeys($path, array $keys)
{
if (!$this->has($path)) {
return false;
}
$return = [];
foreach ($keys as $key) {
if ($key === 'path') {
$return[$key] = $path;
continue;
}
$return[$key]... | [
"protected",
"function",
"getKeys",
"(",
"$",
"path",
",",
"array",
"$",
"keys",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"("... | Returns the keys for a path.
@param string $path
@param array $keys
@return array|false | [
"Returns",
"the",
"keys",
"for",
"a",
"path",
"."
] | 614f184d855135c1d55b1a579feabaf577de62b1 | https://github.com/twistor/flysystem-memory-adapter/blob/614f184d855135c1d55b1a579feabaf577de62b1/src/MemoryAdapter.php#L360-L377 | train |
ekyna/AdminBundle | Controller/Resource/SortableTrait.php | SortableTrait.moveUpAction | public function moveUpAction(Request $request)
{
$context = $this->loadContext($request);
$resource = $context->getResource();
$this->isGranted('EDIT', $resource);
$this->move($resource, -1);
return $this->redirectToReferer($this->generateUrl(
$this->config->g... | php | public function moveUpAction(Request $request)
{
$context = $this->loadContext($request);
$resource = $context->getResource();
$this->isGranted('EDIT', $resource);
$this->move($resource, -1);
return $this->redirectToReferer($this->generateUrl(
$this->config->g... | [
"public",
"function",
"moveUpAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"loadContext",
"(",
"$",
"request",
")",
";",
"$",
"resource",
"=",
"$",
"context",
"->",
"getResource",
"(",
")",
";",
"$",
"this",... | Move up the resource.
@param Request $request
@return \Symfony\Component\HttpFoundation\Response | [
"Move",
"up",
"the",
"resource",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Controller/Resource/SortableTrait.php#L20-L34 | train |
ekyna/AdminBundle | Controller/Resource/SortableTrait.php | SortableTrait.move | protected function move($resource, $movement)
{
$resource->setPosition($resource->getPosition() + $movement);
// TODO use ResourceManager
$event = $this->getOperator()->update($resource);
$event->toFlashes($this->getFlashBag());
} | php | protected function move($resource, $movement)
{
$resource->setPosition($resource->getPosition() + $movement);
// TODO use ResourceManager
$event = $this->getOperator()->update($resource);
$event->toFlashes($this->getFlashBag());
} | [
"protected",
"function",
"move",
"(",
"$",
"resource",
",",
"$",
"movement",
")",
"{",
"$",
"resource",
"->",
"setPosition",
"(",
"$",
"resource",
"->",
"getPosition",
"(",
")",
"+",
"$",
"movement",
")",
";",
"// TODO use ResourceManager",
"$",
"event",
"... | Move the resource.
@param $resource
@param $movement | [
"Move",
"the",
"resource",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Controller/Resource/SortableTrait.php#L64-L71 | train |
praxisnetau/silverware-navigation | src/Components/AnchorNavigation.php | AnchorNavigation.getAnchors | public function getAnchors()
{
$list = ArrayList::create();
if ($page = $this->getCurrentPage(Page::class)) {
$html = HTMLValue::create($page->Content);
$anchors = $html->query("//*[@id]");
foreach ($anchors as $anch... | php | public function getAnchors()
{
$list = ArrayList::create();
if ($page = $this->getCurrentPage(Page::class)) {
$html = HTMLValue::create($page->Content);
$anchors = $html->query("//*[@id]");
foreach ($anchors as $anch... | [
"public",
"function",
"getAnchors",
"(",
")",
"{",
"$",
"list",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"if",
"(",
"$",
"page",
"=",
"$",
"this",
"->",
"getCurrentPage",
"(",
"Page",
"::",
"class",
")",
")",
"{",
"$",
"html",
"=",
"HTMLVal... | Answers an array list of anchors identified within the current page content.
@return ArrayList | [
"Answers",
"an",
"array",
"list",
"of",
"anchors",
"identified",
"within",
"the",
"current",
"page",
"content",
"."
] | 04e6f3003c2871348d5bba7869d4fc273641627e | https://github.com/praxisnetau/silverware-navigation/blob/04e6f3003c2871348d5bba7869d4fc273641627e/src/Components/AnchorNavigation.php#L232-L256 | train |
phPoirot/Client-OAuth2 | src/Assertion/AssertByInternalServer.php | AssertByInternalServer.assertToken | function assertToken($tokenStr)
{
if (false === $token = $this->_accessTokens->findByIdentifier((string) $tokenStr))
throw new exOAuthAccessDenied;
$accessToken = new AccessTokenEntity(
new HydrateGetters($token) );
return $accessToken;
} | php | function assertToken($tokenStr)
{
if (false === $token = $this->_accessTokens->findByIdentifier((string) $tokenStr))
throw new exOAuthAccessDenied;
$accessToken = new AccessTokenEntity(
new HydrateGetters($token) );
return $accessToken;
} | [
"function",
"assertToken",
"(",
"$",
"tokenStr",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"token",
"=",
"$",
"this",
"->",
"_accessTokens",
"->",
"findByIdentifier",
"(",
"(",
"string",
")",
"$",
"tokenStr",
")",
")",
"throw",
"new",
"exOAuthAccessDenied"... | Validate Authorize Token With OAuth Server
note: implement grant extension http request
@param string $tokenStr
@return iAccessTokenEntity
@throws exOAuthAccessDenied Access Denied | [
"Validate",
"Authorize",
"Token",
"With",
"OAuth",
"Server"
] | 8745fd54afbbb185669b9e38b1241ecc8ffc7268 | https://github.com/phPoirot/Client-OAuth2/blob/8745fd54afbbb185669b9e38b1241ecc8ffc7268/src/Assertion/AssertByInternalServer.php#L42-L52 | train |
Etenil/assegai | src/assegai/modules/forms/fields/Field.php | Field.getType | function getType()
{
if($this->_type) {
return $this->_type;
}
else {
$myclass = get_class($this);
return strtolower(substr($myclass, strrpos($myclass, '\\') + 1, -5));
}
} | php | function getType()
{
if($this->_type) {
return $this->_type;
}
else {
$myclass = get_class($this);
return strtolower(substr($myclass, strrpos($myclass, '\\') + 1, -5));
}
} | [
"function",
"getType",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_type",
")",
"{",
"return",
"$",
"this",
"->",
"_type",
";",
"}",
"else",
"{",
"$",
"myclass",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"return",
"strtolower",
"(",
"substr",... | This essentially returns the field's class name without the "Field" part. | [
"This",
"essentially",
"returns",
"the",
"field",
"s",
"class",
"name",
"without",
"the",
"Field",
"part",
"."
] | d43cce1a88f1c332f60dd0a4374b17764852af9e | https://github.com/Etenil/assegai/blob/d43cce1a88f1c332f60dd0a4374b17764852af9e/src/assegai/modules/forms/fields/Field.php#L111-L120 | train |
schpill/thin | src/Navigation/Page/Uri.php | Zend_Navigation_Page_Uri.setUri | public function setUri($uri)
{
if (null !== $uri && !is_string($uri)) {
require_once 'Zend/Navigation/Exception.php';
throw new Zend_Navigation_Exception(
'Invalid argument: $uri must be a string or null');
}
$this->_uri = $uri;
return $th... | php | public function setUri($uri)
{
if (null !== $uri && !is_string($uri)) {
require_once 'Zend/Navigation/Exception.php';
throw new Zend_Navigation_Exception(
'Invalid argument: $uri must be a string or null');
}
$this->_uri = $uri;
return $th... | [
"public",
"function",
"setUri",
"(",
"$",
"uri",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"uri",
"&&",
"!",
"is_string",
"(",
"$",
"uri",
")",
")",
"{",
"require_once",
"'Zend/Navigation/Exception.php'",
";",
"throw",
"new",
"Zend_Navigation_Exception",
"(",... | Sets page URI
@param string $uri page URI, must a string or null
@return Zend_Navigation_Page_Uri fluent interface, returns self
@throws Zend_Navigation_Exception if $uri is invalid | [
"Sets",
"page",
"URI"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Navigation/Page/Uri.php#L53-L63 | train |
Synapse-Cmf/synapse-cmf | src/Synapse/Page/Bundle/Action/Page/CreateAction.php | CreateAction.resolve | public function resolve()
{
$this->page
->setName($this->name)
->setOnline(!empty($this->online))
->setTitle($this->title)
->setMeta(array('title' => $this->title))
->setPath($this->getFullPath())
;
$this->assertEntityIsValid($this... | php | public function resolve()
{
$this->page
->setName($this->name)
->setOnline(!empty($this->online))
->setTitle($this->title)
->setMeta(array('title' => $this->title))
->setPath($this->getFullPath())
;
$this->assertEntityIsValid($this... | [
"public",
"function",
"resolve",
"(",
")",
"{",
"$",
"this",
"->",
"page",
"->",
"setName",
"(",
"$",
"this",
"->",
"name",
")",
"->",
"setOnline",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"online",
")",
")",
"->",
"setTitle",
"(",
"$",
"this",
... | Page creation method.
@return Page | [
"Page",
"creation",
"method",
"."
] | d8122a4150a83d5607289724425cf35c56a5e880 | https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Page/Bundle/Action/Page/CreateAction.php#L62-L80 | train |
Synapse-Cmf/synapse-cmf | src/Synapse/Page/Bundle/Action/Page/CreateAction.php | CreateAction.generateFullPath | protected function generateFullPath()
{
return $this->fullPath = $this->pathGenerator
->generatePath($this->page, $this->path ?: '')
;
} | php | protected function generateFullPath()
{
return $this->fullPath = $this->pathGenerator
->generatePath($this->page, $this->path ?: '')
;
} | [
"protected",
"function",
"generateFullPath",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"fullPath",
"=",
"$",
"this",
"->",
"pathGenerator",
"->",
"generatePath",
"(",
"$",
"this",
"->",
"page",
",",
"$",
"this",
"->",
"path",
"?",
":",
"''",
")",
";"... | Generate page full path.
@return string | [
"Generate",
"page",
"full",
"path",
"."
] | d8122a4150a83d5607289724425cf35c56a5e880 | https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Page/Bundle/Action/Page/CreateAction.php#L136-L141 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Abstract/Send.php | EbayEnterprise_Order_Model_Abstract_Send._sendRequest | protected function _sendRequest()
{
$logger = $this->_logger;
$logContext = $this->_logContext;
$response = null;
try {
$response = $this->_api
->setRequestBody($this->_request)
->send()
->getResponseBody();
} catch... | php | protected function _sendRequest()
{
$logger = $this->_logger;
$logContext = $this->_logContext;
$response = null;
try {
$response = $this->_api
->setRequestBody($this->_request)
->send()
->getResponseBody();
} catch... | [
"protected",
"function",
"_sendRequest",
"(",
")",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"_logger",
";",
"$",
"logContext",
"=",
"$",
"this",
"->",
"_logContext",
";",
"$",
"response",
"=",
"null",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"t... | Sending the payload request and returning the response.
@return IPayload | null | [
"Sending",
"the",
"payload",
"request",
"and",
"returning",
"the",
"response",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Abstract/Send.php#L119-L152 | train |
phavour/phavour | Phavour/Application.php | Application.setCacheAdapter | public function setCacheAdapter(AdapterAbstract $adapter)
{
if ($this->isSetup) {
$e = new ApplicationIsAlreadySetupException('You cannot set the cache after calling setup()');
$this->error($e);
}
$this->cache = $adapter;
} | php | public function setCacheAdapter(AdapterAbstract $adapter)
{
if ($this->isSetup) {
$e = new ApplicationIsAlreadySetupException('You cannot set the cache after calling setup()');
$this->error($e);
}
$this->cache = $adapter;
} | [
"public",
"function",
"setCacheAdapter",
"(",
"AdapterAbstract",
"$",
"adapter",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSetup",
")",
"{",
"$",
"e",
"=",
"new",
"ApplicationIsAlreadySetupException",
"(",
"'You cannot set the cache after calling setup()'",
")",
";... | Set an application level cache adapter.
This adapter will be made available to all runnables
@param AdapterAbstract $adapter | [
"Set",
"an",
"application",
"level",
"cache",
"adapter",
".",
"This",
"adapter",
"will",
"be",
"made",
"available",
"to",
"all",
"runnables"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Application.php#L134-L142 | train |
phavour/phavour | Phavour/Application.php | Application.setup | public function setup()
{
$this->request = new Request();
$this->response = new Response();
$this->env = new Environment();
$this->mode = $this->env->getMode();
if (!$this->env->isProduction() || $this->cache == null) {
$this->cache = new AdapterNull();
}
... | php | public function setup()
{
$this->request = new Request();
$this->response = new Response();
$this->env = new Environment();
$this->mode = $this->env->getMode();
if (!$this->env->isProduction() || $this->cache == null) {
$this->cache = new AdapterNull();
}
... | [
"public",
"function",
"setup",
"(",
")",
"{",
"$",
"this",
"->",
"request",
"=",
"new",
"Request",
"(",
")",
";",
"$",
"this",
"->",
"response",
"=",
"new",
"Response",
"(",
")",
";",
"$",
"this",
"->",
"env",
"=",
"new",
"Environment",
"(",
")",
... | Setup the application, assigns all the packages, config,
routes | [
"Setup",
"the",
"application",
"assigns",
"all",
"the",
"packages",
"config",
"routes"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Application.php#L148-L168 | train |
phavour/phavour | Phavour/Application.php | Application.loadPackages | private function loadPackages()
{
foreach ($this->packages as $package) {
/** @var $package \Phavour\Package */
$this->packagesMetadata[$package->getPackageName()] = array(
'namespace' => $package->getNamespace(),
'route_path' => $package->getRoutePath... | php | private function loadPackages()
{
foreach ($this->packages as $package) {
/** @var $package \Phavour\Package */
$this->packagesMetadata[$package->getPackageName()] = array(
'namespace' => $package->getNamespace(),
'route_path' => $package->getRoutePath... | [
"private",
"function",
"loadPackages",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"packages",
"as",
"$",
"package",
")",
"{",
"/** @var $package \\Phavour\\Package */",
"$",
"this",
"->",
"packagesMetadata",
"[",
"$",
"package",
"->",
"getPackageName",
"(... | Load the package metadata from the given list | [
"Load",
"the",
"package",
"metadata",
"from",
"the",
"given",
"list"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Application.php#L281-L293 | train |
phavour/phavour | Phavour/Application.php | Application.getRunnable | private function getRunnable($package, $class, $method, $className)
{
$view = $this->getViewFor($package, $class, $method);
$instance = new $className($this->request, $this->response, $view, $this->env, $this->cache, $this->router, $this->config);
/* @var $instance Runnable */
$insta... | php | private function getRunnable($package, $class, $method, $className)
{
$view = $this->getViewFor($package, $class, $method);
$instance = new $className($this->request, $this->response, $view, $this->env, $this->cache, $this->router, $this->config);
/* @var $instance Runnable */
$insta... | [
"private",
"function",
"getRunnable",
"(",
"$",
"package",
",",
"$",
"class",
",",
"$",
"method",
",",
"$",
"className",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getViewFor",
"(",
"$",
"package",
",",
"$",
"class",
",",
"$",
"method",
")",
"... | Get the corresponding runnable for the given parameters
@param string $package
@param string $class
@param string $method
@param string $className
@return \Phavour\Runnable | [
"Get",
"the",
"corresponding",
"runnable",
"for",
"the",
"given",
"parameters"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Application.php#L526-L534 | train |
phavour/phavour | Phavour/Application.php | Application.getViewFor | private function getViewFor($package, $class, $method)
{
$view = new View($this, $package, $class, $method);
$view->setRouter($this->router);
$view->setConfig($this->config);
return $view;
} | php | private function getViewFor($package, $class, $method)
{
$view = new View($this, $package, $class, $method);
$view->setRouter($this->router);
$view->setConfig($this->config);
return $view;
} | [
"private",
"function",
"getViewFor",
"(",
"$",
"package",
",",
"$",
"class",
",",
"$",
"method",
")",
"{",
"$",
"view",
"=",
"new",
"View",
"(",
"$",
"this",
",",
"$",
"package",
",",
"$",
"class",
",",
"$",
"method",
")",
";",
"$",
"view",
"->",... | Retrieve an instance of View for a given package, class, method combination
@param string $package
@param string $class
@param string $method
@return \Phavour\Runnable\View | [
"Retrieve",
"an",
"instance",
"of",
"View",
"for",
"a",
"given",
"package",
"class",
"method",
"combination"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Application.php#L543-L550 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Api.php | Radial_Core_Model_Api.request | public function request(
DOMDocument $doc,
$xsdName,
$uri,
$timeout = self::DEFAULT_TIMEOUT,
$adapter = self::DEFAULT_ADAPTER,
Zend_Http_Client $client = null,
$apiKey = null
) {
if (!$apiKey) {
$apiKey = Mage::helper('radial_core')->getCon... | php | public function request(
DOMDocument $doc,
$xsdName,
$uri,
$timeout = self::DEFAULT_TIMEOUT,
$adapter = self::DEFAULT_ADAPTER,
Zend_Http_Client $client = null,
$apiKey = null
) {
if (!$apiKey) {
$apiKey = Mage::helper('radial_core')->getCon... | [
"public",
"function",
"request",
"(",
"DOMDocument",
"$",
"doc",
",",
"$",
"xsdName",
",",
"$",
"uri",
",",
"$",
"timeout",
"=",
"self",
"::",
"DEFAULT_TIMEOUT",
",",
"$",
"adapter",
"=",
"self",
"::",
"DEFAULT_ADAPTER",
",",
"Zend_Http_Client",
"$",
"clie... | Call the API.
@param DOMDocument $doc The document to send in the request body
@param string $xsdName The basename of the xsd file to validate $doc (The dirname is in config.xml)
@param string $uri The uri to send the request to
@param int $timeout The amount of time in seconds after which the connection is terminated... | [
"Call",
"the",
"API",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Api.php#L73-L102 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Api.php | Radial_Core_Model_Api._processResponse | protected function _processResponse(Zend_Http_Response $response, $uri)
{
$this->_status = $response->getStatus();
$config = $this->_getHandlerConfig($this->_getHandlerKey($response));
$logMethod = isset($config['logger']) ? $config['logger'] : 'debug';
$logData = array_merge(['rom_r... | php | protected function _processResponse(Zend_Http_Response $response, $uri)
{
$this->_status = $response->getStatus();
$config = $this->_getHandlerConfig($this->_getHandlerKey($response));
$logMethod = isset($config['logger']) ? $config['logger'] : 'debug';
$logData = array_merge(['rom_r... | [
"protected",
"function",
"_processResponse",
"(",
"Zend_Http_Response",
"$",
"response",
",",
"$",
"uri",
")",
"{",
"$",
"this",
"->",
"_status",
"=",
"$",
"response",
"->",
"getStatus",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"_getHandlerCon... | log the response and return the result of the configured handler method.
@param Zend_Http_Response $response
@param string $uri
@return string response body or empty | [
"log",
"the",
"response",
"and",
"return",
"the",
"result",
"of",
"the",
"configured",
"handler",
"method",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Api.php#L136-L154 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Api.php | Radial_Core_Model_Api.schemaValidate | public function schemaValidate(DOMDocument $doc, $xsdName)
{
$errors = array();
set_error_handler(function ($errno, $errstr) use (&$errors) {
$errors[] = "'$errstr' [Errno $errno]";
});
$cfg = Mage::helper('radial_core')->getConfigModel();
$isValid = $doc->schemaV... | php | public function schemaValidate(DOMDocument $doc, $xsdName)
{
$errors = array();
set_error_handler(function ($errno, $errstr) use (&$errors) {
$errors[] = "'$errstr' [Errno $errno]";
});
$cfg = Mage::helper('radial_core')->getConfigModel();
$isValid = $doc->schemaV... | [
"public",
"function",
"schemaValidate",
"(",
"DOMDocument",
"$",
"doc",
",",
"$",
"xsdName",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"set_error_handler",
"(",
"function",
"(",
"$",
"errno",
",",
"$",
"errstr",
")",
"use",
"(",
"&",
"$",
... | Validates the DOM against a validation schema,
which should be a full path to an xsd for this DOMDocument.
@param DomDocument $doc The document to validate
@param string $xsdName xsd file basename with which to validate the doc
@throws Radial_Core_Exception_InvalidXml when the schema is invalid
@return self | [
"Validates",
"the",
"DOM",
"against",
"a",
"validation",
"schema",
"which",
"should",
"be",
"a",
"full",
"path",
"to",
"an",
"xsd",
"for",
"this",
"DOMDocument",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Api.php#L171-L189 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Api.php | Radial_Core_Model_Api._processException | protected function _processException(Zend_Http_Client_Exception $exception, $uri)
{
$this->_status = 0;
$config = $this->_getHandlerConfig($this->_getHandlerKey());
$logMethod = isset($config['logger']) ? $config['logger'] : 'debug';
// the zend http client throws exceptions that are... | php | protected function _processException(Zend_Http_Client_Exception $exception, $uri)
{
$this->_status = 0;
$config = $this->_getHandlerConfig($this->_getHandlerKey());
$logMethod = isset($config['logger']) ? $config['logger'] : 'debug';
// the zend http client throws exceptions that are... | [
"protected",
"function",
"_processException",
"(",
"Zend_Http_Client_Exception",
"$",
"exception",
",",
"$",
"uri",
")",
"{",
"$",
"this",
"->",
"_status",
"=",
"0",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"_getHandlerConfig",
"(",
"$",
"this",
"->",
"... | handle the exception thrown by the zend client and return the result of the
configured handler.
@param Zend_Http_Client_Exception $exception
@param string $uri
@return string | [
"handle",
"the",
"exception",
"thrown",
"by",
"the",
"zend",
"client",
"and",
"return",
"the",
"result",
"of",
"the",
"configured",
"handler",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Api.php#L197-L209 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Model/Api.php | Radial_Core_Model_Api._getHandlerKey | protected function _getHandlerKey(Zend_Http_Response $response = null)
{
if ($response) {
$code = $response->getStatus();
if ($response->isSuccessful() || $response->isRedirect()) {
return 'success';
} elseif ($code < 500 && $code >= 400) {
... | php | protected function _getHandlerKey(Zend_Http_Response $response = null)
{
if ($response) {
$code = $response->getStatus();
if ($response->isSuccessful() || $response->isRedirect()) {
return 'success';
} elseif ($code < 500 && $code >= 400) {
... | [
"protected",
"function",
"_getHandlerKey",
"(",
"Zend_Http_Response",
"$",
"response",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"response",
")",
"{",
"$",
"code",
"=",
"$",
"response",
"->",
"getStatus",
"(",
")",
";",
"if",
"(",
"$",
"response",
"->",
"... | return a string that is a key to the handler config for the class of status codes.
@param Zend_Http_Response $response
@return string | [
"return",
"a",
"string",
"that",
"is",
"a",
"key",
"to",
"the",
"handler",
"config",
"for",
"the",
"class",
"of",
"status",
"codes",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Model/Api.php#L239-L254 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.