repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
agentmedia/phine-core | src/Core/Logic/Routing/Rewriter.php | Rewriter.AddIndexCommands | function AddIndexCommands()
{
$condition = new RewriteCondition('$1', '!^(index\\.php|files|phine|robots\\.txt)');
$this->writer->AddContent($condition);
$rule = new RewriteRule('(.*)$', 'index.php');
$rule->AddFlag(new CommandFlag(FlagType::Qsa()));
$rule->AddFlag(n... | php | function AddIndexCommands()
{
$condition = new RewriteCondition('$1', '!^(index\\.php|files|phine|robots\\.txt)');
$this->writer->AddContent($condition);
$rule = new RewriteRule('(.*)$', 'index.php');
$rule->AddFlag(new CommandFlag(FlagType::Qsa()));
$rule->AddFlag(n... | [
"function",
"AddIndexCommands",
"(",
")",
"{",
"$",
"condition",
"=",
"new",
"RewriteCondition",
"(",
"'$1'",
",",
"'!^(index\\\\.php|files|phine|robots\\\\.txt)'",
")",
";",
"$",
"this",
"->",
"writer",
"->",
"AddContent",
"(",
"$",
"condition",
")",
";",
"$",
... | Adds the rules to rewrite anything to the index.php | [
"Adds",
"the",
"rules",
"to",
"rewrite",
"anything",
"to",
"the",
"index",
".",
"php"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/Rewriter.php#L98-L107 | train |
agentmedia/phine-core | src/Core/Logic/Routing/Rewriter.php | Rewriter.SiteHostCondition | private function SiteHostCondition(Site $site)
{
$siteUrl = $site->GetUrl();
$host = parse_url($siteUrl, PHP_URL_HOST);
return new RewriteCondition(new Variable(ServerVariable::HttpHost()), $host);
} | php | private function SiteHostCondition(Site $site)
{
$siteUrl = $site->GetUrl();
$host = parse_url($siteUrl, PHP_URL_HOST);
return new RewriteCondition(new Variable(ServerVariable::HttpHost()), $host);
} | [
"private",
"function",
"SiteHostCondition",
"(",
"Site",
"$",
"site",
")",
"{",
"$",
"siteUrl",
"=",
"$",
"site",
"->",
"GetUrl",
"(",
")",
";",
"$",
"host",
"=",
"parse_url",
"(",
"$",
"siteUrl",
",",
"PHP_URL_HOST",
")",
";",
"return",
"new",
"Rewrit... | Gets the host condition for a page rewrite
@param Site $site
@return RewriteCondition | [
"Gets",
"the",
"host",
"condition",
"for",
"a",
"page",
"rewrite"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/Rewriter.php#L114-L119 | train |
agentmedia/phine-core | src/Core/Logic/Routing/Rewriter.php | Rewriter.SiteFolderCondition | private function SiteFolderCondition(Site $site)
{
$siteUrl = $site->GetUrl();
$siteFolder = parse_url($siteUrl, PHP_URL_PATH);
if ($siteFolder != '' && $siteFolder != '/')
{
return new RewriteCondition(new Variable(ServerVariable::RequestUri()), '^' . rtrim($siteF... | php | private function SiteFolderCondition(Site $site)
{
$siteUrl = $site->GetUrl();
$siteFolder = parse_url($siteUrl, PHP_URL_PATH);
if ($siteFolder != '' && $siteFolder != '/')
{
return new RewriteCondition(new Variable(ServerVariable::RequestUri()), '^' . rtrim($siteF... | [
"private",
"function",
"SiteFolderCondition",
"(",
"Site",
"$",
"site",
")",
"{",
"$",
"siteUrl",
"=",
"$",
"site",
"->",
"GetUrl",
"(",
")",
";",
"$",
"siteFolder",
"=",
"parse_url",
"(",
"$",
"siteUrl",
",",
"PHP_URL_PATH",
")",
";",
"if",
"(",
"$",
... | Gets the rewrite condition for the site specific folder; if present
@param Site $site
@return RewriteCondition | [
"Gets",
"the",
"rewrite",
"condition",
"for",
"the",
"site",
"specific",
"folder",
";",
"if",
"present"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/Rewriter.php#L125-L138 | train |
agentmedia/phine-core | src/Core/Logic/Routing/Rewriter.php | Rewriter.PageRule | private function PageRule(Page $page, array $params)
{
$lhs = $page->GetUrl();
foreach ($params as $param)
{
$lhs = str_replace('{' . $param . '}', self::PARAM_PATTERN, $lhs);
}
$rhs = 'index.php';
$idx = 1;
foreach ($params as $p... | php | private function PageRule(Page $page, array $params)
{
$lhs = $page->GetUrl();
foreach ($params as $param)
{
$lhs = str_replace('{' . $param . '}', self::PARAM_PATTERN, $lhs);
}
$rhs = 'index.php';
$idx = 1;
foreach ($params as $p... | [
"private",
"function",
"PageRule",
"(",
"Page",
"$",
"page",
",",
"array",
"$",
"params",
")",
"{",
"$",
"lhs",
"=",
"$",
"page",
"->",
"GetUrl",
"(",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"param",
")",
"{",
"$",
"lhs",
"=",
"str_re... | Returns the page rule
@param Page $page
@param array $params
@return RewriteRule | [
"Returns",
"the",
"page",
"rule"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/Rewriter.php#L145-L167 | train |
agentmedia/phine-core | src/Core/Logic/Routing/Rewriter.php | Rewriter.PageStartComment | function PageStartComment(Page $page)
{
$text = str_replace('{0}', $page->GetID(), self::START_PAGE_COMMENT);
return new CommentLine($text);
} | php | function PageStartComment(Page $page)
{
$text = str_replace('{0}', $page->GetID(), self::START_PAGE_COMMENT);
return new CommentLine($text);
} | [
"function",
"PageStartComment",
"(",
"Page",
"$",
"page",
")",
"{",
"$",
"text",
"=",
"str_replace",
"(",
"'{0}'",
",",
"$",
"page",
"->",
"GetID",
"(",
")",
",",
"self",
"::",
"START_PAGE_COMMENT",
")",
";",
"return",
"new",
"CommentLine",
"(",
"$",
"... | The page start comment
@param Page $page
@return CommentLine | [
"The",
"page",
"start",
"comment"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/Rewriter.php#L173-L177 | train |
agentmedia/phine-core | src/Core/Logic/Routing/Rewriter.php | Rewriter.PageEndComment | function PageEndComment(Page $page)
{
$text = str_replace('{0}', $page->GetID(), self::END_PAGE_COMMENT);
return new CommentLine($text);
} | php | function PageEndComment(Page $page)
{
$text = str_replace('{0}', $page->GetID(), self::END_PAGE_COMMENT);
return new CommentLine($text);
} | [
"function",
"PageEndComment",
"(",
"Page",
"$",
"page",
")",
"{",
"$",
"text",
"=",
"str_replace",
"(",
"'{0}'",
",",
"$",
"page",
"->",
"GetID",
"(",
")",
",",
"self",
"::",
"END_PAGE_COMMENT",
")",
";",
"return",
"new",
"CommentLine",
"(",
"$",
"text... | The page end comment
@param Page $page
@return CommentLine | [
"The",
"page",
"end",
"comment"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Routing/Rewriter.php#L185-L189 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.& | private static function &getProperty($object, string $property)
{
$value = &\Closure::bind(function & () use ($property) {
return $this->$property;
}, $object, $object)->__invoke();
return $value;
} | php | private static function &getProperty($object, string $property)
{
$value = &\Closure::bind(function & () use ($property) {
return $this->$property;
}, $object, $object)->__invoke();
return $value;
} | [
"private",
"static",
"function",
"&",
"getProperty",
"(",
"$",
"object",
",",
"string",
"$",
"property",
")",
"{",
"$",
"value",
"=",
"&",
"\\",
"Closure",
"::",
"bind",
"(",
"function",
"&",
"(",
")",
"use",
"(",
"$",
"property",
")",
"{",
"return",... | Returns a reference to a non static property of an object.
@param object $object The object.
@param string $property The name of the property.
@return mixed | [
"Returns",
"a",
"reference",
"to",
"a",
"non",
"static",
"property",
"of",
"an",
"object",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L63-L70 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.& | private static function &getStaticProperty($object, string $property)
{
$value = &\Closure::bind(function & () use ($property) {
return self::$$property;
}, $object, $object)->__invoke();
return $value;
} | php | private static function &getStaticProperty($object, string $property)
{
$value = &\Closure::bind(function & () use ($property) {
return self::$$property;
}, $object, $object)->__invoke();
return $value;
} | [
"private",
"static",
"function",
"&",
"getStaticProperty",
"(",
"$",
"object",
",",
"string",
"$",
"property",
")",
"{",
"$",
"value",
"=",
"&",
"\\",
"Closure",
"::",
"bind",
"(",
"function",
"&",
"(",
")",
"use",
"(",
"$",
"property",
")",
"{",
"re... | Returns a reference to a static property of an object.
@param object $object The object.
@param string $property The name of the property.
@return mixed | [
"Returns",
"a",
"reference",
"to",
"a",
"static",
"property",
"of",
"an",
"object",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L81-L88 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.dump | public function dump($name, &$value, bool $scalarReferences = false): void
{
$this->seen = [];
$this->scalarReferences = $scalarReferences;
$this->gid = uniqid((string)mt_rand(), true);
$this->writer->start();
$this->recursiveDump($value, $name);
$this->writer->stop... | php | public function dump($name, &$value, bool $scalarReferences = false): void
{
$this->seen = [];
$this->scalarReferences = $scalarReferences;
$this->gid = uniqid((string)mt_rand(), true);
$this->writer->start();
$this->recursiveDump($value, $name);
$this->writer->stop... | [
"public",
"function",
"dump",
"(",
"$",
"name",
",",
"&",
"$",
"value",
",",
"bool",
"$",
"scalarReferences",
"=",
"false",
")",
":",
"void",
"{",
"$",
"this",
"->",
"seen",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"scalarReferences",
"=",
"$",
"scal... | Main function for dumping.
@param string|int|null $name The name of the variable.
@param mixed $value Value to be dumped.
@param bool $scalarReferences If true scalar references to values must be traced.
@api
@since 1.0.0 | [
"Main",
"function",
"for",
"dumping",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L125-L136 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.dumpArray | private function dumpArray(array &$value, $name): void
{
list($id, $ref) = $this->isReference($value);
if ($ref===null)
{
$this->writer->writeArrayOpen($id, $name);
foreach ($value as $key => &$item)
{
$this->recursiveDump($item, $key);
}
$this->writer->writeArrayC... | php | private function dumpArray(array &$value, $name): void
{
list($id, $ref) = $this->isReference($value);
if ($ref===null)
{
$this->writer->writeArrayOpen($id, $name);
foreach ($value as $key => &$item)
{
$this->recursiveDump($item, $key);
}
$this->writer->writeArrayC... | [
"private",
"function",
"dumpArray",
"(",
"array",
"&",
"$",
"value",
",",
"$",
"name",
")",
":",
"void",
"{",
"list",
"(",
"$",
"id",
",",
"$",
"ref",
")",
"=",
"$",
"this",
"->",
"isReference",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"ref... | Dumps an array.
@param array $value The array.
@param string|int|null $name Variable name. | [
"Dumps",
"an",
"array",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L145-L164 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.dumpBool | private function dumpBool(bool &$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeBool($id, $ref, $value, $name);
} | php | private function dumpBool(bool &$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeBool($id, $ref, $value, $name);
} | [
"private",
"function",
"dumpBool",
"(",
"bool",
"&",
"$",
"value",
",",
"$",
"name",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"scalarReferences",
")",
"{",
"list",
"(",
"$",
"id",
",",
"$",
"ref",
")",
"=",
"$",
"this",
"->",
"isRefer... | Dumps a boolean.
@param bool $value The boolean.
@param string|int|null $name The name of the variable. | [
"Dumps",
"a",
"boolean",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L173-L186 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.dumpFloat | private function dumpFloat(float &$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeFloat($id, $ref, $value, $name);
} | php | private function dumpFloat(float &$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeFloat($id, $ref, $value, $name);
} | [
"private",
"function",
"dumpFloat",
"(",
"float",
"&",
"$",
"value",
",",
"$",
"name",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"scalarReferences",
")",
"{",
"list",
"(",
"$",
"id",
",",
"$",
"ref",
")",
"=",
"$",
"this",
"->",
"isRef... | Dumps a float.
@param float $value The float.
@param string|int|null $name The name of the variable. | [
"Dumps",
"a",
"float",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L195-L208 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.dumpInt | private function dumpInt(int &$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeInt($id, $ref, $value, $name);
} | php | private function dumpInt(int &$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeInt($id, $ref, $value, $name);
} | [
"private",
"function",
"dumpInt",
"(",
"int",
"&",
"$",
"value",
",",
"$",
"name",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"scalarReferences",
")",
"{",
"list",
"(",
"$",
"id",
",",
"$",
"ref",
")",
"=",
"$",
"this",
"->",
"isReferen... | Dumps an integer.
@param int $value The integer.
@param string|int|null $name The name of the variable. | [
"Dumps",
"an",
"integer",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L217-L230 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.dumpNull | private function dumpNull(&$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeNull($id, $ref, $name);
} | php | private function dumpNull(&$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeNull($id, $ref, $name);
} | [
"private",
"function",
"dumpNull",
"(",
"&",
"$",
"value",
",",
"$",
"name",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"scalarReferences",
")",
"{",
"list",
"(",
"$",
"id",
",",
"$",
"ref",
")",
"=",
"$",
"this",
"->",
"isReference",
"... | Dumps null.
@param null $value The null.
@param string|int|null $name The name of the variable. | [
"Dumps",
"null",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L239-L252 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.dumpObject | private function dumpObject($value, $name): void
{
list($id, $ref) = $this->isReference($value);
if ($ref===null)
{
$this->writer->writeObjectOpen($id, $name, get_class($value));
// Dump all fields of the object, unless the object is me.
if ($this!==$value)
{
$reflect ... | php | private function dumpObject($value, $name): void
{
list($id, $ref) = $this->isReference($value);
if ($ref===null)
{
$this->writer->writeObjectOpen($id, $name, get_class($value));
// Dump all fields of the object, unless the object is me.
if ($this!==$value)
{
$reflect ... | [
"private",
"function",
"dumpObject",
"(",
"$",
"value",
",",
"$",
"name",
")",
":",
"void",
"{",
"list",
"(",
"$",
"id",
",",
"$",
"ref",
")",
"=",
"$",
"this",
"->",
"isReference",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"ref",
"===",
"nu... | Dumps an object.
@param object $value The object.
@param string|int|null $name The name of the variable. | [
"Dumps",
"an",
"object",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L261-L307 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.dumpResource | private function dumpResource($value, $name): void
{
list($id, $ref) = $this->isReference($value);
$this->writer->writeResource($id, $ref, $name, get_resource_type($value));
} | php | private function dumpResource($value, $name): void
{
list($id, $ref) = $this->isReference($value);
$this->writer->writeResource($id, $ref, $name, get_resource_type($value));
} | [
"private",
"function",
"dumpResource",
"(",
"$",
"value",
",",
"$",
"name",
")",
":",
"void",
"{",
"list",
"(",
"$",
"id",
",",
"$",
"ref",
")",
"=",
"$",
"this",
"->",
"isReference",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"writer",
"->"... | Dumps a resource.
@param resource $value The resource.
@param string $name The name of the variable. | [
"Dumps",
"a",
"resource",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L316-L321 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.dumpString | private function dumpString(string &$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeString($id, $ref, $value, $name);
} | php | private function dumpString(string &$value, $name): void
{
if ($this->scalarReferences)
{
list($id, $ref) = $this->isReference($value);
}
else
{
$id = null;
$ref = null;
}
$this->writer->writeString($id, $ref, $value, $name);
} | [
"private",
"function",
"dumpString",
"(",
"string",
"&",
"$",
"value",
",",
"$",
"name",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"scalarReferences",
")",
"{",
"list",
"(",
"$",
"id",
",",
"$",
"ref",
")",
"=",
"$",
"this",
"->",
"isR... | Dumps a string.
@param string $value The string.
@param string|int|null $name The name of the variable. | [
"Dumps",
"a",
"string",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L330-L343 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.isReference | private function isReference(&$value): array
{
switch (true)
{
case is_bool($value):
case is_null($value):
case is_int($value):
case is_string($value):
case is_double($value):
case is_resource($value):
$ref = $this->testSeen($value);
break;
case is_ob... | php | private function isReference(&$value): array
{
switch (true)
{
case is_bool($value):
case is_null($value):
case is_int($value):
case is_string($value):
case is_double($value):
case is_resource($value):
$ref = $this->testSeen($value);
break;
case is_ob... | [
"private",
"function",
"isReference",
"(",
"&",
"$",
"value",
")",
":",
"array",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"is_bool",
"(",
"$",
"value",
")",
":",
"case",
"is_null",
"(",
"$",
"value",
")",
":",
"case",
"is_int",
"(",
"$",
"valu... | If a value has been dumped before returns the ID of the variable. Otherwise returns null.
@param mixed $value The variable.
@return array<int|null> | [
"If",
"a",
"value",
"has",
"been",
"dumped",
"before",
"returns",
"the",
"ID",
"of",
"the",
"variable",
".",
"Otherwise",
"returns",
"null",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L353-L381 | train |
SetBased/php-abc-var-dumper | src/VarDumper.php | VarDumper.recursiveDump | private function recursiveDump(&$value, $name): void
{
switch (true)
{
case is_null($value):
$this->dumpNull($value, $name);
break;
case is_bool($value):
$this->dumpBool($value, $name);
break;
case is_float($value):
$this->dumpFloat($value, $name);
... | php | private function recursiveDump(&$value, $name): void
{
switch (true)
{
case is_null($value):
$this->dumpNull($value, $name);
break;
case is_bool($value):
$this->dumpBool($value, $name);
break;
case is_float($value):
$this->dumpFloat($value, $name);
... | [
"private",
"function",
"recursiveDump",
"(",
"&",
"$",
"value",
",",
"$",
"name",
")",
":",
"void",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"is_null",
"(",
"$",
"value",
")",
":",
"$",
"this",
"->",
"dumpNull",
"(",
"$",
"value",
",",
"$",
... | Dumps recursively a variable.
@param mixed $value The value.
@param string|int|null $name Variable The name of the variable. | [
"Dumps",
"recursively",
"a",
"variable",
"."
] | cb03a4f1e76d65378c818120f97cbd734768a842 | https://github.com/SetBased/php-abc-var-dumper/blob/cb03a4f1e76d65378c818120f97cbd734768a842/src/VarDumper.php#L390-L438 | train |
phospr/DoubleEntryBundle | Model/Account.php | Account.generateSlugSegmentationAndPath | public function generateSlugSegmentationAndPath()
{
// Set slug for this Account. The reason we do this here is that
// the slug listener hasn't been called yet
$this->setSlug(\Gedmo\Sluggable\Util\Urlizer::urlize($this->name));
if ($this->getParent()) {
$account = $thi... | php | public function generateSlugSegmentationAndPath()
{
// Set slug for this Account. The reason we do this here is that
// the slug listener hasn't been called yet
$this->setSlug(\Gedmo\Sluggable\Util\Urlizer::urlize($this->name));
if ($this->getParent()) {
$account = $thi... | [
"public",
"function",
"generateSlugSegmentationAndPath",
"(",
")",
"{",
"// Set slug for this Account. The reason we do this here is that",
"// the slug listener hasn't been called yet",
"$",
"this",
"->",
"setSlug",
"(",
"\\",
"Gedmo",
"\\",
"Sluggable",
"\\",
"Util",
"\\",
... | Generate slug, segmentation and path
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@ORM\PrePersist
@ORM\PreUpdate | [
"Generate",
"slug",
"segmentation",
"and",
"path"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/Account.php#L574-L602 | train |
phospr/DoubleEntryBundle | Model/Account.php | Account.getPostedPostings | public function getPostedPostings()
{
$criteria = Criteria::create()
->where(Criteria::expr()->neq('postedAt', null))
->orderBy(array('postedAt' => Criteria::ASC))
;
return $this->getPostings()->matching($criteria);
} | php | public function getPostedPostings()
{
$criteria = Criteria::create()
->where(Criteria::expr()->neq('postedAt', null))
->orderBy(array('postedAt' => Criteria::ASC))
;
return $this->getPostings()->matching($criteria);
} | [
"public",
"function",
"getPostedPostings",
"(",
")",
"{",
"$",
"criteria",
"=",
"Criteria",
"::",
"create",
"(",
")",
"->",
"where",
"(",
"Criteria",
"::",
"expr",
"(",
")",
"->",
"neq",
"(",
"'postedAt'",
",",
"null",
")",
")",
"->",
"orderBy",
"(",
... | Get posted Postings
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@return ArrayCollection|Posting | [
"Get",
"posted",
"Postings"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/Account.php#L672-L680 | train |
phospr/DoubleEntryBundle | Model/Account.php | Account.getUnpostedPostings | public function getUnpostedPostings()
{
$criteria = Criteria::create()
->where(Criteria::expr()->eq('postedAt', null))
;
return $this->getPostings()->matching($criteria);
} | php | public function getUnpostedPostings()
{
$criteria = Criteria::create()
->where(Criteria::expr()->eq('postedAt', null))
;
return $this->getPostings()->matching($criteria);
} | [
"public",
"function",
"getUnpostedPostings",
"(",
")",
"{",
"$",
"criteria",
"=",
"Criteria",
"::",
"create",
"(",
")",
"->",
"where",
"(",
"Criteria",
"::",
"expr",
"(",
")",
"->",
"eq",
"(",
"'postedAt'",
",",
"null",
")",
")",
";",
"return",
"$",
... | Get unposted Postings
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@return ArrayCollection|Posting | [
"Get",
"unposted",
"Postings"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/Account.php#L690-L697 | train |
phospr/DoubleEntryBundle | Model/Account.php | Account.getChildForName | public function getChildForName($name)
{
$criteria = Criteria::create()
->where(Criteria::expr()->eq('name', $name))
;
return $this->getChildren()->matching($criteria)->first();
} | php | public function getChildForName($name)
{
$criteria = Criteria::create()
->where(Criteria::expr()->eq('name', $name))
;
return $this->getChildren()->matching($criteria)->first();
} | [
"public",
"function",
"getChildForName",
"(",
"$",
"name",
")",
"{",
"$",
"criteria",
"=",
"Criteria",
"::",
"create",
"(",
")",
"->",
"where",
"(",
"Criteria",
"::",
"expr",
"(",
")",
"->",
"eq",
"(",
"'name'",
",",
"$",
"name",
")",
")",
";",
"re... | Get a child account by name
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@param string $name
@return Account | [
"Get",
"a",
"child",
"account",
"by",
"name"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/Account.php#L709-L716 | train |
RudyMas/Emvc_Router | src/Router/Router.php | Router.respondOnOptionsRequest | private function respondOnOptionsRequest(int $httpResponseCode): void
{
http_response_code($httpResponseCode);
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
exit;
} | php | private function respondOnOptionsRequest(int $httpResponseCode): void
{
http_response_code($httpResponseCode);
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
exit;
} | [
"private",
"function",
"respondOnOptionsRequest",
"(",
"int",
"$",
"httpResponseCode",
")",
":",
"void",
"{",
"http_response_code",
"(",
"$",
"httpResponseCode",
")",
";",
"header",
"(",
"'Content-Type: application/json'",
")",
";",
"header",
"(",
"'Access-Control-All... | Send confirmation for an OPTIONS request
@param int $httpResponseCode | [
"Send",
"confirmation",
"for",
"an",
"OPTIONS",
"request"
] | 80eada990a5f9471d7516e988d464ba2bfa9ebd3 | https://github.com/RudyMas/Emvc_Router/blob/80eada990a5f9471d7516e988d464ba2bfa9ebd3/src/Router/Router.php#L344-L351 | train |
RudyMas/Emvc_Router | src/Router/Router.php | Router.checkFunctions | private function checkFunctions()
{
if (!function_exists('apache_request_headers')) {
function apache_request_headers()
{
$arh = array();
$rx_http = '/\AHTTP_/';
foreach ($_SERVER as $key => $val) {
if (preg_match($r... | php | private function checkFunctions()
{
if (!function_exists('apache_request_headers')) {
function apache_request_headers()
{
$arh = array();
$rx_http = '/\AHTTP_/';
foreach ($_SERVER as $key => $val) {
if (preg_match($r... | [
"private",
"function",
"checkFunctions",
"(",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'apache_request_headers'",
")",
")",
"{",
"function",
"apache_request_headers",
"(",
")",
"{",
"$",
"arh",
"=",
"array",
"(",
")",
";",
"$",
"rx_http",
"=",
"'... | Checks if a certain function exists on the server, or not.
I needed to add this, because else the router wouldn't work on a NGINX server! | [
"Checks",
"if",
"a",
"certain",
"function",
"exists",
"on",
"the",
"server",
"or",
"not",
".",
"I",
"needed",
"to",
"add",
"this",
"because",
"else",
"the",
"router",
"wouldn",
"t",
"work",
"on",
"a",
"NGINX",
"server!"
] | 80eada990a5f9471d7516e988d464ba2bfa9ebd3 | https://github.com/RudyMas/Emvc_Router/blob/80eada990a5f9471d7516e988d464ba2bfa9ebd3/src/Router/Router.php#L357-L380 | train |
mageware/magento2-common | Model/Feed.php | Feed.getFeedXml | protected function getFeedXml()
{
$client = $this->curlFactory->create();
$client->setConfig($this->getCurlConfig());
$client->write(\Zend_Http_Client::GET, self::ENDPOINT, '1.0');
$response = $client->read();
$client->close();
if (false !== $response) {
... | php | protected function getFeedXml()
{
$client = $this->curlFactory->create();
$client->setConfig($this->getCurlConfig());
$client->write(\Zend_Http_Client::GET, self::ENDPOINT, '1.0');
$response = $client->read();
$client->close();
if (false !== $response) {
... | [
"protected",
"function",
"getFeedXml",
"(",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"curlFactory",
"->",
"create",
"(",
")",
";",
"$",
"client",
"->",
"setConfig",
"(",
"$",
"this",
"->",
"getCurlConfig",
"(",
")",
")",
";",
"$",
"client",
"... | Retrieve feed data as XML element
@return \SimpleXMLElement|bool | [
"Retrieve",
"feed",
"data",
"as",
"XML",
"element"
] | 3cf0dff5600f614d9081a4d585e257bbec27b1e6 | https://github.com/mageware/magento2-common/blob/3cf0dff5600f614d9081a4d585e257bbec27b1e6/Model/Feed.php#L83-L106 | train |
mageware/magento2-common | Model/Feed.php | Feed.getCurlConfig | protected function getCurlConfig()
{
$useragent = $this->productMetadata->getName()
. '/' . $this->productMetadata->getVersion()
. ' (' . $this->productMetadata->getEdition() . ')';
return [
'useragent' => $useragent,
'timeout' => 2
];
} | php | protected function getCurlConfig()
{
$useragent = $this->productMetadata->getName()
. '/' . $this->productMetadata->getVersion()
. ' (' . $this->productMetadata->getEdition() . ')';
return [
'useragent' => $useragent,
'timeout' => 2
];
} | [
"protected",
"function",
"getCurlConfig",
"(",
")",
"{",
"$",
"useragent",
"=",
"$",
"this",
"->",
"productMetadata",
"->",
"getName",
"(",
")",
".",
"'/'",
".",
"$",
"this",
"->",
"productMetadata",
"->",
"getVersion",
"(",
")",
".",
"' ('",
".",
"$",
... | Retrieve config for curl
@return array | [
"Retrieve",
"config",
"for",
"curl"
] | 3cf0dff5600f614d9081a4d585e257bbec27b1e6 | https://github.com/mageware/magento2-common/blob/3cf0dff5600f614d9081a4d585e257bbec27b1e6/Model/Feed.php#L113-L123 | train |
anime-db/catalog-bundle | src/Service/Item/ListControls.php | ListControls.getLimit | public function getLimit(array $query = [])
{
if (isset($query['limit']) && is_numeric($query['limit']) && in_array($query['limit'], self::$limits)) {
return (int) $query['limit'];
}
return self::DEFAULT_LIMIT;
} | php | public function getLimit(array $query = [])
{
if (isset($query['limit']) && is_numeric($query['limit']) && in_array($query['limit'], self::$limits)) {
return (int) $query['limit'];
}
return self::DEFAULT_LIMIT;
} | [
"public",
"function",
"getLimit",
"(",
"array",
"$",
"query",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"query",
"[",
"'limit'",
"]",
")",
"&&",
"is_numeric",
"(",
"$",
"query",
"[",
"'limit'",
"]",
")",
"&&",
"in_array",
"(",
"$",
"... | Get limit list items.
@param array $query
@return int | [
"Get",
"limit",
"list",
"items",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Service/Item/ListControls.php#L95-L102 | train |
anime-db/catalog-bundle | src/Service/Item/ListControls.php | ListControls.getLimits | public function getLimits(array $query = [])
{
$limits = [];
$current_limit = $this->getLimit($query);
foreach (self::$limits as $limit) {
$limits[] = [
'link' => '?'.http_build_query(array_merge($query, ['limit' => $limit])),
'name' => $limit ? $... | php | public function getLimits(array $query = [])
{
$limits = [];
$current_limit = $this->getLimit($query);
foreach (self::$limits as $limit) {
$limits[] = [
'link' => '?'.http_build_query(array_merge($query, ['limit' => $limit])),
'name' => $limit ? $... | [
"public",
"function",
"getLimits",
"(",
"array",
"$",
"query",
"=",
"[",
"]",
")",
"{",
"$",
"limits",
"=",
"[",
"]",
";",
"$",
"current_limit",
"=",
"$",
"this",
"->",
"getLimit",
"(",
"$",
"query",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"... | Get list limits.
@param array $query
@return array | [
"Get",
"list",
"limits",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Service/Item/ListControls.php#L111-L126 | train |
SagittariusX/Beluga.IO | src/Beluga/IO/MimeTypeTool.php | MimeTypeTool.GetByExtension | public static function GetByExtension( string $extension ) : string
{
$normalizedExtension = \strtolower( \ltrim( $extension, '.' ) );
if ( isset( static::$mimeTypes[ $normalizedExtension ] ) )
{
return static::$mimeTypes[ $normalizedExtension ];
}
return 'application/octet-... | php | public static function GetByExtension( string $extension ) : string
{
$normalizedExtension = \strtolower( \ltrim( $extension, '.' ) );
if ( isset( static::$mimeTypes[ $normalizedExtension ] ) )
{
return static::$mimeTypes[ $normalizedExtension ];
}
return 'application/octet-... | [
"public",
"static",
"function",
"GetByExtension",
"(",
"string",
"$",
"extension",
")",
":",
"string",
"{",
"$",
"normalizedExtension",
"=",
"\\",
"strtolower",
"(",
"\\",
"ltrim",
"(",
"$",
"extension",
",",
"'.'",
")",
")",
";",
"if",
"(",
"isset",
"("... | Returns the MIME type, associated with the defined file name extension.
@param string $extension The file name extension (with or without the leading dot)
@return string Returns the MIME type | [
"Returns",
"the",
"MIME",
"type",
"associated",
"with",
"the",
"defined",
"file",
"name",
"extension",
"."
] | c8af09a1b3cc8a955e43c89b70779d11b30ae29e | https://github.com/SagittariusX/Beluga.IO/blob/c8af09a1b3cc8a955e43c89b70779d11b30ae29e/src/Beluga/IO/MimeTypeTool.php#L210-L222 | train |
SagittariusX/Beluga.IO | src/Beluga/IO/MimeTypeTool.php | MimeTypeTool.HasGifHeader | public static function HasGifHeader( string $file, string $firstBytes = null ) : bool
{
if ( empty( $firstBytes ) )
{
$firstBytes = File::ReadFirstBytes( $file, 6 );
}
return (bool) \preg_match( '~^GIF\d~', $firstBytes );
} | php | public static function HasGifHeader( string $file, string $firstBytes = null ) : bool
{
if ( empty( $firstBytes ) )
{
$firstBytes = File::ReadFirstBytes( $file, 6 );
}
return (bool) \preg_match( '~^GIF\d~', $firstBytes );
} | [
"public",
"static",
"function",
"HasGifHeader",
"(",
"string",
"$",
"file",
",",
"string",
"$",
"firstBytes",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"firstBytes",
")",
")",
"{",
"$",
"firstBytes",
"=",
"File",
"::",
"ReadFirs... | Returns if the defined file uses a valid GIF image file header.
@param string $file
@param string $firstBytes If defined it is used to get image info from.
@return boolean | [
"Returns",
"if",
"the",
"defined",
"file",
"uses",
"a",
"valid",
"GIF",
"image",
"file",
"header",
"."
] | c8af09a1b3cc8a955e43c89b70779d11b30ae29e | https://github.com/SagittariusX/Beluga.IO/blob/c8af09a1b3cc8a955e43c89b70779d11b30ae29e/src/Beluga/IO/MimeTypeTool.php#L283-L293 | train |
SagittariusX/Beluga.IO | src/Beluga/IO/MimeTypeTool.php | MimeTypeTool.HasJpegHeader | public static function HasJpegHeader( string $file, string $firstBytes = null ) : bool
{
if ( empty( $firstBytes ) )
{
$firstBytes = File::ReadFirstBytes( $file, 4 );
}
return (
( 'ff' == \dechex( \ord( $firstBytes [ 0 ] ) ) )
&& ( 'd8' == \dechex( \ord( $first... | php | public static function HasJpegHeader( string $file, string $firstBytes = null ) : bool
{
if ( empty( $firstBytes ) )
{
$firstBytes = File::ReadFirstBytes( $file, 4 );
}
return (
( 'ff' == \dechex( \ord( $firstBytes [ 0 ] ) ) )
&& ( 'd8' == \dechex( \ord( $first... | [
"public",
"static",
"function",
"HasJpegHeader",
"(",
"string",
"$",
"file",
",",
"string",
"$",
"firstBytes",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"firstBytes",
")",
")",
"{",
"$",
"firstBytes",
"=",
"File",
"::",
"ReadFir... | Returns if the defined file uses a valid JPEG image file header.
@param string $file
@param string $firstBytes If defined it is used to get image info from.
@return boolean | [
"Returns",
"if",
"the",
"defined",
"file",
"uses",
"a",
"valid",
"JPEG",
"image",
"file",
"header",
"."
] | c8af09a1b3cc8a955e43c89b70779d11b30ae29e | https://github.com/SagittariusX/Beluga.IO/blob/c8af09a1b3cc8a955e43c89b70779d11b30ae29e/src/Beluga/IO/MimeTypeTool.php#L302-L316 | train |
SagittariusX/Beluga.IO | src/Beluga/IO/MimeTypeTool.php | MimeTypeTool.GetWebImageMimeTypeByHeaderCode | public static function GetWebImageMimeTypeByHeaderCode( string $file )
{
$f8b = File::ReadFirstBytes( $file, 8 );
$ext = \strtolower( File::GetExtensionName( $file ) );
switch ( $ext )
{
case 'gif':
if ( static::HasGifHeader( $file, $f8b ) )
{
r... | php | public static function GetWebImageMimeTypeByHeaderCode( string $file )
{
$f8b = File::ReadFirstBytes( $file, 8 );
$ext = \strtolower( File::GetExtensionName( $file ) );
switch ( $ext )
{
case 'gif':
if ( static::HasGifHeader( $file, $f8b ) )
{
r... | [
"public",
"static",
"function",
"GetWebImageMimeTypeByHeaderCode",
"(",
"string",
"$",
"file",
")",
"{",
"$",
"f8b",
"=",
"File",
"::",
"ReadFirstBytes",
"(",
"$",
"file",
",",
"8",
")",
";",
"$",
"ext",
"=",
"\\",
"strtolower",
"(",
"File",
"::",
"GetEx... | Returns the web image MIME type, depending to file name extension and used image file header.
If its not a web image FALSE is returned. Valid web image ar images of type GIF, PNG and JPEG.
@param string $file
@return string|FALSE | [
"Returns",
"the",
"web",
"image",
"MIME",
"type",
"depending",
"to",
"file",
"name",
"extension",
"and",
"used",
"image",
"file",
"header",
"."
] | c8af09a1b3cc8a955e43c89b70779d11b30ae29e | https://github.com/SagittariusX/Beluga.IO/blob/c8af09a1b3cc8a955e43c89b70779d11b30ae29e/src/Beluga/IO/MimeTypeTool.php#L351-L379 | train |
CeusMedia/Router | src/Registry.php | Registry.add | public function add( Route $route ){
$routeId = $route->getId();
if( array_key_exists( $routeId, $this->routes ) ){
throw new \DomainException( sprintf(
'A route for pattern and method is already registered: %2$s %1$s',
$route->getPattern(),
$route->getMethod()
) );
}
$this->routes[$routeId] =... | php | public function add( Route $route ){
$routeId = $route->getId();
if( array_key_exists( $routeId, $this->routes ) ){
throw new \DomainException( sprintf(
'A route for pattern and method is already registered: %2$s %1$s',
$route->getPattern(),
$route->getMethod()
) );
}
$this->routes[$routeId] =... | [
"public",
"function",
"add",
"(",
"Route",
"$",
"route",
")",
"{",
"$",
"routeId",
"=",
"$",
"route",
"->",
"getId",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"routeId",
",",
"$",
"this",
"->",
"routes",
")",
")",
"{",
"throw",
"new",... | Adds route to route registry by route object.
@access public
@param Route $route Route object
@return string ID of added route
@throws DomainException if route is already registered by route ID | [
"Adds",
"route",
"to",
"route",
"registry",
"by",
"route",
"object",
"."
] | d4c68e8c2895abf5c13835e1671635507e2fb21d | https://github.com/CeusMedia/Router/blob/d4c68e8c2895abf5c13835e1671635507e2fb21d/src/Registry.php#L51-L62 | train |
CeusMedia/Router | src/Registry.php | Registry.loadFromJsonFile | public function loadFromJsonFile( $filePath, $folderPath = NULL ){
if( !file_exists( $filePath ) && $folderPath ){
$this->assembleJsonFileFromFolder( $filePath, $folderPath );
}
$data = \FS_File_JSON_Reader::load( $filePath );
foreach( $data as $item ){
if( !isset( $item->controller ) )
throw new \Out... | php | public function loadFromJsonFile( $filePath, $folderPath = NULL ){
if( !file_exists( $filePath ) && $folderPath ){
$this->assembleJsonFileFromFolder( $filePath, $folderPath );
}
$data = \FS_File_JSON_Reader::load( $filePath );
foreach( $data as $item ){
if( !isset( $item->controller ) )
throw new \Out... | [
"public",
"function",
"loadFromJsonFile",
"(",
"$",
"filePath",
",",
"$",
"folderPath",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filePath",
")",
"&&",
"$",
"folderPath",
")",
"{",
"$",
"this",
"->",
"assembleJsonFileFromFolder",
"("... | Adds a list of routes defined in a JSON file.
@access public
@param string $filePath Relative or absolute file path of JSON file to load
@param string $folderPath Relative or absolute path to folder containing JSON files to assemble
@return void
@throws OutOfRangeException if route set has no controller
@thr... | [
"Adds",
"a",
"list",
"of",
"routes",
"defined",
"in",
"a",
"JSON",
"file",
"."
] | d4c68e8c2895abf5c13835e1671635507e2fb21d | https://github.com/CeusMedia/Router/blob/d4c68e8c2895abf5c13835e1671635507e2fb21d/src/Registry.php#L114-L138 | train |
CeusMedia/Router | src/Registry.php | Registry.remove | public function remove( $routeId, $strict = TRUE ){
if( array_key_exists( $routeId, $this->routes ) ){
unset( $this->routes[$routeId] );
return TRUE;
}
if( $strict )
throw new \DomainException( 'No route found for this route ID' );
return FALSE;
} | php | public function remove( $routeId, $strict = TRUE ){
if( array_key_exists( $routeId, $this->routes ) ){
unset( $this->routes[$routeId] );
return TRUE;
}
if( $strict )
throw new \DomainException( 'No route found for this route ID' );
return FALSE;
} | [
"public",
"function",
"remove",
"(",
"$",
"routeId",
",",
"$",
"strict",
"=",
"TRUE",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"routeId",
",",
"$",
"this",
"->",
"routes",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"routes",
"[",
"$"... | Removes a route from route registry by its ID.
@access public
@param string $routeId ID of route
@param boolean $strict Throw exception if route ID is invalid
@return boolean TRUE is route existed and has been removed
@throws DomainException if route ID has not been found in registry (strict mode only) | [
"Removes",
"a",
"route",
"from",
"route",
"registry",
"by",
"its",
"ID",
"."
] | d4c68e8c2895abf5c13835e1671635507e2fb21d | https://github.com/CeusMedia/Router/blob/d4c68e8c2895abf5c13835e1671635507e2fb21d/src/Registry.php#L148-L156 | train |
phpffcms/ffcms-core | src/Arch/Widget.php | Widget.widget | public static function widget(?array $params = null): ?string
{
self::$class = get_called_class();
self::$view = App::$View;
self::$request = App::$Request;
self::$response = App::$Response;
// check if class exist
if (!class_exists(self::$class)) {
retur... | php | public static function widget(?array $params = null): ?string
{
self::$class = get_called_class();
self::$view = App::$View;
self::$request = App::$Request;
self::$response = App::$Response;
// check if class exist
if (!class_exists(self::$class)) {
retur... | [
"public",
"static",
"function",
"widget",
"(",
"?",
"array",
"$",
"params",
"=",
"null",
")",
":",
"?",
"string",
"{",
"self",
"::",
"$",
"class",
"=",
"get_called_class",
"(",
")",
";",
"self",
"::",
"$",
"view",
"=",
"App",
"::",
"$",
"View",
";"... | Build and display widget
@param array|null $params
@return null|string | [
"Build",
"and",
"display",
"widget"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Arch/Widget.php#L29-L54 | train |
agentmedia/phine-core | src/Core/Modules/Backend/ContainerList.php | ContainerList.CanCreate | protected function CanCreate()
{
return self::Guard()->Allow(BackendAction::Create(), new Container())
&& self::Guard()->Allow(BackendAction::UseIt(), new ContainerForm());
} | php | protected function CanCreate()
{
return self::Guard()->Allow(BackendAction::Create(), new Container())
&& self::Guard()->Allow(BackendAction::UseIt(), new ContainerForm());
} | [
"protected",
"function",
"CanCreate",
"(",
")",
"{",
"return",
"self",
"::",
"Guard",
"(",
")",
"->",
"Allow",
"(",
"BackendAction",
"::",
"Create",
"(",
")",
",",
"new",
"Container",
"(",
")",
")",
"&&",
"self",
"::",
"Guard",
"(",
")",
"->",
"Allow... | True if a new container can be created
@return bool | [
"True",
"if",
"a",
"new",
"container",
"can",
"be",
"created"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/ContainerList.php#L109-L113 | train |
agentmedia/phine-core | src/Core/Modules/Backend/ContainerList.php | ContainerList.CanEdit | protected function CanEdit(Container $container)
{
return self::Guard()->Allow(BackendAction::Edit(), $container)
&& self::Guard()->Allow(BackendAction::UseIt(), new ContainerForm());
} | php | protected function CanEdit(Container $container)
{
return self::Guard()->Allow(BackendAction::Edit(), $container)
&& self::Guard()->Allow(BackendAction::UseIt(), new ContainerForm());
} | [
"protected",
"function",
"CanEdit",
"(",
"Container",
"$",
"container",
")",
"{",
"return",
"self",
"::",
"Guard",
"(",
")",
"->",
"Allow",
"(",
"BackendAction",
"::",
"Edit",
"(",
")",
",",
"$",
"container",
")",
"&&",
"self",
"::",
"Guard",
"(",
")",... | True if the container can be edited
@param Container $container
@return boolean | [
"True",
"if",
"the",
"container",
"can",
"be",
"edited"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/ContainerList.php#L119-L123 | train |
brightnucleus/options-store | src/Option/OptionTrait.php | OptionTrait.setValue | public function setValue($value, $persist = true)
{
if ($this->isEmpty($value) && ! $this->flags & Value::CAN_BE_EMPTY) {
throw FailedToValidate::fromValue($value, $this);
}
if (! $this->isEmpty($value)) {
$value = $this->validate($value);
}
if (null... | php | public function setValue($value, $persist = true)
{
if ($this->isEmpty($value) && ! $this->flags & Value::CAN_BE_EMPTY) {
throw FailedToValidate::fromValue($value, $this);
}
if (! $this->isEmpty($value)) {
$value = $this->validate($value);
}
if (null... | [
"public",
"function",
"setValue",
"(",
"$",
"value",
",",
"$",
"persist",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isEmpty",
"(",
"$",
"value",
")",
"&&",
"!",
"$",
"this",
"->",
"flags",
"&",
"Value",
"::",
"CAN_BE_EMPTY",
")",
"{",
... | Set the raw value.
@since 0.1.0
@param mixed $value New raw value.
@param bool $persist Optional. Whether to immediately persist the value.
@return Option Modified Option object. Can differ from the original one. | [
"Set",
"the",
"raw",
"value",
"."
] | 9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1 | https://github.com/brightnucleus/options-store/blob/9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1/src/Option/OptionTrait.php#L83-L107 | train |
jdmaymeow/cake-utility | src/Random/Dice.php | Dice.roll | public function roll($config = '1x6')
{
// parse config and set variables
$config = $this->parseConfig($config);
$diceType = $config[2];
$count = $config[1];
// initialize rolls and value variables
$rolls = [];
$value = 0;
// roll dice
for ($i ... | php | public function roll($config = '1x6')
{
// parse config and set variables
$config = $this->parseConfig($config);
$diceType = $config[2];
$count = $config[1];
// initialize rolls and value variables
$rolls = [];
$value = 0;
// roll dice
for ($i ... | [
"public",
"function",
"roll",
"(",
"$",
"config",
"=",
"'1x6'",
")",
"{",
"// parse config and set variables",
"$",
"config",
"=",
"$",
"this",
"->",
"parseConfig",
"(",
"$",
"config",
")",
";",
"$",
"diceType",
"=",
"$",
"config",
"[",
"2",
"]",
";",
... | Roll Dice and return array with all rolls and sum fo your rolls.
@param null $config Config
@return array | [
"Roll",
"Dice",
"and",
"return",
"array",
"with",
"all",
"rolls",
"and",
"sum",
"fo",
"your",
"rolls",
"."
] | 9da54f12a0f41fb1d590924db0c1130978b6e94e | https://github.com/jdmaymeow/cake-utility/blob/9da54f12a0f41fb1d590924db0c1130978b6e94e/src/Random/Dice.php#L36-L55 | train |
SlabPHP/configuration-manager | src/Manager.php | Manager.buildFileList | private function buildFileList($directories = [], $fileList = [])
{
$output = [];
foreach ($directories as $directory) {
foreach ($fileList as $file) {
$fileName = $directory . DIRECTORY_SEPARATOR . $file;
if (is_file($fileName) && is_readable($fileName))... | php | private function buildFileList($directories = [], $fileList = [])
{
$output = [];
foreach ($directories as $directory) {
foreach ($fileList as $file) {
$fileName = $directory . DIRECTORY_SEPARATOR . $file;
if (is_file($fileName) && is_readable($fileName))... | [
"private",
"function",
"buildFileList",
"(",
"$",
"directories",
"=",
"[",
"]",
",",
"$",
"fileList",
"=",
"[",
"]",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"directories",
"as",
"$",
"directory",
")",
"{",
"foreach",
"(",
... | Build file list
@param array $directories
@param array $fileList
@return array | [
"Build",
"file",
"list"
] | 3f36b528b8d7b0ffbb43ec933e82efd7312a3397 | https://github.com/SlabPHP/configuration-manager/blob/3f36b528b8d7b0ffbb43ec933e82efd7312a3397/src/Manager.php#L114-L128 | train |
SlabPHP/configuration-manager | src/Manager.php | Manager.parseConfigurationFiles | private function parseConfigurationFiles($fileList)
{
foreach ($fileList as $file) {
if (!is_file($file) || !is_readable($file)) {
if ($this->configuration->getLog())
{
$this->configuration->getLog()->error("Failed to load configuration file " ... | php | private function parseConfigurationFiles($fileList)
{
foreach ($fileList as $file) {
if (!is_file($file) || !is_readable($file)) {
if ($this->configuration->getLog())
{
$this->configuration->getLog()->error("Failed to load configuration file " ... | [
"private",
"function",
"parseConfigurationFiles",
"(",
"$",
"fileList",
")",
"{",
"foreach",
"(",
"$",
"fileList",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"file",
")",
"||",
"!",
"is_readable",
"(",
"$",
"file",
")",
")",
"{... | Go through each configuration directory and get the data
@param string[] $fileList | [
"Go",
"through",
"each",
"configuration",
"directory",
"and",
"get",
"the",
"data"
] | 3f36b528b8d7b0ffbb43ec933e82efd7312a3397 | https://github.com/SlabPHP/configuration-manager/blob/3f36b528b8d7b0ffbb43ec933e82efd7312a3397/src/Manager.php#L136-L167 | train |
SlabPHP/configuration-manager | src/Manager.php | Manager.mergeConfigurationOption | private function mergeConfigurationOption(&$currentNode, $name, $value)
{
if (empty($currentNode) || empty($name)) {
return;
}
//We're going to be building our own objects here
if (is_object($value)) {
$value = (array)$value;
}
if (is_array($... | php | private function mergeConfigurationOption(&$currentNode, $name, $value)
{
if (empty($currentNode) || empty($name)) {
return;
}
//We're going to be building our own objects here
if (is_object($value)) {
$value = (array)$value;
}
if (is_array($... | [
"private",
"function",
"mergeConfigurationOption",
"(",
"&",
"$",
"currentNode",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"currentNode",
")",
"||",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"return",
";",
"}",
"//W... | Merge a configuration option in
@param mixed $currentNode
@param string $name
@param mixed $value | [
"Merge",
"a",
"configuration",
"option",
"in"
] | 3f36b528b8d7b0ffbb43ec933e82efd7312a3397 | https://github.com/SlabPHP/configuration-manager/blob/3f36b528b8d7b0ffbb43ec933e82efd7312a3397/src/Manager.php#L222-L268 | train |
native5/native5-sdk-client-php | src/Native5/Control/DefaultController.php | DefaultController.execute | public function execute($request)
{
ob_start();
$logger = $GLOBALS['logger'];
$this->_request = $request;
$this->_response = new HttpResponse();
try {
WebSessionManager::updateActiveSession();
foreach ($this->_preProcessors as $preProcessor) ... | php | public function execute($request)
{
ob_start();
$logger = $GLOBALS['logger'];
$this->_request = $request;
$this->_response = new HttpResponse();
try {
WebSessionManager::updateActiveSession();
foreach ($this->_preProcessors as $preProcessor) ... | [
"public",
"function",
"execute",
"(",
"$",
"request",
")",
"{",
"ob_start",
"(",
")",
";",
"$",
"logger",
"=",
"$",
"GLOBALS",
"[",
"'logger'",
"]",
";",
"$",
"this",
"->",
"_request",
"=",
"$",
"request",
";",
"$",
"this",
"->",
"_response",
"=",
... | Handles Request Execution.
@param mixed $request HttpRequest @see Native5/Route/HttpRequest
@access public
@return void | [
"Handles",
"Request",
"Execution",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Control/DefaultController.php#L104-L158 | train |
SlabPHP/controllers | src/Sequenced.php | Sequenced.buildFailedOutputObject | protected function buildFailedOutputObject()
{
$error = '<!DOCTYPE html><html><head><title>An Error Occurred</title></head><body>';
$error.= '<h1>Error ' . $this->statusCode . '</h1>';
$error.= '<p>Sorry about that, please try again later!</p></body></html>';
$output = new \Slab\Con... | php | protected function buildFailedOutputObject()
{
$error = '<!DOCTYPE html><html><head><title>An Error Occurred</title></head><body>';
$error.= '<h1>Error ' . $this->statusCode . '</h1>';
$error.= '<p>Sorry about that, please try again later!</p></body></html>';
$output = new \Slab\Con... | [
"protected",
"function",
"buildFailedOutputObject",
"(",
")",
"{",
"$",
"error",
"=",
"'<!DOCTYPE html><html><head><title>An Error Occurred</title></head><body>'",
";",
"$",
"error",
".=",
"'<h1>Error '",
".",
"$",
"this",
"->",
"statusCode",
".",
"'</h1>'",
";",
"$",
... | When a call queue fails, this method will be used
@return \Slab\Components\Output\ControllerResponseInterface | [
"When",
"a",
"call",
"queue",
"fails",
"this",
"method",
"will",
"be",
"used"
] | a1c4fded0265100a85904dd664b972a7f8687652 | https://github.com/SlabPHP/controllers/blob/a1c4fded0265100a85904dd664b972a7f8687652/src/Sequenced.php#L97-L111 | train |
rollerworks/search-core | LazyFieldSetRegistry.php | LazyFieldSetRegistry.create | public static function create(array $configurators = []): self
{
$names = array_keys($configurators);
return new self(new ClosureContainer($configurators), array_combine($names, $names));
} | php | public static function create(array $configurators = []): self
{
$names = array_keys($configurators);
return new self(new ClosureContainer($configurators), array_combine($names, $names));
} | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"configurators",
"=",
"[",
"]",
")",
":",
"self",
"{",
"$",
"names",
"=",
"array_keys",
"(",
"$",
"configurators",
")",
";",
"return",
"new",
"self",
"(",
"new",
"ClosureContainer",
"(",
"$",
... | Creates a new LazyFieldSetRegistry with easy factories for loading.
@param \Closure[] $configurators an array of lazy loading configurators.
The Closure when called is expected to return
a FieldSetConfiguratorInterface object
@return LazyFieldSetRegistry | [
"Creates",
"a",
"new",
"LazyFieldSetRegistry",
"with",
"easy",
"factories",
"for",
"loading",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/LazyFieldSetRegistry.php#L66-L71 | train |
rollerworks/search-core | LazyFieldSetRegistry.php | LazyFieldSetRegistry.getConfigurator | public function getConfigurator(string $name): FieldSetConfigurator
{
if (!isset($this->configurators[$name])) {
if (isset($this->serviceIds[$name])) {
$configurator = $this->container->get($this->serviceIds[$name]);
} elseif (class_exists($name)) {
//... | php | public function getConfigurator(string $name): FieldSetConfigurator
{
if (!isset($this->configurators[$name])) {
if (isset($this->serviceIds[$name])) {
$configurator = $this->container->get($this->serviceIds[$name]);
} elseif (class_exists($name)) {
//... | [
"public",
"function",
"getConfigurator",
"(",
"string",
"$",
"name",
")",
":",
"FieldSetConfigurator",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"configurators",
"[",
"$",
"name",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
... | Returns a FieldSetConfigurator by name.
@param string $name The name of the FieldSet configurator
@throws InvalidArgumentException if the configurator can not be retrieved
@return FieldSetConfigurator | [
"Returns",
"a",
"FieldSetConfigurator",
"by",
"name",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/LazyFieldSetRegistry.php#L82-L102 | train |
rollerworks/search-core | LazyFieldSetRegistry.php | LazyFieldSetRegistry.hasConfigurator | public function hasConfigurator(string $name): bool
{
if (isset($this->configurators[$name])) {
return true;
}
if (isset($this->serviceIds[$name])) {
return true;
}
return class_exists($name) && \in_array(FieldSetConfigurator::class, class_implements... | php | public function hasConfigurator(string $name): bool
{
if (isset($this->configurators[$name])) {
return true;
}
if (isset($this->serviceIds[$name])) {
return true;
}
return class_exists($name) && \in_array(FieldSetConfigurator::class, class_implements... | [
"public",
"function",
"hasConfigurator",
"(",
"string",
"$",
"name",
")",
":",
"bool",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"configurators",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"isset",
"(",
"$",... | Returns whether the given FieldSetConfigurator is supported.
@param string $name The name of the FieldSet configurator
@return bool | [
"Returns",
"whether",
"the",
"given",
"FieldSetConfigurator",
"is",
"supported",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/LazyFieldSetRegistry.php#L111-L122 | train |
DoSomething/mb-toolbox | src/MB_Configuration.php | MB_Configuration.getProperty | public function getProperty($key, $notifyWarnings = true)
{
if (!(isset($this->configSettings[$key])) && $notifyWarnings) {
echo 'MB_Configuration->getProperty() - Warning: "' . $key . '" not defined.', PHP_EOL;
$callers = debug_backtrace();
echo '- Called from: ' . $callers[1]['function'], PHP_... | php | public function getProperty($key, $notifyWarnings = true)
{
if (!(isset($this->configSettings[$key])) && $notifyWarnings) {
echo 'MB_Configuration->getProperty() - Warning: "' . $key . '" not defined.', PHP_EOL;
$callers = debug_backtrace();
echo '- Called from: ' . $callers[1]['function'], PHP_... | [
"public",
"function",
"getProperty",
"(",
"$",
"key",
",",
"$",
"notifyWarnings",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"(",
"isset",
"(",
"$",
"this",
"->",
"configSettings",
"[",
"$",
"key",
"]",
")",
")",
"&&",
"$",
"notifyWarnings",
")",
"{",
... | Get property in MB_Configuration instance.
@param string $key
The name of property to get.
@param boolean $notifyWarnings
Flag to enable / disable warning and traceback if property not found. | [
"Get",
"property",
"in",
"MB_Configuration",
"instance",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Configuration.php#L99-L110 | train |
DoSomething/mb-toolbox | src/MB_Configuration.php | MB_Configuration.exchangeSettings | public function exchangeSettings($targetExchange)
{
$settings = null;
if (isset($this->configSettings['configFile']->rabbit->exchanges)) {
foreach ($this->configSettings['configFile']->rabbit->exchanges as $exchange => $exchangeSettings) {
if ($exchange == $targetExchange) {
$settings... | php | public function exchangeSettings($targetExchange)
{
$settings = null;
if (isset($this->configSettings['configFile']->rabbit->exchanges)) {
foreach ($this->configSettings['configFile']->rabbit->exchanges as $exchange => $exchangeSettings) {
if ($exchange == $targetExchange) {
$settings... | [
"public",
"function",
"exchangeSettings",
"(",
"$",
"targetExchange",
")",
"{",
"$",
"settings",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"configSettings",
"[",
"'configFile'",
"]",
"->",
"rabbit",
"->",
"exchanges",
")",
")",
"{",
"... | Gather all setting for a specific exchange
@param string $targetExchange
The name of the exchange to gather setting for.
@return array $settings
The exchange settings in the format needed for a RabbitMQ connection. | [
"Gather",
"all",
"setting",
"for",
"a",
"specific",
"exchange"
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Configuration.php#L204-L225 | train |
DoSomething/mb-toolbox | src/MB_Configuration.php | MB_Configuration._gatherSettings | private static function _gatherSettings($source)
{
if (strpos('http://', $source) !== false) {
echo 'cURL sources are not currently supported.', PHP_EOL;
} elseif (file_exists($source)) {
$settings = json_decode(implode(file($source)));
return $settings;
} else {
echo 'Source: ' .... | php | private static function _gatherSettings($source)
{
if (strpos('http://', $source) !== false) {
echo 'cURL sources are not currently supported.', PHP_EOL;
} elseif (file_exists($source)) {
$settings = json_decode(implode(file($source)));
return $settings;
} else {
echo 'Source: ' .... | [
"private",
"static",
"function",
"_gatherSettings",
"(",
"$",
"source",
")",
"{",
"if",
"(",
"strpos",
"(",
"'http://'",
",",
"$",
"source",
")",
"!==",
"false",
")",
"{",
"echo",
"'cURL sources are not currently supported.'",
",",
"PHP_EOL",
";",
"}",
"elseif... | Gather all Message Broker configuration settings from the defined source.
@param string $source
Source can be the path to a file or a URL to an endpoint. | [
"Gather",
"all",
"Message",
"Broker",
"configuration",
"settings",
"from",
"the",
"defined",
"source",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Configuration.php#L264-L275 | train |
linpax/microphp-framework | src/file/Filesystem.php | Filesystem.setDriver | public function setDriver(array $params = [])
{
$driverName = !empty($params['driver']) ? $params['driver'] : 'local';
$this->driver = new $driverName($params);
} | php | public function setDriver(array $params = [])
{
$driverName = !empty($params['driver']) ? $params['driver'] : 'local';
$this->driver = new $driverName($params);
} | [
"public",
"function",
"setDriver",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"driverName",
"=",
"!",
"empty",
"(",
"$",
"params",
"[",
"'driver'",
"]",
")",
"?",
"$",
"params",
"[",
"'driver'",
"]",
":",
"'local'",
";",
"$",
"this"... | Set driver usage driver params
@access public
@param array $params Driver params
@return void | [
"Set",
"driver",
"usage",
"driver",
"params"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/file/Filesystem.php#L52-L57 | train |
sokil/NotificationBundle | src/DependencyInjection/CompilerPass/MessageBuilderPass.php | MessageBuilderPass.getMessageBuilderCollectionServiceidList | private function getMessageBuilderCollectionServiceidList(ContainerBuilder $container)
{
$builderCollectionServiceIdList = [];
$messageBuilderCollectionListDefinition = $container->findTaggedServiceIds('notification.message_builder_collection');
foreach ($messageBuilderCollectionListDefinit... | php | private function getMessageBuilderCollectionServiceidList(ContainerBuilder $container)
{
$builderCollectionServiceIdList = [];
$messageBuilderCollectionListDefinition = $container->findTaggedServiceIds('notification.message_builder_collection');
foreach ($messageBuilderCollectionListDefinit... | [
"private",
"function",
"getMessageBuilderCollectionServiceidList",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"builderCollectionServiceIdList",
"=",
"[",
"]",
";",
"$",
"messageBuilderCollectionListDefinition",
"=",
"$",
"container",
"->",
"findTaggedServiceI... | Get service ids of collections | [
"Get",
"service",
"ids",
"of",
"collections"
] | bf8d793b6b5a13827b2db4f0b3c588cf6a03c66b | https://github.com/sokil/NotificationBundle/blob/bf8d793b6b5a13827b2db4f0b3c588cf6a03c66b/src/DependencyInjection/CompilerPass/MessageBuilderPass.php#L81-L97 | train |
FuzeWorks/Core | src/FuzeWorks/ConfigORM/ConfigORM.php | ConfigORM.commit | public function commit()
{
// Write the changes
if (is_writable($this->file)) {
$config = var_export($this->cfg, true);
file_put_contents($this->file, "<?php return $config ;");
return true;
}
throw new ConfigException("Could not write config file. $... | php | public function commit()
{
// Write the changes
if (is_writable($this->file)) {
$config = var_export($this->cfg, true);
file_put_contents($this->file, "<?php return $config ;");
return true;
}
throw new ConfigException("Could not write config file. $... | [
"public",
"function",
"commit",
"(",
")",
"{",
"// Write the changes",
"if",
"(",
"is_writable",
"(",
"$",
"this",
"->",
"file",
")",
")",
"{",
"$",
"config",
"=",
"var_export",
"(",
"$",
"this",
"->",
"cfg",
",",
"true",
")",
";",
"file_put_contents",
... | Updates the config file and writes it.
@throws ConfigException on fatal error | [
"Updates",
"the",
"config",
"file",
"and",
"writes",
"it",
"."
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/ConfigORM/ConfigORM.php#L84-L94 | train |
Lustmored/oauth2-lockme | src/Provider/Lockme.php | Lockme.executeRequest | public function executeRequest($method, $url, $token, $body = null)
{
$options = [];
if ($body) {
$options['body'] = json_encode($body);
$options['headers']['Content-Type'] = 'application/json';
}
$request = $this->getAuthenticatedRequest($method, $this->apiD... | php | public function executeRequest($method, $url, $token, $body = null)
{
$options = [];
if ($body) {
$options['body'] = json_encode($body);
$options['headers']['Content-Type'] = 'application/json';
}
$request = $this->getAuthenticatedRequest($method, $this->apiD... | [
"public",
"function",
"executeRequest",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"token",
",",
"$",
"body",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"body",
")",
"{",
"$",
"options",
"[",
"'body'",
"]",
"... | Generate request, execute it and return parsed response
@param string $method
@param string $url
@param AccessToken|string|null $token
@param mixed $body
@return mixed | [
"Generate",
"request",
"execute",
"it",
"and",
"return",
"parsed",
"response"
] | 906c40be9d896d28d20b1bbdf32f91c858e3c280 | https://github.com/Lustmored/oauth2-lockme/blob/906c40be9d896d28d20b1bbdf32f91c858e3c280/src/Provider/Lockme.php#L77-L88 | train |
miguelibero/meinhof | src/Meinhof/Meinhof.php | Meinhof.reload | public function reload()
{
$this->container = $this->buildContainer($this->dir);
// load input and output
$this->container->set('input', $this->input);
$this->container->set('output', $this->output);
// freeze the container
$this->container->compile();
} | php | public function reload()
{
$this->container = $this->buildContainer($this->dir);
// load input and output
$this->container->set('input', $this->input);
$this->container->set('output', $this->output);
// freeze the container
$this->container->compile();
} | [
"public",
"function",
"reload",
"(",
")",
"{",
"$",
"this",
"->",
"container",
"=",
"$",
"this",
"->",
"buildContainer",
"(",
"$",
"this",
"->",
"dir",
")",
";",
"// load input and output",
"$",
"this",
"->",
"container",
"->",
"set",
"(",
"'input'",
","... | Reload the dependency container | [
"Reload",
"the",
"dependency",
"container"
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Meinhof.php#L60-L70 | train |
miguelibero/meinhof | src/Meinhof/Meinhof.php | Meinhof.buildContainer | public function buildContainer($dir)
{
// load the container
$container = new ContainerBuilder();
// setup basic container compiler passes
$container->addCompilerPass(new EventListenerPass());
$container->addCompilerPass(new TemplatingEnginePass());
$configDir = $di... | php | public function buildContainer($dir)
{
// load the container
$container = new ContainerBuilder();
// setup basic container compiler passes
$container->addCompilerPass(new EventListenerPass());
$container->addCompilerPass(new TemplatingEnginePass());
$configDir = $di... | [
"public",
"function",
"buildContainer",
"(",
"$",
"dir",
")",
"{",
"// load the container",
"$",
"container",
"=",
"new",
"ContainerBuilder",
"(",
")",
";",
"// setup basic container compiler passes",
"$",
"container",
"->",
"addCompilerPass",
"(",
"new",
"EventListen... | Builds the dependency injection container
@param string $dir the path to the base of the site configuration
@return ContainerInterface the new container
@throws \RuntimeException when a service tagged as an extension does not implement ExtensionInterface | [
"Builds",
"the",
"dependency",
"injection",
"container"
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Meinhof.php#L103-L139 | train |
miguelibero/meinhof | src/Meinhof/Meinhof.php | Meinhof.dispatchEvent | protected function dispatchEvent($event)
{
if (!$this->container) {
throw new \RuntimeException("The container has not been set up.");
}
$dir = $this->container->getParameter('base_dir');
if (!is_dir($dir) || !is_readable($dir)) {
throw new \RuntimeException("... | php | protected function dispatchEvent($event)
{
if (!$this->container) {
throw new \RuntimeException("The container has not been set up.");
}
$dir = $this->container->getParameter('base_dir');
if (!is_dir($dir) || !is_readable($dir)) {
throw new \RuntimeException("... | [
"protected",
"function",
"dispatchEvent",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"The container has not been set up.\"",
")",
";",
"}",
"$",
"dir",
"=",
"$",
"... | Dispatches an event
@throws \RuntimeException when the container is not present
@throws \RuntimeException when the site directory is not readable | [
"Dispatches",
"an",
"event"
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Meinhof.php#L147-L158 | train |
quantaphp/container-factories | src/AutowiredInstance.php | AutowiredInstance.parameters | private function parameters(): array
{
try {
$reflection = new \ReflectionClass($this->class);
}
catch (\ReflectionException $e) {
return [];
}
$constructor = $reflection->getConstructor();
return is_null($constructor) ? [] : $constructor->g... | php | private function parameters(): array
{
try {
$reflection = new \ReflectionClass($this->class);
}
catch (\ReflectionException $e) {
return [];
}
$constructor = $reflection->getConstructor();
return is_null($constructor) ? [] : $constructor->g... | [
"private",
"function",
"parameters",
"(",
")",
":",
"array",
"{",
"try",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
"->",
"class",
")",
";",
"}",
"catch",
"(",
"\\",
"ReflectionException",
"$",
"e",
")",
"{",
"return... | Return the non variadic class constructor parameter reflections.
When the string is not a class name the method does not fail and returns
an empty array. This way the script keeps going until the factory tries
to instantiate a non class and fail like it would by manually doing so.
@return \ReflectionParameter[] | [
"Return",
"the",
"non",
"variadic",
"class",
"constructor",
"parameter",
"reflections",
"."
] | 5e753d66a18d0ce4418cbf33fe6d6b74948f303d | https://github.com/quantaphp/container-factories/blob/5e753d66a18d0ce4418cbf33fe6d6b74948f303d/src/AutowiredInstance.php#L82-L95 | train |
enikeishik/ufoframework | src/Ufo/Core/Debug.php | Debug.trace | public function trace(string $operation): int
{
$this->buffTrace[] = [
'operation' => $operation,
'time' => microtime(true),
'result' => '',
'stack' => 9 == self::C_DEBUG_LEVEL ? debug_backtrace(): null,
];
return count($this->b... | php | public function trace(string $operation): int
{
$this->buffTrace[] = [
'operation' => $operation,
'time' => microtime(true),
'result' => '',
'stack' => 9 == self::C_DEBUG_LEVEL ? debug_backtrace(): null,
];
return count($this->b... | [
"public",
"function",
"trace",
"(",
"string",
"$",
"operation",
")",
":",
"int",
"{",
"$",
"this",
"->",
"buffTrace",
"[",
"]",
"=",
"[",
"'operation'",
"=>",
"$",
"operation",
",",
"'time'",
"=>",
"microtime",
"(",
"true",
")",
",",
"'result'",
"=>",
... | Create new trace item.
@param string $operation
@return int | [
"Create",
"new",
"trace",
"item",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Core/Debug.php#L58-L67 | train |
enikeishik/ufoframework | src/Ufo/Core/Debug.php | Debug.traceClose | public function traceClose(int $idx = null, int $errCode = null, string $errMessage = null): void
{
if (null === $idx) {
$idx = count($this->buffTrace) - 1;
}
if (!array_key_exists($idx, $this->buffTrace)) {
throw new DebugIndexNotExistsException();
}... | php | public function traceClose(int $idx = null, int $errCode = null, string $errMessage = null): void
{
if (null === $idx) {
$idx = count($this->buffTrace) - 1;
}
if (!array_key_exists($idx, $this->buffTrace)) {
throw new DebugIndexNotExistsException();
}... | [
"public",
"function",
"traceClose",
"(",
"int",
"$",
"idx",
"=",
"null",
",",
"int",
"$",
"errCode",
"=",
"null",
",",
"string",
"$",
"errMessage",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"===",
"$",
"idx",
")",
"{",
"$",
"idx",
"=... | Close trace item by its index.
@param int $idx = null
@param int $errCode = null
@param string $errMessage = null
@return void | [
"Close",
"trace",
"item",
"by",
"its",
"index",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Core/Debug.php#L76-L88 | train |
enikeishik/ufoframework | src/Ufo/Core/Debug.php | Debug.traceEnd | public function traceEnd(): void
{
$now = microtime(true);
foreach ($this->buffTrace as &$traceItem) {
if ('' === $traceItem['result']) {
$traceItem['time'] = $now - $traceItem['time'];
$traceItem['result'] = 'Trace end';
}
}
un... | php | public function traceEnd(): void
{
$now = microtime(true);
foreach ($this->buffTrace as &$traceItem) {
if ('' === $traceItem['result']) {
$traceItem['time'] = $now - $traceItem['time'];
$traceItem['result'] = 'Trace end';
}
}
un... | [
"public",
"function",
"traceEnd",
"(",
")",
":",
"void",
"{",
"$",
"now",
"=",
"microtime",
"(",
"true",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"buffTrace",
"as",
"&",
"$",
"traceItem",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"traceItem",
"[",... | Set time to now-time for each unclosed trace items.
@return void | [
"Set",
"time",
"to",
"now",
"-",
"time",
"for",
"each",
"unclosed",
"trace",
"items",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Core/Debug.php#L94-L104 | train |
enikeishik/ufoframework | src/Ufo/Core/Debug.php | Debug.vd | public static function vd($var, bool $dump = true, bool $stop = true, int $obLevel = 0): void
{
if ($stop) {
while (ob_get_level() > $obLevel) {
ob_end_clean();
}
}
ob_start();
if (empty($_SERVER['DOCUMENT_ROOT'])) {
$dump ... | php | public static function vd($var, bool $dump = true, bool $stop = true, int $obLevel = 0): void
{
if ($stop) {
while (ob_get_level() > $obLevel) {
ob_end_clean();
}
}
ob_start();
if (empty($_SERVER['DOCUMENT_ROOT'])) {
$dump ... | [
"public",
"static",
"function",
"vd",
"(",
"$",
"var",
",",
"bool",
"$",
"dump",
"=",
"true",
",",
"bool",
"$",
"stop",
"=",
"true",
",",
"int",
"$",
"obLevel",
"=",
"0",
")",
":",
"void",
"{",
"if",
"(",
"$",
"stop",
")",
"{",
"while",
"(",
... | Show variable debug info.
@param mixed $var
@param bool $dump = true
@param bool $stop = true
@return void | [
"Show",
"variable",
"debug",
"info",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Core/Debug.php#L150-L172 | train |
Dhii/exception-helper-base | src/CreateOutOfRangeExceptionCapableTrait.php | CreateOutOfRangeExceptionCapableTrait._createOutOfRangeException | protected function _createOutOfRangeException(
$message = null,
$code = null,
RootException $previous = null,
$argument = null
) {
return new OutOfRangeException($message, $code, $previous, $argument);
} | php | protected function _createOutOfRangeException(
$message = null,
$code = null,
RootException $previous = null,
$argument = null
) {
return new OutOfRangeException($message, $code, $previous, $argument);
} | [
"protected",
"function",
"_createOutOfRangeException",
"(",
"$",
"message",
"=",
"null",
",",
"$",
"code",
"=",
"null",
",",
"RootException",
"$",
"previous",
"=",
"null",
",",
"$",
"argument",
"=",
"null",
")",
"{",
"return",
"new",
"OutOfRangeException",
"... | Creates a new Dhii Out Of Range exception.
@since [*next-version*]
@param string|Stringable|int|float|bool|null $message The message, if any.
@param int|float|string|Stringable|null $code The numeric error code, if any.
@param RootException|null $previous The inner exception, if any.
@par... | [
"Creates",
"a",
"new",
"Dhii",
"Out",
"Of",
"Range",
"exception",
"."
] | e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5 | https://github.com/Dhii/exception-helper-base/blob/e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5/src/CreateOutOfRangeExceptionCapableTrait.php#L27-L34 | train |
Wedeto/HTTP | src/Response/StringResponse.php | StringResponse.setOutput | public function setOutput($output, string $mime = "text/html")
{
if (
!is_string($output) && !is_callable($output)
&& !(is_object($output) && method_exists($output, '__toString'))
)
{
throw new \InvalidArgumentException(
"Output must be te... | php | public function setOutput($output, string $mime = "text/html")
{
if (
!is_string($output) && !is_callable($output)
&& !(is_object($output) && method_exists($output, '__toString'))
)
{
throw new \InvalidArgumentException(
"Output must be te... | [
"public",
"function",
"setOutput",
"(",
"$",
"output",
",",
"string",
"$",
"mime",
"=",
"\"text/html\"",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"output",
")",
"&&",
"!",
"is_callable",
"(",
"$",
"output",
")",
"&&",
"!",
"(",
"is_object",
"... | Set or replace the output for a content type
@param mixed $str The text to add. This can be a string, a callback
function returning a string or an object with a
__toString method.
@param string $mime The mime-type for the content
@return StringResponse Provides fluent interface | [
"Set",
"or",
"replace",
"the",
"output",
"for",
"a",
"content",
"type"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Response/StringResponse.php#L55-L69 | train |
Wedeto/HTTP | src/Response/StringResponse.php | StringResponse.append | public function append(string $str, string $mime = "text/html")
{
// To append, we need to make sure we have a string first
if (empty($this->output[$mime]) || !is_string($this->output[$mime]))
$this->output[$mime] = $this->getOutput($mime);
$this->output[$mime] .= $str;
... | php | public function append(string $str, string $mime = "text/html")
{
// To append, we need to make sure we have a string first
if (empty($this->output[$mime]) || !is_string($this->output[$mime]))
$this->output[$mime] = $this->getOutput($mime);
$this->output[$mime] .= $str;
... | [
"public",
"function",
"append",
"(",
"string",
"$",
"str",
",",
"string",
"$",
"mime",
"=",
"\"text/html\"",
")",
"{",
"// To append, we need to make sure we have a string first",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"output",
"[",
"$",
"mime",
"]",
")"... | Append a string to the current output
@param string $str The string to add
@return StringResponse Provides fluent interface | [
"Append",
"a",
"string",
"to",
"the",
"current",
"output"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Response/StringResponse.php#L76-L84 | train |
Wedeto/HTTP | src/Response/StringResponse.php | StringResponse.output | public function output(string $mime)
{
$output = $this->getOutput($mime);
if (empty($output))
$output = "Unknown mime type requested";
echo $output;
return $this;
} | php | public function output(string $mime)
{
$output = $this->getOutput($mime);
if (empty($output))
$output = "Unknown mime type requested";
echo $output;
return $this;
} | [
"public",
"function",
"output",
"(",
"string",
"$",
"mime",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"getOutput",
"(",
"$",
"mime",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"output",
")",
")",
"$",
"output",
"=",
"\"Unknown mime type requested\"... | Write the string to the script output
@return StringResponse Provides fluent interface | [
"Write",
"the",
"string",
"to",
"the",
"script",
"output"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Response/StringResponse.php#L108-L116 | train |
mrcrmn/collection | src/Collection.php | Collection.set | public function set($key, $value = null)
{
if (isset($value)) {
return $this->array[$key] = $value;
}
return $this->array[] = $key;
} | php | public function set($key, $value = null)
{
if (isset($value)) {
return $this->array[$key] = $value;
}
return $this->array[] = $key;
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"array",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"return",
"... | Adds an element to the array. With key or without.
@param int|string $key
@param mixed $value
@return void | [
"Adds",
"an",
"element",
"to",
"the",
"array",
".",
"With",
"key",
"or",
"without",
"."
] | a48c5ed15f14ff4b52d2a824c4df7456a88f7678 | https://github.com/mrcrmn/collection/blob/a48c5ed15f14ff4b52d2a824c4df7456a88f7678/src/Collection.php#L123-L130 | train |
mrcrmn/collection | src/Collection.php | Collection.each | public function each($callback)
{
array_walk($this->array, function($value, $key) use ($callback) {
$callback($key, $value);
});
return $this;
} | php | public function each($callback)
{
array_walk($this->array, function($value, $key) use ($callback) {
$callback($key, $value);
});
return $this;
} | [
"public",
"function",
"each",
"(",
"$",
"callback",
")",
"{",
"array_walk",
"(",
"$",
"this",
"->",
"array",
",",
"function",
"(",
"$",
"value",
",",
"$",
"key",
")",
"use",
"(",
"$",
"callback",
")",
"{",
"$",
"callback",
"(",
"$",
"key",
",",
"... | Runs the given callback on each element of the array.
@param Callable $callback
@return $this | [
"Runs",
"the",
"given",
"callback",
"on",
"each",
"element",
"of",
"the",
"array",
"."
] | a48c5ed15f14ff4b52d2a824c4df7456a88f7678 | https://github.com/mrcrmn/collection/blob/a48c5ed15f14ff4b52d2a824c4df7456a88f7678/src/Collection.php#L213-L220 | train |
mrcrmn/collection | src/Collection.php | Collection.filter | public function filter($callback = null)
{
if (is_null($callback)) {
return new static(array_filter($this->array));
}
return new static(array_filter($this->array, $callback));
} | php | public function filter($callback = null)
{
if (is_null($callback)) {
return new static(array_filter($this->array));
}
return new static(array_filter($this->array, $callback));
} | [
"public",
"function",
"filter",
"(",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"callback",
")",
")",
"{",
"return",
"new",
"static",
"(",
"array_filter",
"(",
"$",
"this",
"->",
"array",
")",
")",
";",
"}",
"return",
"... | Filters the array by a given callback.
@param Callable $callback
@return self | [
"Filters",
"the",
"array",
"by",
"a",
"given",
"callback",
"."
] | a48c5ed15f14ff4b52d2a824c4df7456a88f7678 | https://github.com/mrcrmn/collection/blob/a48c5ed15f14ff4b52d2a824c4df7456a88f7678/src/Collection.php#L249-L255 | train |
mrcrmn/collection | src/Collection.php | Collection.chunk | public function chunk($size)
{
$chunked = array_chunk($this->array, $size);
return new static(array_map(function ($item) {
return new static($item);
}, $chunked));
} | php | public function chunk($size)
{
$chunked = array_chunk($this->array, $size);
return new static(array_map(function ($item) {
return new static($item);
}, $chunked));
} | [
"public",
"function",
"chunk",
"(",
"$",
"size",
")",
"{",
"$",
"chunked",
"=",
"array_chunk",
"(",
"$",
"this",
"->",
"array",
",",
"$",
"size",
")",
";",
"return",
"new",
"static",
"(",
"array_map",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"r... | Splits the array into chunks of the given size.
@param string $size
@return self | [
"Splits",
"the",
"array",
"into",
"chunks",
"of",
"the",
"given",
"size",
"."
] | a48c5ed15f14ff4b52d2a824c4df7456a88f7678 | https://github.com/mrcrmn/collection/blob/a48c5ed15f14ff4b52d2a824c4df7456a88f7678/src/Collection.php#L263-L270 | train |
pryley/castor-framework | src/Forms/Form.php | Form.normalize | public function normalize( array $args = [] )
{
$defaults = [
'action' => '',
'attributes' => '',
'id' => '',
'class' => '',
'enctype' => 'multipart/form-data',
'method' => 'post',
'nonce' => '',
'submit' => __( 'Submit', 'site-reviews' ),
];
$this->args ... | php | public function normalize( array $args = [] )
{
$defaults = [
'action' => '',
'attributes' => '',
'id' => '',
'class' => '',
'enctype' => 'multipart/form-data',
'method' => 'post',
'nonce' => '',
'submit' => __( 'Submit', 'site-reviews' ),
];
$this->args ... | [
"public",
"function",
"normalize",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'action'",
"=>",
"''",
",",
"'attributes'",
"=>",
"''",
",",
"'id'",
"=>",
"''",
",",
"'class'",
"=>",
"''",
",",
"'enctype'",
"=>",
... | Normalize the form arguments
@return Form | [
"Normalize",
"the",
"form",
"arguments"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Form.php#L106-L126 | train |
pryley/castor-framework | src/Forms/Form.php | Form.generateFields | protected function generateFields()
{
$hiddenFields = '';
$fields = array_reduce( $this->fields, function( $carry, $formField ) use ( &$hiddenFields ) {
$stringLegend = '<legend class="screen-reader-text"><span>%s</span></legend>';
$stringFieldset = '<fieldset%s>%s%s</fieldset>';
$stringRendered = ... | php | protected function generateFields()
{
$hiddenFields = '';
$fields = array_reduce( $this->fields, function( $carry, $formField ) use ( &$hiddenFields ) {
$stringLegend = '<legend class="screen-reader-text"><span>%s</span></legend>';
$stringFieldset = '<fieldset%s>%s%s</fieldset>';
$stringRendered = ... | [
"protected",
"function",
"generateFields",
"(",
")",
"{",
"$",
"hiddenFields",
"=",
"''",
";",
"$",
"fields",
"=",
"array_reduce",
"(",
"$",
"this",
"->",
"fields",
",",
"function",
"(",
"$",
"carry",
",",
"$",
"formField",
")",
"use",
"(",
"&",
"$",
... | Generate the form fields
@return string | [
"Generate",
"the",
"form",
"fields"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Form.php#L168-L212 | train |
pryley/castor-framework | src/Forms/Form.php | Form.generateSubmitButton | protected function generateSubmitButton()
{
$args = $this->args['submit'];
is_array( $args ) ?: $args = ['text' => $args ];
$args = shortcode_atts([
'text' => __( 'Save Changes', 'site-reviews' ),
'type' => 'primary',
'name' => 'submit',
'wrap' => true,
'other_attributes' => null,
], $args );
... | php | protected function generateSubmitButton()
{
$args = $this->args['submit'];
is_array( $args ) ?: $args = ['text' => $args ];
$args = shortcode_atts([
'text' => __( 'Save Changes', 'site-reviews' ),
'type' => 'primary',
'name' => 'submit',
'wrap' => true,
'other_attributes' => null,
], $args );
... | [
"protected",
"function",
"generateSubmitButton",
"(",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"args",
"[",
"'submit'",
"]",
";",
"is_array",
"(",
"$",
"args",
")",
"?",
":",
"$",
"args",
"=",
"[",
"'text'",
"=>",
"$",
"args",
"]",
";",
"$",
... | Generate the form submit button
@return null|string | [
"Generate",
"the",
"form",
"submit",
"button"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Form.php#L219-L238 | train |
Talesoft/tale-framework | src/Tale/Enum.php | Enum.getName | public static function getName( $value ) {
$constants = array_flip( static::getValues() );
if( !isset( $constants[ $value ] ) )
throw new InvalidArgumentException( "Invalid argument passed to Enum::getName: $value is not a valid value in this enum" );
return $constants[ $value ];
... | php | public static function getName( $value ) {
$constants = array_flip( static::getValues() );
if( !isset( $constants[ $value ] ) )
throw new InvalidArgumentException( "Invalid argument passed to Enum::getName: $value is not a valid value in this enum" );
return $constants[ $value ];
... | [
"public",
"static",
"function",
"getName",
"(",
"$",
"value",
")",
"{",
"$",
"constants",
"=",
"array_flip",
"(",
"static",
"::",
"getValues",
"(",
")",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"constants",
"[",
"$",
"value",
"]",
")",
")",
"th... | Returns the name for a specific enum value.
Notice that it find's the first constant having that value, all constants with the same
value after that will be ignored
@param mixed $value The value for the constant name to find
@return string The name of the constant with the given value | [
"Returns",
"the",
"name",
"for",
"a",
"specific",
"enum",
"value",
".",
"Notice",
"that",
"it",
"find",
"s",
"the",
"first",
"constant",
"having",
"that",
"value",
"all",
"constants",
"with",
"the",
"same",
"value",
"after",
"that",
"will",
"be",
"ignored"... | 739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49 | https://github.com/Talesoft/tale-framework/blob/739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49/src/Tale/Enum.php#L58-L66 | train |
mpf-soft/admin-widgets | datatable/columns/Basic.php | Basic.getFilter | public function getFilter()
{
if (false === $this->filter) {
return '';
}
if (is_array($this->filter)) {
return Form::get()->select($this->dataProvider->filtersKey . '[' . $this->name . ']', $this->filter, null, array(), '');
}
if (is_string($... | php | public function getFilter()
{
if (false === $this->filter) {
return '';
}
if (is_array($this->filter)) {
return Form::get()->select($this->dataProvider->filtersKey . '[' . $this->name . ']', $this->filter, null, array(), '');
}
if (is_string($... | [
"public",
"function",
"getFilter",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"filter",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"filter",
")",
")",
"{",
"return",
"Form",
"::",
"get",
"... | Get HTML table filter for selected column;
@return string | [
"Get",
"HTML",
"table",
"filter",
"for",
"selected",
"column",
";"
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/datatable/columns/Basic.php#L181-L195 | train |
mpf-soft/admin-widgets | datatable/columns/Basic.php | Basic.getHeaderHtmlOptions | public function getHeaderHtmlOptions()
{
$r = '';
if ($this->htmlClass) {
$this->headerHtmlOptions['class'] = (isset($this->headerHtmlOptions['class']) ? $this->headerHtmlOptions['class'] . ' ' : '') . $this->htmlClass;
}
foreach ($this->headerHtmlOptions as $k => $v)
... | php | public function getHeaderHtmlOptions()
{
$r = '';
if ($this->htmlClass) {
$this->headerHtmlOptions['class'] = (isset($this->headerHtmlOptions['class']) ? $this->headerHtmlOptions['class'] . ' ' : '') . $this->htmlClass;
}
foreach ($this->headerHtmlOptions as $k => $v)
... | [
"public",
"function",
"getHeaderHtmlOptions",
"(",
")",
"{",
"$",
"r",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"htmlClass",
")",
"{",
"$",
"this",
"->",
"headerHtmlOptions",
"[",
"'class'",
"]",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"heade... | Return html options for header;
@return string | [
"Return",
"html",
"options",
"for",
"header",
";"
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/datatable/columns/Basic.php#L201-L210 | train |
mpf-soft/admin-widgets | datatable/columns/Basic.php | Basic.getFilterHtmlOptions | public function getFilterHtmlOptions()
{
$r = '';
if ($this->htmlClass) {
$this->filterHtmlOptions['class'] = (isset($this->filterHtmlOptions['class']) ? $this->filterHtmlOptions['class'] . ' ' : '') . $this->htmlClass;
}
foreach ($this->filterHtmlOptions as $k => $v)
... | php | public function getFilterHtmlOptions()
{
$r = '';
if ($this->htmlClass) {
$this->filterHtmlOptions['class'] = (isset($this->filterHtmlOptions['class']) ? $this->filterHtmlOptions['class'] . ' ' : '') . $this->htmlClass;
}
foreach ($this->filterHtmlOptions as $k => $v)
... | [
"public",
"function",
"getFilterHtmlOptions",
"(",
")",
"{",
"$",
"r",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"htmlClass",
")",
"{",
"$",
"this",
"->",
"filterHtmlOptions",
"[",
"'class'",
"]",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"filte... | Return html options for filter;
@return string | [
"Return",
"html",
"options",
"for",
"filter",
";"
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/datatable/columns/Basic.php#L216-L225 | train |
mpf-soft/admin-widgets | datatable/columns/Basic.php | Basic.getHtmlOptions | public function getHtmlOptions()
{
$r = '';
if ($this->htmlClass) {
$this->htmlOptions['class'] = (isset($this->htmlOptions['class']) ? $this->htmlOptions['class'] . ' ' : '') . $this->htmlClass;
}
foreach ($this->htmlOptions as $k => $v)
$r .= "$k = '$v' ";
... | php | public function getHtmlOptions()
{
$r = '';
if ($this->htmlClass) {
$this->htmlOptions['class'] = (isset($this->htmlOptions['class']) ? $this->htmlOptions['class'] . ' ' : '') . $this->htmlClass;
}
foreach ($this->htmlOptions as $k => $v)
$r .= "$k = '$v' ";
... | [
"public",
"function",
"getHtmlOptions",
"(",
")",
"{",
"$",
"r",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"htmlClass",
")",
"{",
"$",
"this",
"->",
"htmlOptions",
"[",
"'class'",
"]",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"htmlOptions",
"... | Return html options for cell;
@return string | [
"Return",
"html",
"options",
"for",
"cell",
";"
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/datatable/columns/Basic.php#L231-L240 | train |
mpf-soft/admin-widgets | datatable/columns/Basic.php | Basic.getHeaderCode | public function getHeaderCode(\mpf\widgets\datatable\Table $table)
{
$label = $this->getLabel();
if (!$this->order) {
return $label;
}
$order = $this->dataProvider->getOrder();
$prefix = '';
$this->iconArrowUp = str_replace(array('%DATATABLE_ASSETS%', '%S... | php | public function getHeaderCode(\mpf\widgets\datatable\Table $table)
{
$label = $this->getLabel();
if (!$this->order) {
return $label;
}
$order = $this->dataProvider->getOrder();
$prefix = '';
$this->iconArrowUp = str_replace(array('%DATATABLE_ASSETS%', '%S... | [
"public",
"function",
"getHeaderCode",
"(",
"\\",
"mpf",
"\\",
"widgets",
"\\",
"datatable",
"\\",
"Table",
"$",
"table",
")",
"{",
"$",
"label",
"=",
"$",
"this",
"->",
"getLabel",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"order",
")",
"{... | Get HTML code for header
@param Table $table
@return string | [
"Get",
"HTML",
"code",
"for",
"header"
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/datatable/columns/Basic.php#L247-L268 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/CurlTransport.php | CurlTransport.send | public function send($request)
{
$this->handle->init();
$this->handle->setOption(CURLOPT_URL, $request->getURL());
$this->handle->setOption(CURLOPT_HTTPHEADER, $request->getHeaders());
$this->handle->setOption(CURLOPT_RETURNTRANSFER, true);
$this->handle->setOption(CURLOPT_C... | php | public function send($request)
{
$this->handle->init();
$this->handle->setOption(CURLOPT_URL, $request->getURL());
$this->handle->setOption(CURLOPT_HTTPHEADER, $request->getHeaders());
$this->handle->setOption(CURLOPT_RETURNTRANSFER, true);
$this->handle->setOption(CURLOPT_C... | [
"public",
"function",
"send",
"(",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"handle",
"->",
"init",
"(",
")",
";",
"$",
"this",
"->",
"handle",
"->",
"setOption",
"(",
"CURLOPT_URL",
",",
"$",
"request",
"->",
"getURL",
"(",
")",
")",
";",
"$",... | Send a request object
@param object $request The request to send
@throws KlarnaException For e.g. a timeout
@return object A response to the request sent | [
"Send",
"a",
"request",
"object"
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/CurlTransport.php#L63-L93 | train |
gregorybesson/PlaygroundStats | src/Service/Stats.php | Stats.getParticipationsByDayByGame | public function getParticipationsByDayByGame($game = null)
{
$em = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');
$emConfig = $em->getConfiguration();
$emConfig->addCustomDatetimeFunction('DATE', '\DoctrineExtensions\Query\Mysql\Date');
if ($game !== null) {
... | php | public function getParticipationsByDayByGame($game = null)
{
$em = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');
$emConfig = $em->getConfiguration();
$emConfig->addCustomDatetimeFunction('DATE', '\DoctrineExtensions\Query\Mysql\Date');
if ($game !== null) {
... | [
"public",
"function",
"getParticipationsByDayByGame",
"(",
"$",
"game",
"=",
"null",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"'doctrine.entitymanager.orm_default'",
")",
";",
"$",
"emConfig",
"=",
"$",
"e... | Return count of participation for a game
@param number|unknown $startDate
@param number|unknown $endDate | [
"Return",
"count",
"of",
"participation",
"for",
"a",
"game"
] | 166fb340c0b6a19fd5a333eeb8b54350f7cf3360 | https://github.com/gregorybesson/PlaygroundStats/blob/166fb340c0b6a19fd5a333eeb8b54350f7cf3360/src/Service/Stats.php#L319-L344 | train |
jenskooij/cloudcontrol | src/components/LanguageComponent.php | LanguageComponent.checkParameters | protected function checkParameters()
{
if (isset($this->parameters[self::PARAMETER_DEFAULT_LANGUAGE])) {
self::$DEFAULT_LANGUAGE = $this->parameters[self::PARAMETER_DEFAULT_LANGUAGE];
unset($this->parameters[self::PARAMETER_DEFAULT_LANGUAGE]);
}
if (isset($this->param... | php | protected function checkParameters()
{
if (isset($this->parameters[self::PARAMETER_DEFAULT_LANGUAGE])) {
self::$DEFAULT_LANGUAGE = $this->parameters[self::PARAMETER_DEFAULT_LANGUAGE];
unset($this->parameters[self::PARAMETER_DEFAULT_LANGUAGE]);
}
if (isset($this->param... | [
"protected",
"function",
"checkParameters",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"parameters",
"[",
"self",
"::",
"PARAMETER_DEFAULT_LANGUAGE",
"]",
")",
")",
"{",
"self",
"::",
"$",
"DEFAULT_LANGUAGE",
"=",
"$",
"this",
"->",
"parame... | Checks to see if any parameters are given from the configuration in the CMS | [
"Checks",
"to",
"see",
"if",
"any",
"parameters",
"are",
"given",
"from",
"the",
"configuration",
"in",
"the",
"CMS"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/components/LanguageComponent.php#L66-L84 | train |
jenskooij/cloudcontrol | src/components/LanguageComponent.php | LanguageComponent.detectLanguage | protected function detectLanguage($lang, $request)
{
$lang = $this->setLanguagInSession($lang);
$this->sessionValues = $_SESSION[self::SESSION_PARAMETER_LANGUAGE_COMPONENT];
$this->checkForceRedirect($lang, $request);
} | php | protected function detectLanguage($lang, $request)
{
$lang = $this->setLanguagInSession($lang);
$this->sessionValues = $_SESSION[self::SESSION_PARAMETER_LANGUAGE_COMPONENT];
$this->checkForceRedirect($lang, $request);
} | [
"protected",
"function",
"detectLanguage",
"(",
"$",
"lang",
",",
"$",
"request",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"setLanguagInSession",
"(",
"$",
"lang",
")",
";",
"$",
"this",
"->",
"sessionValues",
"=",
"$",
"_SESSION",
"[",
"self",
"... | Check if the found language is allowed and
if an action is to be taken.
@param $lang
@param Request $request | [
"Check",
"if",
"the",
"found",
"language",
"is",
"allowed",
"and",
"if",
"an",
"action",
"is",
"to",
"be",
"taken",
"."
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/components/LanguageComponent.php#L102-L109 | train |
jenskooij/cloudcontrol | src/components/LanguageComponent.php | LanguageComponent.checkLanguageSwitch | protected function checkLanguageSwitch($request)
{
if (isset($request::$get['langSwitch'])) {
$this->forceRedirect = true;
$this->detectLanguage($request::$get['langSwitch'], $request);
}
} | php | protected function checkLanguageSwitch($request)
{
if (isset($request::$get['langSwitch'])) {
$this->forceRedirect = true;
$this->detectLanguage($request::$get['langSwitch'], $request);
}
} | [
"protected",
"function",
"checkLanguageSwitch",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"request",
"::",
"$",
"get",
"[",
"'langSwitch'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"forceRedirect",
"=",
"true",
";",
"$",
"this",
"->",
... | Detect if the language is switched manually
@param Request $request | [
"Detect",
"if",
"the",
"language",
"is",
"switched",
"manually"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/components/LanguageComponent.php#L116-L122 | train |
rawphp/RawDispatcher | src/RawPHP/RawDispatcher/Dispatcher.php | Dispatcher.removeListener | public function removeListener( $eventName, IListener $listener )
{
if ( !isset( $this->listeners[ $eventName ] ) )
{
return $this;
}
foreach ( $this->listeners[ $eventName ] as $priority => $listeners )
{
if ( FALSE !== ( $key = array_search... | php | public function removeListener( $eventName, IListener $listener )
{
if ( !isset( $this->listeners[ $eventName ] ) )
{
return $this;
}
foreach ( $this->listeners[ $eventName ] as $priority => $listeners )
{
if ( FALSE !== ( $key = array_search... | [
"public",
"function",
"removeListener",
"(",
"$",
"eventName",
",",
"IListener",
"$",
"listener",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventName",
"]",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"for... | Remove a listener from an event.
@param string $eventName
@param IListener $listener
@return IDispatcher | [
"Remove",
"a",
"listener",
"from",
"an",
"event",
"."
] | b9a62f3ef2266d355e2647d681312770158a6843 | https://github.com/rawphp/RawDispatcher/blob/b9a62f3ef2266d355e2647d681312770158a6843/src/RawPHP/RawDispatcher/Dispatcher.php#L102-L118 | train |
rawphp/RawDispatcher | src/RawPHP/RawDispatcher/Dispatcher.php | Dispatcher.getListeners | public function getListeners( $eventName = NULL )
{
if ( NULL !== $eventName )
{
if ( !isset( $this->_sorted[ $eventName ] ) )
{
$this->sortListeners( $eventName );
}
return $this->_sorted[ $eventName ];
}
... | php | public function getListeners( $eventName = NULL )
{
if ( NULL !== $eventName )
{
if ( !isset( $this->_sorted[ $eventName ] ) )
{
$this->sortListeners( $eventName );
}
return $this->_sorted[ $eventName ];
}
... | [
"public",
"function",
"getListeners",
"(",
"$",
"eventName",
"=",
"NULL",
")",
"{",
"if",
"(",
"NULL",
"!==",
"$",
"eventName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_sorted",
"[",
"$",
"eventName",
"]",
")",
")",
"{",
"$",
... | Get all listeners or just for an event.
@param string $eventName
@return array | [
"Get",
"all",
"listeners",
"or",
"just",
"for",
"an",
"event",
"."
] | b9a62f3ef2266d355e2647d681312770158a6843 | https://github.com/rawphp/RawDispatcher/blob/b9a62f3ef2266d355e2647d681312770158a6843/src/RawPHP/RawDispatcher/Dispatcher.php#L127-L148 | train |
rawphp/RawDispatcher | src/RawPHP/RawDispatcher/Dispatcher.php | Dispatcher.sortListeners | protected function sortListeners( $eventName )
{
$this->_sorted[ $eventName ] = [ ];
if ( isset( $this->listeners[ $eventName ] ) )
{
krsort( $this->listeners[ $eventName ] );
$this->_sorted[ $eventName ] = call_user_func_array( 'array_merge', $this->listeners... | php | protected function sortListeners( $eventName )
{
$this->_sorted[ $eventName ] = [ ];
if ( isset( $this->listeners[ $eventName ] ) )
{
krsort( $this->listeners[ $eventName ] );
$this->_sorted[ $eventName ] = call_user_func_array( 'array_merge', $this->listeners... | [
"protected",
"function",
"sortListeners",
"(",
"$",
"eventName",
")",
"{",
"$",
"this",
"->",
"_sorted",
"[",
"$",
"eventName",
"]",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventName",
"]",
")",
")",
... | Sorts listeners for an event.
@param string $eventName | [
"Sorts",
"listeners",
"for",
"an",
"event",
"."
] | b9a62f3ef2266d355e2647d681312770158a6843 | https://github.com/rawphp/RawDispatcher/blob/b9a62f3ef2266d355e2647d681312770158a6843/src/RawPHP/RawDispatcher/Dispatcher.php#L167-L176 | train |
MichaelJ2324/PHP-REST-Client | src/Auth/Abstracts/AbstractOAuth2Controller.php | AbstractOAuth2Controller.refresh | public function refresh()
{
if (isset($this->token['refresh_token'])) {
$Endpoint = $this->getActionEndpoint(self::ACTION_OAUTH_REFRESH);
if ($Endpoint !== null) {
$Endpoint = $this->configureEndpoint($Endpoint, self::ACTION_OAUTH_REFRESH);
$response =... | php | public function refresh()
{
if (isset($this->token['refresh_token'])) {
$Endpoint = $this->getActionEndpoint(self::ACTION_OAUTH_REFRESH);
if ($Endpoint !== null) {
$Endpoint = $this->configureEndpoint($Endpoint, self::ACTION_OAUTH_REFRESH);
$response =... | [
"public",
"function",
"refresh",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"token",
"[",
"'refresh_token'",
"]",
")",
")",
"{",
"$",
"Endpoint",
"=",
"$",
"this",
"->",
"getActionEndpoint",
"(",
"self",
"::",
"ACTION_OAUTH_REFRESH",
")",... | Refreshes the OAuth 2 Token
@return bool
@throws InvalidToken | [
"Refreshes",
"the",
"OAuth",
"2",
"Token"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Auth/Abstracts/AbstractOAuth2Controller.php#L112-L128 | train |
MichaelJ2324/PHP-REST-Client | src/Auth/Abstracts/AbstractOAuth2Controller.php | AbstractOAuth2Controller.isAuthenticated | public function isAuthenticated()
{
if (parent::isAuthenticated()) {
if (isset($this->token['access_token'])) {
$expired = $this->isTokenExpired();
//We err on the side of valid vs invalid, as the API will invalidate if we are wrong, which isn't harmful
... | php | public function isAuthenticated()
{
if (parent::isAuthenticated()) {
if (isset($this->token['access_token'])) {
$expired = $this->isTokenExpired();
//We err on the side of valid vs invalid, as the API will invalidate if we are wrong, which isn't harmful
... | [
"public",
"function",
"isAuthenticated",
"(",
")",
"{",
"if",
"(",
"parent",
"::",
"isAuthenticated",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"token",
"[",
"'access_token'",
"]",
")",
")",
"{",
"$",
"expired",
"=",
"$",
"this"... | Checks for Access Token property in token, and checks if Token is expired
@inheritdoc | [
"Checks",
"for",
"Access",
"Token",
"property",
"in",
"token",
"and",
"checks",
"if",
"Token",
"is",
"expired"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Auth/Abstracts/AbstractOAuth2Controller.php#L134-L146 | train |
MichaelJ2324/PHP-REST-Client | src/Auth/Abstracts/AbstractOAuth2Controller.php | AbstractOAuth2Controller.configureRefreshEndpoint | protected function configureRefreshEndpoint(EndpointInterface $Endpoint)
{
$data = array();
$data['client_id'] = $this->credentials['client_id'];
$data['client_secret'] = $this->credentials['client_secret'];
$data['grant_type'] = self::OAUTH_REFRESH_GRANT;
$data['refresh_toke... | php | protected function configureRefreshEndpoint(EndpointInterface $Endpoint)
{
$data = array();
$data['client_id'] = $this->credentials['client_id'];
$data['client_secret'] = $this->credentials['client_secret'];
$data['grant_type'] = self::OAUTH_REFRESH_GRANT;
$data['refresh_toke... | [
"protected",
"function",
"configureRefreshEndpoint",
"(",
"EndpointInterface",
"$",
"Endpoint",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"data",
"[",
"'client_id'",
"]",
"=",
"$",
"this",
"->",
"credentials",
"[",
"'client_id'",
"]",
";",
"... | Configure the Refresh Data based on Creds, Token, and Refresh Grant Type
@param EndpointInterface $Endpoint
@return EndpointInterface | [
"Configure",
"the",
"Refresh",
"Data",
"based",
"on",
"Creds",
"Token",
"and",
"Refresh",
"Grant",
"Type"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Auth/Abstracts/AbstractOAuth2Controller.php#L183-L191 | train |
MichaelJ2324/PHP-REST-Client | src/Auth/Abstracts/AbstractOAuth2Controller.php | AbstractOAuth2Controller.configureAuthenticationEndpoint | protected function configureAuthenticationEndpoint(EndpointInterface $Endpoint)
{
$data = $this->credentials;
$data['grant_type'] = static::$_DEFAULT_GRANT_TYPE;
return $Endpoint->setData($data);
} | php | protected function configureAuthenticationEndpoint(EndpointInterface $Endpoint)
{
$data = $this->credentials;
$data['grant_type'] = static::$_DEFAULT_GRANT_TYPE;
return $Endpoint->setData($data);
} | [
"protected",
"function",
"configureAuthenticationEndpoint",
"(",
"EndpointInterface",
"$",
"Endpoint",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"credentials",
";",
"$",
"data",
"[",
"'grant_type'",
"]",
"=",
"static",
"::",
"$",
"_DEFAULT_GRANT_TYPE",
";",... | Add OAuth Grant Type for Auth
@inheritdoc | [
"Add",
"OAuth",
"Grant",
"Type",
"for",
"Auth"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Auth/Abstracts/AbstractOAuth2Controller.php#L197-L202 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/PersistenceBuilder.php | PersistenceBuilder.prepareAttributeValue | public function prepareAttributeValue($mapping, $value)
{
if ($value === null) {
return Type::getNull();
}
$type = $mapping !== null ? $mapping->getType() : TypeFactory::getTypeFromPHPVariable($value);
if (is_array($value)) {
$value = array_map(
... | php | public function prepareAttributeValue($mapping, $value)
{
if ($value === null) {
return Type::getNull();
}
$type = $mapping !== null ? $mapping->getType() : TypeFactory::getTypeFromPHPVariable($value);
if (is_array($value)) {
$value = array_map(
... | [
"public",
"function",
"prepareAttributeValue",
"(",
"$",
"mapping",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"Type",
"::",
"getNull",
"(",
")",
";",
"}",
"$",
"type",
"=",
"$",
"mapping",
"!==",
"null",... | Prepares a non-associated attribute value.
@param PropertyMetadata|null $mapping
@param mixed $value
@return array | [
"Prepares",
"a",
"non",
"-",
"associated",
"attribute",
"value",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/PersistenceBuilder.php#L113-L131 | train |
mylxsw/FocusPHP | src/MVC/SmpView.php | SmpView.assign | public function assign($key, $value)
{
if (empty($key)) {
throw new \RuntimeException('ASSIGN_KEY_EMPTY');
}
$this->_data[$key] = $value;
return $this;
} | php | public function assign($key, $value)
{
if (empty($key)) {
throw new \RuntimeException('ASSIGN_KEY_EMPTY');
}
$this->_data[$key] = $value;
return $this;
} | [
"public",
"function",
"assign",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'ASSIGN_KEY_EMPTY'",
")",
";",
"}",
"$",
"this",
"->",
"_data",
"[",
"... | passing data to template parser.
@param string $key data key
@param mixed $value data body
@return View | [
"passing",
"data",
"to",
"template",
"parser",
"."
] | 33922bacbea66f11f874d991d7308a36cdf5831a | https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/MVC/SmpView.php#L89-L97 | train |
mylxsw/FocusPHP | src/MVC/SmpView.php | SmpView.setLayout | public function setLayout($layoutName)
{
$this->_layout = empty($layoutName) ? null : $layoutName.$this->_suffix;
} | php | public function setLayout($layoutName)
{
$this->_layout = empty($layoutName) ? null : $layoutName.$this->_suffix;
} | [
"public",
"function",
"setLayout",
"(",
"$",
"layoutName",
")",
"{",
"$",
"this",
"->",
"_layout",
"=",
"empty",
"(",
"$",
"layoutName",
")",
"?",
"null",
":",
"$",
"layoutName",
".",
"$",
"this",
"->",
"_suffix",
";",
"}"
] | set the default layout name.
@param string|null $layoutName layout name | [
"set",
"the",
"default",
"layout",
"name",
"."
] | 33922bacbea66f11f874d991d7308a36cdf5831a | https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/MVC/SmpView.php#L142-L145 | train |
mylxsw/FocusPHP | src/MVC/SmpView.php | SmpView.remove | public function remove($key)
{
if (isset($this->_data[$key])) {
unset($this->_data[$key]);
}
return $this;
} | php | public function remove($key)
{
if (isset($this->_data[$key])) {
unset($this->_data[$key]);
}
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
")",
";",
"}",
"return",
"$",... | Remove a key from data array.
@param string $key the key to remove
@return View | [
"Remove",
"a",
"key",
"from",
"data",
"array",
"."
] | 33922bacbea66f11f874d991d7308a36cdf5831a | https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/MVC/SmpView.php#L167-L174 | train |
romm/configuration_object | Classes/Service/Items/Persistence/PersistenceService.php | PersistenceService.configurationObjectAfter | public function configurationObjectAfter(GetConfigurationObjectDTO $serviceDataTransferObject)
{
// Will save the registered domain object properties paths.
$this->delay(
self::PRIORITY_SAVE_DOMAIN_OBJECTS_PATHS,
function (GetConfigurationObjectDTO $serviceDataTransferObject)... | php | public function configurationObjectAfter(GetConfigurationObjectDTO $serviceDataTransferObject)
{
// Will save the registered domain object properties paths.
$this->delay(
self::PRIORITY_SAVE_DOMAIN_OBJECTS_PATHS,
function (GetConfigurationObjectDTO $serviceDataTransferObject)... | [
"public",
"function",
"configurationObjectAfter",
"(",
"GetConfigurationObjectDTO",
"$",
"serviceDataTransferObject",
")",
"{",
"// Will save the registered domain object properties paths.",
"$",
"this",
"->",
"delay",
"(",
"self",
"::",
"PRIORITY_SAVE_DOMAIN_OBJECTS_PATHS",
",",... | This function will first save the entire storage of properties paths set
in the function `objectConversionBefore`.
Then, each of the properties above will be fetched from Extbase
persistence.
@param GetConfigurationObjectDTO $serviceDataTransferObject | [
"This",
"function",
"will",
"first",
"save",
"the",
"entire",
"storage",
"of",
"properties",
"paths",
"set",
"in",
"the",
"function",
"objectConversionBefore",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/Items/Persistence/PersistenceService.php#L103-L133 | train |
romm/configuration_object | Classes/Service/Items/Persistence/PersistenceService.php | PersistenceService.setDomainObjectInProperty | protected function setDomainObjectInProperty($object, $propertyName, $domainObject, $lastObject, array $objectArrayPropertyPath)
{
if (is_object($object)) {
ObjectAccess::setProperty($object, $propertyName, $domainObject);
} elseif (is_array($object)) {
$this->injectDomainObj... | php | protected function setDomainObjectInProperty($object, $propertyName, $domainObject, $lastObject, array $objectArrayPropertyPath)
{
if (is_object($object)) {
ObjectAccess::setProperty($object, $propertyName, $domainObject);
} elseif (is_array($object)) {
$this->injectDomainObj... | [
"protected",
"function",
"setDomainObjectInProperty",
"(",
"$",
"object",
",",
"$",
"propertyName",
",",
"$",
"domainObject",
",",
"$",
"lastObject",
",",
"array",
"$",
"objectArrayPropertyPath",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"object",
")",
")",
... | Will inject the domain object in the property, at the correct path.
@param object|array $object
@param string $propertyName
@param object $domainObject
@param object $lastObject
@param array $objectArrayPropertyPath | [
"Will",
"inject",
"the",
"domain",
"object",
"in",
"the",
"property",
"at",
"the",
"correct",
"path",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/Items/Persistence/PersistenceService.php#L180-L187 | train |
miknatr/grace-dbal | lib/Grace/DBAL/QueryLogger.php | QueryLogger.startQuery | public function startQuery($queryString)
{
$this->queries[$this->counter] = array('query' => $queryString);
$this->timer = time() + microtime(true);
} | php | public function startQuery($queryString)
{
$this->queries[$this->counter] = array('query' => $queryString);
$this->timer = time() + microtime(true);
} | [
"public",
"function",
"startQuery",
"(",
"$",
"queryString",
")",
"{",
"$",
"this",
"->",
"queries",
"[",
"$",
"this",
"->",
"counter",
"]",
"=",
"array",
"(",
"'query'",
"=>",
"$",
"queryString",
")",
";",
"$",
"this",
"->",
"timer",
"=",
"time",
"(... | Start timer for query
@param string $queryString sql query string | [
"Start",
"timer",
"for",
"query"
] | b05e03040568631dc6c77477c0eaed6e60db4ba2 | https://github.com/miknatr/grace-dbal/blob/b05e03040568631dc6c77477c0eaed6e60db4ba2/lib/Grace/DBAL/QueryLogger.php#L28-L32 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.