id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
24,600 | Kris-Kuiper/sFire-Framework | src/Permissions/ACL.php | ACL.getResources | public function getResources($match = null) {
if(null !== $match && false === is_string($match)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($match)), E_USER_ERROR);
}
$permissions = [];
$match = null === $match ? '.*?' : ... | php | public function getResources($match = null) {
if(null !== $match && false === is_string($match)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($match)), E_USER_ERROR);
}
$permissions = [];
$match = null === $match ? '.*?' : ... | [
"public",
"function",
"getResources",
"(",
"$",
"match",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"match",
"&&",
"false",
"===",
"is_string",
"(",
"$",
"match",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 pass... | Returns all the resourses in array
@param string|null $match
@return array | [
"Returns",
"all",
"the",
"resourses",
"in",
"array"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L168-L188 |
24,601 | Kris-Kuiper/sFire-Framework | src/Permissions/ACL.php | ACL.fill | private function fill($roles, $resources, $allow) {
if(true === is_string($roles)) {
$roles = [$roles];
}
if(true === is_string($resources)) {
$resources = [$resources];
}
if(false === is_array($roles)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string... | php | private function fill($roles, $resources, $allow) {
if(true === is_string($roles)) {
$roles = [$roles];
}
if(true === is_string($resources)) {
$resources = [$resources];
}
if(false === is_array($roles)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string... | [
"private",
"function",
"fill",
"(",
"$",
"roles",
",",
"$",
"resources",
",",
"$",
"allow",
")",
"{",
"if",
"(",
"true",
"===",
"is_string",
"(",
"$",
"roles",
")",
")",
"{",
"$",
"roles",
"=",
"[",
"$",
"roles",
"]",
";",
"}",
"if",
"(",
"true... | Add a new permission entry
@param string|array $roles
@param string|array $resources
@param boolean $allow
@return sFire\Permissions\ACL | [
"Add",
"a",
"new",
"permission",
"entry"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L198-L241 |
24,602 | Wedeto/IO | src/File.php | File.touch | public function touch()
{
// Check permissions
$path = $this->getFullPath();
if (file_exists($path))
{
if (!is_writable($path))
Path::makeWritable($path);
}
touch($path);
Path::setPermissions($path);
} | php | public function touch()
{
// Check permissions
$path = $this->getFullPath();
if (file_exists($path))
{
if (!is_writable($path))
Path::makeWritable($path);
}
touch($path);
Path::setPermissions($path);
} | [
"public",
"function",
"touch",
"(",
")",
"{",
"// Check permissions",
"$",
"path",
"=",
"$",
"this",
"->",
"getFullPath",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"path",
")",
... | Touch the file, updating its permissions | [
"Touch",
"the",
"file",
"updating",
"its",
"permissions"
] | 4cfeaedd1bd9bda3097d18cb12233a4afecb2e85 | https://github.com/Wedeto/IO/blob/4cfeaedd1bd9bda3097d18cb12233a4afecb2e85/src/File.php#L47-L59 |
24,603 | Wedeto/IO | src/File.php | File.getMime | public function getMime()
{
if (!$this->mime)
{
$type = FileType::getFromFile($this->getFullPath());
$this->mime = $type->getMimeType();
}
return $this->mime;
} | php | public function getMime()
{
if (!$this->mime)
{
$type = FileType::getFromFile($this->getFullPath());
$this->mime = $type->getMimeType();
}
return $this->mime;
} | [
"public",
"function",
"getMime",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"mime",
")",
"{",
"$",
"type",
"=",
"FileType",
"::",
"getFromFile",
"(",
"$",
"this",
"->",
"getFullPath",
"(",
")",
")",
";",
"$",
"this",
"->",
"mime",
"=",
"$"... | Return the appropriate mime type for the file | [
"Return",
"the",
"appropriate",
"mime",
"type",
"for",
"the",
"file"
] | 4cfeaedd1bd9bda3097d18cb12233a4afecb2e85 | https://github.com/Wedeto/IO/blob/4cfeaedd1bd9bda3097d18cb12233a4afecb2e85/src/File.php#L84-L92 |
24,604 | Wedeto/IO | src/File.php | File.open | public function open(string $mode)
{
$read = strpbrk($mode, "r+") !== false;
$write = strpbrk($mode, "waxc+") !== false;
$x = strpbrk($mode, "x") !== false;
$path = $this->getFullPath();
$fh = @fopen($path, $mode);
if (is_resource($fh))
return $fh;
... | php | public function open(string $mode)
{
$read = strpbrk($mode, "r+") !== false;
$write = strpbrk($mode, "waxc+") !== false;
$x = strpbrk($mode, "x") !== false;
$path = $this->getFullPath();
$fh = @fopen($path, $mode);
if (is_resource($fh))
return $fh;
... | [
"public",
"function",
"open",
"(",
"string",
"$",
"mode",
")",
"{",
"$",
"read",
"=",
"strpbrk",
"(",
"$",
"mode",
",",
"\"r+\"",
")",
"!==",
"false",
";",
"$",
"write",
"=",
"strpbrk",
"(",
"$",
"mode",
",",
"\"waxc+\"",
")",
"!==",
"false",
";",
... | Open the file for reading or writing, throwing informative
exceptions when it fails.
@param string $mode The file opening mode
@return resource The opened file resource
@throws IOException When opening the file failed.
@seealso fopen | [
"Open",
"the",
"file",
"for",
"reading",
"or",
"writing",
"throwing",
"informative",
"exceptions",
"when",
"it",
"fails",
"."
] | 4cfeaedd1bd9bda3097d18cb12233a4afecb2e85 | https://github.com/Wedeto/IO/blob/4cfeaedd1bd9bda3097d18cb12233a4afecb2e85/src/File.php#L154-L173 |
24,605 | lanfisis/deflection | src/Deflection/Transformer.php | Transformer.arrayToClassElement | public function arrayToClassElement($definition)
{
$class = new Classes();
if (isset($definition['docblock'])) {
$docblock = $this->arrayToDocblockElement($definition['docblock']);
$class->setDocbloc($docblock);
}
if (isset($definition['namespace'])) {
... | php | public function arrayToClassElement($definition)
{
$class = new Classes();
if (isset($definition['docblock'])) {
$docblock = $this->arrayToDocblockElement($definition['docblock']);
$class->setDocbloc($docblock);
}
if (isset($definition['namespace'])) {
... | [
"public",
"function",
"arrayToClassElement",
"(",
"$",
"definition",
")",
"{",
"$",
"class",
"=",
"new",
"Classes",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"definition",
"[",
"'docblock'",
"]",
")",
")",
"{",
"$",
"docblock",
"=",
"$",
"this",
"... | Transform an array to a class element object
@param array $definition Class definitoion
@return Deflection\Element\Classes | [
"Transform",
"an",
"array",
"to",
"a",
"class",
"element",
"object"
] | 31deaf7f085d6456d8a323e7ac3cc9914fbe49a9 | https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Transformer.php#L26-L60 |
24,606 | lanfisis/deflection | src/Deflection/Transformer.php | Transformer.arrayToDocblockElement | public function arrayToDocblockElement(array $definition)
{
$docblock = new Docblock();
if (isset($definition['description'])) {
$docblock->setDescription($definition['description']);
}
if (isset($definition['params'])) {
foreach ($definition['params'] as $par... | php | public function arrayToDocblockElement(array $definition)
{
$docblock = new Docblock();
if (isset($definition['description'])) {
$docblock->setDescription($definition['description']);
}
if (isset($definition['params'])) {
foreach ($definition['params'] as $par... | [
"public",
"function",
"arrayToDocblockElement",
"(",
"array",
"$",
"definition",
")",
"{",
"$",
"docblock",
"=",
"new",
"Docblock",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"definition",
"[",
"'description'",
"]",
")",
")",
"{",
"$",
"docblock",
"->"... | Returns well formated header with descriptions, param, return, ...
@param array $definition Header definition
@return Deflection\Element\Docblock | [
"Returns",
"well",
"formated",
"header",
"with",
"descriptions",
"param",
"return",
"..."
] | 31deaf7f085d6456d8a323e7ac3cc9914fbe49a9 | https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Transformer.php#L69-L91 |
24,607 | lanfisis/deflection | src/Deflection/Transformer.php | Transformer.arrayToFunctionElement | public function arrayToFunctionElement(array $definition)
{
$function = new Functions;
if (isset($definition['docblock'])) {
$docblock = $this->arrayToDocblockElement($definition['docblock']);
$function->setDocbloc($docblock);
}
if (isset($definition['public']... | php | public function arrayToFunctionElement(array $definition)
{
$function = new Functions;
if (isset($definition['docblock'])) {
$docblock = $this->arrayToDocblockElement($definition['docblock']);
$function->setDocbloc($docblock);
}
if (isset($definition['public']... | [
"public",
"function",
"arrayToFunctionElement",
"(",
"array",
"$",
"definition",
")",
"{",
"$",
"function",
"=",
"new",
"Functions",
";",
"if",
"(",
"isset",
"(",
"$",
"definition",
"[",
"'docblock'",
"]",
")",
")",
"{",
"$",
"docblock",
"=",
"$",
"this"... | Returns well formated function declaration
@param array $definition Functions definition
@return Deflection\Element\Functions | [
"Returns",
"well",
"formated",
"function",
"declaration"
] | 31deaf7f085d6456d8a323e7ac3cc9914fbe49a9 | https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Transformer.php#L100-L122 |
24,608 | rzajac/phptools | src/Helper/Err.php | Err.errToException | public static function errToException($turnOn = true)
{
if (!$turnOn) {
return set_error_handler(null);
}
/*
* Error handler
*
* @param int $errno
* @param string $errStr
* @param string $errFile
* @param int $errLine
... | php | public static function errToException($turnOn = true)
{
if (!$turnOn) {
return set_error_handler(null);
}
/*
* Error handler
*
* @param int $errno
* @param string $errStr
* @param string $errFile
* @param int $errLine
... | [
"public",
"static",
"function",
"errToException",
"(",
"$",
"turnOn",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"turnOn",
")",
"{",
"return",
"set_error_handler",
"(",
"null",
")",
";",
"}",
"/*\n * Error handler\n *\n * @param int $errno\n... | Change errors to exceptions.
@see http://php.net/manual/en/class.errorexception.php
@param bool $turnOn Set to false to turn off user defined error exception handling and set the default one.
@return mixed | [
"Change",
"errors",
"to",
"exceptions",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Helper/Err.php#L38-L63 |
24,609 | peridot-php/peridot-scope | src/Scope.php | Scope.& | public function &__get($name)
{
list($result, $found) = $this->peridotScanChildren($this, function ($childScope, &$accumulator) use ($name) {
if (property_exists($childScope, $name)) {
$accumulator = [$childScope->$name, true, $childScope];
}
});
if (!... | php | public function &__get($name)
{
list($result, $found) = $this->peridotScanChildren($this, function ($childScope, &$accumulator) use ($name) {
if (property_exists($childScope, $name)) {
$accumulator = [$childScope->$name, true, $childScope];
}
});
if (!... | [
"public",
"function",
"&",
"__get",
"(",
"$",
"name",
")",
"{",
"list",
"(",
"$",
"result",
",",
"$",
"found",
")",
"=",
"$",
"this",
"->",
"peridotScanChildren",
"(",
"$",
"this",
",",
"function",
"(",
"$",
"childScope",
",",
"&",
"$",
"accumulator"... | Lookup properties on child scopes.
@param $name
@return mixed
@throws DomainException | [
"Lookup",
"properties",
"on",
"child",
"scopes",
"."
] | baabb128c805f84279c1506435120314ac09d9ff | https://github.com/peridot-php/peridot-scope/blob/baabb128c805f84279c1506435120314ac09d9ff/src/Scope.php#L106-L117 |
24,610 | peridot-php/peridot-scope | src/Scope.php | Scope.peridotScanChildren | protected function peridotScanChildren(Scope $scope, callable $fn, &$accumulator = [])
{
if (! empty($accumulator)) {
return $accumulator;
}
$children = $scope->peridotGetChildScopes();
foreach ($children as $childScope) {
$fn($childScope, $accumulator);
... | php | protected function peridotScanChildren(Scope $scope, callable $fn, &$accumulator = [])
{
if (! empty($accumulator)) {
return $accumulator;
}
$children = $scope->peridotGetChildScopes();
foreach ($children as $childScope) {
$fn($childScope, $accumulator);
... | [
"protected",
"function",
"peridotScanChildren",
"(",
"Scope",
"$",
"scope",
",",
"callable",
"$",
"fn",
",",
"&",
"$",
"accumulator",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"accumulator",
")",
")",
"{",
"return",
"$",
"accumulator"... | Scan child scopes and execute a function against each one passing an
accumulator reference along.
@param Scope $scope
@param callable $fn
@param array $accumulator
@return array | [
"Scan",
"child",
"scopes",
"and",
"execute",
"a",
"function",
"against",
"each",
"one",
"passing",
"an",
"accumulator",
"reference",
"along",
"."
] | baabb128c805f84279c1506435120314ac09d9ff | https://github.com/peridot-php/peridot-scope/blob/baabb128c805f84279c1506435120314ac09d9ff/src/Scope.php#L128-L145 |
24,611 | netzmacht-archive/subcolumns_bootstrap_customizable | src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php | ColumnSet.prepareContainer | public static function prepareContainer($id)
{
// use array key exists so non existing column will researched
if(array_key_exists('id', self::$container)) {
return static::$container[$id];
}
$model = ColumnsetModel::findByPk($id);
if($model === null)
{
static::$container[$id] = null;
return null... | php | public static function prepareContainer($id)
{
// use array key exists so non existing column will researched
if(array_key_exists('id', self::$container)) {
return static::$container[$id];
}
$model = ColumnsetModel::findByPk($id);
if($model === null)
{
static::$container[$id] = null;
return null... | [
"public",
"static",
"function",
"prepareContainer",
"(",
"$",
"id",
")",
"{",
"// use array key exists so non existing column will researched",
"if",
"(",
"array_key_exists",
"(",
"'id'",
",",
"self",
"::",
"$",
"container",
")",
")",
"{",
"return",
"static",
"::",
... | prepare the container which sub columns expects
@param int $id id of the columnset
@return array | [
"prepare",
"the",
"container",
"which",
"sub",
"columns",
"expects"
] | c0f63755282451fad670ceaa49b984bfabf9e4ee | https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L39-L75 |
24,612 | netzmacht-archive/subcolumns_bootstrap_customizable | src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php | ColumnSet.prepareSize | protected static function prepareSize($size, array $definition)
{
$css = sprintf('col-%s-%s', $size, $definition['width']);
if($definition['offset']) {
$css .= sprintf(' col-%s-offset-%s', $size, $definition['offset']);
}
if($definition['order']) {
$css .= sprintf(' col-%s-%s', $size, $definition['orde... | php | protected static function prepareSize($size, array $definition)
{
$css = sprintf('col-%s-%s', $size, $definition['width']);
if($definition['offset']) {
$css .= sprintf(' col-%s-offset-%s', $size, $definition['offset']);
}
if($definition['order']) {
$css .= sprintf(' col-%s-%s', $size, $definition['orde... | [
"protected",
"static",
"function",
"prepareSize",
"(",
"$",
"size",
",",
"array",
"$",
"definition",
")",
"{",
"$",
"css",
"=",
"sprintf",
"(",
"'col-%s-%s'",
",",
"$",
"size",
",",
"$",
"definition",
"[",
"'width'",
"]",
")",
";",
"if",
"(",
"$",
"d... | generates the css class defnition for one column
@param string $size the selected size
@param array $definition the column definition
@return string | [
"generates",
"the",
"css",
"class",
"defnition",
"for",
"one",
"column"
] | c0f63755282451fad670ceaa49b984bfabf9e4ee | https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L85-L98 |
24,613 | netzmacht-archive/subcolumns_bootstrap_customizable | src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php | ColumnSet.appendColumnsetIdToPalette | public function appendColumnsetIdToPalette($dc)
{
if($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') {
return;
}
if($dc->table == 'tl_content') {
$model = \ContentModel::findByPK($dc->id);
if($model->sc_type > 0) {
\MetaPalettes::appendFields($dc->table, 'colsetStart', 'colset', a... | php | public function appendColumnsetIdToPalette($dc)
{
if($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') {
return;
}
if($dc->table == 'tl_content') {
$model = \ContentModel::findByPK($dc->id);
if($model->sc_type > 0) {
\MetaPalettes::appendFields($dc->table, 'colsetStart', 'colset', a... | [
"public",
"function",
"appendColumnsetIdToPalette",
"(",
"$",
"dc",
")",
"{",
"if",
"(",
"$",
"GLOBALS",
"[",
"'TL_CONFIG'",
"]",
"[",
"'subcolumns'",
"]",
"!=",
"'bootstrap_customizable'",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"dc",
"->",
"table",... | add column set field to the colsetStart content element. We need to do it dynamically because subcolumns
creates its palette dynamically
@param $dc | [
"add",
"column",
"set",
"field",
"to",
"the",
"colsetStart",
"content",
"element",
".",
"We",
"need",
"to",
"do",
"it",
"dynamically",
"because",
"subcolumns",
"creates",
"its",
"palette",
"dynamically"
] | c0f63755282451fad670ceaa49b984bfabf9e4ee | https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L107-L133 |
24,614 | netzmacht-archive/subcolumns_bootstrap_customizable | src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php | ColumnSet.appendColumnSizesToPalette | public function appendColumnSizesToPalette($dc)
{
$model = ColumnsetModel::findByPk($dc->id);
$sizes = array_merge(deserialize($model->sizes, true));
foreach($sizes as $size)
{
$field = 'columnset_' . $size;
\MetaPalettes::appendFields('tl_columnset', 'columnset', array($field));
}
} | php | public function appendColumnSizesToPalette($dc)
{
$model = ColumnsetModel::findByPk($dc->id);
$sizes = array_merge(deserialize($model->sizes, true));
foreach($sizes as $size)
{
$field = 'columnset_' . $size;
\MetaPalettes::appendFields('tl_columnset', 'columnset', array($field));
}
} | [
"public",
"function",
"appendColumnSizesToPalette",
"(",
"$",
"dc",
")",
"{",
"$",
"model",
"=",
"ColumnsetModel",
"::",
"findByPk",
"(",
"$",
"dc",
"->",
"id",
")",
";",
"$",
"sizes",
"=",
"array_merge",
"(",
"deserialize",
"(",
"$",
"model",
"->",
"siz... | Append column sizes fields dynamically to the palettes. Not using
@param $dc | [
"Append",
"column",
"sizes",
"fields",
"dynamically",
"to",
"the",
"palettes",
".",
"Not",
"using"
] | c0f63755282451fad670ceaa49b984bfabf9e4ee | https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L140-L151 |
24,615 | netzmacht-archive/subcolumns_bootstrap_customizable | src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php | ColumnSet.createColumns | public function createColumns($value, $mcw)
{
$columns = (int) $mcw->activeRecord->columns;
$value = deserialize($value, true);
$count = count($value);
// initialize columns
if($count == 0) {
for($i= 0; $i < $columns; $i++) {
$value[$i]['width'] = floor(12/$columns);
}
}
// reduce columns if n... | php | public function createColumns($value, $mcw)
{
$columns = (int) $mcw->activeRecord->columns;
$value = deserialize($value, true);
$count = count($value);
// initialize columns
if($count == 0) {
for($i= 0; $i < $columns; $i++) {
$value[$i]['width'] = floor(12/$columns);
}
}
// reduce columns if n... | [
"public",
"function",
"createColumns",
"(",
"$",
"value",
",",
"$",
"mcw",
")",
"{",
"$",
"columns",
"=",
"(",
"int",
")",
"$",
"mcw",
"->",
"activeRecord",
"->",
"columns",
";",
"$",
"value",
"=",
"deserialize",
"(",
"$",
"value",
",",
"true",
")",
... | create a MCW row for each column
@param string $value deseriazable value, for getting an array
@param $mcw multi column wizard or DC_Table
@return mixed | [
"create",
"a",
"MCW",
"row",
"for",
"each",
"column"
] | c0f63755282451fad670ceaa49b984bfabf9e4ee | https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L161-L190 |
24,616 | netzmacht-archive/subcolumns_bootstrap_customizable | src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php | ColumnSet.getAllTypes | public function getAllTypes($dc)
{
if($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') {
$sc = new \tl_content_sc();
return $sc->getAllTypes();
}
$this->import('Database');
$collection = $this->Database->execute('SELECT columns FROM tl_columnset GROUP BY columns ORDER BY columns');
$t... | php | public function getAllTypes($dc)
{
if($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') {
$sc = new \tl_content_sc();
return $sc->getAllTypes();
}
$this->import('Database');
$collection = $this->Database->execute('SELECT columns FROM tl_columnset GROUP BY columns ORDER BY columns');
$t... | [
"public",
"function",
"getAllTypes",
"(",
"$",
"dc",
")",
"{",
"if",
"(",
"$",
"GLOBALS",
"[",
"'TL_CONFIG'",
"]",
"[",
"'subcolumns'",
"]",
"!=",
"'bootstrap_customizable'",
")",
"{",
"$",
"sc",
"=",
"new",
"\\",
"tl_content_sc",
"(",
")",
";",
"return"... | replace subcolumns getAllTypes method, to load all created columnsets. There is a fallback provided if not
bootstra_customizable is used
@param DC_Table $dc
@return array | [
"replace",
"subcolumns",
"getAllTypes",
"method",
"to",
"load",
"all",
"created",
"columnsets",
".",
"There",
"is",
"a",
"fallback",
"provided",
"if",
"not",
"bootstra_customizable",
"is",
"used"
] | c0f63755282451fad670ceaa49b984bfabf9e4ee | https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L200-L217 |
24,617 | netzmacht-archive/subcolumns_bootstrap_customizable | src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php | ColumnSet.getAllColumnsets | public function getAllColumnsets($dc)
{
$collection = ColumnsetModel::findBy('published=1 AND columns', $dc->activeRecord->sc_type, array('order' => 'title'));
$set = array();
if($collection !== null)
{
while($collection->next()) {
$set[$collection->id] = $collection->title;
}
}
return $set;
} | php | public function getAllColumnsets($dc)
{
$collection = ColumnsetModel::findBy('published=1 AND columns', $dc->activeRecord->sc_type, array('order' => 'title'));
$set = array();
if($collection !== null)
{
while($collection->next()) {
$set[$collection->id] = $collection->title;
}
}
return $set;
} | [
"public",
"function",
"getAllColumnsets",
"(",
"$",
"dc",
")",
"{",
"$",
"collection",
"=",
"ColumnsetModel",
"::",
"findBy",
"(",
"'published=1 AND columns'",
",",
"$",
"dc",
"->",
"activeRecord",
"->",
"sc_type",
",",
"array",
"(",
"'order'",
"=>",
"'title'"... | get all columnsets which fits to the selected type
@param $dc
@return array | [
"get",
"all",
"columnsets",
"which",
"fits",
"to",
"the",
"selected",
"type"
] | c0f63755282451fad670ceaa49b984bfabf9e4ee | https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L225-L238 |
24,618 | leprephp/di | src/ExtensionQueue.php | ExtensionQueue.getService | public function getService($service)
{
foreach ($this->queue as $extension) {
$new = call_user_func($extension, $service, $this->container);
if ($new) {
$service = $new;
}
}
return $service;
} | php | public function getService($service)
{
foreach ($this->queue as $extension) {
$new = call_user_func($extension, $service, $this->container);
if ($new) {
$service = $new;
}
}
return $service;
} | [
"public",
"function",
"getService",
"(",
"$",
"service",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"queue",
"as",
"$",
"extension",
")",
"{",
"$",
"new",
"=",
"call_user_func",
"(",
"$",
"extension",
",",
"$",
"service",
",",
"$",
"this",
"->",
"c... | Gets the extended version of the service.
@param mixed $service
@return mixed | [
"Gets",
"the",
"extended",
"version",
"of",
"the",
"service",
"."
] | d7de90c0d44714abd70c4f5bd5341a1a87203a7e | https://github.com/leprephp/di/blob/d7de90c0d44714abd70c4f5bd5341a1a87203a7e/src/ExtensionQueue.php#L60-L71 |
24,619 | MichaelJ2324/PHP-REST-Client | src/Endpoint/Abstracts/AbstractCollectionEndpoint.php | AbstractCollectionEndpoint.update | public function update(array $collection){
foreach($collection as $key => $value){
$this->collection[$key] = $value;
}
return $this;
} | php | public function update(array $collection){
foreach($collection as $key => $value){
$this->collection[$key] = $value;
}
return $this;
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"collection",
")",
"{",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"collection",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"retur... | Update and append to Collection array
@param array $collection
@return self | [
"Update",
"and",
"append",
"to",
"Collection",
"array"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Endpoint/Abstracts/AbstractCollectionEndpoint.php#L112-L117 |
24,620 | MichaelJ2324/PHP-REST-Client | src/Endpoint/Abstracts/AbstractCollectionEndpoint.php | AbstractCollectionEndpoint.at | public function at($index){
$return = NULL;
$index = intval($index);
$data = $this->asArray();
reset($data);
if ($index < 0){
$index += $this->length();
}
$c = 1;
while ($c <= $index){
next($data);
$c++;
}
... | php | public function at($index){
$return = NULL;
$index = intval($index);
$data = $this->asArray();
reset($data);
if ($index < 0){
$index += $this->length();
}
$c = 1;
while ($c <= $index){
next($data);
$c++;
}
... | [
"public",
"function",
"at",
"(",
"$",
"index",
")",
"{",
"$",
"return",
"=",
"NULL",
";",
"$",
"index",
"=",
"intval",
"(",
"$",
"index",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"asArray",
"(",
")",
";",
"reset",
"(",
"$",
"data",
")",
... | Get a model based on numerical index
@param int $index
@return array|ModelInterface | [
"Get",
"a",
"model",
"based",
"on",
"numerical",
"index"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Endpoint/Abstracts/AbstractCollectionEndpoint.php#L149-L168 |
24,621 | MichaelJ2324/PHP-REST-Client | src/Endpoint/Abstracts/AbstractCollectionEndpoint.php | AbstractCollectionEndpoint.updateCollection | protected function updateCollection(){
$responseBody = $this->Response->getBody();
if (is_array($responseBody)){
if (isset($this->model)){
$modelIdKey = $this->buildModel()->modelIdKey();
foreach($responseBody as $key => $model){
if (isset(... | php | protected function updateCollection(){
$responseBody = $this->Response->getBody();
if (is_array($responseBody)){
if (isset($this->model)){
$modelIdKey = $this->buildModel()->modelIdKey();
foreach($responseBody as $key => $model){
if (isset(... | [
"protected",
"function",
"updateCollection",
"(",
")",
"{",
"$",
"responseBody",
"=",
"$",
"this",
"->",
"Response",
"->",
"getBody",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"responseBody",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
... | Configures the collection based on the Response Body | [
"Configures",
"the",
"collection",
"based",
"on",
"the",
"Response",
"Body"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Endpoint/Abstracts/AbstractCollectionEndpoint.php#L229-L245 |
24,622 | MichaelJ2324/PHP-REST-Client | src/Endpoint/Abstracts/AbstractCollectionEndpoint.php | AbstractCollectionEndpoint.buildModel | protected function buildModel(array $data = array()){
$Model = NULL;
if (isset($this->model)){
$Model = new $this->model();
$Model->setBaseUrl($this->getBaseUrl());
if ($this->getAuth() !== NULL) {
$Model->setAuth($this->getAuth());
}
... | php | protected function buildModel(array $data = array()){
$Model = NULL;
if (isset($this->model)){
$Model = new $this->model();
$Model->setBaseUrl($this->getBaseUrl());
if ($this->getAuth() !== NULL) {
$Model->setAuth($this->getAuth());
}
... | [
"protected",
"function",
"buildModel",
"(",
"array",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"$",
"Model",
"=",
"NULL",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"model",
")",
")",
"{",
"$",
"Model",
"=",
"new",
"$",
"this",
"->",
... | Build the ModelEndpoint
@param array $data
@return AbstractModelEndpoint | [
"Build",
"the",
"ModelEndpoint"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Endpoint/Abstracts/AbstractCollectionEndpoint.php#L252-L267 |
24,623 | Gendoria/command-queue | src/Gendoria/CommandQueue/QueueManager/MultipleQueueManager.php | MultipleQueueManager.detectPool | private function detectPool(CommandInterface $command)
{
$commandClass = get_class($command);
return $this->poolDetector->detect($commandClass);
} | php | private function detectPool(CommandInterface $command)
{
$commandClass = get_class($command);
return $this->poolDetector->detect($commandClass);
} | [
"private",
"function",
"detectPool",
"(",
"CommandInterface",
"$",
"command",
")",
"{",
"$",
"commandClass",
"=",
"get_class",
"(",
"$",
"command",
")",
";",
"return",
"$",
"this",
"->",
"poolDetector",
"->",
"detect",
"(",
"$",
"commandClass",
")",
";",
"... | Detect correct pool for given command.
@param CommandInterface $command
@return string | [
"Detect",
"correct",
"pool",
"for",
"given",
"command",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/QueueManager/MultipleQueueManager.php#L117-L121 |
24,624 | OxfordInfoLabs/kinikit-core | src/Util/ArrayUtils.php | ArrayUtils.prefixArrayKeys | public static function prefixArrayKeys($array, $prefix) {
$prefixedArray = array();
foreach ($array as $key => $value) {
$prefixedArray [$prefix . $key] = $value;
}
return $prefixedArray;
} | php | public static function prefixArrayKeys($array, $prefix) {
$prefixedArray = array();
foreach ($array as $key => $value) {
$prefixedArray [$prefix . $key] = $value;
}
return $prefixedArray;
} | [
"public",
"static",
"function",
"prefixArrayKeys",
"(",
"$",
"array",
",",
"$",
"prefix",
")",
"{",
"$",
"prefixedArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"prefixedArray",
... | Take an associative array as input and return a new array with all the original keys prefixed by the
passed prefix.
@param array $array
@param string $prefix
@return array | [
"Take",
"an",
"associative",
"array",
"as",
"input",
"and",
"return",
"a",
"new",
"array",
"with",
"all",
"the",
"original",
"keys",
"prefixed",
"by",
"the",
"passed",
"prefix",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L35-L44 |
24,625 | OxfordInfoLabs/kinikit-core | src/Util/ArrayUtils.php | ArrayUtils.getAllArrayItemsByKeyPrefix | public static function getAllArrayItemsByKeyPrefix($array, $prefix, $stripPrefix = false) {
$returnValues = array();
foreach ($array as $key => $value) {
$positionOfPrefix = strpos($key, $prefix);
if (is_numeric($positionOfPrefix) && $positionOfPrefix == 0) {
if (... | php | public static function getAllArrayItemsByKeyPrefix($array, $prefix, $stripPrefix = false) {
$returnValues = array();
foreach ($array as $key => $value) {
$positionOfPrefix = strpos($key, $prefix);
if (is_numeric($positionOfPrefix) && $positionOfPrefix == 0) {
if (... | [
"public",
"static",
"function",
"getAllArrayItemsByKeyPrefix",
"(",
"$",
"array",
",",
"$",
"prefix",
",",
"$",
"stripPrefix",
"=",
"false",
")",
"{",
"$",
"returnValues",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",... | Find all parameters in the passed array with a key starting with the supplied prefix.
Return them as an associative array by key.
@param array $array
@param string $prefix
@return array | [
"Find",
"all",
"parameters",
"in",
"the",
"passed",
"array",
"with",
"a",
"key",
"starting",
"with",
"the",
"supplied",
"prefix",
".",
"Return",
"them",
"as",
"an",
"associative",
"array",
"by",
"key",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L55-L66 |
24,626 | OxfordInfoLabs/kinikit-core | src/Util/ArrayUtils.php | ArrayUtils.arrayDiff | public static function arrayDiff($array1, $array2) {
return array_udiff($array1, $array2,
function ($a, $b) {
if (is_object($a)) {
return strcmp(spl_object_hash($a), spl_object_hash($b));
} else if (is_array($a)) {
return ArrayU... | php | public static function arrayDiff($array1, $array2) {
return array_udiff($array1, $array2,
function ($a, $b) {
if (is_object($a)) {
return strcmp(spl_object_hash($a), spl_object_hash($b));
} else if (is_array($a)) {
return ArrayU... | [
"public",
"static",
"function",
"arrayDiff",
"(",
"$",
"array1",
",",
"$",
"array2",
")",
"{",
"return",
"array_udiff",
"(",
"$",
"array1",
",",
"$",
"array2",
",",
"function",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"if",
"(",
"is_object",
"(",
"$... | Diff function for arrays which works with arrays of objects as well as string comparables.
@param $array1
@param $array2 | [
"Diff",
"function",
"for",
"arrays",
"which",
"works",
"with",
"arrays",
"of",
"objects",
"as",
"well",
"as",
"string",
"comparables",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L87-L99 |
24,627 | OxfordInfoLabs/kinikit-core | src/Util/ArrayUtils.php | ArrayUtils.recursiveMerge | public static function recursiveMerge($array1, $array2) {
if ($array1 instanceof AssociativeArray) {
$array1 = $array1->toArray();
}
if ($array2 instanceof AssociativeArray) {
$array2 = $array2->toArray();
}
if (ArrayUtils::isAssociative($array1) != Arr... | php | public static function recursiveMerge($array1, $array2) {
if ($array1 instanceof AssociativeArray) {
$array1 = $array1->toArray();
}
if ($array2 instanceof AssociativeArray) {
$array2 = $array2->toArray();
}
if (ArrayUtils::isAssociative($array1) != Arr... | [
"public",
"static",
"function",
"recursiveMerge",
"(",
"$",
"array1",
",",
"$",
"array2",
")",
"{",
"if",
"(",
"$",
"array1",
"instanceof",
"AssociativeArray",
")",
"{",
"$",
"array1",
"=",
"$",
"array1",
"->",
"toArray",
"(",
")",
";",
"}",
"if",
"(",... | Recursively merge array1 and array2. If keys exist in both arrays at any level, take the value from array1 in preference.
@param $array1
@param $array2 | [
"Recursively",
"merge",
"array1",
"and",
"array2",
".",
"If",
"keys",
"exist",
"in",
"both",
"arrays",
"at",
"any",
"level",
"take",
"the",
"value",
"from",
"array1",
"in",
"preference",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L107-L148 |
24,628 | OxfordInfoLabs/kinikit-core | src/Util/ArrayUtils.php | ArrayUtils.recursiveDiff | public static function recursiveDiff($array1, $array2, $caseInsensitive = true, $matchingKeysOnly = true) {
if ($array1 instanceof AssociativeArray) {
$array1 = $array1->toArray();
}
if ($array2 instanceof AssociativeArray) {
$array2 = $array2->toArray();
}
... | php | public static function recursiveDiff($array1, $array2, $caseInsensitive = true, $matchingKeysOnly = true) {
if ($array1 instanceof AssociativeArray) {
$array1 = $array1->toArray();
}
if ($array2 instanceof AssociativeArray) {
$array2 = $array2->toArray();
}
... | [
"public",
"static",
"function",
"recursiveDiff",
"(",
"$",
"array1",
",",
"$",
"array2",
",",
"$",
"caseInsensitive",
"=",
"true",
",",
"$",
"matchingKeysOnly",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"array1",
"instanceof",
"AssociativeArray",
")",
"{",
"$... | Return an array of different elements within the 2 arrays. If matching keys only is supplied, only elements which exist in both but which are different are included.
The returned array contains an associative array for each differing value with a "value1" and "value2" element.
@param $array1
@param $array2
@param b... | [
"Return",
"an",
"array",
"of",
"different",
"elements",
"within",
"the",
"2",
"arrays",
".",
"If",
"matching",
"keys",
"only",
"is",
"supplied",
"only",
"elements",
"which",
"exist",
"in",
"both",
"but",
"which",
"are",
"different",
"are",
"included",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L161-L194 |
24,629 | OxfordInfoLabs/kinikit-core | src/Util/ArrayUtils.php | ArrayUtils.reduceToElementsWithKey | public static function reduceToElementsWithKey($array, $key) {
if ($array instanceof AssociativeArray) {
$array = $array->toArray();
}
$targetArray = array();
foreach ($array as $itemKey => $value) {
if ($itemKey == $key) {
$targetArray[$key] =... | php | public static function reduceToElementsWithKey($array, $key) {
if ($array instanceof AssociativeArray) {
$array = $array->toArray();
}
$targetArray = array();
foreach ($array as $itemKey => $value) {
if ($itemKey == $key) {
$targetArray[$key] =... | [
"public",
"static",
"function",
"reduceToElementsWithKey",
"(",
"$",
"array",
",",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"array",
"instanceof",
"AssociativeArray",
")",
"{",
"$",
"array",
"=",
"$",
"array",
"->",
"toArray",
"(",
")",
";",
"}",
"$",
"ta... | Reduce the array to only elements with the passed key at any depth.
@param $array
@param $key | [
"Reduce",
"the",
"array",
"to",
"only",
"elements",
"with",
"the",
"passed",
"key",
"at",
"any",
"depth",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L203-L226 |
24,630 | OxfordInfoLabs/kinikit-core | src/Util/ArrayUtils.php | ArrayUtils.findElementsByKey | public static function findElementsByKey($array, $key, &$targetArray = null, $prefix = "") {
if ($array instanceof AssociativeArray) {
$array = $array->toArray();
}
if (!$targetArray)
$targetArray = array();
foreach ($array as $itemKey => $value) {
... | php | public static function findElementsByKey($array, $key, &$targetArray = null, $prefix = "") {
if ($array instanceof AssociativeArray) {
$array = $array->toArray();
}
if (!$targetArray)
$targetArray = array();
foreach ($array as $itemKey => $value) {
... | [
"public",
"static",
"function",
"findElementsByKey",
"(",
"$",
"array",
",",
"$",
"key",
",",
"&",
"$",
"targetArray",
"=",
"null",
",",
"$",
"prefix",
"=",
"\"\"",
")",
"{",
"if",
"(",
"$",
"array",
"instanceof",
"AssociativeArray",
")",
"{",
"$",
"ar... | Find elements by key.
@param $array
@param $key | [
"Find",
"elements",
"by",
"key",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L235-L262 |
24,631 | OxfordInfoLabs/kinikit-core | src/Util/ArrayUtils.php | ArrayUtils.groupElementsByValueKeys | public static function groupElementsByValueKeys($array, $groupKeys) {
if (!is_array($groupKeys)) {
$groupKeys = array($groupKeys);
}
$newArray = new AssociativeArray();
foreach ($array as $element) {
$applyObject = $newArray;
foreach ($groupKeys as ... | php | public static function groupElementsByValueKeys($array, $groupKeys) {
if (!is_array($groupKeys)) {
$groupKeys = array($groupKeys);
}
$newArray = new AssociativeArray();
foreach ($array as $element) {
$applyObject = $newArray;
foreach ($groupKeys as ... | [
"public",
"static",
"function",
"groupElementsByValueKeys",
"(",
"$",
"array",
",",
"$",
"groupKeys",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"groupKeys",
")",
")",
"{",
"$",
"groupKeys",
"=",
"array",
"(",
"$",
"groupKeys",
")",
";",
"}",
"$",... | Group an array of elements by one or more of it's keys. Essentially convert into an indexed array for each key type.
@param $array
@param $groupKeys | [
"Group",
"an",
"array",
"of",
"elements",
"by",
"one",
"or",
"more",
"of",
"it",
"s",
"keys",
".",
"Essentially",
"convert",
"into",
"an",
"indexed",
"array",
"for",
"each",
"key",
"type",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L271-L302 |
24,632 | phossa/phossa-config | src/Phossa/Config/Reference/TreeTrait.php | TreeTrait.& | protected function &searchTree(
/*# string */ $key,
/*# array */ &$tree,
/*# bool */ $create = false
) {
$found = &$tree;
$parts = explode($this->field_splitter, $key);
while (null !== ($part = array_shift($parts))) {
if (!isset($found[$part])) {
... | php | protected function &searchTree(
/*# string */ $key,
/*# array */ &$tree,
/*# bool */ $create = false
) {
$found = &$tree;
$parts = explode($this->field_splitter, $key);
while (null !== ($part = array_shift($parts))) {
if (!isset($found[$part])) {
... | [
"protected",
"function",
"&",
"searchTree",
"(",
"/*# string */",
"$",
"key",
",",
"/*# array */",
"&",
"$",
"tree",
",",
"/*# bool */",
"$",
"create",
"=",
"false",
")",
"{",
"$",
"found",
"=",
"&",
"$",
"tree",
";",
"$",
"parts",
"=",
"explode",
"(",... | Return a node in an array structure
@param string $key something like 'db.auth.host'
@param array &$tree the array tree
@param bool $create create the node if missing
@return null|array|string the matching node
@access protected | [
"Return",
"a",
"node",
"in",
"an",
"array",
"structure"
] | fdb90831da06408bb674ab777754e67025604bed | https://github.com/phossa/phossa-config/blob/fdb90831da06408bb674ab777754e67025604bed/src/Phossa/Config/Reference/TreeTrait.php#L57-L76 |
24,633 | MetaModels/phpunit-contao-database | src/Contao/Database/FakeResult.php | FakeResult.addRow | public function addRow($data, $rowId = null)
{
if (($rowId === null) && isset($data['id'])) {
$rowId = $data['id'];
}
if ($rowId === null) {
$rowId = count($this->rows);
}
$this->rows[$rowId] = $data;
return $this;
} | php | public function addRow($data, $rowId = null)
{
if (($rowId === null) && isset($data['id'])) {
$rowId = $data['id'];
}
if ($rowId === null) {
$rowId = count($this->rows);
}
$this->rows[$rowId] = $data;
return $this;
} | [
"public",
"function",
"addRow",
"(",
"$",
"data",
",",
"$",
"rowId",
"=",
"null",
")",
"{",
"if",
"(",
"(",
"$",
"rowId",
"===",
"null",
")",
"&&",
"isset",
"(",
"$",
"data",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"rowId",
"=",
"$",
"data",
"[... | Add a row.
@param array $data The row data.
@param null|int $rowId The id for the row.
@return FakeResult | [
"Add",
"a",
"row",
"."
] | aeb2ee10dac532fa73e2deb6457b6a167a1c01c7 | https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeResult.php#L44-L57 |
24,634 | MetaModels/phpunit-contao-database | src/Contao/Database/FakeResult.php | FakeResult.addRows | public function addRows($data)
{
foreach ($data as $key => $row) {
$this->addRow($row, isset($row['id']) ? $row['id'] : $key);
}
return $this;
} | php | public function addRows($data)
{
foreach ($data as $key => $row) {
$this->addRow($row, isset($row['id']) ? $row['id'] : $key);
}
return $this;
} | [
"public",
"function",
"addRows",
"(",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"row",
")",
"{",
"$",
"this",
"->",
"addRow",
"(",
"$",
"row",
",",
"isset",
"(",
"$",
"row",
"[",
"'id'",
"]",
")",
"?",
"... | Add rows.
@param array $data The row data.
@return FakeResult | [
"Add",
"rows",
"."
] | aeb2ee10dac532fa73e2deb6457b6a167a1c01c7 | https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeResult.php#L66-L73 |
24,635 | MetaModels/phpunit-contao-database | src/Contao/Database/FakeResult.php | FakeResult.getRow | public function getRow($index)
{
$keys = array_keys($this->rows);
return isset($keys[$index]) ? $this->rows[$keys[$index]] : null;
} | php | public function getRow($index)
{
$keys = array_keys($this->rows);
return isset($keys[$index]) ? $this->rows[$keys[$index]] : null;
} | [
"public",
"function",
"getRow",
"(",
"$",
"index",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"rows",
")",
";",
"return",
"isset",
"(",
"$",
"keys",
"[",
"$",
"index",
"]",
")",
"?",
"$",
"this",
"->",
"rows",
"[",
"$",
"... | Retrieve the row with the given index.
@param int $index The index.
@return array | [
"Retrieve",
"the",
"row",
"with",
"the",
"given",
"index",
"."
] | aeb2ee10dac532fa73e2deb6457b6a167a1c01c7 | https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeResult.php#L84-L89 |
24,636 | perryflynn/PerrysLambda | src/PerrysLambda/ArrayList.php | ArrayList.asType | public static function asType($type, array $data)
{
$converter = new TypeStringListConverter($type);
$converter->setArraySource($data);
return new static($converter);
} | php | public static function asType($type, array $data)
{
$converter = new TypeStringListConverter($type);
$converter->setArraySource($data);
return new static($converter);
} | [
"public",
"static",
"function",
"asType",
"(",
"$",
"type",
",",
"array",
"$",
"data",
")",
"{",
"$",
"converter",
"=",
"new",
"TypeStringListConverter",
"(",
"$",
"type",
")",
";",
"$",
"converter",
"->",
"setArraySource",
"(",
"$",
"data",
")",
";",
... | Create arraylist of class
@param string $type
@param mixed[] $data
@return \PerrysLambda\ArrayList | [
"Create",
"arraylist",
"of",
"class"
] | 9f1734ae4689d73278b887f9354dfd31428e96de | https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/ArrayList.php#L32-L37 |
24,637 | perryflynn/PerrysLambda | src/PerrysLambda/ArrayList.php | ArrayList.serializeGenerator | public function serializeGenerator()
{
if($this->__converter instanceof IListConverter)
{
foreach($this->__converter->toGenerator($this) as $index => $row)
{
yield $index => $row;
}
}
else
{
foreach($t... | php | public function serializeGenerator()
{
if($this->__converter instanceof IListConverter)
{
foreach($this->__converter->toGenerator($this) as $index => $row)
{
yield $index => $row;
}
}
else
{
foreach($t... | [
"public",
"function",
"serializeGenerator",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"__converter",
"instanceof",
"IListConverter",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"__converter",
"->",
"toGenerator",
"(",
"$",
"this",
")",
"as",
"$",
"inde... | Serialize via converter as generator
@return mixed[] | [
"Serialize",
"via",
"converter",
"as",
"generator"
] | 9f1734ae4689d73278b887f9354dfd31428e96de | https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/ArrayList.php#L79-L95 |
24,638 | locomotivemtl/charcoal-translator | src/Charcoal/Translator/TranslatorConfig.php | TranslatorConfig.setTranslations | public function setTranslations(array $translations)
{
$this->translations = [];
foreach ($translations as $domain => $data) {
if (!is_array($data)) {
throw new InvalidArgumentException(
'Translator translations must be a 3-level array'
... | php | public function setTranslations(array $translations)
{
$this->translations = [];
foreach ($translations as $domain => $data) {
if (!is_array($data)) {
throw new InvalidArgumentException(
'Translator translations must be a 3-level array'
... | [
"public",
"function",
"setTranslations",
"(",
"array",
"$",
"translations",
")",
"{",
"$",
"this",
"->",
"translations",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"translations",
"as",
"$",
"domain",
"=>",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_arra... | Set mapping of additional translations.
Expects:
```json
{
"<domain>": {
"<locale>": {
"<translation-key>": "translation"
}
}
}
```
@param array $translations Mapping of domains/locales/messages.
@throws InvalidArgumentException If the path is not a string.
@return TranslatorConfig Chainable | [
"Set",
"mapping",
"of",
"additional",
"translations",
"."
] | 0a64432baef223dcccbfecf057015440dfa76e49 | https://github.com/locomotivemtl/charcoal-translator/blob/0a64432baef223dcccbfecf057015440dfa76e49/src/Charcoal/Translator/TranslatorConfig.php#L144-L166 |
24,639 | ZFrapid/zf2rapid-domain | src/ZF2rapidDomain/Entity/AbstractEntity.php | AbstractEntity.exchangeArray | public function exchangeArray(array $array)
{
foreach ($array as $key => $value) {
$setMethod = 'set' . StaticFilter::execute(
$key, 'WordUnderscoreToCamelCase'
);
if (method_exists($this, $setMethod)) {
$this->$setMethod($value);
... | php | public function exchangeArray(array $array)
{
foreach ($array as $key => $value) {
$setMethod = 'set' . StaticFilter::execute(
$key, 'WordUnderscoreToCamelCase'
);
if (method_exists($this, $setMethod)) {
$this->$setMethod($value);
... | [
"public",
"function",
"exchangeArray",
"(",
"array",
"$",
"array",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"setMethod",
"=",
"'set'",
".",
"StaticFilter",
"::",
"execute",
"(",
"$",
"key",
",",
"'W... | Exchange properties with values from array
@param array $array | [
"Exchange",
"properties",
"with",
"values",
"from",
"array"
] | 9455689cac06b42025c144878604d27c28b4bb04 | https://github.com/ZFrapid/zf2rapid-domain/blob/9455689cac06b42025c144878604d27c28b4bb04/src/ZF2rapidDomain/Entity/AbstractEntity.php#L32-L43 |
24,640 | ZFrapid/zf2rapid-domain | src/ZF2rapidDomain/Entity/AbstractEntity.php | AbstractEntity.getArrayCopy | public function getArrayCopy()
{
$data = [];
foreach (get_object_vars($this) as $key => $value) {
$getMethod = 'get' . ucfirst($key);
$arrayKey = StaticFilter::execute($key, 'WordCamelCaseToUnderscore');
$arrayKey = StaticFilter::execute($arrayKey, 'StringToLowe... | php | public function getArrayCopy()
{
$data = [];
foreach (get_object_vars($this) as $key => $value) {
$getMethod = 'get' . ucfirst($key);
$arrayKey = StaticFilter::execute($key, 'WordCamelCaseToUnderscore');
$arrayKey = StaticFilter::execute($arrayKey, 'StringToLowe... | [
"public",
"function",
"getArrayCopy",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"getMethod",
"=",
"'get'",
".",
"ucfirst",
"(",
"$"... | Generate an array copy from property values | [
"Generate",
"an",
"array",
"copy",
"from",
"property",
"values"
] | 9455689cac06b42025c144878604d27c28b4bb04 | https://github.com/ZFrapid/zf2rapid-domain/blob/9455689cac06b42025c144878604d27c28b4bb04/src/ZF2rapidDomain/Entity/AbstractEntity.php#L48-L65 |
24,641 | Fenzland/http-api-gluer | src/Gluer/THoldsSerializers_.php | THoldsSerializers_.registerSerializer_ | static public function registerSerializer_( string$mime, $serializer ):string
{
static::checkSerializerNotRegistered_( $mime );
static::checkSerializer_( $serializer );
static::$serializers_[$mime]= $serializer;
return self::class;
} | php | static public function registerSerializer_( string$mime, $serializer ):string
{
static::checkSerializerNotRegistered_( $mime );
static::checkSerializer_( $serializer );
static::$serializers_[$mime]= $serializer;
return self::class;
} | [
"static",
"public",
"function",
"registerSerializer_",
"(",
"string",
"$",
"mime",
",",
"$",
"serializer",
")",
":",
"string",
"{",
"static",
"::",
"checkSerializerNotRegistered_",
"(",
"$",
"mime",
")",
";",
"static",
"::",
"checkSerializer_",
"(",
"$",
"seri... | Static method registerSerializer_
@static
@access public
@param string $mime
@param class|S\ASerializer $serializer
@return class | [
"Static",
"method",
"registerSerializer_"
] | 3488de28b7f54fb444ec47f84034473a7d86e17e | https://github.com/Fenzland/http-api-gluer/blob/3488de28b7f54fb444ec47f84034473a7d86e17e/src/Gluer/THoldsSerializers_.php#L26-L35 |
24,642 | Fenzland/http-api-gluer | src/Gluer/THoldsSerializers_.php | THoldsSerializers_.checkSerializer_ | static protected function checkSerializer_( $serializer ):void
{
if(!(
(
is_object( $serializer )
&&
$serializer instanceof S\ASerializer
)
or
(
is_string( $serializer )
&&
class_exists( $serializer )
&&
isset( class_parents( $serializer )[S\ASerializer::class] )
)
)){
... | php | static protected function checkSerializer_( $serializer ):void
{
if(!(
(
is_object( $serializer )
&&
$serializer instanceof S\ASerializer
)
or
(
is_string( $serializer )
&&
class_exists( $serializer )
&&
isset( class_parents( $serializer )[S\ASerializer::class] )
)
)){
... | [
"static",
"protected",
"function",
"checkSerializer_",
"(",
"$",
"serializer",
")",
":",
"void",
"{",
"if",
"(",
"!",
"(",
"(",
"is_object",
"(",
"$",
"serializer",
")",
"&&",
"$",
"serializer",
"instanceof",
"S",
"\\",
"ASerializer",
")",
"or",
"(",
"is... | Static method checkSerializer_
@static
@access protected
@param mixed $serializer
@return void | [
"Static",
"method",
"checkSerializer_"
] | 3488de28b7f54fb444ec47f84034473a7d86e17e | https://github.com/Fenzland/http-api-gluer/blob/3488de28b7f54fb444ec47f84034473a7d86e17e/src/Gluer/THoldsSerializers_.php#L93-L116 |
24,643 | Fenzland/http-api-gluer | src/Gluer/THoldsSerializers_.php | THoldsSerializers_.achieveSerializer_ | static protected function achieveSerializer_( string$mime ):S\ASerializer
{
static::checkSerializerSupported_( $mime );
$serializer= static::getSerializer_( $mime );
return static::instantiateSerializer_( $serializer );
} | php | static protected function achieveSerializer_( string$mime ):S\ASerializer
{
static::checkSerializerSupported_( $mime );
$serializer= static::getSerializer_( $mime );
return static::instantiateSerializer_( $serializer );
} | [
"static",
"protected",
"function",
"achieveSerializer_",
"(",
"string",
"$",
"mime",
")",
":",
"S",
"\\",
"ASerializer",
"{",
"static",
"::",
"checkSerializerSupported_",
"(",
"$",
"mime",
")",
";",
"$",
"serializer",
"=",
"static",
"::",
"getSerializer_",
"("... | Static method achieveSerializer_
@static
@access protected
@param string $mime
@return S\ASerializer | [
"Static",
"method",
"achieveSerializer_"
] | 3488de28b7f54fb444ec47f84034473a7d86e17e | https://github.com/Fenzland/http-api-gluer/blob/3488de28b7f54fb444ec47f84034473a7d86e17e/src/Gluer/THoldsSerializers_.php#L171-L178 |
24,644 | varunsridharan/wp-post | src/Post.php | Post.set_post | protected function set_post( $post ) {
$this->post = $post;
$this->id = ( isset( $post->ID ) ) ? $post->ID : false;
if ( ! empty( $this->taxonomies() ) ) {
foreach ( $this->taxonomies() as $taxonomy ) {
$this->{$taxonomy} = $this->get_terms( $taxonomy, array( 'fields' => 'all' ) );
}
}
} | php | protected function set_post( $post ) {
$this->post = $post;
$this->id = ( isset( $post->ID ) ) ? $post->ID : false;
if ( ! empty( $this->taxonomies() ) ) {
foreach ( $this->taxonomies() as $taxonomy ) {
$this->{$taxonomy} = $this->get_terms( $taxonomy, array( 'fields' => 'all' ) );
}
}
} | [
"protected",
"function",
"set_post",
"(",
"$",
"post",
")",
"{",
"$",
"this",
"->",
"post",
"=",
"$",
"post",
";",
"$",
"this",
"->",
"id",
"=",
"(",
"isset",
"(",
"$",
"post",
"->",
"ID",
")",
")",
"?",
"$",
"post",
"->",
"ID",
":",
"false",
... | Sets Post Data.
@param $post | [
"Sets",
"Post",
"Data",
"."
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L70-L79 |
24,645 | varunsridharan/wp-post | src/Post.php | Post.featured_image_id | public function featured_image_id() {
if ( isset( $this->featured_image_id ) ) {
return $this->featured_image_id;
}
$this->featured_image_id = \get_post_thumbnail_id( $this->post );
return $this->featured_image_id;
} | php | public function featured_image_id() {
if ( isset( $this->featured_image_id ) ) {
return $this->featured_image_id;
}
$this->featured_image_id = \get_post_thumbnail_id( $this->post );
return $this->featured_image_id;
} | [
"public",
"function",
"featured_image_id",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"featured_image_id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"featured_image_id",
";",
"}",
"$",
"this",
"->",
"featured_image_id",
"=",
"\\",
"get_po... | Returns Featured Image ID.
@return bool|int|mixed|string | [
"Returns",
"Featured",
"Image",
"ID",
"."
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L137-L143 |
24,646 | varunsridharan/wp-post | src/Post.php | Post.featured_image_url | public function featured_image_url( $size = 'thumbnail', $default = '' ) {
$featured_image = \get_the_post_thumbnail_url( $this->id(), $size );
return ( false !== $featured_image ) ? $featured_image : $default;
} | php | public function featured_image_url( $size = 'thumbnail', $default = '' ) {
$featured_image = \get_the_post_thumbnail_url( $this->id(), $size );
return ( false !== $featured_image ) ? $featured_image : $default;
} | [
"public",
"function",
"featured_image_url",
"(",
"$",
"size",
"=",
"'thumbnail'",
",",
"$",
"default",
"=",
"''",
")",
"{",
"$",
"featured_image",
"=",
"\\",
"get_the_post_thumbnail_url",
"(",
"$",
"this",
"->",
"id",
"(",
")",
",",
"$",
"size",
")",
";"... | Returns Featured Image URL.
@param string $size
@param string $default
@return false|string | [
"Returns",
"Featured",
"Image",
"URL",
"."
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L153-L156 |
24,647 | varunsridharan/wp-post | src/Post.php | Post.parent | public function parent( $only_id = true ) {
if ( $only_id ) {
return $this->post->post_parent;
}
$class = get_called_class();
return new $class( $this->post->post_parent );
} | php | public function parent( $only_id = true ) {
if ( $only_id ) {
return $this->post->post_parent;
}
$class = get_called_class();
return new $class( $this->post->post_parent );
} | [
"public",
"function",
"parent",
"(",
"$",
"only_id",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"only_id",
")",
"{",
"return",
"$",
"this",
"->",
"post",
"->",
"post_parent",
";",
"}",
"$",
"class",
"=",
"get_called_class",
"(",
")",
";",
"return",
"new"... | Returns Post Parent.
@param boolean $only_id
@return int | [
"Returns",
"Post",
"Parent",
"."
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L224-L230 |
24,648 | varunsridharan/wp-post | src/Post.php | Post.update_meta | public function update_meta( $meta_key = '', $values = '', $prev_values = '' ) {
return \update_post_meta( $this->id(), $meta_key, $values, $prev_values );
} | php | public function update_meta( $meta_key = '', $values = '', $prev_values = '' ) {
return \update_post_meta( $this->id(), $meta_key, $values, $prev_values );
} | [
"public",
"function",
"update_meta",
"(",
"$",
"meta_key",
"=",
"''",
",",
"$",
"values",
"=",
"''",
",",
"$",
"prev_values",
"=",
"''",
")",
"{",
"return",
"\\",
"update_post_meta",
"(",
"$",
"this",
"->",
"id",
"(",
")",
",",
"$",
"meta_key",
",",
... | Updates Post Meta.
@param string $meta_key
@param string $values
@param string $prev_values
@return bool|int | [
"Updates",
"Post",
"Meta",
"."
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L313-L315 |
24,649 | varunsridharan/wp-post | src/Post.php | Post.add_meta | public function add_meta( $meta_key = '', $values = '', $unique = false ) {
return \add_post_meta( $this->id(), $meta_key, $values, $unique );
} | php | public function add_meta( $meta_key = '', $values = '', $unique = false ) {
return \add_post_meta( $this->id(), $meta_key, $values, $unique );
} | [
"public",
"function",
"add_meta",
"(",
"$",
"meta_key",
"=",
"''",
",",
"$",
"values",
"=",
"''",
",",
"$",
"unique",
"=",
"false",
")",
"{",
"return",
"\\",
"add_post_meta",
"(",
"$",
"this",
"->",
"id",
"(",
")",
",",
"$",
"meta_key",
",",
"$",
... | Adds Post Meta.
@param string $meta_key
@param string $values
@param boolean|bool $unique
@return bool|int | [
"Adds",
"Post",
"Meta",
"."
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L326-L328 |
24,650 | varunsridharan/wp-post | src/Post.php | Post.taxonomies | public function taxonomies() {
if ( ! empty( $this->taxes ) ) {
return $this->taxes;
}
$taxes = \get_post_taxonomies( $this->post );
$this->taxes = $taxes;
return $this->taxes;
} | php | public function taxonomies() {
if ( ! empty( $this->taxes ) ) {
return $this->taxes;
}
$taxes = \get_post_taxonomies( $this->post );
$this->taxes = $taxes;
return $this->taxes;
} | [
"public",
"function",
"taxonomies",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"taxes",
")",
")",
"{",
"return",
"$",
"this",
"->",
"taxes",
";",
"}",
"$",
"taxes",
"=",
"\\",
"get_post_taxonomies",
"(",
"$",
"this",
"->",
"pos... | Returns All Post Taxonomies.
@return array | [
"Returns",
"All",
"Post",
"Taxonomies",
"."
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L351-L358 |
24,651 | varunsridharan/wp-post | src/Post.php | Post.get_terms | public function get_terms( $taxonomy = '', $args = array() ) {
if ( isset( $this->{$taxonomy} ) && empty( $args ) ) {
return $this->{$taxonomy};
} else {
$name = $taxonomy . '_' . md5( json_encode( $args ) );
if ( isset( $this->{$name} ) ) {
return $this->{$name};
}
$data = \wp_get_post_... | php | public function get_terms( $taxonomy = '', $args = array() ) {
if ( isset( $this->{$taxonomy} ) && empty( $args ) ) {
return $this->{$taxonomy};
} else {
$name = $taxonomy . '_' . md5( json_encode( $args ) );
if ( isset( $this->{$name} ) ) {
return $this->{$name};
}
$data = \wp_get_post_... | [
"public",
"function",
"get_terms",
"(",
"$",
"taxonomy",
"=",
"''",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"{",
"$",
"taxonomy",
"}",
")",
"&&",
"empty",
"(",
"$",
"args",
")",
")",
"{",
... | Returns All Terms From Post.
@param string $taxonomy
@param array $args
@return array|\WP_Error | [
"Returns",
"All",
"Terms",
"From",
"Post",
"."
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L368-L380 |
24,652 | varunsridharan/wp-post | src/Post.php | Post.set_terms | public function set_terms( $terms = array(), $taxonomy = '', $append = false ) {
return \wp_set_post_terms( $this->id(), $terms, $taxonomy, $append );
} | php | public function set_terms( $terms = array(), $taxonomy = '', $append = false ) {
return \wp_set_post_terms( $this->id(), $terms, $taxonomy, $append );
} | [
"public",
"function",
"set_terms",
"(",
"$",
"terms",
"=",
"array",
"(",
")",
",",
"$",
"taxonomy",
"=",
"''",
",",
"$",
"append",
"=",
"false",
")",
"{",
"return",
"\\",
"wp_set_post_terms",
"(",
"$",
"this",
"->",
"id",
"(",
")",
",",
"$",
"terms... | Sets Given Terms With Tax To The Current Post.
@param array $terms
@param string $taxonomy
@param bool $append
@return array|false|\WP_Error | [
"Sets",
"Given",
"Terms",
"With",
"Tax",
"To",
"The",
"Current",
"Post",
"."
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L391-L393 |
24,653 | varunsridharan/wp-post | src/Post.php | Post.in | public function in( $key = '', $data = '', $default = false ) {
if ( is_array( $data ) ) {
return ( in_array( $key, $data ) ) ? $key : $default;
}
if ( isset( $this->{$data} ) ) {
return ( in_array( $key, $this->{$data} ) ) ? $key : $default;
}
return $default;
} | php | public function in( $key = '', $data = '', $default = false ) {
if ( is_array( $data ) ) {
return ( in_array( $key, $data ) ) ? $key : $default;
}
if ( isset( $this->{$data} ) ) {
return ( in_array( $key, $this->{$data} ) ) ? $key : $default;
}
return $default;
} | [
"public",
"function",
"in",
"(",
"$",
"key",
"=",
"''",
",",
"$",
"data",
"=",
"''",
",",
"$",
"default",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"(",
"in_array",
"(",
"$",
"key",
",",
"$",
"d... | Checks if given key is in array
@uses \in_array()
@uses \VS_WP_Post
@example in('somekey','post_category','no') post_category will be taken from post data.
@example in('somekey',array('somekey' => 'somekey'), will be used the given array.
@param string $key
@param string $data
@param bool $default
@return bool|st... | [
"Checks",
"if",
"given",
"key",
"is",
"in",
"array"
] | 064bdc55c945b08480c841c1b99502eb8df148e1 | https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L415-L423 |
24,654 | linpax/microphp-framework | src/cli/CliApplication.php | CliApplication.doException | protected function doException(\Exception $e)
{
$command = new DefaultConsoleCommand();
$command->data = '"Error #' . $e->getCode() . ' - ' . $e->getMessage() . '"';
$command->execute();
$response = (new ResponseInjector)->build();
$response = $response->withHeader('status',... | php | protected function doException(\Exception $e)
{
$command = new DefaultConsoleCommand();
$command->data = '"Error #' . $e->getCode() . ' - ' . $e->getMessage() . '"';
$command->execute();
$response = (new ResponseInjector)->build();
$response = $response->withHeader('status',... | [
"protected",
"function",
"doException",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"command",
"=",
"new",
"DefaultConsoleCommand",
"(",
")",
";",
"$",
"command",
"->",
"data",
"=",
"'\"Error #'",
".",
"$",
"e",
"->",
"getCode",
"(",
")",
".",
"' ... | Run application with error
@param \Exception $e
@return ResponseInterface
@throws \InvalidArgumentException|\RuntimeException|Exception | [
"Run",
"application",
"with",
"error"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/cli/CliApplication.php#L30-L43 |
24,655 | Wedeto/Util | src/DI/DI.php | DI.startNewContext | public static function startNewContext(string $name, bool $inherit = true)
{
if ($inherit)
{
$current = static::getInjector();
$new_injector = new Injector($current);
}
else
$new_injector = new Injector();
return static::$injectors[$name] ... | php | public static function startNewContext(string $name, bool $inherit = true)
{
if ($inherit)
{
$current = static::getInjector();
$new_injector = new Injector($current);
}
else
$new_injector = new Injector();
return static::$injectors[$name] ... | [
"public",
"static",
"function",
"startNewContext",
"(",
"string",
"$",
"name",
",",
"bool",
"$",
"inherit",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"inherit",
")",
"{",
"$",
"current",
"=",
"static",
"::",
"getInjector",
"(",
")",
";",
"$",
"new_injecto... | Start a new injection context. Useful to be able to release
all static context to a certain run of the software, for example
in testing.
@param string $name A name for the injection context
@param bool $inherit True to inherit instances from the current injector,
false to start with an empty set. | [
"Start",
"a",
"new",
"injection",
"context",
".",
"Useful",
"to",
"be",
"able",
"to",
"release",
"all",
"static",
"context",
"to",
"a",
"certain",
"run",
"of",
"the",
"software",
"for",
"example",
"in",
"testing",
"."
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/DI.php#L63-L74 |
24,656 | Wedeto/Util | src/DI/DI.php | DI.destroyContext | public static function destroyContext(string $name)
{
end(static::$injectors);
if ($name !== key(static::$injectors))
throw new DIException("Injection context $name is not at top of the stack");
$injector = array_pop(static::$injectors);
} | php | public static function destroyContext(string $name)
{
end(static::$injectors);
if ($name !== key(static::$injectors))
throw new DIException("Injection context $name is not at top of the stack");
$injector = array_pop(static::$injectors);
} | [
"public",
"static",
"function",
"destroyContext",
"(",
"string",
"$",
"name",
")",
"{",
"end",
"(",
"static",
"::",
"$",
"injectors",
")",
";",
"if",
"(",
"$",
"name",
"!==",
"key",
"(",
"static",
"::",
"$",
"injectors",
")",
")",
"throw",
"new",
"DI... | Destroy a context - the injector at the top of the stack
is released.
@param string $name The name of the injection context
@throws DIException When the injection context is not at the top of the stack | [
"Destroy",
"a",
"context",
"-",
"the",
"injector",
"at",
"the",
"top",
"of",
"the",
"stack",
"is",
"released",
"."
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/DI.php#L83-L90 |
24,657 | g4code/utility | src/Cleaner.php | Cleaner.getHtml | public function getHtml($variable, $default = '', $allowed = "", $escape = true)
{
return (string) rawurldecode($this->get($variable, $default, $allowed, $escape));
} | php | public function getHtml($variable, $default = '', $allowed = "", $escape = true)
{
return (string) rawurldecode($this->get($variable, $default, $allowed, $escape));
} | [
"public",
"function",
"getHtml",
"(",
"$",
"variable",
",",
"$",
"default",
"=",
"''",
",",
"$",
"allowed",
"=",
"\"\"",
",",
"$",
"escape",
"=",
"true",
")",
"{",
"return",
"(",
"string",
")",
"rawurldecode",
"(",
"$",
"this",
"->",
"get",
"(",
"$... | Same as _get, but it rawurldecodes the string
@param mixed $variable - variable
@param mixed $default - default value if variable not set
@param mixed $allowed - array of allowed values
@param bool $escape - escape quotes
@return string | [
"Same",
"as",
"_get",
"but",
"it",
"rawurldecodes",
"the",
"string"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L62-L65 |
24,658 | g4code/utility | src/Cleaner.php | Cleaner.getString | public function getString($variable, $default = '', $allowed = "", $escape = true)
{
return (string) strip_tags($this->getHtml($variable, $default, $allowed, $escape));
} | php | public function getString($variable, $default = '', $allowed = "", $escape = true)
{
return (string) strip_tags($this->getHtml($variable, $default, $allowed, $escape));
} | [
"public",
"function",
"getString",
"(",
"$",
"variable",
",",
"$",
"default",
"=",
"''",
",",
"$",
"allowed",
"=",
"\"\"",
",",
"$",
"escape",
"=",
"true",
")",
"{",
"return",
"(",
"string",
")",
"strip_tags",
"(",
"$",
"this",
"->",
"getHtml",
"(",
... | Same as _getHtml, but it also strips tags
@param mixed $variable - variable
@param mixed $default - default value if variable not set
@param mixed $allowed - array of allowed values
@param bool $escape - escape quotes
@return string | [
"Same",
"as",
"_getHtml",
"but",
"it",
"also",
"strips",
"tags"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L76-L79 |
24,659 | g4code/utility | src/Cleaner.php | Cleaner.getBool | public function getBool($variable, $default = false)
{
return (bool) $this->get($variable, $default, array(false, true), false);
} | php | public function getBool($variable, $default = false)
{
return (bool) $this->get($variable, $default, array(false, true), false);
} | [
"public",
"function",
"getBool",
"(",
"$",
"variable",
",",
"$",
"default",
"=",
"false",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"get",
"(",
"$",
"variable",
",",
"$",
"default",
",",
"array",
"(",
"false",
",",
"true",
")",
",",
... | Same as _get but casts return value to bollean
@access public
@param mixed $variable - variable
@return bool | [
"Same",
"as",
"_get",
"but",
"casts",
"return",
"value",
"to",
"bollean"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L116-L119 |
24,660 | g4code/utility | src/Cleaner.php | Cleaner.htmlEncode | public function htmlEncode($string, $quoteStyle = ENT_QUOTES, $charset = 'UTF-8', $doubleEncode = false)
{
return htmlspecialchars((string) $string, $quoteStyle, $charset, $doubleEncode);
} | php | public function htmlEncode($string, $quoteStyle = ENT_QUOTES, $charset = 'UTF-8', $doubleEncode = false)
{
return htmlspecialchars((string) $string, $quoteStyle, $charset, $doubleEncode);
} | [
"public",
"function",
"htmlEncode",
"(",
"$",
"string",
",",
"$",
"quoteStyle",
"=",
"ENT_QUOTES",
",",
"$",
"charset",
"=",
"'UTF-8'",
",",
"$",
"doubleEncode",
"=",
"false",
")",
"{",
"return",
"htmlspecialchars",
"(",
"(",
"string",
")",
"$",
"string",
... | Replacement for htmlspecialchars
@param string $string
@param int $quoteStyle default ENT_QUOTES
@param string $charset default UTF-8
@param bool $doubleEncode - when double_encode is turned off PHP will not encode existing html entities
@return string | [
"Replacement",
"for",
"htmlspecialchars"
] | e0c9138aab61a53d88f32bb66201b075f3f44f1d | https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L184-L187 |
24,661 | stubbles/stubbles-dbal | src/main/php/Database.php | Database.query | public function query(string $sql, array $values = []): int
{
return $this->dbConnection->prepare($sql)
->execute($values)
->count();
} | php | public function query(string $sql, array $values = []): int
{
return $this->dbConnection->prepare($sql)
->execute($values)
->count();
} | [
"public",
"function",
"query",
"(",
"string",
"$",
"sql",
",",
"array",
"$",
"values",
"=",
"[",
"]",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"dbConnection",
"->",
"prepare",
"(",
"$",
"sql",
")",
"->",
"execute",
"(",
"$",
"values",
")"... | sends a query to the database and returns amount of affected records
@param string $sql
@param array $values
@return int
@since 3.1.0 | [
"sends",
"a",
"query",
"to",
"the",
"database",
"and",
"returns",
"amount",
"of",
"affected",
"records"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L57-L62 |
24,662 | stubbles/stubbles-dbal | src/main/php/Database.php | Database.fetchOne | public function fetchOne(string $sql, array $values = [], int $columnNumber = 0): string
{
return $this->dbConnection->prepare($sql)
->execute($values)
->fetchOne($columnNumber);
} | php | public function fetchOne(string $sql, array $values = [], int $columnNumber = 0): string
{
return $this->dbConnection->prepare($sql)
->execute($values)
->fetchOne($columnNumber);
} | [
"public",
"function",
"fetchOne",
"(",
"string",
"$",
"sql",
",",
"array",
"$",
"values",
"=",
"[",
"]",
",",
"int",
"$",
"columnNumber",
"=",
"0",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"dbConnection",
"->",
"prepare",
"(",
"$",
"sql"... | fetch single value from a result set
@param string $sql sql query to fetch data with
@param array $values map of values in case $sql contains a prepared statement
@param int $columnNumber optional the column number to fetch, default is first column
@return string
@throws \stubbles\d... | [
"fetch",
"single",
"value",
"from",
"a",
"result",
"set"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L74-L79 |
24,663 | stubbles/stubbles-dbal | src/main/php/Database.php | Database.fetchAll | public function fetchAll(
string $sql,
array $values = [],
int $fetchMode = null,
array $driverOptions = []
): Sequence {
return Sequence::of(new QueryResultIterator(
$this->dbConnection->prepare($sql)->execute($values),
$fetchM... | php | public function fetchAll(
string $sql,
array $values = [],
int $fetchMode = null,
array $driverOptions = []
): Sequence {
return Sequence::of(new QueryResultIterator(
$this->dbConnection->prepare($sql)->execute($values),
$fetchM... | [
"public",
"function",
"fetchAll",
"(",
"string",
"$",
"sql",
",",
"array",
"$",
"values",
"=",
"[",
"]",
",",
"int",
"$",
"fetchMode",
"=",
"null",
",",
"array",
"$",
"driverOptions",
"=",
"[",
"]",
")",
":",
"Sequence",
"{",
"return",
"Sequence",
":... | return all result rows for given sql query
Allows to fetch all results for a query at once.
<code>
$blockedUsers = $database->fetchAll('SELECT * FROM users WHERE status = "blocked"');
</code>
Now $blockedUsers contains all rows from the query.
@param string $sql sql query to fetch data with
@param arr... | [
"return",
"all",
"result",
"rows",
"for",
"given",
"sql",
"query"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L96-L107 |
24,664 | stubbles/stubbles-dbal | src/main/php/Database.php | Database.fetchRow | public function fetchRow(
string $sql,
array $values = [],
int $fetchMode = null,
array $driverOptions = []
): array {
return $this->dbConnection->prepare($sql)
->execute($values)
->fetch($fetchMode, $driverOptions);
} | php | public function fetchRow(
string $sql,
array $values = [],
int $fetchMode = null,
array $driverOptions = []
): array {
return $this->dbConnection->prepare($sql)
->execute($values)
->fetch($fetchMode, $driverOptions);
} | [
"public",
"function",
"fetchRow",
"(",
"string",
"$",
"sql",
",",
"array",
"$",
"values",
"=",
"[",
"]",
",",
"int",
"$",
"fetchMode",
"=",
"null",
",",
"array",
"$",
"driverOptions",
"=",
"[",
"]",
")",
":",
"array",
"{",
"return",
"$",
"this",
"-... | returns first result row for given sql query
@param string $sql sql query to fetch data with
@param array $values map of values in case $sql contains a prepared statement
@param int $fetchMode optional the mode to use for fetching the data
@param array $driverOptions optional... | [
"returns",
"first",
"result",
"row",
"for",
"given",
"sql",
"query"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L119-L128 |
24,665 | stubbles/stubbles-dbal | src/main/php/Database.php | Database.fetchColumn | public function fetchColumn(
string $sql,
array $values = [],
int $columnIndex = 0
): Sequence {
return $this->fetchAll(
$sql,
$values,
\PDO::FETCH_COLUMN,
['columnIndex' => $columnIndex]
);
} | php | public function fetchColumn(
string $sql,
array $values = [],
int $columnIndex = 0
): Sequence {
return $this->fetchAll(
$sql,
$values,
\PDO::FETCH_COLUMN,
['columnIndex' => $columnIndex]
);
} | [
"public",
"function",
"fetchColumn",
"(",
"string",
"$",
"sql",
",",
"array",
"$",
"values",
"=",
"[",
"]",
",",
"int",
"$",
"columnIndex",
"=",
"0",
")",
":",
"Sequence",
"{",
"return",
"$",
"this",
"->",
"fetchAll",
"(",
"$",
"sql",
",",
"$",
"va... | return a list with all rows from given result
Allows to map the result into a list of values from one single column:
<code>
$userNames = $database->fetchColumn('SELECT username FROM users WHERE status = "blocked"');
</code>
@param string $sql sql query to fetch data with
@param array $values map... | [
"return",
"a",
"list",
"with",
"all",
"rows",
"from",
"given",
"result"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L143-L154 |
24,666 | Innmind/Math | src/Regression/LinearRegression.php | LinearRegression.compute | private function compute(Dataset $data): array
{
$dimension = $data->dimension()->rows();
$elements = $dimension->value();
$x = $data->abscissas()->toArray();
$y = $data->ordinates()->toArray();
$xSum = $data->abscissas()->sum();
$ySum = $data->ordinates()->sum();
... | php | private function compute(Dataset $data): array
{
$dimension = $data->dimension()->rows();
$elements = $dimension->value();
$x = $data->abscissas()->toArray();
$y = $data->ordinates()->toArray();
$xSum = $data->abscissas()->sum();
$ySum = $data->ordinates()->sum();
... | [
"private",
"function",
"compute",
"(",
"Dataset",
"$",
"data",
")",
":",
"array",
"{",
"$",
"dimension",
"=",
"$",
"data",
"->",
"dimension",
"(",
")",
"->",
"rows",
"(",
")",
";",
"$",
"elements",
"=",
"$",
"dimension",
"->",
"value",
"(",
")",
";... | Determine the slope and intercept for the given dataset
@see https://richardathome.wordpress.com/2006/01/25/a-php-linear-regression-function/
@param Dataset $data
@return array | [
"Determine",
"the",
"slope",
"and",
"intercept",
"for",
"the",
"given",
"dataset"
] | ac9ad4dd1852c145e90f5edc0f38a873b125a50b | https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Regression/LinearRegression.php#L80-L116 |
24,667 | drdplusinfo/drdplus-skills | DrdPlus/Skills/Skills.php | Skills.getMalusToBaseOfWoundsWithWeaponlike | public function getMalusToBaseOfWoundsWithWeaponlike(
WeaponlikeCode $weaponlikeCode,
Tables $tables,
bool $fightsWithTwoWeapons
): int
{
if ($weaponlikeCode->isMelee() || $weaponlikeCode->isThrowingWeapon()) {
return $this->getPhysicalSkills()->getMalusToBaseOfWounds... | php | public function getMalusToBaseOfWoundsWithWeaponlike(
WeaponlikeCode $weaponlikeCode,
Tables $tables,
bool $fightsWithTwoWeapons
): int
{
if ($weaponlikeCode->isMelee() || $weaponlikeCode->isThrowingWeapon()) {
return $this->getPhysicalSkills()->getMalusToBaseOfWounds... | [
"public",
"function",
"getMalusToBaseOfWoundsWithWeaponlike",
"(",
"WeaponlikeCode",
"$",
"weaponlikeCode",
",",
"Tables",
"$",
"tables",
",",
"bool",
"$",
"fightsWithTwoWeapons",
")",
":",
"int",
"{",
"if",
"(",
"$",
"weaponlikeCode",
"->",
"isMelee",
"(",
")",
... | If you want to use shield as a PROTECTIVE item, there is no base of wounds malus from that.
@param WeaponlikeCode $weaponlikeCode
@param Tables $tables
@param bool $fightsWithTwoWeapons
@return int
@throws Exceptions\UnknownTypeOfWeapon | [
"If",
"you",
"want",
"to",
"use",
"shield",
"as",
"a",
"PROTECTIVE",
"item",
"there",
"is",
"no",
"base",
"of",
"wounds",
"malus",
"from",
"that",
"."
] | 9ae6ecdbaadf594d6572ec0c190fc13572c0a53f | https://github.com/drdplusinfo/drdplus-skills/blob/9ae6ecdbaadf594d6572ec0c190fc13572c0a53f/DrdPlus/Skills/Skills.php#L685-L704 |
24,668 | thomasez/BisonLabSakonninBundle | EventListener/SakonninFileListener.php | SakonninFileListener.preRemove | public function preRemove(EventArgs $args)
{
$entity = $args->getEntity();
if ($entity instanceof SakonninFile) {
// VichUploader removes this property when it removes the file,
// alas I need to store it somehow.
$this->removes[] = $entity->getStoredAs();
}
... | php | public function preRemove(EventArgs $args)
{
$entity = $args->getEntity();
if ($entity instanceof SakonninFile) {
// VichUploader removes this property when it removes the file,
// alas I need to store it somehow.
$this->removes[] = $entity->getStoredAs();
}
... | [
"public",
"function",
"preRemove",
"(",
"EventArgs",
"$",
"args",
")",
"{",
"$",
"entity",
"=",
"$",
"args",
"->",
"getEntity",
"(",
")",
";",
"if",
"(",
"$",
"entity",
"instanceof",
"SakonninFile",
")",
"{",
"// VichUploader removes this property when it remove... | Ensures a proxy will be usable in the postRemove.
@param EventArgs $event The event. | [
"Ensures",
"a",
"proxy",
"will",
"be",
"usable",
"in",
"the",
"postRemove",
"."
] | 45ca7ce9874c4a2be7b503d7067b3d11d2b518cb | https://github.com/thomasez/BisonLabSakonninBundle/blob/45ca7ce9874c4a2be7b503d7067b3d11d2b518cb/EventListener/SakonninFileListener.php#L45-L53 |
24,669 | NukaCode/Front-End-Bootstrap | src/NukaCode/Bootstrap/Filesystem/Less/Variables.php | Variables.updateEntry | public function updateEntry($package)
{
$this->verifyCommand($package);
$lines = file($this->less);
// Set the new colors
$lines[0] = '@bg: ' . $package['bg'] . ";\n";
$lines[1] = '@gray: ' . $package['gray'] . ";\n";
$lines[2] = '@brand-primary: ' . $package['primary'] . ... | php | public function updateEntry($package)
{
$this->verifyCommand($package);
$lines = file($this->less);
// Set the new colors
$lines[0] = '@bg: ' . $package['bg'] . ";\n";
$lines[1] = '@gray: ' . $package['gray'] . ";\n";
$lines[2] = '@brand-primary: ' . $package['primary'] . ... | [
"public",
"function",
"updateEntry",
"(",
"$",
"package",
")",
"{",
"$",
"this",
"->",
"verifyCommand",
"(",
"$",
"package",
")",
";",
"$",
"lines",
"=",
"file",
"(",
"$",
"this",
"->",
"less",
")",
";",
"// Set the new colors",
"$",
"lines",
"[",
"0",... | Update the colors.less file to persist the changes
@param $package | [
"Update",
"the",
"colors",
".",
"less",
"file",
"to",
"persist",
"the",
"changes"
] | 46c30fba4c77afb74ec4a4d70c43c9cffd464d6e | https://github.com/NukaCode/Front-End-Bootstrap/blob/46c30fba4c77afb74ec4a4d70c43c9cffd464d6e/src/NukaCode/Bootstrap/Filesystem/Less/Variables.php#L36-L54 |
24,670 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Compiler/Compiler.php | Compiler.getLoggingFormatter | public function getLoggingFormatter()
{
if (null === $this->loggingFormatter) {
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), E_USER_DEPRECATED);
$this->loggingFormat... | php | public function getLoggingFormatter()
{
if (null === $this->loggingFormatter) {
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), E_USER_DEPRECATED);
$this->loggingFormat... | [
"public",
"function",
"getLoggingFormatter",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"loggingFormatter",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerB... | Returns the logging formatter which can be used by compilation passes.
@return LoggingFormatter
@deprecated since version 3.3, to be removed in 4.0. Use the ContainerBuilder::log() method instead. | [
"Returns",
"the",
"logging",
"formatter",
"which",
"can",
"be",
"used",
"by",
"compilation",
"passes",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php#L62-L71 |
24,671 | creios/creiwork-framework | src/Util/JsonValidator.php | JsonValidator.validateJson | public function validateJson(string $json, string $schemaName): ValidationResult
{
$schemaDir = $this->config->get('schema-dir');
$schemaPath = $this->configDirectoryPath.$schemaDir.'/'.$schemaName.'.json';
if(!file_exists($schemaPath)){
throw new FileNotFoundException("File $sch... | php | public function validateJson(string $json, string $schemaName): ValidationResult
{
$schemaDir = $this->config->get('schema-dir');
$schemaPath = $this->configDirectoryPath.$schemaDir.'/'.$schemaName.'.json';
if(!file_exists($schemaPath)){
throw new FileNotFoundException("File $sch... | [
"public",
"function",
"validateJson",
"(",
"string",
"$",
"json",
",",
"string",
"$",
"schemaName",
")",
":",
"ValidationResult",
"{",
"$",
"schemaDir",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'schema-dir'",
")",
";",
"$",
"schemaPath",
"=",
... | Validates JSON strings against a schema.
@param string $json
@param string $schemaName Name of the .json file providing the schema (without file extension)
@return ValidationResult | [
"Validates",
"JSON",
"strings",
"against",
"a",
"schema",
"."
] | 5089578b44ef6af725ab0c8a2dfe691bfe07ffb6 | https://github.com/creios/creiwork-framework/blob/5089578b44ef6af725ab0c8a2dfe691bfe07ffb6/src/Util/JsonValidator.php#L84-L106 |
24,672 | agentmedia/phine-core | src/Core/Logic/Installation/BundleInstaller.php | BundleInstaller.ExecuteSql | function ExecuteSql()
{
$versionCompare = version_compare($this->installedVersion, $this->manifest->Version());
if ($versionCompare > 0)
{
$bundle = $this->manifest->BundleName();
throw new \Exception("Error instaling bundle $bundle: Previously installed versi... | php | function ExecuteSql()
{
$versionCompare = version_compare($this->installedVersion, $this->manifest->Version());
if ($versionCompare > 0)
{
$bundle = $this->manifest->BundleName();
throw new \Exception("Error instaling bundle $bundle: Previously installed versi... | [
"function",
"ExecuteSql",
"(",
")",
"{",
"$",
"versionCompare",
"=",
"version_compare",
"(",
"$",
"this",
"->",
"installedVersion",
",",
"$",
"this",
"->",
"manifest",
"->",
"Version",
"(",
")",
")",
";",
"if",
"(",
"$",
"versionCompare",
">",
"0",
")",
... | Executes all necessary sql scripts | [
"Executes",
"all",
"necessary",
"sql",
"scripts"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Installation/BundleInstaller.php#L52-L71 |
24,673 | agentmedia/phine-core | src/Core/Logic/Installation/BundleInstaller.php | BundleInstaller.ExecuteScripts | private function ExecuteScripts($engineFolder)
{
$files = $this->SortFilesByVersion(Folder::GetFiles($engineFolder));
$completeSql = '';
foreach ($files as $file)
{
$sqlFile = Path::Combine($engineFolder, $file);
$completeSql .= "\r\n" . File::GetCont... | php | private function ExecuteScripts($engineFolder)
{
$files = $this->SortFilesByVersion(Folder::GetFiles($engineFolder));
$completeSql = '';
foreach ($files as $file)
{
$sqlFile = Path::Combine($engineFolder, $file);
$completeSql .= "\r\n" . File::GetCont... | [
"private",
"function",
"ExecuteScripts",
"(",
"$",
"engineFolder",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"SortFilesByVersion",
"(",
"Folder",
"::",
"GetFiles",
"(",
"$",
"engineFolder",
")",
")",
";",
"$",
"completeSql",
"=",
"''",
";",
"foreach"... | Executes all necessary scripts in the engine folder
@param string $engineFolder The folder
@throws \Exception Raises error if any of the scripts fail | [
"Executes",
"all",
"necessary",
"scripts",
"in",
"the",
"engine",
"folder"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Installation/BundleInstaller.php#L78-L101 |
24,674 | agentmedia/phine-core | src/Core/Logic/Installation/BundleInstaller.php | BundleInstaller.CleanForeignKeys | private function CleanForeignKeys($table)
{
$foreignKeys = $this->connection->GetForeignKeys($table);
foreach ($foreignKeys as $foreignKey)
{
$this->connection->DropForeignKey($table, $foreignKey);
}
} | php | private function CleanForeignKeys($table)
{
$foreignKeys = $this->connection->GetForeignKeys($table);
foreach ($foreignKeys as $foreignKey)
{
$this->connection->DropForeignKey($table, $foreignKey);
}
} | [
"private",
"function",
"CleanForeignKeys",
"(",
"$",
"table",
")",
"{",
"$",
"foreignKeys",
"=",
"$",
"this",
"->",
"connection",
"->",
"GetForeignKeys",
"(",
"$",
"table",
")",
";",
"foreach",
"(",
"$",
"foreignKeys",
"as",
"$",
"foreignKey",
")",
"{",
... | Cleans all foreign keys of a table
@param strign $table The table name | [
"Cleans",
"all",
"foreign",
"keys",
"of",
"a",
"table"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Installation/BundleInstaller.php#L119-L126 |
24,675 | agentmedia/phine-core | src/Core/Logic/Installation/BundleInstaller.php | BundleInstaller.SortFilesByVersion | private function SortFilesByVersion(array $files)
{
$result = array();
$foreignKeysFile = '';
foreach ($files as $file)
{
if ($file == 'foreign-keys.sql')
{
$foreignKeysFile = $file;
continue;
}
$version ... | php | private function SortFilesByVersion(array $files)
{
$result = array();
$foreignKeysFile = '';
foreach ($files as $file)
{
if ($file == 'foreign-keys.sql')
{
$foreignKeysFile = $file;
continue;
}
$version ... | [
"private",
"function",
"SortFilesByVersion",
"(",
"array",
"$",
"files",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"foreignKeysFile",
"=",
"''",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
... | Sorts files by version
@param string[] $files The files
@return string[] Returns the sorted files | [
"Sorts",
"files",
"by",
"version"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Installation/BundleInstaller.php#L156-L180 |
24,676 | yuncms/yii2-oauth2 | frontend/controllers/ClientController.php | ClientController.actionIndex | public function actionIndex()
{
$query = Client::find()->where(['user_id' => Yii::$app->user->id])->orderBy(['created_at' => SORT_DESC]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
return $this->render('index', [
'dataProvider' => $dataPro... | php | public function actionIndex()
{
$query = Client::find()->where(['user_id' => Yii::$app->user->id])->orderBy(['created_at' => SORT_DESC]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
return $this->render('index', [
'dataProvider' => $dataPro... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"query",
"=",
"Client",
"::",
"find",
"(",
")",
"->",
"where",
"(",
"[",
"'user_id'",
"=>",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"id",
"]",
")",
"->",
"orderBy",
"(",
"[",
"'created_a... | Lists all App models.
@return mixed | [
"Lists",
"all",
"App",
"models",
"."
] | 7fb41fc56d4a6a5f4107aec5429580729257ed3a | https://github.com/yuncms/yii2-oauth2/blob/7fb41fc56d4a6a5f4107aec5429580729257ed3a/frontend/controllers/ClientController.php#L53-L62 |
24,677 | yuncms/yii2-oauth2 | frontend/controllers/ClientController.php | ClientController.actionCreate | public function actionCreate()
{
$model = new Client();
if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
} else if ($model->load(Yii::$app->request->... | php | public function actionCreate()
{
$model = new Client();
if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
} else if ($model->load(Yii::$app->request->... | [
"public",
"function",
"actionCreate",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"Client",
"(",
")",
";",
"if",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"isAjax",
"&&",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"re... | Creates a new Rest model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed | [
"Creates",
"a",
"new",
"Rest",
"model",
".",
"If",
"creation",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] | 7fb41fc56d4a6a5f4107aec5429580729257ed3a | https://github.com/yuncms/yii2-oauth2/blob/7fb41fc56d4a6a5f4107aec5429580729257ed3a/frontend/controllers/ClientController.php#L69-L83 |
24,678 | TiMESPLiNTER/tsFramework | src/ch/timesplinter/core/Core.php | Core.createHttpRequest | protected function createHttpRequest()
{
$protocol = (isset($_SERVER['HTTPS']) === true && $_SERVER['HTTPS'] === 'on') ? HttpRequest::PROTOCOL_HTTPS : HttpRequest::PROTOCOL_HTTP;
$uri = StringUtils::startsWith($_SERVER['REQUEST_URI'], '/index.php')?StringUtils::afterFirst($_SERVER['REQUEST_URI'], '/index.php'):$_S... | php | protected function createHttpRequest()
{
$protocol = (isset($_SERVER['HTTPS']) === true && $_SERVER['HTTPS'] === 'on') ? HttpRequest::PROTOCOL_HTTPS : HttpRequest::PROTOCOL_HTTP;
$uri = StringUtils::startsWith($_SERVER['REQUEST_URI'], '/index.php')?StringUtils::afterFirst($_SERVER['REQUEST_URI'], '/index.php'):$_S... | [
"protected",
"function",
"createHttpRequest",
"(",
")",
"{",
"$",
"protocol",
"=",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTPS'",
"]",
")",
"===",
"true",
"&&",
"$",
"_SERVER",
"[",
"'HTTPS'",
"]",
"===",
"'on'",
")",
"?",
"HttpRequest",
"::",
"PRO... | Creates a HttpRequest object for the current request
@return HttpRequest | [
"Creates",
"a",
"HttpRequest",
"object",
"for",
"the",
"current",
"request"
] | b3b9fd98f6d456a9e571015877ecca203786fd0c | https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/core/Core.php#L95-L133 |
24,679 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.camelTo_ | public static function camelTo_($str) {
if (!is_string($str))
return '';
$str[0] = strtolower($str[0]);
$func = create_function('$c', 'return "_" . strtolower($c[1]);');
return preg_replace_callback('/([A-Z])/', $func, $str);
} | php | public static function camelTo_($str) {
if (!is_string($str))
return '';
$str[0] = strtolower($str[0]);
$func = create_function('$c', 'return "_" . strtolower($c[1]);');
return preg_replace_callback('/([A-Z])/', $func, $str);
} | [
"public",
"static",
"function",
"camelTo_",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"str",
")",
")",
"return",
"''",
";",
"$",
"str",
"[",
"0",
"]",
"=",
"strtolower",
"(",
"$",
"str",
"[",
"0",
"]",
")",
";",
"$",
"... | Turns camelCasedString to under_scored_string
@param string $str
@return string | [
"Turns",
"camelCasedString",
"to",
"under_scored_string"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L24-L30 |
24,680 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.camelToHyphen | public static function camelToHyphen($str, $strtolower = true) {
if (!is_string($str))
return '';
$str[0] = strtolower($str[0]);
$func = create_function('$c', 'return "-" . $c[1];');
$str = preg_replace_callback('/([A-Z])/', $func, $str);
return ($strtolower) ? strtol... | php | public static function camelToHyphen($str, $strtolower = true) {
if (!is_string($str))
return '';
$str[0] = strtolower($str[0]);
$func = create_function('$c', 'return "-" . $c[1];');
$str = preg_replace_callback('/([A-Z])/', $func, $str);
return ($strtolower) ? strtol... | [
"public",
"static",
"function",
"camelToHyphen",
"(",
"$",
"str",
",",
"$",
"strtolower",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"str",
")",
")",
"return",
"''",
";",
"$",
"str",
"[",
"0",
"]",
"=",
"strtolower",
"(",
"$",
... | Turns camelCasedString to hyphened-string
@param string $str
@param boolean $strtolower
@return string | [
"Turns",
"camelCasedString",
"to",
"hyphened",
"-",
"string"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L38-L45 |
24,681 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.camelToSpace | public static function camelToSpace($str) {
if (!is_string($str))
return '';
$str[0] = strtolower($str[0]);
$func = create_function('$c', 'return " " . $c[1];');
return preg_replace_callback('/([A-Z])/', $func, $str);
} | php | public static function camelToSpace($str) {
if (!is_string($str))
return '';
$str[0] = strtolower($str[0]);
$func = create_function('$c', 'return " " . $c[1];');
return preg_replace_callback('/([A-Z])/', $func, $str);
} | [
"public",
"static",
"function",
"camelToSpace",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"str",
")",
")",
"return",
"''",
";",
"$",
"str",
"[",
"0",
"]",
"=",
"strtolower",
"(",
"$",
"str",
"[",
"0",
"]",
")",
";",
"$",... | Turns camelCasedString to spaced out string
@param string $str
@return string | [
"Turns",
"camelCasedString",
"to",
"spaced",
"out",
"string"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L63-L69 |
24,682 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.readDir | public static function readDir($dir, $return = Util::ALL, $recursive = false, $extension = NULL, $nameOnly = false, array $options = array()) {
if (!is_dir($dir))
return array(
'error' => 'Directory "' . $dir . '" does not exist',
);
if (!is_array($extension) && ... | php | public static function readDir($dir, $return = Util::ALL, $recursive = false, $extension = NULL, $nameOnly = false, array $options = array()) {
if (!is_dir($dir))
return array(
'error' => 'Directory "' . $dir . '" does not exist',
);
if (!is_array($extension) && ... | [
"public",
"static",
"function",
"readDir",
"(",
"$",
"dir",
",",
"$",
"return",
"=",
"Util",
"::",
"ALL",
",",
"$",
"recursive",
"=",
"false",
",",
"$",
"extension",
"=",
"NULL",
",",
"$",
"nameOnly",
"=",
"false",
",",
"array",
"$",
"options",
"=",
... | Reads the required source directory
@param string $dir
@param int $return
@param boolean $recursive
@param string|array\null $extension Extensions without the dot (.)
@param boolean $nameOnly Indicates whether to return full path of dirs/files or names only
@param array $options keys include:
@return array
@throws \Exc... | [
"Reads",
"the",
"required",
"source",
"directory"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L107-L151 |
24,683 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.copyDir | public static function copyDir($source, $destination, $permission = 0777, $recursive = true) {
if (substr($source, strlen($destination) - 1) !== DIRECTORY_SEPARATOR)
$destination .= DIRECTORY_SEPARATOR;
try {
if (!is_dir($destination))
mkdir($destination, $permis... | php | public static function copyDir($source, $destination, $permission = 0777, $recursive = true) {
if (substr($source, strlen($destination) - 1) !== DIRECTORY_SEPARATOR)
$destination .= DIRECTORY_SEPARATOR;
try {
if (!is_dir($destination))
mkdir($destination, $permis... | [
"public",
"static",
"function",
"copyDir",
"(",
"$",
"source",
",",
"$",
"destination",
",",
"$",
"permission",
"=",
"0777",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"source",
",",
"strlen",
"(",
"$",
"destination",
... | Copies a directory to another location
@param string $source
@param string $destination
@param string $permission
@param boolean $recursive
@throws \Exception | [
"Copies",
"a",
"directory",
"to",
"another",
"location"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L161-L186 |
24,684 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.delDir | public static function delDir($dir) {
$all = self::readDir($dir, self::ALL, true, NULL);
if (isset($all['files'])) {
foreach ($all['files'] as $file) {
if (is_array($file)) {
foreach ($file as $fil) {
if (!unlink($fil)) {
... | php | public static function delDir($dir) {
$all = self::readDir($dir, self::ALL, true, NULL);
if (isset($all['files'])) {
foreach ($all['files'] as $file) {
if (is_array($file)) {
foreach ($file as $fil) {
if (!unlink($fil)) {
... | [
"public",
"static",
"function",
"delDir",
"(",
"$",
"dir",
")",
"{",
"$",
"all",
"=",
"self",
"::",
"readDir",
"(",
"$",
"dir",
",",
"self",
"::",
"ALL",
",",
"true",
",",
"NULL",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"all",
"[",
"'files'",
"... | Deletes a directory and all contents including subdirectories and files
@param string $file
@return boolean | [
"Deletes",
"a",
"directory",
"and",
"all",
"contents",
"including",
"subdirectories",
"and",
"files"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L194-L229 |
24,685 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.resizeImageDirectory | public static function resizeImageDirectory($dir, $desiredWidth = 200, $overwrite = false, $recursive = true, $subDir = 'resized') {
foreach (self::readDir($dir, self::FILES_ONLY, $recursive, null, true) as $path => $filesArray) {
foreach ($filesArray as $file) {
$destination = null;... | php | public static function resizeImageDirectory($dir, $desiredWidth = 200, $overwrite = false, $recursive = true, $subDir = 'resized') {
foreach (self::readDir($dir, self::FILES_ONLY, $recursive, null, true) as $path => $filesArray) {
foreach ($filesArray as $file) {
$destination = null;... | [
"public",
"static",
"function",
"resizeImageDirectory",
"(",
"$",
"dir",
",",
"$",
"desiredWidth",
"=",
"200",
",",
"$",
"overwrite",
"=",
"false",
",",
"$",
"recursive",
"=",
"true",
",",
"$",
"subDir",
"=",
"'resized'",
")",
"{",
"foreach",
"(",
"self"... | Resize all images in a directory
@param string $dir Directory path of images
@param int $desiredWidth Desired width of new images
@param boolean $overwrite Overwrite old images?
@param boolean $recursive Indicates if subdirectories should be searched too
@param string $subDir If not overwrite, name of subfolder within... | [
"Resize",
"all",
"images",
"in",
"a",
"directory"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L300-L313 |
24,686 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.shortenString | public static function shortenString($str, $length = 75, $break = '...') {
if (strlen($str) < $length)
return $str;
$str = strip_tags($str);
return substr($str, 0, $length) . $break;
} | php | public static function shortenString($str, $length = 75, $break = '...') {
if (strlen($str) < $length)
return $str;
$str = strip_tags($str);
return substr($str, 0, $length) . $break;
} | [
"public",
"static",
"function",
"shortenString",
"(",
"$",
"str",
",",
"$",
"length",
"=",
"75",
",",
"$",
"break",
"=",
"'...'",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"str",
")",
"<",
"$",
"length",
")",
"return",
"$",
"str",
";",
"$",
"str",... | Shortens a string to desired length
@param string $str String to shorten
@param integer $length Length of the string to return
@param string $break String to replace the truncated part with
@return string | [
"Shortens",
"a",
"string",
"to",
"desired",
"length"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L322-L329 |
24,687 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.randomPassword | public static function randomPassword($length = 8, $string = null) {
if (!$string)
$string = 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ123456789&^%$#@!_-+=';
$chars = str_split(str_shuffle($string));
$password = '';
foreach (array_rand($chars, $length) as $key) {
... | php | public static function randomPassword($length = 8, $string = null) {
if (!$string)
$string = 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ123456789&^%$#@!_-+=';
$chars = str_split(str_shuffle($string));
$password = '';
foreach (array_rand($chars, $length) as $key) {
... | [
"public",
"static",
"function",
"randomPassword",
"(",
"$",
"length",
"=",
"8",
",",
"$",
"string",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"string",
")",
"$",
"string",
"=",
"'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ123456789&^%$#@!_-+='",
";",
"$",
"ch... | Generates a random password
@param int $length Length of the password to generate. Default is 8
@return string | [
"Generates",
"a",
"random",
"password"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L401-L410 |
24,688 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.listTimezones | public static function listTimezones() {
if (self::$timezones === null) {
self::$timezones = array();
$offsets = array();
$now = new DateTime();
foreach (DateTimeZone::listIdentifiers() as $timezone) {
$now->setTimezone(new DateTimeZone($timezone)... | php | public static function listTimezones() {
if (self::$timezones === null) {
self::$timezones = array();
$offsets = array();
$now = new DateTime();
foreach (DateTimeZone::listIdentifiers() as $timezone) {
$now->setTimezone(new DateTimeZone($timezone)... | [
"public",
"static",
"function",
"listTimezones",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"timezones",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"timezones",
"=",
"array",
"(",
")",
";",
"$",
"offsets",
"=",
"array",
"(",
")",
";",
"$",
"now"... | Create a list of time zones
@return array | [
"Create",
"a",
"list",
"of",
"time",
"zones"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L448-L464 |
24,689 | ezra-obiwale/dSCore | src/Stdlib/Util.php | Util.formatGmtOffset | public static function formatGmtOffset($offset) {
$hours = intval($offset / 3600);
$minutes = abs(intval($offset % 3600 / 60));
return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
} | php | public static function formatGmtOffset($offset) {
$hours = intval($offset / 3600);
$minutes = abs(intval($offset % 3600 / 60));
return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
} | [
"public",
"static",
"function",
"formatGmtOffset",
"(",
"$",
"offset",
")",
"{",
"$",
"hours",
"=",
"intval",
"(",
"$",
"offset",
"/",
"3600",
")",
";",
"$",
"minutes",
"=",
"abs",
"(",
"intval",
"(",
"$",
"offset",
"%",
"3600",
"/",
"60",
")",
")"... | Formats GMT offset to string
@param string $offset
@return string | [
"Formats",
"GMT",
"offset",
"to",
"string"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Stdlib/Util.php#L471-L475 |
24,690 | swaros/golib | src/Types/Props.php | Props.applyData | public function applyData ( $data = NULL ) {
if (NULL != $data && is_array( $data )) {
foreach ($data as $propName => $propValue) {
$this->assignValue( $propName, $propValue );
}
} else {
$this->buildVars();
}
} | php | public function applyData ( $data = NULL ) {
if (NULL != $data && is_array( $data )) {
foreach ($data as $propName => $propValue) {
$this->assignValue( $propName, $propValue );
}
} else {
$this->buildVars();
}
} | [
"public",
"function",
"applyData",
"(",
"$",
"data",
"=",
"NULL",
")",
"{",
"if",
"(",
"NULL",
"!=",
"$",
"data",
"&&",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"propName",
"=>",
"$",
"propValue",
")",
... | apply given data to properties
@param array $data | [
"apply",
"given",
"data",
"to",
"properties"
] | 9e75c8fb36de7c09b01a6c1c0d27c45f02fed567 | https://github.com/swaros/golib/blob/9e75c8fb36de7c09b01a6c1c0d27c45f02fed567/src/Types/Props.php#L36-L44 |
24,691 | swaros/golib | src/Types/Props.php | Props.assignExisting | public function assignExisting ( $propName, $propValue ) {
if (is_bool( $this->$propName )) {
if (strtolower( $propValue ) == 'false') {
$propValue = false;
}
$this->$propName = (bool) $propValue;
} elseif (is_int( $this->$propName )) {
$th... | php | public function assignExisting ( $propName, $propValue ) {
if (is_bool( $this->$propName )) {
if (strtolower( $propValue ) == 'false') {
$propValue = false;
}
$this->$propName = (bool) $propValue;
} elseif (is_int( $this->$propName )) {
$th... | [
"public",
"function",
"assignExisting",
"(",
"$",
"propName",
",",
"$",
"propValue",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"this",
"->",
"$",
"propName",
")",
")",
"{",
"if",
"(",
"strtolower",
"(",
"$",
"propValue",
")",
"==",
"'false'",
")",
"{... | assign value to a existing propertie and
cast depending on defined default value
@param string $propName
@param boolean $propValue | [
"assign",
"value",
"to",
"a",
"existing",
"propertie",
"and",
"cast",
"depending",
"on",
"defined",
"default",
"value"
] | 9e75c8fb36de7c09b01a6c1c0d27c45f02fed567 | https://github.com/swaros/golib/blob/9e75c8fb36de7c09b01a6c1c0d27c45f02fed567/src/Types/Props.php#L61-L76 |
24,692 | swaros/golib | src/Types/Props.php | Props.assignValue | public function assignValue ( $propNameOrig, $propValue ) {
$propNameA = str_replace( self::$replaceChars, '_', $propNameOrig );
$propName = preg_replace( "/[^A-Za-z0-9_]/", "", $propNameA );
if (property_exists( $this, $propName ) && $this->$propName !== NULL) {
$this->assignExistin... | php | public function assignValue ( $propNameOrig, $propValue ) {
$propNameA = str_replace( self::$replaceChars, '_', $propNameOrig );
$propName = preg_replace( "/[^A-Za-z0-9_]/", "", $propNameA );
if (property_exists( $this, $propName ) && $this->$propName !== NULL) {
$this->assignExistin... | [
"public",
"function",
"assignValue",
"(",
"$",
"propNameOrig",
",",
"$",
"propValue",
")",
"{",
"$",
"propNameA",
"=",
"str_replace",
"(",
"self",
"::",
"$",
"replaceChars",
",",
"'_'",
",",
"$",
"propNameOrig",
")",
";",
"$",
"propName",
"=",
"preg_replac... | main assign value method.
@param string $propNameOrig
@param mixed $propValue | [
"main",
"assign",
"value",
"method",
"."
] | 9e75c8fb36de7c09b01a6c1c0d27c45f02fed567 | https://github.com/swaros/golib/blob/9e75c8fb36de7c09b01a6c1c0d27c45f02fed567/src/Types/Props.php#L84-L92 |
24,693 | libreworks/caridea-auth | src/Service.php | Service.getPrincipal | public function getPrincipal(): Principal
{
if ($this->principal === null && !$this->resume()) {
$this->principal = Principal::getAnonymous();
}
return $this->principal;
} | php | public function getPrincipal(): Principal
{
if ($this->principal === null && !$this->resume()) {
$this->principal = Principal::getAnonymous();
}
return $this->principal;
} | [
"public",
"function",
"getPrincipal",
"(",
")",
":",
"Principal",
"{",
"if",
"(",
"$",
"this",
"->",
"principal",
"===",
"null",
"&&",
"!",
"$",
"this",
"->",
"resume",
"(",
")",
")",
"{",
"$",
"this",
"->",
"principal",
"=",
"Principal",
"::",
"getA... | Gets the currently authenticated principal.
If no one is authenticated, this will return an anonymous Principal. If
The session is not started but can be resumed, it will be resumed and the
principal will be loaded.
@return Principal the authenticated principal | [
"Gets",
"the",
"currently",
"authenticated",
"principal",
"."
] | 1bf965c57716942b18ca3204629f6bda99cf876a | https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Service.php#L81-L87 |
24,694 | libreworks/caridea-auth | src/Service.php | Service.login | public function login(ServerRequestInterface $request, ?Adapter $adapter = null): bool
{
$started = $this->session->resume() || $this->session->start();
if (!$started) {
return false;
}
$login = $adapter ?? $this->adapter;
if ($login === null) {
throw... | php | public function login(ServerRequestInterface $request, ?Adapter $adapter = null): bool
{
$started = $this->session->resume() || $this->session->start();
if (!$started) {
return false;
}
$login = $adapter ?? $this->adapter;
if ($login === null) {
throw... | [
"public",
"function",
"login",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"?",
"Adapter",
"$",
"adapter",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"started",
"=",
"$",
"this",
"->",
"session",
"->",
"resume",
"(",
")",
"||",
"$",
"this",
"->",... | Authenticates a principal.
@param ServerRequestInterface $request The Server Request message containing credentials
@param Adapter|null $adapter An optional adapter to use.
Will use the default authentication adapter if none is specified.
@return bool Whether the session could be established
@throws \InvalidArgumentEx... | [
"Authenticates",
"a",
"principal",
"."
] | 1bf965c57716942b18ca3204629f6bda99cf876a | https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Service.php#L103-L129 |
24,695 | libreworks/caridea-auth | src/Service.php | Service.publishLogin | protected function publishLogin(Principal $principal): bool
{
$this->publisher->publish(new Event\Login($this, $principal));
return true;
} | php | protected function publishLogin(Principal $principal): bool
{
$this->publisher->publish(new Event\Login($this, $principal));
return true;
} | [
"protected",
"function",
"publishLogin",
"(",
"Principal",
"$",
"principal",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"publisher",
"->",
"publish",
"(",
"new",
"Event",
"\\",
"Login",
"(",
"$",
"this",
",",
"$",
"principal",
")",
")",
";",
"return",
"... | Publishes the login event.
@param \Caridea\Auth\Principal $principal The authenticated principal
@return bool Always true | [
"Publishes",
"the",
"login",
"event",
"."
] | 1bf965c57716942b18ca3204629f6bda99cf876a | https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Service.php#L137-L141 |
24,696 | libreworks/caridea-auth | src/Service.php | Service.resume | public function resume(): bool
{
if ($this->values->offsetExists('principal')) {
$this->principal = $this->values->get('principal');
$this->logger->info(
"Authentication resume: {user}",
['user' => $this->principal]
);
$this->p... | php | public function resume(): bool
{
if ($this->values->offsetExists('principal')) {
$this->principal = $this->values->get('principal');
$this->logger->info(
"Authentication resume: {user}",
['user' => $this->principal]
);
$this->p... | [
"public",
"function",
"resume",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"values",
"->",
"offsetExists",
"(",
"'principal'",
")",
")",
"{",
"$",
"this",
"->",
"principal",
"=",
"$",
"this",
"->",
"values",
"->",
"get",
"(",
"'princip... | Resumes an existing authenticated session.
@return bool If an authentication session existed | [
"Resumes",
"an",
"existing",
"authenticated",
"session",
"."
] | 1bf965c57716942b18ca3204629f6bda99cf876a | https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Service.php#L148-L164 |
24,697 | libreworks/caridea-auth | src/Service.php | Service.publishResume | protected function publishResume(Principal $principal, Map $values)
{
$this->publisher->publish(new Event\Resume(
$this,
$principal,
$values->get('firstActive') ?? 0.0,
$values->get('lastActive') ?? 0.0
));
} | php | protected function publishResume(Principal $principal, Map $values)
{
$this->publisher->publish(new Event\Resume(
$this,
$principal,
$values->get('firstActive') ?? 0.0,
$values->get('lastActive') ?? 0.0
));
} | [
"protected",
"function",
"publishResume",
"(",
"Principal",
"$",
"principal",
",",
"Map",
"$",
"values",
")",
"{",
"$",
"this",
"->",
"publisher",
"->",
"publish",
"(",
"new",
"Event",
"\\",
"Resume",
"(",
"$",
"this",
",",
"$",
"principal",
",",
"$",
... | Publishes the resume event.
@param \Caridea\Auth\Principal $principal The authenticated principal
@param \Caridea\Session\Map $values The session values | [
"Publishes",
"the",
"resume",
"event",
"."
] | 1bf965c57716942b18ca3204629f6bda99cf876a | https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Service.php#L172-L180 |
24,698 | libreworks/caridea-auth | src/Service.php | Service.logout | public function logout(): bool
{
if ($this->values->offsetExists('principal')) {
$principal = $this->getPrincipal();
$this->principal = Principal::getAnonymous();
$this->session->destroy();
$this->logger->info(
"Authentication logout: {user}"... | php | public function logout(): bool
{
if ($this->values->offsetExists('principal')) {
$principal = $this->getPrincipal();
$this->principal = Principal::getAnonymous();
$this->session->destroy();
$this->logger->info(
"Authentication logout: {user}"... | [
"public",
"function",
"logout",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"values",
"->",
"offsetExists",
"(",
"'principal'",
")",
")",
"{",
"$",
"principal",
"=",
"$",
"this",
"->",
"getPrincipal",
"(",
")",
";",
"$",
"this",
"->",
... | Logs out the currently authenticated principal.
@return bool If a principal existed in the session to log out | [
"Logs",
"out",
"the",
"currently",
"authenticated",
"principal",
"."
] | 1bf965c57716942b18ca3204629f6bda99cf876a | https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Service.php#L187-L202 |
24,699 | libreworks/caridea-auth | src/Service.php | Service.publishLogout | protected function publishLogout(Principal $principal): bool
{
$this->publisher->publish(new Event\Logout($this, $principal));
return true;
} | php | protected function publishLogout(Principal $principal): bool
{
$this->publisher->publish(new Event\Logout($this, $principal));
return true;
} | [
"protected",
"function",
"publishLogout",
"(",
"Principal",
"$",
"principal",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"publisher",
"->",
"publish",
"(",
"new",
"Event",
"\\",
"Logout",
"(",
"$",
"this",
",",
"$",
"principal",
")",
")",
";",
"return",
... | Publishes the logout event.
@param \Caridea\Auth\Principal $principal The authenticated principal
@return bool Always true | [
"Publishes",
"the",
"logout",
"event",
"."
] | 1bf965c57716942b18ca3204629f6bda99cf876a | https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Service.php#L210-L214 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.