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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
pMatviienko/zf2-common | SbxCommon/src/SbxCommon/Form/View/Helper/Bootstrap/FormRow.php | FormRow.getElementErrorsHelper | protected function getElementErrorsHelper()
{
if ($this->elementErrorsHelper) {
return $this->elementErrorsHelper;
}
if (method_exists($this->view, 'plugin')) {
$this->elementErrorsHelper = $this->view->plugin('bootstrap_form_element_errors');
}
if (... | php | protected function getElementErrorsHelper()
{
if ($this->elementErrorsHelper) {
return $this->elementErrorsHelper;
}
if (method_exists($this->view, 'plugin')) {
$this->elementErrorsHelper = $this->view->plugin('bootstrap_form_element_errors');
}
if (... | [
"protected",
"function",
"getElementErrorsHelper",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"elementErrorsHelper",
")",
"{",
"return",
"$",
"this",
"->",
"elementErrorsHelper",
";",
"}",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"view",
",",
... | Retrieve the FormElementErrors helper
@return FormElementErrors | [
"Retrieve",
"the",
"FormElementErrors",
"helper"
] | e59aa9b1eece72437cf0fd7c8466c0daeffcc481 | https://github.com/pMatviienko/zf2-common/blob/e59aa9b1eece72437cf0fd7c8466c0daeffcc481/SbxCommon/src/SbxCommon/Form/View/Helper/Bootstrap/FormRow.php#L128-L143 | train |
olobu/olobu | core/loader.php | O_Loader.database | function database($params='', $return=TRUE)
{
$O =& get_instance();
if (class_exists('O_Db_driver') and $return === FALSE and isset($O->db) and is_object($O->db)) {
throw new \Zanda\Orgasm\Fatal('Untuk sambungan ke database tambahan, harus menambahkan parameter $return bernilai TRUE');
}
require_once(BASE... | php | function database($params='', $return=TRUE)
{
$O =& get_instance();
if (class_exists('O_Db_driver') and $return === FALSE and isset($O->db) and is_object($O->db)) {
throw new \Zanda\Orgasm\Fatal('Untuk sambungan ke database tambahan, harus menambahkan parameter $return bernilai TRUE');
}
require_once(BASE... | [
"function",
"database",
"(",
"$",
"params",
"=",
"''",
",",
"$",
"return",
"=",
"TRUE",
")",
"{",
"$",
"O",
"=",
"&",
"get_instance",
"(",
")",
";",
"if",
"(",
"class_exists",
"(",
"'O_Db_driver'",
")",
"and",
"$",
"return",
"===",
"FALSE",
"and",
... | default kalo ada pangge ini, berarti koneksi tambahan | [
"default",
"kalo",
"ada",
"pangge",
"ini",
"berarti",
"koneksi",
"tambahan"
] | 05bea2bff63d3e38b458fb42e8f07f1d850ae211 | https://github.com/olobu/olobu/blob/05bea2bff63d3e38b458fb42e8f07f1d850ae211/core/loader.php#L325-L341 | train |
AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.map | public function map(callable $callback) : Collection
{
$result = array_map($callback, array_keys($this->_data), $this->_data);
return new static($result);
} | php | public function map(callable $callback) : Collection
{
$result = array_map($callback, array_keys($this->_data), $this->_data);
return new static($result);
} | [
"public",
"function",
"map",
"(",
"callable",
"$",
"callback",
")",
":",
"Collection",
"{",
"$",
"result",
"=",
"array_map",
"(",
"$",
"callback",
",",
"array_keys",
"(",
"$",
"this",
"->",
"_data",
")",
",",
"$",
"this",
"->",
"_data",
")",
";",
"re... | Maps the array and returns a new object of this class.
Example:
```php
$arr = new \Alexya\Tools\Collection([
"test",
"foo",
"bar",
"tests"
]);
$newArr = $arr->map(function($key, $value) {
$value = strtoupper($value);
return $value;
});
// $newArr = new \Alexya\Tools\Collection([
// "TEST",
// "FOO",
// ... | [
"Maps",
"the",
"array",
"and",
"returns",
"a",
"new",
"object",
"of",
"this",
"class",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L201-L206 | train |
AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.walk | public function walk(callable $callback) : void
{
$newData = [];
foreach($this->_data as $key => $value) {
$ret = $callback($key, $value);
$newData[$ret[0]] = $ret[1];
}
$this->_data = $newData;
} | php | public function walk(callable $callback) : void
{
$newData = [];
foreach($this->_data as $key => $value) {
$ret = $callback($key, $value);
$newData[$ret[0]] = $ret[1];
}
$this->_data = $newData;
} | [
"public",
"function",
"walk",
"(",
"callable",
"$",
"callback",
")",
":",
"void",
"{",
"$",
"newData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"ret",
"=",
"$",
"callback... | Walks through the array.
The difference between this method and `map` is that
the callback must return an array with two indexes:
* The new key of the item.
* The new value of the item.
This will override the current array while `map` will only loop
through the array and call the callback with the item key and value... | [
"Walks",
"through",
"the",
"array",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L245-L255 | train |
AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.accumulate | public function accumulate(callable $callback, $accumulator = "")
{
foreach($this->_data as $key => $value) {
$accumulator = $callback($key, $value, $accumulator);
}
return $accumulator;
} | php | public function accumulate(callable $callback, $accumulator = "")
{
foreach($this->_data as $key => $value) {
$accumulator = $callback($key, $value, $accumulator);
}
return $accumulator;
} | [
"public",
"function",
"accumulate",
"(",
"callable",
"$",
"callback",
",",
"$",
"accumulator",
"=",
"\"\"",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"accumulator",
"=",
"$",
"callback",
... | Performs a `array_reduce` action with the array.
This method loops through the array and executes the callback
on each element.
The difference between `accumulate` and `map` and `filter` is that
this method sends the result of each call to the callback as
a second parameter to the callback.
Example:
```php
$arr = n... | [
"Performs",
"a",
"array_reduce",
"action",
"with",
"the",
"array",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L293-L300 | train |
AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.combine | public function combine($arr) : Collection
{
if($arr instanceof Collection) {
$arr = $arr->getAll();
}
if(!is_array($arr)) {
return new static([]);
}
return new static(array_combine($this->_data, $arr));
} | php | public function combine($arr) : Collection
{
if($arr instanceof Collection) {
$arr = $arr->getAll();
}
if(!is_array($arr)) {
return new static([]);
}
return new static(array_combine($this->_data, $arr));
} | [
"public",
"function",
"combine",
"(",
"$",
"arr",
")",
":",
"Collection",
"{",
"if",
"(",
"$",
"arr",
"instanceof",
"Collection",
")",
"{",
"$",
"arr",
"=",
"$",
"arr",
"->",
"getAll",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"ar... | Combines this and another array and returns a new object.
The resulting array will contain the values of this array as key and the values
of the parameter as values:
```php
$keys = new Collection([
"foo" => "bar"
]);
$values = new Collection([
"test" => "test"
]);
$newCollection = $keys->combine($values);
// $newCol... | [
"Combines",
"this",
"and",
"another",
"array",
"and",
"returns",
"a",
"new",
"object",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L326-L337 | train |
AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.append | public function append($arr) : void
{
if($arr instanceof Collection) {
$arr = $arr->getAll();
}
if(!is_array($arr)) {
return;
}
foreach($arr as $key => $value) {
$this->_data[$key] = $value;
}
} | php | public function append($arr) : void
{
if($arr instanceof Collection) {
$arr = $arr->getAll();
}
if(!is_array($arr)) {
return;
}
foreach($arr as $key => $value) {
$this->_data[$key] = $value;
}
} | [
"public",
"function",
"append",
"(",
"$",
"arr",
")",
":",
"void",
"{",
"if",
"(",
"$",
"arr",
"instanceof",
"Collection",
")",
"{",
"$",
"arr",
"=",
"$",
"arr",
"->",
"getAll",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"arr",
"... | Appends the contents of an array to this array.
The indexes with same key will be overwritten.
@param array|Collection $arr Array to append. | [
"Appends",
"the",
"contents",
"of",
"an",
"array",
"to",
"this",
"array",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L346-L359 | train |
AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.valueExists | public function valueExists($value, bool $strict = true) : bool
{
foreach($this->_data as $data) {
$ret = ($strict) ? ($data === $value)
: ($data == $value);
if($ret) {
return true;
}
}
return false;
} | php | public function valueExists($value, bool $strict = true) : bool
{
foreach($this->_data as $data) {
$ret = ($strict) ? ($data === $value)
: ($data == $value);
if($ret) {
return true;
}
}
return false;
} | [
"public",
"function",
"valueExists",
"(",
"$",
"value",
",",
"bool",
"$",
"strict",
"=",
"true",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"data",
")",
"{",
"$",
"ret",
"=",
"(",
"$",
"strict",
")",
"?",
"(",
... | Checks that a value exists in the array.
@param mixed $value Index value.
@param bool $strict Flag indicating that the value must be exactly the same or not (default = `true`).
@return bool `true` if `$value` exists as a value in the array, `false` if not. | [
"Checks",
"that",
"a",
"value",
"exists",
"in",
"the",
"array",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L502-L514 | train |
AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.deleteByValue | public function deleteByValue($value, bool $strict = true) : void
{
foreach($this->_data as $data) {
$exists = ($strict) ? ($data === $value)
: ($data == $value);
if($exists) {
unset($this->_data[$value]);
}
}
} | php | public function deleteByValue($value, bool $strict = true) : void
{
foreach($this->_data as $data) {
$exists = ($strict) ? ($data === $value)
: ($data == $value);
if($exists) {
unset($this->_data[$value]);
}
}
} | [
"public",
"function",
"deleteByValue",
"(",
"$",
"value",
",",
"bool",
"$",
"strict",
"=",
"true",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"data",
")",
"{",
"$",
"exists",
"=",
"(",
"$",
"strict",
")",
"?",
"... | Deletes an index in the array by its value.
@param mixed $value Index value.
@param bool $strict Flag indicating that the value must be exactly the same or not (default = `true`). | [
"Deletes",
"an",
"index",
"in",
"the",
"array",
"by",
"its",
"value",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L532-L542 | train |
mvccore/ext-router-media | src/MvcCore/Ext/Routers/Media/Preparing.php | Preparing.prepareRequestMediaVersionFromUrl | protected function prepareRequestMediaVersionFromUrl () {
$this->prepareRequestMediaVersionFromUrlQueryString();
if ($this->requestMediaSiteVersion === NULL && $this->anyRoutesConfigured)
$this->prepareRequestMediaVersionFromUrlPath();
if ($this->requestMediaSiteVersion === NULL)
$this->requestMediaSiteVe... | php | protected function prepareRequestMediaVersionFromUrl () {
$this->prepareRequestMediaVersionFromUrlQueryString();
if ($this->requestMediaSiteVersion === NULL && $this->anyRoutesConfigured)
$this->prepareRequestMediaVersionFromUrlPath();
if ($this->requestMediaSiteVersion === NULL)
$this->requestMediaSiteVe... | [
"protected",
"function",
"prepareRequestMediaVersionFromUrl",
"(",
")",
"{",
"$",
"this",
"->",
"prepareRequestMediaVersionFromUrlQueryString",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"requestMediaSiteVersion",
"===",
"NULL",
"&&",
"$",
"this",
"->",
"anyRoutes... | Try to set up into `\MvcCore\Request` object new
media site version detected from requested url by url query string param
or by url path prefix. If there is caught any valid media site
version - set this value into request object. If there is nothing caught,
set into request object full media site version anyway.
@retu... | [
"Try",
"to",
"set",
"up",
"into",
"\\",
"MvcCore",
"\\",
"Request",
"object",
"new",
"media",
"site",
"version",
"detected",
"from",
"requested",
"url",
"by",
"url",
"query",
"string",
"param",
"or",
"by",
"url",
"path",
"prefix",
".",
"If",
"there",
"is... | 976e83290cf25ad6bc32e4824790b5e0d5d4c08b | https://github.com/mvccore/ext-router-media/blob/976e83290cf25ad6bc32e4824790b5e0d5d4c08b/src/MvcCore/Ext/Routers/Media/Preparing.php#L64-L70 | train |
mvccore/ext-router-media | src/MvcCore/Ext/Routers/Media/Preparing.php | Preparing.prepareRequestMediaVersionFromUrlPath | protected function prepareRequestMediaVersionFromUrlPath () {
$requestPath = $this->request->GetPath(TRUE);
$requestPathExploded = explode('/', trim($requestPath, '/'));
$requestPathFirstPart = mb_strtolower($requestPathExploded[0]);
foreach ($this->allowedMediaVersionsAndUrlValues as $mediaSiteVersion => $medi... | php | protected function prepareRequestMediaVersionFromUrlPath () {
$requestPath = $this->request->GetPath(TRUE);
$requestPathExploded = explode('/', trim($requestPath, '/'));
$requestPathFirstPart = mb_strtolower($requestPathExploded[0]);
foreach ($this->allowedMediaVersionsAndUrlValues as $mediaSiteVersion => $medi... | [
"protected",
"function",
"prepareRequestMediaVersionFromUrlPath",
"(",
")",
"{",
"$",
"requestPath",
"=",
"$",
"this",
"->",
"request",
"->",
"GetPath",
"(",
"TRUE",
")",
";",
"$",
"requestPathExploded",
"=",
"explode",
"(",
"'/'",
",",
"trim",
"(",
"$",
"re... | Try to set up media site version from request path as request media site
version. If there is any request path detected, remove media site version
from request path and store detected media site version in local context.
@return void | [
"Try",
"to",
"set",
"up",
"media",
"site",
"version",
"from",
"request",
"path",
"as",
"request",
"media",
"site",
"version",
".",
"If",
"there",
"is",
"any",
"request",
"path",
"detected",
"remove",
"media",
"site",
"version",
"from",
"request",
"path",
"... | 976e83290cf25ad6bc32e4824790b5e0d5d4c08b | https://github.com/mvccore/ext-router-media/blob/976e83290cf25ad6bc32e4824790b5e0d5d4c08b/src/MvcCore/Ext/Routers/Media/Preparing.php#L88-L104 | train |
jabernardo/lollipop-php | Library/DOM/Scraper.php | Scraper.getContentsByAttr | public function getContentsByAttr($attr, $attr_value) {
$nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->nodeValue);
}
return $contents;
... | php | public function getContentsByAttr($attr, $attr_value) {
$nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->nodeValue);
}
return $contents;
... | [
"public",
"function",
"getContentsByAttr",
"(",
"$",
"attr",
",",
"$",
"attr_value",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_dom_x_path",
"->",
"query",
"(",
"\"//*[contains(@{$attr}, '{$attr_value}')]\"",
")",
";",
"$",
"contents",
"=",
"[",
"]",
... | Get contents of an element by using attributes
@example getContentsByAttr('class', 'thumbnail');
@param string $attr Element attribute
@param string $attr_value Value of element attribute
@return array | [
"Get",
"contents",
"of",
"an",
"element",
"by",
"using",
"attributes"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/DOM/Scraper.php#L112-L122 | train |
jabernardo/lollipop-php | Library/DOM/Scraper.php | Scraper.getContentsByElem | public function getContentsByElem($elem) {
$nodes = $this->_dom_x_path->query("//$elem");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->nodeValue);
}
return $contents;
} | php | public function getContentsByElem($elem) {
$nodes = $this->_dom_x_path->query("//$elem");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->nodeValue);
}
return $contents;
} | [
"public",
"function",
"getContentsByElem",
"(",
"$",
"elem",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_dom_x_path",
"->",
"query",
"(",
"\"//$elem\"",
")",
";",
"$",
"contents",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"no... | Get contents of an element by using element name
@example getContentsByElem('div');
@param string $elem Element name
@return array | [
"Get",
"contents",
"of",
"an",
"element",
"by",
"using",
"element",
"name"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/DOM/Scraper.php#L134-L144 | train |
jabernardo/lollipop-php | Library/DOM/Scraper.php | Scraper.getAttrByAttr | public function getAttrByAttr($attr, $attr_value, $attr_to_get) {
$nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->getAttribute($attr_to_get));
}
... | php | public function getAttrByAttr($attr, $attr_value, $attr_to_get) {
$nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->getAttribute($attr_to_get));
}
... | [
"public",
"function",
"getAttrByAttr",
"(",
"$",
"attr",
",",
"$",
"attr_value",
",",
"$",
"attr_to_get",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_dom_x_path",
"->",
"query",
"(",
"\"//*[contains(@{$attr}, '{$attr_value}')]\"",
")",
";",
"$",
"content... | Get attribute value using other attributes
@example getAttrByAttr('class', 'thumbnail', 'href')
@param string @attr Element attribute
@param string @attr_value Element attribute value
@param string @attr_to_get Name of attribute to get
@return array | [
"Get",
"attribute",
"value",
"using",
"other",
"attributes"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/DOM/Scraper.php#L158-L168 | train |
jabernardo/lollipop-php | Library/DOM/Scraper.php | Scraper.getAttrByElem | public function getAttrByElem($element) {
$nodes = $this->_dom_x_path->query("//{$element}");
$contents = [];
$attrs = [];
foreach ($nodes as $node) {
$attrs = [];
foreach ($node->attributes as $attr) {
$... | php | public function getAttrByElem($element) {
$nodes = $this->_dom_x_path->query("//{$element}");
$contents = [];
$attrs = [];
foreach ($nodes as $node) {
$attrs = [];
foreach ($node->attributes as $attr) {
$... | [
"public",
"function",
"getAttrByElem",
"(",
"$",
"element",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_dom_x_path",
"->",
"query",
"(",
"\"//{$element}\"",
")",
";",
"$",
"contents",
"=",
"[",
"]",
";",
"$",
"attrs",
"=",
"[",
"]",
";",
"forea... | Get attributes of elements
@example
getAttrByElemWithAttr('a');
Output:
Array
(
[0] => Array
(
[href] => www.sample.com
[class] => thumbnail
)
)
@param string $element Element (e.g. a, div, img)
@return array | [
"Get",
"attributes",
"of",
"elements"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/DOM/Scraper.php#L193-L212 | train |
Vectrex/vxPHP | src/Webpage/MenuGenerator.php | MenuGenerator.create | public static function create($id = null, $level = false, $forceActiveMenu = null, $decorator = null, $renderArgs = null) {
return new static($id, $level, $forceActiveMenu, $decorator, $renderArgs);
} | php | public static function create($id = null, $level = false, $forceActiveMenu = null, $decorator = null, $renderArgs = null) {
return new static($id, $level, $forceActiveMenu, $decorator, $renderArgs);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"level",
"=",
"false",
",",
"$",
"forceActiveMenu",
"=",
"null",
",",
"$",
"decorator",
"=",
"null",
",",
"$",
"renderArgs",
"=",
"null",
")",
"{",
"return",
"new",
"sta... | convenience method to allow chaining
@param string $id
@param bool $level (if NULL, the full menu tree is printed)
@param bool $forceActiveMenu
@param string $decorator
@param mixed $renderArgs
@return MenuGenerator
@throws MenuGeneratorException
@throws \vxPHP\Application\Exception\ApplicationException | [
"convenience",
"method",
"to",
"allow",
"chaining"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuGenerator.php#L185-L189 | train |
Vectrex/vxPHP | src/Webpage/MenuGenerator.php | MenuGenerator.completeMenu | protected function completeMenu(Menu $m) {
if($m->getType() === 'dynamic') {
// invoke service to build menu entries
Application::getInstance()->getService($m->getServiceId())->appendMenuEntries($m);
}
foreach($m->getEntries() as $entry) {
if(($m = $entry->getSubMenu())) {
$this->comple... | php | protected function completeMenu(Menu $m) {
if($m->getType() === 'dynamic') {
// invoke service to build menu entries
Application::getInstance()->getService($m->getServiceId())->appendMenuEntries($m);
}
foreach($m->getEntries() as $entry) {
if(($m = $entry->getSubMenu())) {
$this->comple... | [
"protected",
"function",
"completeMenu",
"(",
"Menu",
"$",
"m",
")",
"{",
"if",
"(",
"$",
"m",
"->",
"getType",
"(",
")",
"===",
"'dynamic'",
")",
"{",
"// invoke service to build menu entries",
"Application",
"::",
"getInstance",
"(",
")",
"->",
"getService",... | walk the menu tree
and invoke service to append dynamic menu entries
@param Menu $m
@throws \vxPHP\Application\Exception\ApplicationException | [
"walk",
"the",
"menu",
"tree",
"and",
"invoke",
"service",
"to",
"append",
"dynamic",
"menu",
"entries"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuGenerator.php#L349-L366 | train |
Vectrex/vxPHP | src/Webpage/MenuGenerator.php | MenuGenerator.clearSelectedMenuEntries | protected function clearSelectedMenuEntries(Menu $menu) {
while(($e = $menu->getSelectedEntry())) {
// dynamic menus come either with unselected entry or have a selected entry explicitly set
if($menu->getType() == 'static') {
$menu->clearSelectedEntry();
}
if(!($menu = $e->getSubMenu())) {
brea... | php | protected function clearSelectedMenuEntries(Menu $menu) {
while(($e = $menu->getSelectedEntry())) {
// dynamic menus come either with unselected entry or have a selected entry explicitly set
if($menu->getType() == 'static') {
$menu->clearSelectedEntry();
}
if(!($menu = $e->getSubMenu())) {
brea... | [
"protected",
"function",
"clearSelectedMenuEntries",
"(",
"Menu",
"$",
"menu",
")",
"{",
"while",
"(",
"(",
"$",
"e",
"=",
"$",
"menu",
"->",
"getSelectedEntry",
"(",
")",
")",
")",
"{",
"// dynamic menus come either with unselected entry or have a selected entry expl... | walks menu tree and clears all previously selected entries
@param Menu $menu | [
"walks",
"menu",
"tree",
"and",
"clears",
"all",
"previously",
"selected",
"entries"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuGenerator.php#L428-L441 | train |
Vectrex/vxPHP | src/Webpage/MenuGenerator.php | MenuGenerator.authenticateMenu | protected function authenticateMenu(Menu $menu) {
if(!self::$authenticator) {
self::$authenticator = new DefaultMenuAuthenticator();
}
return self::$authenticator->authenticate($menu, Application::getInstance()->getCurrentUser());
} | php | protected function authenticateMenu(Menu $menu) {
if(!self::$authenticator) {
self::$authenticator = new DefaultMenuAuthenticator();
}
return self::$authenticator->authenticate($menu, Application::getInstance()->getCurrentUser());
} | [
"protected",
"function",
"authenticateMenu",
"(",
"Menu",
"$",
"menu",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"authenticator",
")",
"{",
"self",
"::",
"$",
"authenticator",
"=",
"new",
"DefaultMenuAuthenticator",
"(",
")",
";",
"}",
"return",
"self",... | authenticates the complete menu
invokes a previously set authenticator class or falls back
to a default menu authenticator
@param Menu $menu
@return boolean
@throws \vxPHP\Application\Exception\ApplicationException | [
"authenticates",
"the",
"complete",
"menu",
"invokes",
"a",
"previously",
"set",
"authenticator",
"class",
"or",
"falls",
"back",
"to",
"a",
"default",
"menu",
"authenticator"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuGenerator.php#L452-L462 | train |
shgysk8zer0/core_api | traits/curl.php | cURL.curlSetOpt | final public function curlSetOpt($opt, $value)
{
if (is_string($opt)) {
$opt = 'CURLOPT_' . strtoupper($opt);
if (defined($opt)) {
$opt = constant($opt);
curl_setopt($this->curl_handle, $opt, $value);
} else {
throw new \InvalidArgumentException(
sprintf('%s is not a valid cURL option', fun... | php | final public function curlSetOpt($opt, $value)
{
if (is_string($opt)) {
$opt = 'CURLOPT_' . strtoupper($opt);
if (defined($opt)) {
$opt = constant($opt);
curl_setopt($this->curl_handle, $opt, $value);
} else {
throw new \InvalidArgumentException(
sprintf('%s is not a valid cURL option', fun... | [
"final",
"public",
"function",
"curlSetOpt",
"(",
"$",
"opt",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"opt",
")",
")",
"{",
"$",
"opt",
"=",
"'CURLOPT_'",
".",
"strtoupper",
"(",
"$",
"opt",
")",
";",
"if",
"(",
"defined",
... | Set an option for a cURL transfer
@param int $opt The CURLOPT_XXX option to set.
@param mixed $value The value to be set on option.
@return self
@see http://php.net/manual/en/function.curl-setopt.php | [
"Set",
"an",
"option",
"for",
"a",
"cURL",
"transfer"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/curl.php#L108-L134 | train |
shgysk8zer0/core_api | traits/curl.php | cURL.curlSetOptArray | final public function curlSetOptArray(array $options = array())
{
$this->curlFilterOpts($options);
curl_setopt_array($this->curl_handle, $options);
return $this;
} | php | final public function curlSetOptArray(array $options = array())
{
$this->curlFilterOpts($options);
curl_setopt_array($this->curl_handle, $options);
return $this;
} | [
"final",
"public",
"function",
"curlSetOptArray",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"curlFilterOpts",
"(",
"$",
"options",
")",
";",
"curl_setopt_array",
"(",
"$",
"this",
"->",
"curl_handle",
",",
"$",
"o... | Set multiple options for a cURL transfer
@param array $options An array specifying which options to set and their values.
@return self | [
"Set",
"multiple",
"options",
"for",
"a",
"cURL",
"transfer"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/curl.php#L142-L147 | train |
shgysk8zer0/core_api | traits/curl.php | cURL.curlFileCreate | final public function curlFileCreate(
$filename,
$mimetype = null,
$postname = null
)
{
$file = new \CURLFile($fname, $mime, $name);
return [$file->getPostFilename(), $file];
} | php | final public function curlFileCreate(
$filename,
$mimetype = null,
$postname = null
)
{
$file = new \CURLFile($fname, $mime, $name);
return [$file->getPostFilename(), $file];
} | [
"final",
"public",
"function",
"curlFileCreate",
"(",
"$",
"filename",
",",
"$",
"mimetype",
"=",
"null",
",",
"$",
"postname",
"=",
"null",
")",
"{",
"$",
"file",
"=",
"new",
"\\",
"CURLFile",
"(",
"$",
"fname",
",",
"$",
"mime",
",",
"$",
"name",
... | Can be used to upload a file with CURLOPT_POSTFIELDS.
@param string $filename Filename of file
@param string $mimetype MIME type of file
@param string $postname Name of file for post data
@see https://php.net/manual/en/class.curlfile.php | [
"Can",
"be",
"used",
"to",
"upload",
"a",
"file",
"with",
"CURLOPT_POSTFIELDS",
"."
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/curl.php#L179-L187 | train |
Talesoft/tale-framework | src/Tale/ClassLoader.php | ClassLoader.load | public function load($className)
{
$name = $className;
if ($this->_nameSpace) {
$ns = rtrim($this->_nameSpace, '\\').'\\';
$nameLen = strlen($className);
$nsLen = strlen($ns);
if ($nameLen < $nsLen || substr($className, 0, $nsLen) !== $ns)
... | php | public function load($className)
{
$name = $className;
if ($this->_nameSpace) {
$ns = rtrim($this->_nameSpace, '\\').'\\';
$nameLen = strlen($className);
$nsLen = strlen($ns);
if ($nameLen < $nsLen || substr($className, 0, $nsLen) !== $ns)
... | [
"public",
"function",
"load",
"(",
"$",
"className",
")",
"{",
"$",
"name",
"=",
"$",
"className",
";",
"if",
"(",
"$",
"this",
"->",
"_nameSpace",
")",
"{",
"$",
"ns",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"_nameSpace",
",",
"'\\\\'",
")",
".",
... | Loads a class based on its class name
If it's not found, it's simply ignored in order to let another loader try to load it
If it's the only loader, an error will be thrown after a failed loading
There's no loader recursion, the final check uses the second parameter of class_exists() to
not trigger another autoloader i... | [
"Loads",
"a",
"class",
"based",
"on",
"its",
"class",
"name",
"If",
"it",
"s",
"not",
"found",
"it",
"s",
"simply",
"ignored",
"in",
"order",
"to",
"let",
"another",
"loader",
"try",
"to",
"load",
"it",
"If",
"it",
"s",
"the",
"only",
"loader",
"an",... | 739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49 | https://github.com/Talesoft/tale-framework/blob/739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49/src/Tale/ClassLoader.php#L235-L260 | train |
valu-digital/valusetup | src/ValuSetup/Setup/SoftwareVersion.php | SoftwareVersion.setVersion | public function setVersion ($version)
{
$version = strtolower(strval($version));
if (! self::isValid($version)) {
$version = self::DEFAULT_UNRESOLVED_VERSION;
}
$this->numbers = self::parse($version);
$this->version = $version;
return $this;
} | php | public function setVersion ($version)
{
$version = strtolower(strval($version));
if (! self::isValid($version)) {
$version = self::DEFAULT_UNRESOLVED_VERSION;
}
$this->numbers = self::parse($version);
$this->version = $version;
return $this;
} | [
"public",
"function",
"setVersion",
"(",
"$",
"version",
")",
"{",
"$",
"version",
"=",
"strtolower",
"(",
"strval",
"(",
"$",
"version",
")",
")",
";",
"if",
"(",
"!",
"self",
"::",
"isValid",
"(",
"$",
"version",
")",
")",
"{",
"$",
"version",
"=... | Set current version
@param $version string|int
Version (float/integer is casted to string)
@return SoftwareVersion | [
"Set",
"current",
"version"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Setup/SoftwareVersion.php#L55-L65 | train |
valu-digital/valusetup | src/ValuSetup/Setup/SoftwareVersion.php | SoftwareVersion.compareTo | public function compareTo($version)
{
$cmp = self::parse($version);
$result = $this->cmp($cmp, $this->numbers);
if ($result === 0) {
$result = $this->cmp($this->numbers, $cmp);
$result = - $result;
} else {
return $result;
}
return ... | php | public function compareTo($version)
{
$cmp = self::parse($version);
$result = $this->cmp($cmp, $this->numbers);
if ($result === 0) {
$result = $this->cmp($this->numbers, $cmp);
$result = - $result;
} else {
return $result;
}
return ... | [
"public",
"function",
"compareTo",
"(",
"$",
"version",
")",
"{",
"$",
"cmp",
"=",
"self",
"::",
"parse",
"(",
"$",
"version",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"cmp",
"(",
"$",
"cmp",
",",
"$",
"this",
"->",
"numbers",
")",
";",
... | Compare current version to given version and
return -1 if current is less and +1 if current
version is greater than given version
@param $version string
@return array | [
"Compare",
"current",
"version",
"to",
"given",
"version",
"and",
"return",
"-",
"1",
"if",
"current",
"is",
"less",
"and",
"+",
"1",
"if",
"current",
"version",
"is",
"greater",
"than",
"given",
"version"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Setup/SoftwareVersion.php#L161-L172 | train |
valu-digital/valusetup | src/ValuSetup/Setup/SoftwareVersion.php | SoftwareVersion.parse | public static function parse ($version)
{
$nums = explode(self::DELIMITER, $version);
$numbers = array();
foreach ($nums as $num) {
if (preg_match('/^0*([0-9]+)/', $num, $matches)) {
if (isset($matches[1])) {
$numbers[] = $matches[1];
... | php | public static function parse ($version)
{
$nums = explode(self::DELIMITER, $version);
$numbers = array();
foreach ($nums as $num) {
if (preg_match('/^0*([0-9]+)/', $num, $matches)) {
if (isset($matches[1])) {
$numbers[] = $matches[1];
... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"version",
")",
"{",
"$",
"nums",
"=",
"explode",
"(",
"self",
"::",
"DELIMITER",
",",
"$",
"version",
")",
";",
"$",
"numbers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"nums",
"as",
"$",... | Parse array of integers based on version
number
Non-integer values and preceeding zeros are
dropped.
@param $version string
@return array | [
"Parse",
"array",
"of",
"integers",
"based",
"on",
"version",
"number"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Setup/SoftwareVersion.php#L208-L227 | train |
valu-digital/valusetup | src/ValuSetup/Setup/SoftwareVersion.php | SoftwareVersion.isValid | public static function isValid ($version)
{
if (self::isDev($version)) {
return true;
} else {
return (boolean) preg_match('/' . self::$validPattern . '/i', $version);
}
} | php | public static function isValid ($version)
{
if (self::isDev($version)) {
return true;
} else {
return (boolean) preg_match('/' . self::$validPattern . '/i', $version);
}
} | [
"public",
"static",
"function",
"isValid",
"(",
"$",
"version",
")",
"{",
"if",
"(",
"self",
"::",
"isDev",
"(",
"$",
"version",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"(",
"boolean",
")",
"preg_match",
"(",
"'/'",
".",
"... | Test if version is valid
@return boolean | [
"Test",
"if",
"version",
"is",
"valid"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Setup/SoftwareVersion.php#L234-L241 | train |
wasinger/adaptimage | src/Output/OutputTypeMap.php | OutputTypeMap.getOutputTypeOptions | public function getOutputTypeOptions($input_type)
{
if (!in_array($input_type, $this->types)) {
$input_type = $this->default_type;
}
return $this->map[$input_type];
} | php | public function getOutputTypeOptions($input_type)
{
if (!in_array($input_type, $this->types)) {
$input_type = $this->default_type;
}
return $this->map[$input_type];
} | [
"public",
"function",
"getOutputTypeOptions",
"(",
"$",
"input_type",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"input_type",
",",
"$",
"this",
"->",
"types",
")",
")",
"{",
"$",
"input_type",
"=",
"$",
"this",
"->",
"default_type",
";",
"}",
"re... | Get OutputTypeOptions for given input type
@param int $input_type One of the IMAGETYPE_XX constants
@return OutputTypeOptionsInterface | [
"Get",
"OutputTypeOptions",
"for",
"given",
"input",
"type"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/Output/OutputTypeMap.php#L30-L36 | train |
wasinger/adaptimage | src/Output/OutputTypeMap.php | OutputTypeMap.setOutputTypeOptions | public function setOutputTypeOptions($input_type, OutputTypeOptionsInterface $options)
{
$this->map[$input_type] = $options;
$this->types = array_keys($this->map);
return $this;
} | php | public function setOutputTypeOptions($input_type, OutputTypeOptionsInterface $options)
{
$this->map[$input_type] = $options;
$this->types = array_keys($this->map);
return $this;
} | [
"public",
"function",
"setOutputTypeOptions",
"(",
"$",
"input_type",
",",
"OutputTypeOptionsInterface",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"map",
"[",
"$",
"input_type",
"]",
"=",
"$",
"options",
";",
"$",
"this",
"->",
"types",
"=",
"array_keys",... | Set an OutputTypeOptionsInterface object for a given input type
@param int $input_type One of the IMAGETYPE_XX constants
@param OutputTypeOptionsInterface $options
@return OutputTypeMap | [
"Set",
"an",
"OutputTypeOptionsInterface",
"object",
"for",
"a",
"given",
"input",
"type"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/Output/OutputTypeMap.php#L45-L50 | train |
Eden-PHP/Block | Base.php | Base.getHelpers | protected function getHelpers()
{
$cdnRoot = eden('block')->getAssetRoot();
$language = eden('block')->getLanguage();
return array(
'cdn' => function() use ($cdnRoot) {
echo $cdnRoot;
},
'_' => function($key) use ($language) {
if($language instanceof Eden\Language\Base) {
echo $lan... | php | protected function getHelpers()
{
$cdnRoot = eden('block')->getAssetRoot();
$language = eden('block')->getLanguage();
return array(
'cdn' => function() use ($cdnRoot) {
echo $cdnRoot;
},
'_' => function($key) use ($language) {
if($language instanceof Eden\Language\Base) {
echo $lan... | [
"protected",
"function",
"getHelpers",
"(",
")",
"{",
"$",
"cdnRoot",
"=",
"eden",
"(",
"'block'",
")",
"->",
"getAssetRoot",
"(",
")",
";",
"$",
"language",
"=",
"eden",
"(",
"'block'",
")",
"->",
"getLanguage",
"(",
")",
";",
"return",
"array",
"(",
... | Returns helper methods
@return array | [
"Returns",
"helper",
"methods"
] | 681b9f01dd118612d0fced84d2f702167b52109b | https://github.com/Eden-PHP/Block/blob/681b9f01dd118612d0fced84d2f702167b52109b/Base.php#L85-L102 | train |
squareproton/Bond | src/Bond/Entity/Types/DateInterval.php | DateInterval.init | public static function init($time = null)
{
try {
$interval = new self( $time );
return $interval;
} catch( \Exception $e ) {
return null;
}
} | php | public static function init($time = null)
{
try {
$interval = new self( $time );
return $interval;
} catch( \Exception $e ) {
return null;
}
} | [
"public",
"static",
"function",
"init",
"(",
"$",
"time",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"interval",
"=",
"new",
"self",
"(",
"$",
"time",
")",
";",
"return",
"$",
"interval",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{"... | Standard initalise. Useful for array_map
@param $time
@return DateInterval|null | [
"Standard",
"initalise",
".",
"Useful",
"for",
"array_map"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/DateInterval.php#L89-L97 | train |
squareproton/Bond | src/Bond/Entity/Types/DateInterval.php | DateInterval.isEmpty | public function isEmpty()
{
return $this->y === 0 && $this->m === 0 && $this->d === 0 && $this->h === 0 && $this->i === 0 && $this->s === 0;
} | php | public function isEmpty()
{
return $this->y === 0 && $this->m === 0 && $this->d === 0 && $this->h === 0 && $this->i === 0 && $this->s === 0;
} | [
"public",
"function",
"isEmpty",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"y",
"===",
"0",
"&&",
"$",
"this",
"->",
"m",
"===",
"0",
"&&",
"$",
"this",
"->",
"d",
"===",
"0",
"&&",
"$",
"this",
"->",
"h",
"===",
"0",
"&&",
"$",
"this",
"->... | Is this interval empty?
@return bool | [
"Is",
"this",
"interval",
"empty?"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/DateInterval.php#L103-L106 | train |
squareproton/Bond | src/Bond/Entity/Types/DateInterval.php | DateInterval.toArray | public function toArray()
{
return array(
'year' => $this->y,
'month' => $this->m,
'day' => $this->d,
'hour' => $this->h,
'minute' => $this->i,
'second' => $this->s,
);
} | php | public function toArray()
{
return array(
'year' => $this->y,
'month' => $this->m,
'day' => $this->d,
'hour' => $this->h,
'minute' => $this->i,
'second' => $this->s,
);
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"array",
"(",
"'year'",
"=>",
"$",
"this",
"->",
"y",
",",
"'month'",
"=>",
"$",
"this",
"->",
"m",
",",
"'day'",
"=>",
"$",
"this",
"->",
"d",
",",
"'hour'",
"=>",
"$",
"this",
"->",
"h",... | Return a array representing interval information
@return array | [
"Return",
"a",
"array",
"representing",
"interval",
"information"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/DateInterval.php#L112-L122 | train |
rutger-speksnijder/restphp | src/RestPHP/Request/Request.php | Request.sanitize | final protected function sanitize($data)
{
// Recursively loop through the data array and return the sanitized data
$sanitized = [];
if (is_array($data)) {
foreach ($data as $key => $value) {
$sanitized[$key] = $this->sanitize($value);
}
} else... | php | final protected function sanitize($data)
{
// Recursively loop through the data array and return the sanitized data
$sanitized = [];
if (is_array($data)) {
foreach ($data as $key => $value) {
$sanitized[$key] = $this->sanitize($value);
}
} else... | [
"final",
"protected",
"function",
"sanitize",
"(",
"$",
"data",
")",
"{",
"// Recursively loop through the data array and return the sanitized data",
"$",
"sanitized",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$... | Sanitizes an array with data.
@param array $data The input data.
@return array A sanitized array. | [
"Sanitizes",
"an",
"array",
"with",
"data",
"."
] | 326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d | https://github.com/rutger-speksnijder/restphp/blob/326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d/src/RestPHP/Request/Request.php#L52-L64 | train |
ammarfaizi2/icetea-framework | src/System/Crayner/Cookie/Cookie.php | Cookie.get | public function get($name)
{
$this->toString = isset($_COOKIE[$name]) ? $_COOKIE[$name] : "";
return new InputUtilities($this->toString);
} | php | public function get($name)
{
$this->toString = isset($_COOKIE[$name]) ? $_COOKIE[$name] : "";
return new InputUtilities($this->toString);
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"toString",
"=",
"isset",
"(",
"$",
"_COOKIE",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"_COOKIE",
"[",
"$",
"name",
"]",
":",
"\"\"",
";",
"return",
"new",
"InputUtilities",
... | Get cookie value.
@param string $name
@return string | [
"Get",
"cookie",
"value",
"."
] | dedd832846c3e69b429b18b8612fae50881af180 | https://github.com/ammarfaizi2/icetea-framework/blob/dedd832846c3e69b429b18b8612fae50881af180/src/System/Crayner/Cookie/Cookie.php#L71-L75 | train |
ammarfaizi2/icetea-framework | src/System/Crayner/Cookie/Cookie.php | Cookie.delete | public function delete($name)
{
$this->func = function () use ($name) {
setcookie($name, null, 0);
return $name;
};
return new CookieFlush($this->func);
} | php | public function delete($name)
{
$this->func = function () use ($name) {
setcookie($name, null, 0);
return $name;
};
return new CookieFlush($this->func);
} | [
"public",
"function",
"delete",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"func",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"name",
")",
"{",
"setcookie",
"(",
"$",
"name",
",",
"null",
",",
"0",
")",
";",
"return",
"$",
"name",
";",
"}"... | Delete cookie.
@param string $name
@return bool | [
"Delete",
"cookie",
"."
] | dedd832846c3e69b429b18b8612fae50881af180 | https://github.com/ammarfaizi2/icetea-framework/blob/dedd832846c3e69b429b18b8612fae50881af180/src/System/Crayner/Cookie/Cookie.php#L83-L90 | train |
wearenolte/wp-endpoints-static | src/StaticApi/Widgets.php | Widgets.get_all_areas | public static function get_all_areas() {
global $sidebars_widgets;
$widget_areas = [];
foreach ( $sidebars_widgets as $widget_area => $widgets ) {
if ( 'wp_inactive_widgets' === $widget_area ) {
continue;
}
$widget_areas[ $widget_area ] = [];
if ( empty( $widgets ) ) {
continue;
}
f... | php | public static function get_all_areas() {
global $sidebars_widgets;
$widget_areas = [];
foreach ( $sidebars_widgets as $widget_area => $widgets ) {
if ( 'wp_inactive_widgets' === $widget_area ) {
continue;
}
$widget_areas[ $widget_area ] = [];
if ( empty( $widgets ) ) {
continue;
}
f... | [
"public",
"static",
"function",
"get_all_areas",
"(",
")",
"{",
"global",
"$",
"sidebars_widgets",
";",
"$",
"widget_areas",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"sidebars_widgets",
"as",
"$",
"widget_area",
"=>",
"$",
"widgets",
")",
"{",
"if",
"(",
... | Returns an array of widget areas, with the assigned widgets in each.
@return array | [
"Returns",
"an",
"array",
"of",
"widget",
"areas",
"with",
"the",
"assigned",
"widgets",
"in",
"each",
"."
] | 23258bba9b65d55b78b3dc3edc123d75009b0825 | https://github.com/wearenolte/wp-endpoints-static/blob/23258bba9b65d55b78b3dc3edc123d75009b0825/src/StaticApi/Widgets.php#L16-L47 | train |
concordat/console | src/Commands/AbstractCommand.php | AbstractCommand.iterator | protected function iterator($framework, $source)
{
$source = $source . DIRECTORY_SEPARATOR . ucfirst($framework);
$directory = new \RecursiveDirectoryIterator($source, 4096);
return new \RecursiveIteratorIterator($directory, 1);
} | php | protected function iterator($framework, $source)
{
$source = $source . DIRECTORY_SEPARATOR . ucfirst($framework);
$directory = new \RecursiveDirectoryIterator($source, 4096);
return new \RecursiveIteratorIterator($directory, 1);
} | [
"protected",
"function",
"iterator",
"(",
"$",
"framework",
",",
"$",
"source",
")",
"{",
"$",
"source",
"=",
"$",
"source",
".",
"DIRECTORY_SEPARATOR",
".",
"ucfirst",
"(",
"$",
"framework",
")",
";",
"$",
"directory",
"=",
"new",
"\\",
"RecursiveDirector... | Returns a \RecursiveIteratorIterator instance.
@param string $framework
@param string $source
@return \RecursiveIteratorIterator | [
"Returns",
"a",
"\\",
"RecursiveIteratorIterator",
"instance",
"."
] | bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3 | https://github.com/concordat/console/blob/bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3/src/Commands/AbstractCommand.php#L97-L104 | train |
concordat/console | src/Commands/AbstractCommand.php | AbstractCommand.migrate | protected function migrate(OutputInterface $output, $source, $path, $framework)
{
foreach ($this->iterator($framework, $source) as $item) {
$name = strtolower(str_replace($source, '', $item->getRealpath()));
if ((boolean) $item->isDir() === false) {
$date = date($thi... | php | protected function migrate(OutputInterface $output, $source, $path, $framework)
{
foreach ($this->iterator($framework, $source) as $item) {
$name = strtolower(str_replace($source, '', $item->getRealpath()));
if ((boolean) $item->isDir() === false) {
$date = date($thi... | [
"protected",
"function",
"migrate",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"source",
",",
"$",
"path",
",",
"$",
"framework",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"iterator",
"(",
"$",
"framework",
",",
"$",
"source",
")",
"as",
"$",
... | Creates a copy of database files to the specified path.
@param \Symfony\Component\Console\Output\OutputInterface $output
@param string $source
@param string $path
@param string $framewor... | [
"Creates",
"a",
"copy",
"of",
"database",
"files",
"to",
"the",
"specified",
"path",
"."
] | bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3 | https://github.com/concordat/console/blob/bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3/src/Commands/AbstractCommand.php#L115-L134 | train |
concordat/console | src/Commands/AbstractCommand.php | AbstractCommand.package | protected function package($name)
{
$exists = in_array($name, array_keys($this->packages));
if ($exists === false || ! class_exists($this->packages[$name])) {
$message = 'Package "' . $name . '" does not exists!';
throw new \InvalidArgumentException((string) $message);
... | php | protected function package($name)
{
$exists = in_array($name, array_keys($this->packages));
if ($exists === false || ! class_exists($this->packages[$name])) {
$message = 'Package "' . $name . '" does not exists!';
throw new \InvalidArgumentException((string) $message);
... | [
"protected",
"function",
"package",
"(",
"$",
"name",
")",
"{",
"$",
"exists",
"=",
"in_array",
"(",
"$",
"name",
",",
"array_keys",
"(",
"$",
"this",
"->",
"packages",
")",
")",
";",
"if",
"(",
"$",
"exists",
"===",
"false",
"||",
"!",
"class_exists... | Return the value of the required type from the specified package.
@param string $package
@return string | [
"Return",
"the",
"value",
"of",
"the",
"required",
"type",
"from",
"the",
"specified",
"package",
"."
] | bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3 | https://github.com/concordat/console/blob/bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3/src/Commands/AbstractCommand.php#L142-L163 | train |
XetaIO/Xetaravel-IpTraceable | src/Providers/IpTraceableServiceProvider.php | IpTraceableServiceProvider.boot | public function boot()
{
foreach ($this->subscribe as $subscriber) {
Event::subscribe($subscriber);
}
$this->publishes([
__DIR__ . '/../../config/iptraceable.php' => config_path('iptraceable.php'),
], 'config');
} | php | public function boot()
{
foreach ($this->subscribe as $subscriber) {
Event::subscribe($subscriber);
}
$this->publishes([
__DIR__ . '/../../config/iptraceable.php' => config_path('iptraceable.php'),
], 'config');
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"subscribe",
"as",
"$",
"subscriber",
")",
"{",
"Event",
"::",
"subscribe",
"(",
"$",
"subscriber",
")",
";",
"}",
"$",
"this",
"->",
"publishes",
"(",
"[",
"__DIR__",
".... | Register the application's event listeners and publish the config file.
@return void | [
"Register",
"the",
"application",
"s",
"event",
"listeners",
"and",
"publish",
"the",
"config",
"file",
"."
] | e1c57592d45f240c55e827fd6b756e5143c892b5 | https://github.com/XetaIO/Xetaravel-IpTraceable/blob/e1c57592d45f240c55e827fd6b756e5143c892b5/src/Providers/IpTraceableServiceProvider.php#L24-L33 | train |
ekyna/SettingBundle | Controller/HelperController.php | HelperController.fetchAction | public function fetchAction(Request $request)
{
$reference = strtoupper($request->query->get('reference', null));
$remote = (bool)$request->query->get('remote', 1);
if (0 < strlen($reference) && $remote) {
$remoteEndPoints = $this->container->getParameter('ekyna_setting.helper_r... | php | public function fetchAction(Request $request)
{
$reference = strtoupper($request->query->get('reference', null));
$remote = (bool)$request->query->get('remote', 1);
if (0 < strlen($reference) && $remote) {
$remoteEndPoints = $this->container->getParameter('ekyna_setting.helper_r... | [
"public",
"function",
"fetchAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"reference",
"=",
"strtoupper",
"(",
"$",
"request",
"->",
"query",
"->",
"get",
"(",
"'reference'",
",",
"null",
")",
")",
";",
"$",
"remote",
"=",
"(",
"bool",
")",
... | Fetches the helper content.
@param Request $request
@return \Symfony\Component\HttpFoundation\Response | [
"Fetches",
"the",
"helper",
"content",
"."
] | df58f83eb3a01ef56cd76ea73639322c581e75c1 | https://github.com/ekyna/SettingBundle/blob/df58f83eb3a01ef56cd76ea73639322c581e75c1/Controller/HelperController.php#L23-L68 | train |
rzajac/phptools | src/Traits/Error.php | Error.addError | public function addError($error, $key = null)
{
if (is_string($error)) {
$error = new Exception($error);
} elseif ($error instanceof Exception) {
// Nothing to do
} else {
throw new Exception('only string errors or instances of Exception can be added');
... | php | public function addError($error, $key = null)
{
if (is_string($error)) {
$error = new Exception($error);
} elseif ($error instanceof Exception) {
// Nothing to do
} else {
throw new Exception('only string errors or instances of Exception can be added');
... | [
"public",
"function",
"addError",
"(",
"$",
"error",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"error",
")",
")",
"{",
"$",
"error",
"=",
"new",
"Exception",
"(",
"$",
"error",
")",
";",
"}",
"elseif",
"(",
"$",
... | Add error.
If the key is not provided the method will just
add another element to the array.
@param Exception|string $error The error
@param string $key The associative array key
@throws Exception
@return bool Always returns false | [
"Add",
"error",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Traits/Error.php#L49-L66 | train |
jaredchu/JCRequest | src/JCRequest.php | JCRequest.combineUrl | protected static function combineUrl($url, $params = [])
{
$urlObject = Url::parse($url);
$queryData = array_merge($urlObject->query->getData(), $params);
$urlObject->query->setData($queryData);
return $urlObject->getUrl();
} | php | protected static function combineUrl($url, $params = [])
{
$urlObject = Url::parse($url);
$queryData = array_merge($urlObject->query->getData(), $params);
$urlObject->query->setData($queryData);
return $urlObject->getUrl();
} | [
"protected",
"static",
"function",
"combineUrl",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"urlObject",
"=",
"Url",
"::",
"parse",
"(",
"$",
"url",
")",
";",
"$",
"queryData",
"=",
"array_merge",
"(",
"$",
"urlObject",
"->",
... | Manipulate the url & params for GET request
@param string $url
@param array $params
@return string | [
"Manipulate",
"the",
"url",
"&",
"params",
"for",
"GET",
"request"
] | d6b2fb2096f1cac9b625481be920fbccb4edae92 | https://github.com/jaredchu/JCRequest/blob/d6b2fb2096f1cac9b625481be920fbccb4edae92/src/JCRequest.php#L71-L78 | train |
Torann/skosh-generator | src/Console/PublishCommand.php | PublishCommand.validateServer | protected function validateServer($server)
{
if (in_array($server, array_keys($this->servers)))
{
// Get server options
$options = $this->config->get($server);
if (!$options || $options['host'] === 'yoursite') {
throw new \Exception("Remote server... | php | protected function validateServer($server)
{
if (in_array($server, array_keys($this->servers)))
{
// Get server options
$options = $this->config->get($server);
if (!$options || $options['host'] === 'yoursite') {
throw new \Exception("Remote server... | [
"protected",
"function",
"validateServer",
"(",
"$",
"server",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"server",
",",
"array_keys",
"(",
"$",
"this",
"->",
"servers",
")",
")",
")",
"{",
"// Get server options",
"$",
"options",
"=",
"$",
"this",
"->",... | Check existence of remote server.
@param string $server
@return bool
@throws \Exception | [
"Check",
"existence",
"of",
"remote",
"server",
"."
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Console/PublishCommand.php#L89-L108 | train |
Torann/skosh-generator | src/Console/PublishCommand.php | PublishCommand.publish_ssh | protected function publish_ssh(OutputInterface $output, $target)
{
// Get FTP config
$config = $this->config->get('ssh');
// Ensure there isn't a leading slash
$remote_dir = ltrim($config['remote_dir'], '/');
// Shell command
$output->writeln(shell_exec("rsync -avze... | php | protected function publish_ssh(OutputInterface $output, $target)
{
// Get FTP config
$config = $this->config->get('ssh');
// Ensure there isn't a leading slash
$remote_dir = ltrim($config['remote_dir'], '/');
// Shell command
$output->writeln(shell_exec("rsync -avze... | [
"protected",
"function",
"publish_ssh",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"target",
")",
"{",
"// Get FTP config",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'ssh'",
")",
";",
"// Ensure there isn't a leading slash",
"$",
... | Publish using SSH.
@param OutputInterface $output
@param string $target
@return bool
@throws \Exception | [
"Publish",
"using",
"SSH",
"."
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Console/PublishCommand.php#L118-L130 | train |
Danack/Jig | src/Jig/JigConfig.php | JigConfig.getCompiledFilenameFromClassname | public function getCompiledFilenameFromClassname($fqcn)
{
$filename = $this->templateCompileDirectory.'/'.$fqcn.'.php';
$filename = str_replace('\\', '/', $filename);
return $filename;
} | php | public function getCompiledFilenameFromClassname($fqcn)
{
$filename = $this->templateCompileDirectory.'/'.$fqcn.'.php';
$filename = str_replace('\\', '/', $filename);
return $filename;
} | [
"public",
"function",
"getCompiledFilenameFromClassname",
"(",
"$",
"fqcn",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"templateCompileDirectory",
".",
"'/'",
".",
"$",
"fqcn",
".",
"'.php'",
";",
"$",
"filename",
"=",
"str_replace",
"(",
"'\\\\'",
"... | Returns the fully pathed filename for a compiled class.
@param $fqcn
@return string | [
"Returns",
"the",
"fully",
"pathed",
"filename",
"for",
"a",
"compiled",
"class",
"."
] | b11106bc7d634add9873bf246eda1dadb059ed7a | https://github.com/Danack/Jig/blob/b11106bc7d634add9873bf246eda1dadb059ed7a/src/Jig/JigConfig.php#L57-L63 | train |
Danack/Jig | src/Jig/JigConfig.php | JigConfig.getFQCNFromTemplateName | public function getFQCNFromTemplateName($templateName)
{
$classname = $this->compiledNamespace."\\".$templateName;
$classname = str_replace('/', '\\', $classname);
$classname .= "Jig";
return $classname;
} | php | public function getFQCNFromTemplateName($templateName)
{
$classname = $this->compiledNamespace."\\".$templateName;
$classname = str_replace('/', '\\', $classname);
$classname .= "Jig";
return $classname;
} | [
"public",
"function",
"getFQCNFromTemplateName",
"(",
"$",
"templateName",
")",
"{",
"$",
"classname",
"=",
"$",
"this",
"->",
"compiledNamespace",
".",
"\"\\\\\"",
".",
"$",
"templateName",
";",
"$",
"classname",
"=",
"str_replace",
"(",
"'/'",
",",
"'\\\\'",... | Generate the full class name for the compiled version of a template..
@param $templateName
@return string | [
"Generate",
"the",
"full",
"class",
"name",
"for",
"the",
"compiled",
"version",
"of",
"a",
"template",
".."
] | b11106bc7d634add9873bf246eda1dadb059ed7a | https://github.com/Danack/Jig/blob/b11106bc7d634add9873bf246eda1dadb059ed7a/src/Jig/JigConfig.php#L70-L77 | train |
FuzeWorks/Core | src/Libraries/Zip.php | FW_Zip.read_file | public function read_file($path, $archive_filepath = FALSE)
{
if (file_exists($path) && FALSE !== ($data = file_get_contents($path)))
{
if (is_string($archive_filepath))
{
$name = str_replace('\\', '/', $archive_filepath);
}
else
{
$name = str_replace('\\', '/', $path);
if ($archive_fil... | php | public function read_file($path, $archive_filepath = FALSE)
{
if (file_exists($path) && FALSE !== ($data = file_get_contents($path)))
{
if (is_string($archive_filepath))
{
$name = str_replace('\\', '/', $archive_filepath);
}
else
{
$name = str_replace('\\', '/', $path);
if ($archive_fil... | [
"public",
"function",
"read_file",
"(",
"$",
"path",
",",
"$",
"archive_filepath",
"=",
"FALSE",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
"&&",
"FALSE",
"!==",
"(",
"$",
"data",
"=",
"file_get_contents",
"(",
"$",
"path",
")",
")",
... | Read the contents of a file and add it to the zip
@param string $path
@param bool $archive_filepath
@return bool | [
"Read",
"the",
"contents",
"of",
"a",
"file",
"and",
"add",
"it",
"to",
"the",
"zip"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Zip.php#L312-L335 | train |
FuzeWorks/Core | src/Libraries/Zip.php | FW_Zip.read_dir | public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL)
{
$path = rtrim($path, '/\\').DIRECTORY_SEPARATOR;
if ( ! $fp = @opendir($path))
{
return FALSE;
}
// Set the original directory root for child dir's to use as relative
if ($root_path === NULL)
{
$root_path = str_replace... | php | public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL)
{
$path = rtrim($path, '/\\').DIRECTORY_SEPARATOR;
if ( ! $fp = @opendir($path))
{
return FALSE;
}
// Set the original directory root for child dir's to use as relative
if ($root_path === NULL)
{
$root_path = str_replace... | [
"public",
"function",
"read_dir",
"(",
"$",
"path",
",",
"$",
"preserve_filepath",
"=",
"TRUE",
",",
"$",
"root_path",
"=",
"NULL",
")",
"{",
"$",
"path",
"=",
"rtrim",
"(",
"$",
"path",
",",
"'/\\\\'",
")",
".",
"DIRECTORY_SEPARATOR",
";",
"if",
"(",
... | Read a directory and add it to the zip.
This function recursively reads a folder and everything it contains (including
sub-folders) and creates a zip based on it. Whatever directory structure
is in the original file path will be recreated in the zip file.
@param string $path path to source directory
@param bool $pres... | [
"Read",
"a",
"directory",
"and",
"add",
"it",
"to",
"the",
"zip",
"."
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Zip.php#L351-L390 | train |
FuzeWorks/Core | src/Libraries/Zip.php | FW_Zip.get_zip | public function get_zip()
{
// Is there any data to return?
if ($this->entries === 0)
{
return FALSE;
}
return $this->zipdata
.$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00"
.pack('v', $this->entries) // total # of entries "on this disk"
.pack('v', $this->entries) // total # of entries over... | php | public function get_zip()
{
// Is there any data to return?
if ($this->entries === 0)
{
return FALSE;
}
return $this->zipdata
.$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00"
.pack('v', $this->entries) // total # of entries "on this disk"
.pack('v', $this->entries) // total # of entries over... | [
"public",
"function",
"get_zip",
"(",
")",
"{",
"// Is there any data to return?",
"if",
"(",
"$",
"this",
"->",
"entries",
"===",
"0",
")",
"{",
"return",
"FALSE",
";",
"}",
"return",
"$",
"this",
"->",
"zipdata",
".",
"$",
"this",
"->",
"directory",
".... | Get the Zip file
@return string (binary encoded) | [
"Get",
"the",
"Zip",
"file"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Zip.php#L399-L414 | train |
FuzeWorks/Core | src/Libraries/Zip.php | FW_Zip.archive | public function archive($filepath)
{
if ( ! ($fp = @fopen($filepath, 'w+b')))
{
return FALSE;
}
flock($fp, LOCK_EX);
for ($result = $written = 0, $data = $this->get_zip(), $length = strlen($data); $written < $length; $written += $result)
{
if (($result = fwrite($fp, substr($data, $written))) === FA... | php | public function archive($filepath)
{
if ( ! ($fp = @fopen($filepath, 'w+b')))
{
return FALSE;
}
flock($fp, LOCK_EX);
for ($result = $written = 0, $data = $this->get_zip(), $length = strlen($data); $written < $length; $written += $result)
{
if (($result = fwrite($fp, substr($data, $written))) === FA... | [
"public",
"function",
"archive",
"(",
"$",
"filepath",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"filepath",
",",
"'w+b'",
")",
")",
")",
"{",
"return",
"FALSE",
";",
"}",
"flock",
"(",
"$",
"fp",
",",
"LOCK_EX",
")... | Write File to the specified directory
Lets you write a file
@param string $filepath the file name
@return bool | [
"Write",
"File",
"to",
"the",
"specified",
"directory"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Zip.php#L426-L447 | train |
covex-nn/JooS | src/JooS/Log/Log/Event.php | Log_Event.validateMessage | public function validateMessage($value)
{
if (is_string($value)) {
$result = true;
} elseif (is_object($value) && method_exists($value, "__toString")) {
$result = true;
} else {
$result = false;
}
return $result;
} | php | public function validateMessage($value)
{
if (is_string($value)) {
$result = true;
} elseif (is_object($value) && method_exists($value, "__toString")) {
$result = true;
} else {
$result = false;
}
return $result;
} | [
"public",
"function",
"validateMessage",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"result",
"=",
"true",
";",
"}",
"elseif",
"(",
"is_object",
"(",
"$",
"value",
")",
"&&",
"method_exists",
"(",
"$",... | Validator for 'message' property
@param string $value Message
@return boolean | [
"Validator",
"for",
"message",
"property"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Log/Log/Event.php#L29-L40 | train |
locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.data | public function data(array $keys = null)
{
if ($keys === null) {
$keys = $this->keys();
}
$data = [];
foreach ($keys as $key) {
if (strtolower($key) === 'data') {
/** @internal Edge Case: Avoid recursive call */
continue;
... | php | public function data(array $keys = null)
{
if ($keys === null) {
$keys = $this->keys();
}
$data = [];
foreach ($keys as $key) {
if (strtolower($key) === 'data') {
/** @internal Edge Case: Avoid recursive call */
continue;
... | [
"public",
"function",
"data",
"(",
"array",
"$",
"keys",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"keys",
"===",
"null",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"keys",
"(",
")",
";",
"}",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",... | Gets all data, or a subset, from this entity.
@uses self::offsetExists()
@uses self::offsetGet()
@param string[] $keys Optional. Extracts only the requested data.
@return array Key-value array of data, excluding pairs with NULL values. | [
"Gets",
"all",
"data",
"or",
"a",
"subset",
"from",
"this",
"entity",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L47-L65 | train |
locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.offsetExists | public function offsetExists($key)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($key ===... | php | public function offsetExists($key)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($key ===... | [
"public",
"function",
"offsetExists",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Entity array access only supports non-numeric keys'",
")",
";",
"}",
"$",
"key",
"=",
"... | Determines if this entity contains the specified key and if its value is not NULL.
Routine:
- If the entity has a getter method (e.g., "foo_bar" → `fooBar()`),
its called and its value is checked;
- If the entity has a property (e.g., `$fooBar`), its value is checked;
- If the entity has neither, FALSE is returned.
@... | [
"Determines",
"if",
"this",
"entity",
"contains",
"the",
"specified",
"key",
"and",
"if",
"its",
"value",
"is",
"not",
"NULL",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L139-L164 | train |
locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.offsetSet | public function offsetSet($key, $value)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($ke... | php | public function offsetSet($key, $value)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($ke... | [
"public",
"function",
"offsetSet",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Entity array access only supports non-numeric keys'",
")",
";",
"}",
"$... | Assigns the value to the specified key on this entity.
Routine:
- The data key is added to the {@see self::$keys entity's key pool}.
- If the entity has a setter method (e.g., "foo_bar" → `setFooBar()`),
its called and passed the value;
- If the entity has NO setter method, the value is assigned to a property (e.g., `... | [
"Assigns",
"the",
"value",
"to",
"the",
"specified",
"key",
"on",
"this",
"entity",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L221-L244 | train |
locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.offsetUnset | public function offsetUnset($key)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($key === ... | php | public function offsetUnset($key)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($key === ... | [
"public",
"function",
"offsetUnset",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Entity array access only supports non-numeric keys'",
")",
";",
"}",
"$",
"key",
"=",
"$... | Removes the value from the specified key on this entity.
Routine:
- The data key is removed from the {@see self::$keys entity's key pool}.
- NULL is {@see self::offsetSet() assigned} to the entity.
@see \ArrayAccess
@uses self::offsetSet()
@param string $key The data key to remove.
@throws InvalidArgumentExcept... | [
"Removes",
"the",
"value",
"from",
"the",
"specified",
"key",
"on",
"this",
"entity",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L259-L276 | train |
locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.camelize | final protected function camelize($str)
{
if (strstr($str, '_') === false) {
return $str;
}
return lcfirst(implode('', array_map('ucfirst', explode('_', $str))));
} | php | final protected function camelize($str)
{
if (strstr($str, '_') === false) {
return $str;
}
return lcfirst(implode('', array_map('ucfirst', explode('_', $str))));
} | [
"final",
"protected",
"function",
"camelize",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"strstr",
"(",
"$",
"str",
",",
"'_'",
")",
"===",
"false",
")",
"{",
"return",
"$",
"str",
";",
"}",
"return",
"lcfirst",
"(",
"implode",
"(",
"''",
",",
"array_ma... | Transform a string from "snake_case" to "camelCase".
@param string $str The string to camelize.
@return string The camelized string. | [
"Transform",
"a",
"string",
"from",
"snake_case",
"to",
"camelCase",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L319-L325 | train |
midnightLuke/group-security-bundle | Security/GroupRoleVoter.php | GroupRoleVoter.extractRoles | public function extractRoles(GroupMembershipInterface $membership)
{
$roles = [];
foreach ($membership->getRoles() as $role) {
$roles[] = new Role($role);
}
return $roles;
} | php | public function extractRoles(GroupMembershipInterface $membership)
{
$roles = [];
foreach ($membership->getRoles() as $role) {
$roles[] = new Role($role);
}
return $roles;
} | [
"public",
"function",
"extractRoles",
"(",
"GroupMembershipInterface",
"$",
"membership",
")",
"{",
"$",
"roles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"membership",
"->",
"getRoles",
"(",
")",
"as",
"$",
"role",
")",
"{",
"$",
"roles",
"[",
"]",
"=... | Returns the roles for this membership. | [
"Returns",
"the",
"roles",
"for",
"this",
"membership",
"."
] | b7e497939dc3fd9bc205b4595d29e2aa8f6e62c0 | https://github.com/midnightLuke/group-security-bundle/blob/b7e497939dc3fd9bc205b4595d29e2aa8f6e62c0/Security/GroupRoleVoter.php#L68-L75 | train |
Torann/skosh-generator | src/Content/Post.php | Post.getExcerpt | protected function getExcerpt($content)
{
// Check for excerpt tags
$pattern = '#(\<\!\-\-\s?excerpt\s?\-\-\>)(.*)(\<\!\-\-\s?endexcerpt\s?\-\-\>)#si';
if (preg_match($pattern, $content, $matches)) {
return $matches[2];
}
// If all else get the content from the f... | php | protected function getExcerpt($content)
{
// Check for excerpt tags
$pattern = '#(\<\!\-\-\s?excerpt\s?\-\-\>)(.*)(\<\!\-\-\s?endexcerpt\s?\-\-\>)#si';
if (preg_match($pattern, $content, $matches)) {
return $matches[2];
}
// If all else get the content from the f... | [
"protected",
"function",
"getExcerpt",
"(",
"$",
"content",
")",
"{",
"// Check for excerpt tags",
"$",
"pattern",
"=",
"'#(\\<\\!\\-\\-\\s?excerpt\\s?\\-\\-\\>)(.*)(\\<\\!\\-\\-\\s?endexcerpt\\s?\\-\\-\\>)#si'",
";",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
... | Get excerpt from between excerpt tags or
first paragraph.
@param string $content
@return string | [
"Get",
"excerpt",
"from",
"between",
"excerpt",
"tags",
"or",
"first",
"paragraph",
"."
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Content/Post.php#L74-L84 | train |
Torann/skosh-generator | src/Content/Post.php | Post.getTagClassNames | protected function getTagClassNames()
{
$tags = array_map(function($tag) {
return slugify($tag);
}, explode('|', $this->get('tags')));
return implode(' ', $tags);
} | php | protected function getTagClassNames()
{
$tags = array_map(function($tag) {
return slugify($tag);
}, explode('|', $this->get('tags')));
return implode(' ', $tags);
} | [
"protected",
"function",
"getTagClassNames",
"(",
")",
"{",
"$",
"tags",
"=",
"array_map",
"(",
"function",
"(",
"$",
"tag",
")",
"{",
"return",
"slugify",
"(",
"$",
"tag",
")",
";",
"}",
",",
"explode",
"(",
"'|'",
",",
"$",
"this",
"->",
"get",
"... | Get human readable tags.
@return string | [
"Get",
"human",
"readable",
"tags",
"."
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Content/Post.php#L113-L120 | train |
vdhicts/dicms-html-element | src/Element.php | Element.getAttribute | public function getAttribute(string $attribute): array
{
// Determine if the attribute is present
if (! array_key_exists($attribute, $this->attributes)) {
return [];
}
// Return the value of the attribute
return $this->attributes[$attribute];
} | php | public function getAttribute(string $attribute): array
{
// Determine if the attribute is present
if (! array_key_exists($attribute, $this->attributes)) {
return [];
}
// Return the value of the attribute
return $this->attributes[$attribute];
} | [
"public",
"function",
"getAttribute",
"(",
"string",
"$",
"attribute",
")",
":",
"array",
"{",
"// Determine if the attribute is present",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"attribute",
",",
"$",
"this",
"->",
"attributes",
")",
")",
"{",
"return",
... | Returns the value of the attribute. If the value isn't set, it returns the fallback;
@param string $attribute
@return array | [
"Returns",
"the",
"value",
"of",
"the",
"attribute",
".",
"If",
"the",
"value",
"isn",
"t",
"set",
"it",
"returns",
"the",
"fallback",
";"
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L86-L95 | train |
vdhicts/dicms-html-element | src/Element.php | Element.setAttributes | public function setAttributes(array $attributesValues): self
{
foreach ($attributesValues as $attribute => $value) {
$this->setAttribute($attribute, $value);
}
return $this;
} | php | public function setAttributes(array $attributesValues): self
{
foreach ($attributesValues as $attribute => $value) {
$this->setAttribute($attribute, $value);
}
return $this;
} | [
"public",
"function",
"setAttributes",
"(",
"array",
"$",
"attributesValues",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"attributesValues",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setAttribute",
"(",
"$",
"attribute",
",... | Set the value of multiple attributes at once.
@param array $attributesValues
@return $this | [
"Set",
"the",
"value",
"of",
"multiple",
"attributes",
"at",
"once",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L102-L109 | train |
vdhicts/dicms-html-element | src/Element.php | Element.setAttribute | public function setAttribute(string $attribute, $value = []): self
{
$this->attributes[$attribute] = $this->wrap($value);
return $this;
} | php | public function setAttribute(string $attribute, $value = []): self
{
$this->attributes[$attribute] = $this->wrap($value);
return $this;
} | [
"public",
"function",
"setAttribute",
"(",
"string",
"$",
"attribute",
",",
"$",
"value",
"=",
"[",
"]",
")",
":",
"self",
"{",
"$",
"this",
"->",
"attributes",
"[",
"$",
"attribute",
"]",
"=",
"$",
"this",
"->",
"wrap",
"(",
"$",
"value",
")",
";"... | Sets the value of an attribute. If the attribute is already set, it overwrites the current value.
@param string $attribute
@param array|string $value
@return $this | [
"Sets",
"the",
"value",
"of",
"an",
"attribute",
".",
"If",
"the",
"attribute",
"is",
"already",
"set",
"it",
"overwrites",
"the",
"current",
"value",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L117-L122 | train |
vdhicts/dicms-html-element | src/Element.php | Element.addAttributeValue | public function addAttributeValue(string $attribute, string $value = ''): self
{
// Retrieve the current values of the attribute
$values = $this->getAttribute($attribute);
// Merge the values
if (! in_array($value, $values)) {
$values[] = $value;
}
// St... | php | public function addAttributeValue(string $attribute, string $value = ''): self
{
// Retrieve the current values of the attribute
$values = $this->getAttribute($attribute);
// Merge the values
if (! in_array($value, $values)) {
$values[] = $value;
}
// St... | [
"public",
"function",
"addAttributeValue",
"(",
"string",
"$",
"attribute",
",",
"string",
"$",
"value",
"=",
"''",
")",
":",
"self",
"{",
"// Retrieve the current values of the attribute",
"$",
"values",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"$",
"attrib... | Adds a value to the attribute.
@param string $attribute
@param string $value
@return $this | [
"Adds",
"a",
"value",
"to",
"the",
"attribute",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L130-L144 | train |
vdhicts/dicms-html-element | src/Element.php | Element.removeAttributeValue | public function removeAttributeValue(string $attribute, string $value): self
{
// Only remove value if attribute is present
if (! array_key_exists($attribute, $this->attributes)) {
return $this;
}
// Remove the value from the attribute
$values = array_filter(
... | php | public function removeAttributeValue(string $attribute, string $value): self
{
// Only remove value if attribute is present
if (! array_key_exists($attribute, $this->attributes)) {
return $this;
}
// Remove the value from the attribute
$values = array_filter(
... | [
"public",
"function",
"removeAttributeValue",
"(",
"string",
"$",
"attribute",
",",
"string",
"$",
"value",
")",
":",
"self",
"{",
"// Only remove value if attribute is present",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"attribute",
",",
"$",
"this",
"->",
... | Removes a value from the attribute.
@param string $attribute
@param string $value
@return $this | [
"Removes",
"a",
"value",
"from",
"the",
"attribute",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L178-L197 | train |
vdhicts/dicms-html-element | src/Element.php | Element.generateAttribute | private function generateAttribute(string $attribute, array $values = []): string
{
if (! is_numeric($attribute)) {
return sprintf(
'%s="%s"',
$attribute,
htmlentities(trim(implode(' ', $values)))
);
}
return implode(' ... | php | private function generateAttribute(string $attribute, array $values = []): string
{
if (! is_numeric($attribute)) {
return sprintf(
'%s="%s"',
$attribute,
htmlentities(trim(implode(' ', $values)))
);
}
return implode(' ... | [
"private",
"function",
"generateAttribute",
"(",
"string",
"$",
"attribute",
",",
"array",
"$",
"values",
"=",
"[",
"]",
")",
":",
"string",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"attribute",
")",
")",
"{",
"return",
"sprintf",
"(",
"'%s=\"%s\"'",... | Generates the HTML for the attribute.
@param string $attribute
@param array $values
@return string | [
"Generates",
"the",
"HTML",
"for",
"the",
"attribute",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L264-L275 | train |
vdhicts/dicms-html-element | src/Element.php | Element.generateTagAttributes | private function generateTagAttributes(): string
{
// When no attributes present, return empty string
if (count($this->getAttributes()) === 0) {
return '';
}
// Collect the attributes
$renderedAttributes = [];
foreach ($this->getAttributes() as $attribute... | php | private function generateTagAttributes(): string
{
// When no attributes present, return empty string
if (count($this->getAttributes()) === 0) {
return '';
}
// Collect the attributes
$renderedAttributes = [];
foreach ($this->getAttributes() as $attribute... | [
"private",
"function",
"generateTagAttributes",
"(",
")",
":",
"string",
"{",
"// When no attributes present, return empty string",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"getAttributes",
"(",
")",
")",
"===",
"0",
")",
"{",
"return",
"''",
";",
"}",
"// ... | Generates the HTML for the attributes of the HTML element.
@return string | [
"Generates",
"the",
"HTML",
"for",
"the",
"attributes",
"of",
"the",
"HTML",
"element",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L281-L297 | train |
vdhicts/dicms-html-element | src/Element.php | Element.generate | public function generate(): string
{
// The tag name is required
if ($this->getTag() === '') {
return '';
}
// Generate the attribute string
$tagAttributes = $this->generateTagAttributes();
// When attributes are provided, add a space between the tag and... | php | public function generate(): string
{
// The tag name is required
if ($this->getTag() === '') {
return '';
}
// Generate the attribute string
$tagAttributes = $this->generateTagAttributes();
// When attributes are provided, add a space between the tag and... | [
"public",
"function",
"generate",
"(",
")",
":",
"string",
"{",
"// The tag name is required",
"if",
"(",
"$",
"this",
"->",
"getTag",
"(",
")",
"===",
"''",
")",
"{",
"return",
"''",
";",
"}",
"// Generate the attribute string",
"$",
"tagAttributes",
"=",
"... | Generates the HTML tag with it's attributes and text.
@return string | [
"Generates",
"the",
"HTML",
"tag",
"with",
"it",
"s",
"attributes",
"and",
"text",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L303-L335 | train |
Linkvalue-Interne/MajoraOAuthServerBundle | src/Majora/Bundle/OAuthServerBundle/Controller/TokenApiController.php | TokenApiController.postAction | public function postAction(Request $request)
{
try {
return $this->createJsonResponse($this->get('oauth.server')->grant(
$this->getRequestData($request, 'snakelize')
));
} catch (InvalidGrantException $e) {
return new JsonResponse('Unavailable to c... | php | public function postAction(Request $request)
{
try {
return $this->createJsonResponse($this->get('oauth.server')->grant(
$this->getRequestData($request, 'snakelize')
));
} catch (InvalidGrantException $e) {
return new JsonResponse('Unavailable to c... | [
"public",
"function",
"postAction",
"(",
"Request",
"$",
"request",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"createJsonResponse",
"(",
"$",
"this",
"->",
"get",
"(",
"'oauth.server'",
")",
"->",
"grant",
"(",
"$",
"this",
"->",
"getRequestData",... | Create a new access_token from given request throught oAuth server.
@param Request $request
@return Response | [
"Create",
"a",
"new",
"access_token",
"from",
"given",
"request",
"throught",
"oAuth",
"server",
"."
] | 3e84e2494c947d1bd5d5c16221a3b9e343ebff92 | https://github.com/Linkvalue-Interne/MajoraOAuthServerBundle/blob/3e84e2494c947d1bd5d5c16221a3b9e343ebff92/src/Majora/Bundle/OAuthServerBundle/Controller/TokenApiController.php#L25-L36 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/storagefacility/StorageFacilityFile.php | StorageFacilityFile.setID | public function setID($id)
{
if($id !== null && substr($id, 0, 1) !== '/')
throw new Exception("invalid file id, must start with a /");
$this->id = $id;
} | php | public function setID($id)
{
if($id !== null && substr($id, 0, 1) !== '/')
throw new Exception("invalid file id, must start with a /");
$this->id = $id;
} | [
"public",
"function",
"setID",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"id",
"!==",
"null",
"&&",
"substr",
"(",
"$",
"id",
",",
"0",
",",
"1",
")",
"!==",
"'/'",
")",
"throw",
"new",
"Exception",
"(",
"\"invalid file id, must start with a /\"",
")",... | Set the ID for this file
@param string $id The id to set
@return void | [
"Set",
"the",
"ID",
"for",
"this",
"file"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/storagefacility/StorageFacilityFile.php#L123-L128 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/storagefacility/StorageFacilityFile.php | StorageFacilityFile.isValid | public function isValid()
{
return $this->getID() != null && $this->getURL() != null && $this->getLocalPath() != null;
} | php | public function isValid()
{
return $this->getID() != null && $this->getURL() != null && $this->getLocalPath() != null;
} | [
"public",
"function",
"isValid",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getID",
"(",
")",
"!=",
"null",
"&&",
"$",
"this",
"->",
"getURL",
"(",
")",
"!=",
"null",
"&&",
"$",
"this",
"->",
"getLocalPath",
"(",
")",
"!=",
"null",
";",
"}"
] | Determines if this is a valid file object or not.
@return boolean | [
"Determines",
"if",
"this",
"is",
"a",
"valid",
"file",
"object",
"or",
"not",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/storagefacility/StorageFacilityFile.php#L189-L192 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Cookie/CookieJar.php | CookieJar.getCookieValue | public static function getCookieValue($value)
{
if (substr($value, 0, 1) !== '"' &&
substr($value, -1, 1) !== '"' &&
strpbrk($value, ';,')
) {
$value = '"' . $value . '"';
}
return $value;
} | php | public static function getCookieValue($value)
{
if (substr($value, 0, 1) !== '"' &&
substr($value, -1, 1) !== '"' &&
strpbrk($value, ';,')
) {
$value = '"' . $value . '"';
}
return $value;
} | [
"public",
"static",
"function",
"getCookieValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"1",
")",
"!==",
"'\"'",
"&&",
"substr",
"(",
"$",
"value",
",",
"-",
"1",
",",
"1",
")",
"!==",
"'\"'",
"&&",
... | Quote the cookie value if it is not already quoted and it contains
problematic characters.
@param string $value Value that may or may not need to be quoted
@return string | [
"Quote",
"the",
"cookie",
"value",
"if",
"it",
"is",
"not",
"already",
"quoted",
"and",
"it",
"contains",
"problematic",
"characters",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Cookie/CookieJar.php#L69-L79 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.getFirstChild | public function getFirstChild()
{
if($this->isLeaf())
{
return null;
}
if($this->children !== null)
{
$ary = array_slice($this->children, 0, 1);
return $ary[0];
}
$qb = $this->getManager()->getConfiguration()->getBaseQuery... | php | public function getFirstChild()
{
if($this->isLeaf())
{
return null;
}
if($this->children !== null)
{
$ary = array_slice($this->children, 0, 1);
return $ary[0];
}
$qb = $this->getManager()->getConfiguration()->getBaseQuery... | [
"public",
"function",
"getFirstChild",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isLeaf",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"children",
"!==",
"null",
")",
"{",
"$",
"ary",
"=",
"array_slice",
"(",
... | gets first child or null
@return NodeWrapper | [
"gets",
"first",
"child",
"or",
"null"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L85-L116 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.getDescendants | public function getDescendants($depth = null)
{
if(!$this->hasChildren())
{
return array();
}
if($this->descendants === null)
{
$qb = $this->getManager()->getConfiguration()->getBaseQueryBuilder();
$alias = $this->getManager()->getConfigur... | php | public function getDescendants($depth = null)
{
if(!$this->hasChildren())
{
return array();
}
if($this->descendants === null)
{
$qb = $this->getManager()->getConfiguration()->getBaseQueryBuilder();
$alias = $this->getManager()->getConfigur... | [
"public",
"function",
"getDescendants",
"(",
"$",
"depth",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasChildren",
"(",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"descendants",
"===",
"null... | gets descendants for this node
@param int $depth or null for unlimited depth
@return array array of NodeWrapper objects | [
"gets",
"descendants",
"for",
"this",
"node"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L181-L225 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.getParent | public function getParent()
{
if($this->isRoot())
{
return null;
}
if($this->parent == null && $this->ancestors)
{
// Shortcut if we already loaded the ancestors
$this->parent = $this->ancestors[count($this->ancestors)-1];
}
... | php | public function getParent()
{
if($this->isRoot())
{
return null;
}
if($this->parent == null && $this->ancestors)
{
// Shortcut if we already loaded the ancestors
$this->parent = $this->ancestors[count($this->ancestors)-1];
}
... | [
"public",
"function",
"getParent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRoot",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"parent",
"==",
"null",
"&&",
"$",
"this",
"->",
"ancestors",
")",
"{",
"// Sh... | gets parent Node or null
@return NodeWrapper | [
"gets",
"parent",
"Node",
"or",
"null"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L233-L273 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.getAncestors | public function getAncestors()
{
if($this->isRoot())
{
return array();
}
if($this->ancestors === null)
{
$qb = $this->getManager()->getConfiguration()->getBaseQueryBuilder();
$alias = $this->getManager()->getConfiguration()->getQueryBuilde... | php | public function getAncestors()
{
if($this->isRoot())
{
return array();
}
if($this->ancestors === null)
{
$qb = $this->getManager()->getConfiguration()->getBaseQueryBuilder();
$alias = $this->getManager()->getConfiguration()->getQueryBuilde... | [
"public",
"function",
"getAncestors",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRoot",
"(",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"ancestors",
"===",
"null",
")",
"{",
"$",
"qb",
"=",
"$",
"th... | gets ancestors for node
@return array array of NodeWrapper objects | [
"gets",
"ancestors",
"for",
"node"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L281-L318 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.getLevel | public function getLevel()
{
if($this->level === null)
{
$this->level = count($this->getAncestors());
}
return $this->level;
} | php | public function getLevel()
{
if($this->level === null)
{
$this->level = count($this->getAncestors());
}
return $this->level;
} | [
"public",
"function",
"getLevel",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"level",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"level",
"=",
"count",
"(",
"$",
"this",
"->",
"getAncestors",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->... | gets the level of this node
@return int | [
"gets",
"the",
"level",
"of",
"this",
"node"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L326-L334 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.getSiblings | public function getSiblings($includeNode=false)
{
$parent = $this->getParent();
$siblings = array();
if($parent && $parent->isValidNode())
{
$children = $parent->getChildren();
foreach($children as $child)
{
if(!$includeNode && $thi... | php | public function getSiblings($includeNode=false)
{
$parent = $this->getParent();
$siblings = array();
if($parent && $parent->isValidNode())
{
$children = $parent->getChildren();
foreach($children as $child)
{
if(!$includeNode && $thi... | [
"public",
"function",
"getSiblings",
"(",
"$",
"includeNode",
"=",
"false",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
")",
";",
"$",
"siblings",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"parent",
"&&",
"$",
"parent",
"-... | gets siblings for node
@param bool $includeNode whether to include this node in the list of
sibling nodes (default: false)
@return array array of NodeWrapper objects | [
"gets",
"siblings",
"for",
"node"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L479-L497 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.getPrevSibling | public function getPrevSibling()
{
// If parent and children are already loaded, avoid database query
if($this->parent !== null && ($children = $this->parent->internalGetChildren()) !== null)
{
for($i=0; $i<count($children); $i++)
{
if($children[$i] ==... | php | public function getPrevSibling()
{
// If parent and children are already loaded, avoid database query
if($this->parent !== null && ($children = $this->parent->internalGetChildren()) !== null)
{
for($i=0; $i<count($children); $i++)
{
if($children[$i] ==... | [
"public",
"function",
"getPrevSibling",
"(",
")",
"{",
"// If parent and children are already loaded, avoid database query",
"if",
"(",
"$",
"this",
"->",
"parent",
"!==",
"null",
"&&",
"(",
"$",
"children",
"=",
"$",
"this",
"->",
"parent",
"->",
"internalGetChildr... | gets prev sibling or null
@return Node | [
"gets",
"prev",
"sibling",
"or",
"null"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L505-L545 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.insertAsParentOf | public function insertAsParentOf(NodeWrapper $node)
{
if($node == $this)
{
throw new \InvalidArgumentException('Cannot insert node as a parent of itself');
}
if($this->isValidNode())
{
throw new \InvalidArgumentException('Cannot insert a node that alr... | php | public function insertAsParentOf(NodeWrapper $node)
{
if($node == $this)
{
throw new \InvalidArgumentException('Cannot insert node as a parent of itself');
}
if($this->isValidNode())
{
throw new \InvalidArgumentException('Cannot insert a node that alr... | [
"public",
"function",
"insertAsParentOf",
"(",
"NodeWrapper",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"==",
"$",
"this",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Cannot insert node as a parent of itself'",
")",
";",
"}",
"if",
... | inserts node as parent of given node
@param NodeWrapper $node | [
"inserts",
"node",
"as",
"parent",
"of",
"given",
"node"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L634-L697 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.insertAsPrevSiblingOf | public function insertAsPrevSiblingOf(NodeWrapper $node)
{
if($node == $this)
{
throw new \InvalidArgumentException('Cannot insert node as a sibling of itself');
}
$em = $this->getManager()->getEntityManager();
$newLeft = $node->getLeftValue();
$newRight ... | php | public function insertAsPrevSiblingOf(NodeWrapper $node)
{
if($node == $this)
{
throw new \InvalidArgumentException('Cannot insert node as a sibling of itself');
}
$em = $this->getManager()->getEntityManager();
$newLeft = $node->getLeftValue();
$newRight ... | [
"public",
"function",
"insertAsPrevSiblingOf",
"(",
"NodeWrapper",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"==",
"$",
"this",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Cannot insert node as a sibling of itself'",
")",
";",
"}",
"$... | inserts node as previous sibling of given node
@param NodeWrapper $node | [
"inserts",
"node",
"as",
"previous",
"sibling",
"of",
"given",
"node"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L705-L736 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.moveAsLastChildOf | public function moveAsLastChildOf(NodeWrapper $node)
{
if($node == $this)
{
throw new \InvalidArgumentException('Cannot move node as a child of itself');
}
$em = $this->getManager()->getEntityManager();
// beginTransaction
$em->getConnection()->beginTran... | php | public function moveAsLastChildOf(NodeWrapper $node)
{
if($node == $this)
{
throw new \InvalidArgumentException('Cannot move node as a child of itself');
}
$em = $this->getManager()->getEntityManager();
// beginTransaction
$em->getConnection()->beginTran... | [
"public",
"function",
"moveAsLastChildOf",
"(",
"NodeWrapper",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"==",
"$",
"this",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Cannot move node as a child of itself'",
")",
";",
"}",
"$",
"em... | moves node as last child of the given node
@param NodeWrapper $node | [
"moves",
"node",
"as",
"last",
"child",
"of",
"the",
"given",
"node"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L987-L1021 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.makeRoot | public function makeRoot($newRoot)
{
if($this->isRoot())
{
return;
}
if(!$this->hasManyRoots())
{
throw new \BadMethodCallException(sprintf('%s::%s is only supported on multiple root trees', __CLASS__, __METHOD__));
}
$em = $this->get... | php | public function makeRoot($newRoot)
{
if($this->isRoot())
{
return;
}
if(!$this->hasManyRoots())
{
throw new \BadMethodCallException(sprintf('%s::%s is only supported on multiple root trees', __CLASS__, __METHOD__));
}
$em = $this->get... | [
"public",
"function",
"makeRoot",
"(",
"$",
"newRoot",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRoot",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"hasManyRoots",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMeth... | Makes this node a root node.
@param mixed $newRoot | [
"Makes",
"this",
"node",
"a",
"root",
"node",
"."
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L1029-L1096 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.addChild | public function addChild(Node $node)
{
if($node instanceof NodeWrapper)
{
if($node == $this)
{
throw new \InvalidArgumentException('Cannot insert node as a child of itself');
}
$node->insertAsLastChildOf($this);
return $nod... | php | public function addChild(Node $node)
{
if($node instanceof NodeWrapper)
{
if($node == $this)
{
throw new \InvalidArgumentException('Cannot insert node as a child of itself');
}
$node->insertAsLastChildOf($this);
return $nod... | [
"public",
"function",
"addChild",
"(",
"Node",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"NodeWrapper",
")",
"{",
"if",
"(",
"$",
"node",
"==",
"$",
"this",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Cannot inse... | adds given node as the last child of this entity
@param Node $node
@return NodeWrapper $wrapper | [
"adds",
"given",
"node",
"as",
"the",
"last",
"child",
"of",
"this",
"entity"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L1106-L1150 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.delete | public function delete()
{
$em = $this->getManager()->getEntityManager();
$lftField = $this->getLeftFieldName();
$rgtField = $this->getRightFieldName();
$oldLft = $this->getLeftValue();
$oldRgt = $this->getRightValue();
$oldRoot = $this->hasManyRoots() ? $this->getRo... | php | public function delete()
{
$em = $this->getManager()->getEntityManager();
$lftField = $this->getLeftFieldName();
$rgtField = $this->getRightFieldName();
$oldLft = $this->getLeftValue();
$oldRgt = $this->getRightValue();
$oldRoot = $this->hasManyRoots() ? $this->getRo... | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getManager",
"(",
")",
"->",
"getEntityManager",
"(",
")",
";",
"$",
"lftField",
"=",
"$",
"this",
"->",
"getLeftFieldName",
"(",
")",
";",
"$",
"rgtField",
"=",
"$",
... | deletes this node and it's decendants | [
"deletes",
"this",
"node",
"and",
"it",
"s",
"decendants"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L1157-L1202 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.insertNode | protected function insertNode($destLeft, $destRight, $destRoot=null)
{
$this->setLeftValue($destLeft);
$this->setRightValue($destRight);
if($this->hasManyRoots())
{
$this->setRootValue($destRoot);
}
$this->getManager()->getEntityManager()->persist($this->g... | php | protected function insertNode($destLeft, $destRight, $destRoot=null)
{
$this->setLeftValue($destLeft);
$this->setRightValue($destRight);
if($this->hasManyRoots())
{
$this->setRootValue($destRoot);
}
$this->getManager()->getEntityManager()->persist($this->g... | [
"protected",
"function",
"insertNode",
"(",
"$",
"destLeft",
",",
"$",
"destRight",
",",
"$",
"destRoot",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setLeftValue",
"(",
"$",
"destLeft",
")",
";",
"$",
"this",
"->",
"setRightValue",
"(",
"$",
"destRight",... | sets node's left and right values and persist's it
NOTE: This method does not wrap its database queries in a transaction.
This should be done before invoking this code.
@param int $destLeft
@param int $destRight
@param mixed $destRoot | [
"sets",
"node",
"s",
"left",
"and",
"right",
"values",
"and",
"persist",
"s",
"it"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L1216-L1225 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.isDescendantOf | public function isDescendantOf(Node $node)
{
return (($this->getLeftValue() > $node->getLeftValue()) &&
($this->getRightValue() < $node->getRightValue()) &&
(!$this->hasManyRoots() || ($this->getRootValue() == $node->getRootValue())));
} | php | public function isDescendantOf(Node $node)
{
return (($this->getLeftValue() > $node->getLeftValue()) &&
($this->getRightValue() < $node->getRightValue()) &&
(!$this->hasManyRoots() || ($this->getRootValue() == $node->getRootValue())));
} | [
"public",
"function",
"isDescendantOf",
"(",
"Node",
"$",
"node",
")",
"{",
"return",
"(",
"(",
"$",
"this",
"->",
"getLeftValue",
"(",
")",
">",
"$",
"node",
"->",
"getLeftValue",
"(",
")",
")",
"&&",
"(",
"$",
"this",
"->",
"getRightValue",
"(",
")... | determines if this node is a child of the given node
@param Node
@return bool | [
"determines",
"if",
"this",
"node",
"is",
"a",
"child",
"of",
"the",
"given",
"node"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L1478-L1483 | train |
devlabmtl/haven-core | Lib/NestedSet/NodeWrapper.php | NodeWrapper.isEqualTo | public function isEqualTo(Node $node)
{
return (($this->getLeftValue() == $node->getLeftValue()) &&
($this->getRightValue() == $node->getRightValue()) &&
(!$this->hasManyRoots() || ($this->getRootValue() == $node->getRootValue())));
} | php | public function isEqualTo(Node $node)
{
return (($this->getLeftValue() == $node->getLeftValue()) &&
($this->getRightValue() == $node->getRightValue()) &&
(!$this->hasManyRoots() || ($this->getRootValue() == $node->getRootValue())));
} | [
"public",
"function",
"isEqualTo",
"(",
"Node",
"$",
"node",
")",
"{",
"return",
"(",
"(",
"$",
"this",
"->",
"getLeftValue",
"(",
")",
"==",
"$",
"node",
"->",
"getLeftValue",
"(",
")",
")",
"&&",
"(",
"$",
"this",
"->",
"getRightValue",
"(",
")",
... | determines if this node is equal to the given node
@param Node
@return bool | [
"determines",
"if",
"this",
"node",
"is",
"equal",
"to",
"the",
"given",
"node"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/NodeWrapper.php#L1525-L1530 | train |
fuelphp-storage/session | src/Manager.php | Manager.write | public function write()
{
// do we need to rotate?
if ($this->rotationInterval and $this->rotationTimer < time())
{
$this->rotate();
}
return $this->driver->write();
} | php | public function write()
{
// do we need to rotate?
if ($this->rotationInterval and $this->rotationTimer < time())
{
$this->rotate();
}
return $this->driver->write();
} | [
"public",
"function",
"write",
"(",
")",
"{",
"// do we need to rotate?",
"if",
"(",
"$",
"this",
"->",
"rotationInterval",
"and",
"$",
"this",
"->",
"rotationTimer",
"<",
"time",
"(",
")",
")",
"{",
"$",
"this",
"->",
"rotate",
"(",
")",
";",
"}",
"re... | Writes the container data to the session store
@return boolean | [
"Writes",
"the",
"container",
"data",
"to",
"the",
"session",
"store"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Manager.php#L194-L203 | train |
fuelphp-storage/session | src/Manager.php | Manager.stop | public function stop()
{
// do we need to rotate?
if ($this->rotationInterval and $this->rotationTimer < time())
{
$this->rotate();
}
// stop the current session
return $this->driver->stop();
} | php | public function stop()
{
// do we need to rotate?
if ($this->rotationInterval and $this->rotationTimer < time())
{
$this->rotate();
}
// stop the current session
return $this->driver->stop();
} | [
"public",
"function",
"stop",
"(",
")",
"{",
"// do we need to rotate?",
"if",
"(",
"$",
"this",
"->",
"rotationInterval",
"and",
"$",
"this",
"->",
"rotationTimer",
"<",
"time",
"(",
")",
")",
"{",
"$",
"this",
"->",
"rotate",
"(",
")",
";",
"}",
"// ... | Stops a session
@return boolean | [
"Stops",
"a",
"session"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Manager.php#L210-L220 | train |
fuelphp-storage/session | src/Manager.php | Manager.rotate | public function rotate()
{
// update the session id rotation timer
if ($this->rotationInterval)
{
$this->rotationTimer = time() + $this->rotationInterval;
}
// regenerate the session id
$this->driver->regenerate($this);
} | php | public function rotate()
{
// update the session id rotation timer
if ($this->rotationInterval)
{
$this->rotationTimer = time() + $this->rotationInterval;
}
// regenerate the session id
$this->driver->regenerate($this);
} | [
"public",
"function",
"rotate",
"(",
")",
"{",
"// update the session id rotation timer",
"if",
"(",
"$",
"this",
"->",
"rotationInterval",
")",
"{",
"$",
"this",
"->",
"rotationTimer",
"=",
"time",
"(",
")",
"+",
"$",
"this",
"->",
"rotationInterval",
";",
... | Rotates the session id, and reset the rotation timer if needed | [
"Rotates",
"the",
"session",
"id",
"and",
"reset",
"the",
"rotation",
"timer",
"if",
"needed"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Manager.php#L225-L235 | train |
fuelphp-storage/session | src/Manager.php | Manager.setNamespace | public function setNamespace($name)
{
$this->config['namespace'] = is_bool($name) ? $name : (string) $name;
if ($this->config['namespace'] === true)
{
$this->config['namespace'] = $this->app ? $app->getName() : false;
}
$this->data->setNamespace($this->config['namespace']);
} | php | public function setNamespace($name)
{
$this->config['namespace'] = is_bool($name) ? $name : (string) $name;
if ($this->config['namespace'] === true)
{
$this->config['namespace'] = $this->app ? $app->getName() : false;
}
$this->data->setNamespace($this->config['namespace']);
} | [
"public",
"function",
"setNamespace",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'namespace'",
"]",
"=",
"is_bool",
"(",
"$",
"name",
")",
"?",
"$",
"name",
":",
"(",
"string",
")",
"$",
"name",
";",
"if",
"(",
"$",
"this",
"-... | Sets the session namespace
@param string $name | [
"Sets",
"the",
"session",
"namespace"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Manager.php#L282-L292 | train |
fuelphp-storage/session | src/Manager.php | Manager.setFlashNamespace | public function setFlashNamespace($name)
{
$this->config['flash_namespace'] = (string) $name;
$this->flash->setNamespace($this->config['flash_namespace']);
} | php | public function setFlashNamespace($name)
{
$this->config['flash_namespace'] = (string) $name;
$this->flash->setNamespace($this->config['flash_namespace']);
} | [
"public",
"function",
"setFlashNamespace",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'flash_namespace'",
"]",
"=",
"(",
"string",
")",
"$",
"name",
";",
"$",
"this",
"->",
"flash",
"->",
"setNamespace",
"(",
"$",
"this",
"->",
"con... | Sets the session flash namespace
@param string $name | [
"Sets",
"the",
"session",
"flash",
"namespace"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Manager.php#L309-L314 | train |
fuelphp-storage/session | src/Manager.php | Manager.reset | protected function reset()
{
// create the data container
$this->data = new DataContainer();
// create the flash container
$this->flash = new FlashContainer();
// initialise the flash expiry store
$this->flash->set(FlashContainer::EXPIRE_DATA_KEY, array());
} | php | protected function reset()
{
// create the data container
$this->data = new DataContainer();
// create the flash container
$this->flash = new FlashContainer();
// initialise the flash expiry store
$this->flash->set(FlashContainer::EXPIRE_DATA_KEY, array());
} | [
"protected",
"function",
"reset",
"(",
")",
"{",
"// create the data container",
"$",
"this",
"->",
"data",
"=",
"new",
"DataContainer",
"(",
")",
";",
"// create the flash container",
"$",
"this",
"->",
"flash",
"=",
"new",
"FlashContainer",
"(",
")",
";",
"/... | Resets the data and flash data containers | [
"Resets",
"the",
"data",
"and",
"flash",
"data",
"containers"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Manager.php#L319-L330 | train |
sil-project/Contact | Model/Contact.php | Contact.addAddress | public function addAddress(AddressInterface $address)
{
if ($this->addresses->contains($address)) {
throw new \InvalidArgumentException('This contact already owns this address');
}
$this->addresses->add($address);
if (!$this->defaultAddress) {
$this->setDefa... | php | public function addAddress(AddressInterface $address)
{
if ($this->addresses->contains($address)) {
throw new \InvalidArgumentException('This contact already owns this address');
}
$this->addresses->add($address);
if (!$this->defaultAddress) {
$this->setDefa... | [
"public",
"function",
"addAddress",
"(",
"AddressInterface",
"$",
"address",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"addresses",
"->",
"contains",
"(",
"$",
"address",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'This contact alread... | Add an Address to the collection.
@param AddressInterface $address | [
"Add",
"an",
"Address",
"to",
"the",
"collection",
"."
] | ead863b5dc4ee7a6a2e3f0f181d1a0874b4969b9 | https://github.com/sil-project/Contact/blob/ead863b5dc4ee7a6a2e3f0f181d1a0874b4969b9/Model/Contact.php#L228-L239 | train |
sil-project/Contact | Model/Contact.php | Contact.removeAddress | public function removeAddress(AddressInterface $address)
{
if (!$this->hasAddress($address)) {
throw new \InvalidArgumentException('Trying to remove an address that does not belong to this contact');
}
$this->addresses->removeElement($address);
if ($address === $this->d... | php | public function removeAddress(AddressInterface $address)
{
if (!$this->hasAddress($address)) {
throw new \InvalidArgumentException('Trying to remove an address that does not belong to this contact');
}
$this->addresses->removeElement($address);
if ($address === $this->d... | [
"public",
"function",
"removeAddress",
"(",
"AddressInterface",
"$",
"address",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAddress",
"(",
"$",
"address",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Trying to remove an address th... | Remove an Address from the collection.
@param AddressInterface $address | [
"Remove",
"an",
"Address",
"from",
"the",
"collection",
"."
] | ead863b5dc4ee7a6a2e3f0f181d1a0874b4969b9 | https://github.com/sil-project/Contact/blob/ead863b5dc4ee7a6a2e3f0f181d1a0874b4969b9/Model/Contact.php#L246-L263 | train |
sil-project/Contact | Model/Contact.php | Contact.addPhone | public function addPhone(PhoneInterface $phone)
{
if ($this->phones->contains($phone)) {
throw new \InvalidArgumentException('This contact already owns this phone');
}
$this->phones->add($phone);
if (!$this->defaultPhone) {
$this->setDefaultPhone($phone);
... | php | public function addPhone(PhoneInterface $phone)
{
if ($this->phones->contains($phone)) {
throw new \InvalidArgumentException('This contact already owns this phone');
}
$this->phones->add($phone);
if (!$this->defaultPhone) {
$this->setDefaultPhone($phone);
... | [
"public",
"function",
"addPhone",
"(",
"PhoneInterface",
"$",
"phone",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"phones",
"->",
"contains",
"(",
"$",
"phone",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'This contact already owns this... | Add a Phone to the collection.
@param PhoneInterface $phone | [
"Add",
"a",
"Phone",
"to",
"the",
"collection",
"."
] | ead863b5dc4ee7a6a2e3f0f181d1a0874b4969b9 | https://github.com/sil-project/Contact/blob/ead863b5dc4ee7a6a2e3f0f181d1a0874b4969b9/Model/Contact.php#L312-L323 | train |
sil-project/Contact | Model/Contact.php | Contact.removePhone | public function removePhone(PhoneInterface $phone)
{
if (!$this->hasPhone($phone)) {
throw new \InvalidArgumentException('Trying to remove a phone that does not belong to this contact');
}
$this->phones->removeElement($phone);
if ($phone === $this->defaultPhone) {
... | php | public function removePhone(PhoneInterface $phone)
{
if (!$this->hasPhone($phone)) {
throw new \InvalidArgumentException('Trying to remove a phone that does not belong to this contact');
}
$this->phones->removeElement($phone);
if ($phone === $this->defaultPhone) {
... | [
"public",
"function",
"removePhone",
"(",
"PhoneInterface",
"$",
"phone",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasPhone",
"(",
"$",
"phone",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Trying to remove a phone that does not b... | Remove a Phone from the collection.
@param PhoneInterface $phone | [
"Remove",
"a",
"Phone",
"from",
"the",
"collection",
"."
] | ead863b5dc4ee7a6a2e3f0f181d1a0874b4969b9 | https://github.com/sil-project/Contact/blob/ead863b5dc4ee7a6a2e3f0f181d1a0874b4969b9/Model/Contact.php#L330-L347 | train |
melisplatform/melis-calendar | src/Controller/ToolCalendarController.php | ToolCalendarController.retrieveDashboardCalendarEventsAction | public function retrieveDashboardCalendarEventsAction(){
$calendarTable = $this->getServiceLocator()->get('MelisCalendarTable');
$result = $calendarTable->retrieveDashboardCalendarEvents();
return new JsonModel($result->toArray());
} | php | public function retrieveDashboardCalendarEventsAction(){
$calendarTable = $this->getServiceLocator()->get('MelisCalendarTable');
$result = $calendarTable->retrieveDashboardCalendarEvents();
return new JsonModel($result->toArray());
} | [
"public",
"function",
"retrieveDashboardCalendarEventsAction",
"(",
")",
"{",
"$",
"calendarTable",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'MelisCalendarTable'",
")",
";",
"$",
"result",
"=",
"$",
"calendarTable",
"->",
"retrie... | Retrive Calendar Event to initialize calender uifor Dashboard Calendar
@return \Zend\View\Model\JsonModel | [
"Retrive",
"Calendar",
"Event",
"to",
"initialize",
"calender",
"uifor",
"Dashboard",
"Calendar"
] | 1e6df34adc14f03dfdcc6e4ac05d4fa08cb7d223 | https://github.com/melisplatform/melis-calendar/blob/1e6df34adc14f03dfdcc6e4ac05d4fa08cb7d223/src/Controller/ToolCalendarController.php#L25-L29 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.