repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
iP1SMS/ip1-php-sdk | src/Recipient/ProcessedGroup.php | ProcessedGroup.jsonSerialize | public function jsonSerialize(): array
{
$parentArray = parent::jsonSerialize();
$parentArray['Created'] = isset($this->created) ? $this->updated->format("Y-m-d\TH:i:s.").
substr($this->updated->format('u'), 0, 3) : null;
$parentArray['Updated'] = isset($this->created) ? $this->u... | php | public function jsonSerialize(): array
{
$parentArray = parent::jsonSerialize();
$parentArray['Created'] = isset($this->created) ? $this->updated->format("Y-m-d\TH:i:s.").
substr($this->updated->format('u'), 0, 3) : null;
$parentArray['Updated'] = isset($this->created) ? $this->u... | [
"public",
"function",
"jsonSerialize",
"(",
")",
":",
"array",
"{",
"$",
"parentArray",
"=",
"parent",
"::",
"jsonSerialize",
"(",
")",
";",
"$",
"parentArray",
"[",
"'Created'",
"]",
"=",
"isset",
"(",
"$",
"this",
"->",
"created",
")",
"?",
"$",
"thi... | Serializes the object to a value that can be serialized natively by json_encode().
@return array Associative.
@link http://php.net/manual/en/jsonserializable.jsonserialize.php | [
"Serializes",
"the",
"object",
"to",
"a",
"value",
"that",
"can",
"be",
"serialized",
"natively",
"by",
"json_encode",
"()",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/ProcessedGroup.php#L226-L235 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer/PEARSax3.php | HTMLPurifier_Lexer_PEARSax3.openHandler | public function openHandler(&$parser, $name, $attrs, $closed) {
// entities are not resolved in attrs
foreach ($attrs as $key => $attr) {
$attrs[$key] = $this->parseData($attr);
}
if ($closed) {
$this->tokens[] = new HTMLPurifier_Token_Empty($name, $attrs);
... | php | public function openHandler(&$parser, $name, $attrs, $closed) {
// entities are not resolved in attrs
foreach ($attrs as $key => $attr) {
$attrs[$key] = $this->parseData($attr);
}
if ($closed) {
$this->tokens[] = new HTMLPurifier_Token_Empty($name, $attrs);
... | [
"public",
"function",
"openHandler",
"(",
"&",
"$",
"parser",
",",
"$",
"name",
",",
"$",
"attrs",
",",
"$",
"closed",
")",
"{",
"// entities are not resolved in attrs",
"foreach",
"(",
"$",
"attrs",
"as",
"$",
"key",
"=>",
"$",
"attr",
")",
"{",
"$",
... | Open tag event handler, interface is defined by PEAR package. | [
"Open",
"tag",
"event",
"handler",
"interface",
"is",
"defined",
"by",
"PEAR",
"package",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer/PEARSax3.php#L54-L65 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer/PEARSax3.php | HTMLPurifier_Lexer_PEARSax3.closeHandler | public function closeHandler(&$parser, $name) {
// HTMLSax3 seems to always send empty tags an extra close tag
// check and ignore if you see it:
// [TESTME] to make sure it doesn't overreach
if ($this->tokens[count($this->tokens)-1] instanceof HTMLPurifier_Token_Empty) {
ret... | php | public function closeHandler(&$parser, $name) {
// HTMLSax3 seems to always send empty tags an extra close tag
// check and ignore if you see it:
// [TESTME] to make sure it doesn't overreach
if ($this->tokens[count($this->tokens)-1] instanceof HTMLPurifier_Token_Empty) {
ret... | [
"public",
"function",
"closeHandler",
"(",
"&",
"$",
"parser",
",",
"$",
"name",
")",
"{",
"// HTMLSax3 seems to always send empty tags an extra close tag",
"// check and ignore if you see it:",
"// [TESTME] to make sure it doesn't overreach",
"if",
"(",
"$",
"this",
"->",
"t... | Close tag event handler, interface is defined by PEAR package. | [
"Close",
"tag",
"event",
"handler",
"interface",
"is",
"defined",
"by",
"PEAR",
"package",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer/PEARSax3.php#L70-L79 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer/PEARSax3.php | HTMLPurifier_Lexer_PEARSax3.escapeHandler | public function escapeHandler(&$parser, $data) {
if (strpos($data, '--') === 0) {
$this->tokens[] = new HTMLPurifier_Token_Comment($data);
}
// CDATA is handled elsewhere, but if it was handled here:
//if (strpos($data, '[CDATA[') === 0) {
// $this->tokens[] = new ... | php | public function escapeHandler(&$parser, $data) {
if (strpos($data, '--') === 0) {
$this->tokens[] = new HTMLPurifier_Token_Comment($data);
}
// CDATA is handled elsewhere, but if it was handled here:
//if (strpos($data, '[CDATA[') === 0) {
// $this->tokens[] = new ... | [
"public",
"function",
"escapeHandler",
"(",
"&",
"$",
"parser",
",",
"$",
"data",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"data",
",",
"'--'",
")",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"tokens",
"[",
"]",
"=",
"new",
"HTMLPurifier_Token_Comment"... | Escaped text handler, interface is defined by PEAR package. | [
"Escaped",
"text",
"handler",
"interface",
"is",
"defined",
"by",
"PEAR",
"package",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer/PEARSax3.php#L92-L102 |
ptlis/conneg | src/Preference/Builder/AbstractPreferenceBuilder.php | AbstractPreferenceBuilder.setVariant | public function setVariant($variant)
{
if ($this->isFromServer) {
$this->validateVariant($variant);
}
$clone = clone $this;
$clone->variant = $this->normalizeVariant($variant);
return $clone;
} | php | public function setVariant($variant)
{
if ($this->isFromServer) {
$this->validateVariant($variant);
}
$clone = clone $this;
$clone->variant = $this->normalizeVariant($variant);
return $clone;
} | [
"public",
"function",
"setVariant",
"(",
"$",
"variant",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFromServer",
")",
"{",
"$",
"this",
"->",
"validateVariant",
"(",
"$",
"variant",
")",
";",
"}",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"$",
... | @inheritDoc
@throws InvalidVariantException If the provided variant is not valid. | [
"@inheritDoc"
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Builder/AbstractPreferenceBuilder.php#L66-L76 |
ptlis/conneg | src/Preference/Builder/AbstractPreferenceBuilder.php | AbstractPreferenceBuilder.setQualityFactor | public function setQualityFactor($qFactor)
{
if ($this->isFromServer && !$this->validQualityFactor($qFactor)) {
throw new InvalidVariantException('Invalid quality factor "' . $qFactor . '" in server preferences');
}
$qFactor = $this->normalizeQualityFactor($qFactor);
$c... | php | public function setQualityFactor($qFactor)
{
if ($this->isFromServer && !$this->validQualityFactor($qFactor)) {
throw new InvalidVariantException('Invalid quality factor "' . $qFactor . '" in server preferences');
}
$qFactor = $this->normalizeQualityFactor($qFactor);
$c... | [
"public",
"function",
"setQualityFactor",
"(",
"$",
"qFactor",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFromServer",
"&&",
"!",
"$",
"this",
"->",
"validQualityFactor",
"(",
"$",
"qFactor",
")",
")",
"{",
"throw",
"new",
"InvalidVariantException",
"(",
"... | @inheritDoc
@throws InvalidVariantException If an invalid quality factor in encountered when building an server preference. | [
"@inheritDoc"
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Builder/AbstractPreferenceBuilder.php#L83-L95 |
ptlis/conneg | src/Preference/Builder/AbstractPreferenceBuilder.php | AbstractPreferenceBuilder.normalizeQualityFactor | private function normalizeQualityFactor($qFactor)
{
if (!is_numeric($qFactor)) {
$qFactor = 1.0;
} elseif ($qFactor < 0) {
$qFactor = 0.0;
} elseif ($qFactor > 1) {
$qFactor = 1.0;
} else {
$qFactor = floatval($qFactor);
}
... | php | private function normalizeQualityFactor($qFactor)
{
if (!is_numeric($qFactor)) {
$qFactor = 1.0;
} elseif ($qFactor < 0) {
$qFactor = 0.0;
} elseif ($qFactor > 1) {
$qFactor = 1.0;
} else {
$qFactor = floatval($qFactor);
}
... | [
"private",
"function",
"normalizeQualityFactor",
"(",
"$",
"qFactor",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"qFactor",
")",
")",
"{",
"$",
"qFactor",
"=",
"1.0",
";",
"}",
"elseif",
"(",
"$",
"qFactor",
"<",
"0",
")",
"{",
"$",
"qFactor",... | Normalises the provided quality factor, ensuring that the value returned is a float between 0 and 1 (inclusive).
@param float $qFactor
@return float | [
"Normalises",
"the",
"provided",
"quality",
"factor",
"ensuring",
"that",
"the",
"value",
"returned",
"is",
"a",
"float",
"between",
"0",
"and",
"1",
"(",
"inclusive",
")",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Builder/AbstractPreferenceBuilder.php#L137-L153 |
o2system/parser | src/String/Engines/Shortcodes.php | Shortcodes.parseFile | public function parseFile($filePath, array $vars = [])
{
if (is_file($filePath)) {
return $this->parseString(file_get_contents($filePath), $vars);
}
// Try to find from filePaths
if (count($this->filePaths)) {
foreach ($this->filePaths as $fileDirecto... | php | public function parseFile($filePath, array $vars = [])
{
if (is_file($filePath)) {
return $this->parseString(file_get_contents($filePath), $vars);
}
// Try to find from filePaths
if (count($this->filePaths)) {
foreach ($this->filePaths as $fileDirecto... | [
"public",
"function",
"parseFile",
"(",
"$",
"filePath",
",",
"array",
"$",
"vars",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"filePath",
")",
")",
"{",
"return",
"$",
"this",
"->",
"parseString",
"(",
"file_get_contents",
"(",
"$",
"f... | Shortcodes::parseFile
@param string $filePath
@param array $vars
@return string | [
"Shortcodes",
"::",
"parseFile"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/String/Engines/Shortcodes.php#L81-L98 |
o2system/parser | src/String/Engines/Shortcodes.php | Shortcodes.parseString | public function parseString($source, array $vars = [])
{
if (count($vars)) {
foreach ($vars as $offset => $shortcode) {
$this->register($shortcode, $offset);
}
}
$pattern = $this->getRegex();
return preg_replace_callback('/' . $patt... | php | public function parseString($source, array $vars = [])
{
if (count($vars)) {
foreach ($vars as $offset => $shortcode) {
$this->register($shortcode, $offset);
}
}
$pattern = $this->getRegex();
return preg_replace_callback('/' . $patt... | [
"public",
"function",
"parseString",
"(",
"$",
"source",
",",
"array",
"$",
"vars",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"vars",
")",
")",
"{",
"foreach",
"(",
"$",
"vars",
"as",
"$",
"offset",
"=>",
"$",
"shortcode",
")",
"{",
... | Shortcodes::parseString
@param string $source
@param array $vars
@return mixed | [
"Shortcodes",
"::",
"parseString"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/String/Engines/Shortcodes.php#L110-L121 |
o2system/parser | src/String/Engines/Shortcodes.php | Shortcodes.getRegex | private function getRegex()
{
$shortcodes = $this->getIterator();
$offsetKeys = $shortcodes->getKeys();
$offsetRegex = join('|', array_map('preg_quote', $offsetKeys));
// WARNING! Do not change this regex
return '(.?)\[(' . $offsetRegex . ')\b(.*?)(?:(\/))?\](?:(.+?... | php | private function getRegex()
{
$shortcodes = $this->getIterator();
$offsetKeys = $shortcodes->getKeys();
$offsetRegex = join('|', array_map('preg_quote', $offsetKeys));
// WARNING! Do not change this regex
return '(.?)\[(' . $offsetRegex . ')\b(.*?)(?:(\/))?\](?:(.+?... | [
"private",
"function",
"getRegex",
"(",
")",
"{",
"$",
"shortcodes",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
";",
"$",
"offsetKeys",
"=",
"$",
"shortcodes",
"->",
"getKeys",
"(",
")",
";",
"$",
"offsetRegex",
"=",
"join",
"(",
"'|'",
",",
"a... | Shortcodes::getRegex
Retrieve the shortcode regular expression for searching.
The regular expression combines the shortcode tags in the regular expression
in a regex class.
The regular expresion contains 6 different sub matches to help with parsing.
1/6 - An extra [ or ] to allow for escaping shortcodes with double... | [
"Shortcodes",
"::",
"getRegex"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/String/Engines/Shortcodes.php#L143-L152 |
o2system/parser | src/String/Engines/Shortcodes.php | Shortcodes.parseRegex | private function parseRegex($match)
{
// allow [[foo]] syntax for escaping a tag
if ($match[ 1 ] == '[' && $match[ 6 ] == ']') {
return substr($match[ 0 ], 1, -1);
}
$offset = $match[ 2 ];
$attr = $this->parseRegexAttributes($match[ 3 ]);
if ($... | php | private function parseRegex($match)
{
// allow [[foo]] syntax for escaping a tag
if ($match[ 1 ] == '[' && $match[ 6 ] == ']') {
return substr($match[ 0 ], 1, -1);
}
$offset = $match[ 2 ];
$attr = $this->parseRegexAttributes($match[ 3 ]);
if ($... | [
"private",
"function",
"parseRegex",
"(",
"$",
"match",
")",
"{",
"// allow [[foo]] syntax for escaping a tag\r",
"if",
"(",
"$",
"match",
"[",
"1",
"]",
"==",
"'['",
"&&",
"$",
"match",
"[",
"6",
"]",
"==",
"']'",
")",
"{",
"return",
"substr",
"(",
"$",... | Shortcodes::parseRegex
Regular Expression callable for Shortcodes::parseString for calling shortcode hook.
@see Shortcodes::getRegex for details of the match array contents.
@since 1.0
@access private
@uses $shortcode_tags
@param array $match Regular expression match array
@return mixed False on failure. | [
"Shortcodes",
"::",
"parseRegex"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/String/Engines/Shortcodes.php#L185-L209 |
o2system/parser | src/String/Engines/Shortcodes.php | Shortcodes.parseRegexAttributes | private function parseRegexAttributes($string)
{
$attr = [];
$pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
$string = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $string);
if (preg_ma... | php | private function parseRegexAttributes($string)
{
$attr = [];
$pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
$string = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $string);
if (preg_ma... | [
"private",
"function",
"parseRegexAttributes",
"(",
"$",
"string",
")",
"{",
"$",
"attr",
"=",
"[",
"]",
";",
"$",
"pattern",
"=",
"'/(\\w+)\\s*=\\s*\"([^\"]*)\"(?:\\s|$)|(\\w+)\\s*=\\s*\\'([^\\']*)\\'(?:\\s|$)|(\\w+)\\s*=\\s*([^\\s\\'\"]+)(?:\\s|$)|\"([^\"]*)\"(?:\\s|$)|(\\S+)(?:\... | Shortcodes::parseRegexAttr
Retrieve all attributes from the shortcodes tag.
The attributes list has the attribute name as the key and the value of the
attribute as the value in the key/value pair. This allows for easier
retrieval of the attributes, since all attributes have to be known.
@since 1.0
@param string $st... | [
"Shortcodes",
"::",
"parseRegexAttr"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/String/Engines/Shortcodes.php#L228-L252 |
dphn/ScContent | src/ScContent/Mapper/Installation/LayoutMapper.php | LayoutMapper.findExistingWidgets | public function findExistingWidgets($theme, $names)
{
if (! is_array($names)) {
$names = [$names];
}
$select = $this->getSql()->select()
->from($this->getTable(self::LayoutTableAlias))
->columns([
'name',
])
->where(... | php | public function findExistingWidgets($theme, $names)
{
if (! is_array($names)) {
$names = [$names];
}
$select = $this->getSql()->select()
->from($this->getTable(self::LayoutTableAlias))
->columns([
'name',
])
->where(... | [
"public",
"function",
"findExistingWidgets",
"(",
"$",
"theme",
",",
"$",
"names",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"names",
")",
")",
"{",
"$",
"names",
"=",
"[",
"$",
"names",
"]",
";",
"}",
"$",
"select",
"=",
"$",
"this",
"->",... | Returns the names of the widgets from a predefined list,
that are registered in the database.
@param string $theme
@param string $names
@return array | [
"Returns",
"the",
"names",
"of",
"the",
"widgets",
"from",
"a",
"predefined",
"list",
"that",
"are",
"registered",
"in",
"the",
"database",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Mapper/Installation/LayoutMapper.php#L30-L47 |
venta/framework | src/Container/src/MutableContainer.php | MutableContainer.isResolvableCallable | private function isResolvableCallable(Invokable $reflectedCallable): bool
{
// If array represents callable we need to be sure it's an object or a resolvable service id.
$callable = $reflectedCallable->callable();
return $reflectedCallable->isFunction()
|| is_object($callable... | php | private function isResolvableCallable(Invokable $reflectedCallable): bool
{
// If array represents callable we need to be sure it's an object or a resolvable service id.
$callable = $reflectedCallable->callable();
return $reflectedCallable->isFunction()
|| is_object($callable... | [
"private",
"function",
"isResolvableCallable",
"(",
"Invokable",
"$",
"reflectedCallable",
")",
":",
"bool",
"{",
"// If array represents callable we need to be sure it's an object or a resolvable service id.",
"$",
"callable",
"=",
"$",
"reflectedCallable",
"->",
"callable",
"... | Verifies that provided callable can be called by service container.
@param Invokable $reflectedCallable
@return bool | [
"Verifies",
"that",
"provided",
"callable",
"can",
"be",
"called",
"by",
"service",
"container",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Container/src/MutableContainer.php#L171-L179 |
venta/framework | src/Container/src/MutableContainer.php | MutableContainer.register | private function register(string $id, bool $shared, Closure $registrationCallback)
{
// Check if correct service is provided.
$this->validateId($id);
$id = $this->normalize($id);
// Clean up previous bindings, if any.
unset($this->instances[$id], $this->shared[$id], $this->k... | php | private function register(string $id, bool $shared, Closure $registrationCallback)
{
// Check if correct service is provided.
$this->validateId($id);
$id = $this->normalize($id);
// Clean up previous bindings, if any.
unset($this->instances[$id], $this->shared[$id], $this->k... | [
"private",
"function",
"register",
"(",
"string",
"$",
"id",
",",
"bool",
"$",
"shared",
",",
"Closure",
"$",
"registrationCallback",
")",
"{",
"// Check if correct service is provided.",
"$",
"this",
"->",
"validateId",
"(",
"$",
"id",
")",
";",
"$",
"id",
... | Registers binding.
After this method call binding can be resolved by container.
@param string $id
@param bool $shared
@param Closure $registrationCallback
@return void | [
"Registers",
"binding",
".",
"After",
"this",
"method",
"call",
"binding",
"can",
"be",
"resolved",
"by",
"container",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Container/src/MutableContainer.php#L190-L207 |
venta/framework | src/Container/src/MutableContainer.php | MutableContainer.validateId | private function validateId(string $id)
{
if (!interface_exists($id) && !class_exists($id)) {
throw new InvalidArgumentException(
sprintf('Invalid service id "%s". Service id must be an existing interface or class name.', $id)
);
}
} | php | private function validateId(string $id)
{
if (!interface_exists($id) && !class_exists($id)) {
throw new InvalidArgumentException(
sprintf('Invalid service id "%s". Service id must be an existing interface or class name.', $id)
);
}
} | [
"private",
"function",
"validateId",
"(",
"string",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"interface_exists",
"(",
"$",
"id",
")",
"&&",
"!",
"class_exists",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
... | Validate service identifier. Throw an Exception in case of invalid value.
@param string $id
@return void
@throws InvalidArgumentException | [
"Validate",
"service",
"identifier",
".",
"Throw",
"an",
"Exception",
"in",
"case",
"of",
"invalid",
"value",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Container/src/MutableContainer.php#L216-L223 |
mimmi20/Wurfl | src/Handlers/Normalizer/Specific/Maemo.php | Maemo.normalize | public function normalize($userAgent)
{
$model = MaemoHandler::getMaemoModel($userAgent);
if ($model !== null) {
$prefix = 'Maemo ' . $model . WurflConstants::RIS_DELIMITER;
return $prefix . $userAgent;
}
return $userAgent;
} | php | public function normalize($userAgent)
{
$model = MaemoHandler::getMaemoModel($userAgent);
if ($model !== null) {
$prefix = 'Maemo ' . $model . WurflConstants::RIS_DELIMITER;
return $prefix . $userAgent;
}
return $userAgent;
} | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"$",
"model",
"=",
"MaemoHandler",
"::",
"getMaemoModel",
"(",
"$",
"userAgent",
")",
";",
"if",
"(",
"$",
"model",
"!==",
"null",
")",
"{",
"$",
"prefix",
"=",
"'Maemo '",
".",
"$",
... | @param string $userAgent
@return string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Specific/Maemo.php#L35-L46 |
venta/framework | src/Routing/src/RouteGroup.php | RouteGroup.addPathPrefix | private function addPathPrefix(string $path): string
{
return $this->prefix == '/' || $this->prefix == ''
? $path
: sprintf('/%s/%s', trim($this->prefix, '/'), ltrim($path, '/'));
} | php | private function addPathPrefix(string $path): string
{
return $this->prefix == '/' || $this->prefix == ''
? $path
: sprintf('/%s/%s', trim($this->prefix, '/'), ltrim($path, '/'));
} | [
"private",
"function",
"addPathPrefix",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"prefix",
"==",
"'/'",
"||",
"$",
"this",
"->",
"prefix",
"==",
"''",
"?",
"$",
"path",
":",
"sprintf",
"(",
"'/%s/%s'",
",",
"t... | Prepends group prefix to provided route $path.
@param string $path
@return string | [
"Prepends",
"group",
"prefix",
"to",
"provided",
"route",
"$path",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Routing/src/RouteGroup.php#L98-L103 |
skeeks-cms/cms-rbac | src/console/controllers/InitController.php | InitController.initRbacModules | public function initRbacModules()
{
$this->stdout("Init rules, permissions adn data from all modules and extensions\n", Console::BOLD);
$this->stdout("\t1) Loading config\n", Console::FG_YELLOW);
if (!$config = $this->loadConfig()) {
$this->stdout("Start script: not found data fo... | php | public function initRbacModules()
{
$this->stdout("Init rules, permissions adn data from all modules and extensions\n", Console::BOLD);
$this->stdout("\t1) Loading config\n", Console::FG_YELLOW);
if (!$config = $this->loadConfig()) {
$this->stdout("Start script: not found data fo... | [
"public",
"function",
"initRbacModules",
"(",
")",
"{",
"$",
"this",
"->",
"stdout",
"(",
"\"Init rules, permissions adn data from all modules and extensions\\n\"",
",",
"Console",
"::",
"BOLD",
")",
";",
"$",
"this",
"->",
"stdout",
"(",
"\"\\t1) Loading config\\n\"",
... | Получение rules, permissions and data по всем расширениям и модулям | [
"Получение",
"rules",
"permissions",
"and",
"data",
"по",
"всем",
"расширениям",
"и",
"модулям"
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/console/controllers/InitController.php#L54-L66 |
skeeks-cms/cms-rbac | src/console/controllers/InitController.php | InitController.loadConfig | public function loadConfig()
{
$config = \Yii::$app->authManager->config;
$this->stdout("\tAll config is ready: ", Console::FG_GREEN);
$this->stdout(" (rules: " . count(ArrayHelper::getValue($config, 'rules', [])) . ';');
$this->stdout(" roles: " . count(ArrayHelper::getValue($confi... | php | public function loadConfig()
{
$config = \Yii::$app->authManager->config;
$this->stdout("\tAll config is ready: ", Console::FG_GREEN);
$this->stdout(" (rules: " . count(ArrayHelper::getValue($config, 'rules', [])) . ';');
$this->stdout(" roles: " . count(ArrayHelper::getValue($confi... | [
"public",
"function",
"loadConfig",
"(",
")",
"{",
"$",
"config",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"authManager",
"->",
"config",
";",
"$",
"this",
"->",
"stdout",
"(",
"\"\\tAll config is ready: \"",
",",
"Console",
"::",
"FG_GREEN",
")",
";",
... | Сканирование всех расширений и модулей и получение правил для rbac миграций
@return array | [
"Сканирование",
"всех",
"расширений",
"и",
"модулей",
"и",
"получение",
"правил",
"для",
"rbac",
"миграций"
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/console/controllers/InitController.php#L72-L82 |
skeeks-cms/cms-rbac | src/console/controllers/InitController.php | InitController._applyRule | protected function _applyRule($config)
{
if (!is_array($config)) {
return false;
}
if (!$calssName = ArrayHelper::getValue($config, 'class')) {
return false;
}
if (!class_exists($calssName)) {
return false;
}
$rule = new $ca... | php | protected function _applyRule($config)
{
if (!is_array($config)) {
return false;
}
if (!$calssName = ArrayHelper::getValue($config, 'class')) {
return false;
}
if (!class_exists($calssName)) {
return false;
}
$rule = new $ca... | [
"protected",
"function",
"_applyRule",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"calssName",
"=",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"config... | Применение одного правила по данным из конфига
@param $config
@return bool | [
"Применение",
"одного",
"правила",
"по",
"данным",
"из",
"конфига"
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/console/controllers/InitController.php#L126-L151 |
skeeks-cms/cms-rbac | src/console/controllers/InitController.php | InitController._applyRole | protected function _applyRole($config)
{
if (!is_array($config)) {
return false;
}
if (!$name = ArrayHelper::getValue($config, 'name')) {
return false;
}
$description = ArrayHelper::getValue($config, 'description');
if ($role = \Yii::$app->auth... | php | protected function _applyRole($config)
{
if (!is_array($config)) {
return false;
}
if (!$name = ArrayHelper::getValue($config, 'name')) {
return false;
}
$description = ArrayHelper::getValue($config, 'description');
if ($role = \Yii::$app->auth... | [
"protected",
"function",
"_applyRole",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"name",
"=",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"config",
... | Применение одного правила по данным из конфига
@param $config
@return bool | [
"Применение",
"одного",
"правила",
"по",
"данным",
"из",
"конфига"
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/console/controllers/InitController.php#L158-L177 |
skeeks-cms/cms-rbac | src/console/controllers/InitController.php | InitController._applyPermission | protected function _applyPermission($config)
{
if (!is_array($config)) {
return false;
}
if (!$name = ArrayHelper::getValue($config, 'name')) {
return false;
}
$description = ArrayHelper::getValue($config, 'description');
$ruleName = ArrayHelpe... | php | protected function _applyPermission($config)
{
if (!is_array($config)) {
return false;
}
if (!$name = ArrayHelper::getValue($config, 'name')) {
return false;
}
$description = ArrayHelper::getValue($config, 'description');
$ruleName = ArrayHelpe... | [
"protected",
"function",
"_applyPermission",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"name",
"=",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"confi... | Применение одного правила по данным из конфига
@param $config
@return bool | [
"Применение",
"одного",
"правила",
"по",
"данным",
"из",
"конфига"
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/console/controllers/InitController.php#L184-L209 |
skeeks-cms/cms-rbac | src/console/controllers/InitController.php | InitController._assignRole | protected function _assignRole($config)
{
if (!is_array($config)) {
return false;
}
if (!$name = ArrayHelper::getValue($config, 'name')) {
return false;
}
if (!$child = ArrayHelper::getValue($config, 'child')) {
return false;
}
... | php | protected function _assignRole($config)
{
if (!is_array($config)) {
return false;
}
if (!$name = ArrayHelper::getValue($config, 'name')) {
return false;
}
if (!$child = ArrayHelper::getValue($config, 'child')) {
return false;
}
... | [
"protected",
"function",
"_assignRole",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"name",
"=",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"config",
... | Применение одного правила по данным из конфига
@param $config
@return bool | [
"Применение",
"одного",
"правила",
"по",
"данным",
"из",
"конфига"
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/console/controllers/InitController.php#L236-L280 |
skeeks-cms/cms-rbac | src/console/controllers/InitController.php | InitController.initRootUser | protected function initRootUser()
{
$this->stdout("\t6) Init root user \n", Console::FG_YELLOW);
$root = User::findByUsername('root');
$aManager = \Yii::$app->authManager;
if ($root && $aManager->getRole(CmsManager::ROLE_ROOT)) {
if (!$aManager->getAssignment(CmsManager::... | php | protected function initRootUser()
{
$this->stdout("\t6) Init root user \n", Console::FG_YELLOW);
$root = User::findByUsername('root');
$aManager = \Yii::$app->authManager;
if ($root && $aManager->getRole(CmsManager::ROLE_ROOT)) {
if (!$aManager->getAssignment(CmsManager::... | [
"protected",
"function",
"initRootUser",
"(",
")",
"{",
"$",
"this",
"->",
"stdout",
"(",
"\"\\t6) Init root user \\n\"",
",",
"Console",
"::",
"FG_YELLOW",
")",
";",
"$",
"root",
"=",
"User",
"::",
"findByUsername",
"(",
"'root'",
")",
";",
"$",
"aManager",... | Автоматическая генерация
@return $this | [
"Автоматическая",
"генерация"
] | train | https://github.com/skeeks-cms/cms-rbac/blob/1e5b17c1eb405f1ea87279da2ce56162c0281def/src/console/controllers/InitController.php#L445-L456 |
activecollab/bootstrap | src/Router/Router.php | Router.mapModel | public function mapModel($model_class, array $settings = null, callable $extend_collection = null, callable $extend_single = null)
{
if (empty($model_class)) {
throw new InvalidArgumentException('Model class is required');
}
if (empty($settings)) {
$settings = [];
... | php | public function mapModel($model_class, array $settings = null, callable $extend_collection = null, callable $extend_single = null)
{
if (empty($model_class)) {
throw new InvalidArgumentException('Model class is required');
}
if (empty($settings)) {
$settings = [];
... | [
"public",
"function",
"mapModel",
"(",
"$",
"model_class",
",",
"array",
"$",
"settings",
"=",
"null",
",",
"callable",
"$",
"extend_collection",
"=",
"null",
",",
"callable",
"$",
"extend_single",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"mo... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Router/Router.php#L78-L123 |
activecollab/bootstrap | src/Router/Router.php | Router.getModelNameFromClass | private function getModelNameFromClass($model_class)
{
if (($pos = strrpos($model_class, '\\')) !== false) {
return Inflector::pluralize(Inflector::tableize(substr($model_class, $pos + 1)));
} else {
return Inflector::pluralize(Inflector::tableize($model_class));
}
... | php | private function getModelNameFromClass($model_class)
{
if (($pos = strrpos($model_class, '\\')) !== false) {
return Inflector::pluralize(Inflector::tableize(substr($model_class, $pos + 1)));
} else {
return Inflector::pluralize(Inflector::tableize($model_class));
}
... | [
"private",
"function",
"getModelNameFromClass",
"(",
"$",
"model_class",
")",
"{",
"if",
"(",
"(",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"model_class",
",",
"'\\\\'",
")",
")",
"!==",
"false",
")",
"{",
"return",
"Inflector",
"::",
"pluralize",
"(",
"Inf... | Get model name from model class.
@param string $model_class
@return string | [
"Get",
"model",
"name",
"from",
"model",
"class",
"."
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Router/Router.php#L131-L138 |
antarestupin/Accessible | lib/Accessible/Reader/Reader.php | Reader.getClassesToRead | public static function getClassesToRead(\ReflectionObject $reflectionObject)
{
$cacheId = md5("classesToRead:" . $reflectionObject->getName());
$objectClasses = self::getFromCache($cacheId);
if ($objectClasses !== null) {
return $objectClasses;
}
$objectClasses =... | php | public static function getClassesToRead(\ReflectionObject $reflectionObject)
{
$cacheId = md5("classesToRead:" . $reflectionObject->getName());
$objectClasses = self::getFromCache($cacheId);
if ($objectClasses !== null) {
return $objectClasses;
}
$objectClasses =... | [
"public",
"static",
"function",
"getClassesToRead",
"(",
"\\",
"ReflectionObject",
"$",
"reflectionObject",
")",
"{",
"$",
"cacheId",
"=",
"md5",
"(",
"\"classesToRead:\"",
".",
"$",
"reflectionObject",
"->",
"getName",
"(",
")",
")",
";",
"$",
"objectClasses",
... | Get a list of classes and traits to analyze.
@param \ReflectionObject $reflectionObject The object to get the parents from.
@return array The list of classes to read. | [
"Get",
"a",
"list",
"of",
"classes",
"and",
"traits",
"to",
"analyze",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/Reader.php#L27-L60 |
antarestupin/Accessible | lib/Accessible/Reader/Reader.php | Reader.getProperties | public static function getProperties($classes)
{
array_reverse($classes);
$properties = array();
foreach ($classes as $class) {
foreach ($class->getProperties() as $property) {
$properties[$property->getName()] = $property;
}
}
return ... | php | public static function getProperties($classes)
{
array_reverse($classes);
$properties = array();
foreach ($classes as $class) {
foreach ($class->getProperties() as $property) {
$properties[$property->getName()] = $property;
}
}
return ... | [
"public",
"static",
"function",
"getProperties",
"(",
"$",
"classes",
")",
"{",
"array_reverse",
"(",
"$",
"classes",
")",
";",
"$",
"properties",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"class",
")",
"{",
"foreach",
"("... | Get the properties from a list of classes.
@param array $classes
@return array | [
"Get",
"the",
"properties",
"from",
"a",
"list",
"of",
"classes",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/Reader.php#L69-L80 |
antarestupin/Accessible | lib/Accessible/Reader/Reader.php | Reader.getClassInformation | public static function getClassInformation($object)
{
$reflectionObject = new \ReflectionObject($object);
$cacheId = md5("classInformation:" . $reflectionObject->getName());
$classInfo = self::getFromCache($cacheId);
if ($classInfo !== null) {
return $classInfo;
}... | php | public static function getClassInformation($object)
{
$reflectionObject = new \ReflectionObject($object);
$cacheId = md5("classInformation:" . $reflectionObject->getName());
$classInfo = self::getFromCache($cacheId);
if ($classInfo !== null) {
return $classInfo;
}... | [
"public",
"static",
"function",
"getClassInformation",
"(",
"$",
"object",
")",
"{",
"$",
"reflectionObject",
"=",
"new",
"\\",
"ReflectionObject",
"(",
"$",
"object",
")",
";",
"$",
"cacheId",
"=",
"md5",
"(",
"\"classInformation:\"",
".",
"$",
"reflectionObj... | Get the information on a class from its instance.
@param object $object
@return array | [
"Get",
"the",
"information",
"on",
"a",
"class",
"from",
"its",
"instance",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/Reader.php#L89-L114 |
antarestupin/Accessible | lib/Accessible/Reader/Reader.php | Reader.getFromCache | public static function getFromCache($id)
{
$arrayCache = Configuration::getArrayCache();
if ($arrayCache->contains($id)) {
return $arrayCache->fetch($id);
}
$cacheDriver = Configuration::getCacheDriver();
if ($cacheDriver !== null) {
$cacheResult = $c... | php | public static function getFromCache($id)
{
$arrayCache = Configuration::getArrayCache();
if ($arrayCache->contains($id)) {
return $arrayCache->fetch($id);
}
$cacheDriver = Configuration::getCacheDriver();
if ($cacheDriver !== null) {
$cacheResult = $c... | [
"public",
"static",
"function",
"getFromCache",
"(",
"$",
"id",
")",
"{",
"$",
"arrayCache",
"=",
"Configuration",
"::",
"getArrayCache",
"(",
")",
";",
"if",
"(",
"$",
"arrayCache",
"->",
"contains",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"arra... | Get a value from the cache.
@param string $id
@return mixed | [
"Get",
"a",
"value",
"from",
"the",
"cache",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/Reader.php#L123-L140 |
antarestupin/Accessible | lib/Accessible/Reader/Reader.php | Reader.saveToCache | public static function saveToCache($id, $value)
{
$arrayCache = Configuration::getArrayCache();
$cacheDriver = Configuration::getCacheDriver();
$arrayCache->save($id, $value);
if ($cacheDriver !== null) {
$cacheDriver->save($id, $value);
}
} | php | public static function saveToCache($id, $value)
{
$arrayCache = Configuration::getArrayCache();
$cacheDriver = Configuration::getCacheDriver();
$arrayCache->save($id, $value);
if ($cacheDriver !== null) {
$cacheDriver->save($id, $value);
}
} | [
"public",
"static",
"function",
"saveToCache",
"(",
"$",
"id",
",",
"$",
"value",
")",
"{",
"$",
"arrayCache",
"=",
"Configuration",
"::",
"getArrayCache",
"(",
")",
";",
"$",
"cacheDriver",
"=",
"Configuration",
"::",
"getCacheDriver",
"(",
")",
";",
"$",... | Save a value to the cache.
@param string $id
@param mixed $value | [
"Save",
"a",
"value",
"to",
"the",
"cache",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/Reader.php#L148-L157 |
antarestupin/Accessible | lib/Accessible/MethodManager/SetManager.php | SetManager.add | public static function add(&$set, $args)
{
self::assertArgsNumber(1, $args);
$value = $args[0];
foreach ($set as $item) {
if ($item === $value) {
return;
}
}
$set[] = $value;
} | php | public static function add(&$set, $args)
{
self::assertArgsNumber(1, $args);
$value = $args[0];
foreach ($set as $item) {
if ($item === $value) {
return;
}
}
$set[] = $value;
} | [
"public",
"static",
"function",
"add",
"(",
"&",
"$",
"set",
",",
"$",
"args",
")",
"{",
"self",
"::",
"assertArgsNumber",
"(",
"1",
",",
"$",
"args",
")",
";",
"$",
"value",
"=",
"$",
"args",
"[",
"0",
"]",
";",
"foreach",
"(",
"$",
"set",
"as... | Adds an element to the set if it is not already present.
@param array|Traversable $set
@param array $args | [
"Adds",
"an",
"element",
"to",
"the",
"set",
"if",
"it",
"is",
"not",
"already",
"present",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/MethodManager/SetManager.php#L13-L26 |
antarestupin/Accessible | lib/Accessible/MethodManager/SetManager.php | SetManager.remove | public static function remove(&$set, $args)
{
self::assertArgsNumber(1, $args);
foreach ($set as $key => $value) {
if ($value === $args[0]) {
unset($set[$key]);
return;
}
}
} | php | public static function remove(&$set, $args)
{
self::assertArgsNumber(1, $args);
foreach ($set as $key => $value) {
if ($value === $args[0]) {
unset($set[$key]);
return;
}
}
} | [
"public",
"static",
"function",
"remove",
"(",
"&",
"$",
"set",
",",
"$",
"args",
")",
"{",
"self",
"::",
"assertArgsNumber",
"(",
"1",
",",
"$",
"args",
")",
";",
"foreach",
"(",
"$",
"set",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
... | Removes an element from the set.
@param array|Traversable $set
@param array $args | [
"Removes",
"an",
"element",
"from",
"the",
"set",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/MethodManager/SetManager.php#L34-L44 |
PandaPlatform/framework | src/Panda/Events/Event.php | Event.subscribe | public function subscribe(ChannelInterface $channel, SubscriberInterface $subscriber)
{
$this->subscribers[$channel->getIdentifier()][$subscriber->getIdentifier()] = $subscriber;
return $this;
} | php | public function subscribe(ChannelInterface $channel, SubscriberInterface $subscriber)
{
$this->subscribers[$channel->getIdentifier()][$subscriber->getIdentifier()] = $subscriber;
return $this;
} | [
"public",
"function",
"subscribe",
"(",
"ChannelInterface",
"$",
"channel",
",",
"SubscriberInterface",
"$",
"subscriber",
")",
"{",
"$",
"this",
"->",
"subscribers",
"[",
"$",
"channel",
"->",
"getIdentifier",
"(",
")",
"]",
"[",
"$",
"subscriber",
"->",
"g... | @param ChannelInterface $channel
@param SubscriberInterface $subscriber
@return $this | [
"@param",
"ChannelInterface",
"$channel",
"@param",
"SubscriberInterface",
"$subscriber"
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Events/Event.php#L54-L59 |
PandaPlatform/framework | src/Panda/Events/Event.php | Event.dispatch | public function dispatch()
{
foreach ($this->getSubscribers() as $channelIdentifier => $subscribers) {
// Get channel from ChannelFactory
$channel = $this->getChannelFactory()->getChannel($channelIdentifier);
// Get proper message for the given channel
$messa... | php | public function dispatch()
{
foreach ($this->getSubscribers() as $channelIdentifier => $subscribers) {
// Get channel from ChannelFactory
$channel = $this->getChannelFactory()->getChannel($channelIdentifier);
// Get proper message for the given channel
$messa... | [
"public",
"function",
"dispatch",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getSubscribers",
"(",
")",
"as",
"$",
"channelIdentifier",
"=>",
"$",
"subscribers",
")",
"{",
"// Get channel from ChannelFactory",
"$",
"channel",
"=",
"$",
"this",
"->",
... | Dispatch the event to its subscribers through the subscribed channels.
@throws Exceptions\MessageNotSupportedException | [
"Dispatch",
"the",
"event",
"to",
"its",
"subscribers",
"through",
"the",
"subscribed",
"channels",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Events/Event.php#L66-L88 |
PandaPlatform/framework | src/Panda/Events/Event.php | Event.setMessage | public function setMessage(ChannelInterface $channel, MessageInterface $message)
{
$this->messages[$channel->getIdentifier()] = $message;
return $this;
} | php | public function setMessage(ChannelInterface $channel, MessageInterface $message)
{
$this->messages[$channel->getIdentifier()] = $message;
return $this;
} | [
"public",
"function",
"setMessage",
"(",
"ChannelInterface",
"$",
"channel",
",",
"MessageInterface",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"messages",
"[",
"$",
"channel",
"->",
"getIdentifier",
"(",
")",
"]",
"=",
"$",
"message",
";",
"return",
"$... | @param ChannelInterface $channel
@param MessageInterface $message
@return $this | [
"@param",
"ChannelInterface",
"$channel",
"@param",
"MessageInterface",
"$message"
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Events/Event.php#L110-L115 |
LIN3S/WPFoundation | src/LIN3S/WPFoundation/Configuration/Translations/Translations.php | Translations.trans | public static function trans($key)
{
if (false === function_exists('icl_t') || false === function_exists('icl_register_string')) {
return $key;
}
if (empty(icl_t(self::domain(), $key))) {
icl_register_string(self::domain(), $key, $key);
return $key;
... | php | public static function trans($key)
{
if (false === function_exists('icl_t') || false === function_exists('icl_register_string')) {
return $key;
}
if (empty(icl_t(self::domain(), $key))) {
icl_register_string(self::domain(), $key, $key);
return $key;
... | [
"public",
"static",
"function",
"trans",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"false",
"===",
"function_exists",
"(",
"'icl_t'",
")",
"||",
"false",
"===",
"function_exists",
"(",
"'icl_register_string'",
")",
")",
"{",
"return",
"$",
"key",
";",
"}",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/LIN3S/WPFoundation/blob/4f5674b0544b770809f1ffa7bd7d8fdfe013e4bf/src/LIN3S/WPFoundation/Configuration/Translations/Translations.php#L35-L48 |
antarestupin/Accessible | lib/Accessible/Reader/AssociationReader.php | AssociationReader.getAssociations | public static function getAssociations($properties, $annotationReader)
{
$objectAssociations = array();
foreach ($properties as $propertyName => $property) {
$annotation = null;
$associationType = null;
foreach (self::$associationAnnotationClasses as $annotationA... | php | public static function getAssociations($properties, $annotationReader)
{
$objectAssociations = array();
foreach ($properties as $propertyName => $property) {
$annotation = null;
$associationType = null;
foreach (self::$associationAnnotationClasses as $annotationA... | [
"public",
"static",
"function",
"getAssociations",
"(",
"$",
"properties",
",",
"$",
"annotationReader",
")",
"{",
"$",
"objectAssociations",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"propertyName",
"=>",
"$",
"property",
")... | Get a list linking a property with association between the property's class and the current class.
Ex: ["products" => ["property" => "cart", "association" => "inverted"]]
@param array $properties The properties of the object to read.
@param \Doctrine\Common\Annotations\Reader $annotationReader The annotation reader t... | [
"Get",
"a",
"list",
"linking",
"a",
"property",
"with",
"association",
"between",
"the",
"property",
"s",
"class",
"and",
"the",
"current",
"class",
".",
"Ex",
":",
"[",
"products",
"=",
">",
"[",
"property",
"=",
">",
"cart",
"association",
"=",
">",
... | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/AssociationReader.php#L28-L77 |
AbuseIO/parser-common | src/Factory.php | Factory.getParsers | public static function getParsers()
{
$parsers = [];
$parserClassList = ClassMapGenerator::createMap(base_path().'/vendor/abuseio');
/** @noinspection PhpUnusedParameterInspection */
$parserClassListFiltered = array_where(
array_keys($parserClassList),
functio... | php | public static function getParsers()
{
$parsers = [];
$parserClassList = ClassMapGenerator::createMap(base_path().'/vendor/abuseio');
/** @noinspection PhpUnusedParameterInspection */
$parserClassListFiltered = array_where(
array_keys($parserClassList),
functio... | [
"public",
"static",
"function",
"getParsers",
"(",
")",
"{",
"$",
"parsers",
"=",
"[",
"]",
";",
"$",
"parserClassList",
"=",
"ClassMapGenerator",
"::",
"createMap",
"(",
"base_path",
"(",
")",
".",
"'/vendor/abuseio'",
")",
";",
"/** @noinspection PhpUnusedPara... | Get a list of installed AbuseIO parsers and return as an array
@return array | [
"Get",
"a",
"list",
"of",
"installed",
"AbuseIO",
"parsers",
"and",
"return",
"as",
"an",
"array"
] | train | https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Factory.php#L26-L49 |
AbuseIO/parser-common | src/Factory.php | Factory.create | public static function create($parsedMail, $arfMail)
{
/**
* Loop through the parser list and try to find a match by
* validating the send or the body according to the parsers'
* configuration.
*/
$parsers = Factory::getParsers();
foreach ($parsers as $par... | php | public static function create($parsedMail, $arfMail)
{
/**
* Loop through the parser list and try to find a match by
* validating the send or the body according to the parsers'
* configuration.
*/
$parsers = Factory::getParsers();
foreach ($parsers as $par... | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsedMail",
",",
"$",
"arfMail",
")",
"{",
"/**\n * Loop through the parser list and try to find a match by\n * validating the send or the body according to the parsers'\n * configuration.\n */",
"$",
"... | Create and return a Parser class and it's configuration
@param \PhpMimeMailParser\Parser $parsedMail
@param array $arfMail
@return object parser | [
"Create",
"and",
"return",
"a",
"Parser",
"class",
"and",
"it",
"s",
"configuration"
] | train | https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Factory.php#L57-L135 |
cpliakas/search-framework | src/Search/Framework/IteratorQueue.php | IteratorQueue.consume | public function consume()
{
list($id, $message) = each($this->_messages);
if ($id !== null) {
$message->setId($id);
return $message;
}
return false;
} | php | public function consume()
{
list($id, $message) = each($this->_messages);
if ($id !== null) {
$message->setId($id);
return $message;
}
return false;
} | [
"public",
"function",
"consume",
"(",
")",
"{",
"list",
"(",
"$",
"id",
",",
"$",
"message",
")",
"=",
"each",
"(",
"$",
"this",
"->",
"_messages",
")",
";",
"if",
"(",
"$",
"id",
"!==",
"null",
")",
"{",
"$",
"message",
"->",
"setId",
"(",
"$"... | Implements QueueAbstract::consume().
Set the zero-based key as the unique identifier prior to returning. | [
"Implements",
"QueueAbstract",
"::",
"consume",
"()",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/IteratorQueue.php#L45-L53 |
cpliakas/search-framework | src/Search/Framework/IteratorQueue.php | IteratorQueue.acknowledge | public function acknowledge($success = true)
{
if ($success) {
foreach ($this->getConsumedMessages() as $message) {
$id = $message->getId();
unset($this->_messages[$id]);
}
$this->clearConsumedMessages();
}
} | php | public function acknowledge($success = true)
{
if ($success) {
foreach ($this->getConsumedMessages() as $message) {
$id = $message->getId();
unset($this->_messages[$id]);
}
$this->clearConsumedMessages();
}
} | [
"public",
"function",
"acknowledge",
"(",
"$",
"success",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"success",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getConsumedMessages",
"(",
")",
"as",
"$",
"message",
")",
"{",
"$",
"id",
"=",
"$",
"message",
... | Implements QueueAbstract::acknowledge().
On success, remove the consumed messages from the iterator. | [
"Implements",
"QueueAbstract",
"::",
"acknowledge",
"()",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/IteratorQueue.php#L60-L69 |
o2system/parser | src/String/Adapters/Shortcodes.php | Shortcodes.initialize | public function initialize(array $config = [])
{
$config = array_merge($this->config, $config);
if (empty($this->engine)) {
$this->engine = new \O2System\Parser\String\Engines\Shortcodes($config);
}
return $this;
} | php | public function initialize(array $config = [])
{
$config = array_merge($this->config, $config);
if (empty($this->engine)) {
$this->engine = new \O2System\Parser\String\Engines\Shortcodes($config);
}
return $this;
} | [
"public",
"function",
"initialize",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"config",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"config",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"engine",
")",
... | Shortcodes::initialize
@param array $config
@return static | [
"Shortcodes",
"::",
"initialize"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/String/Adapters/Shortcodes.php#L34-L43 |
o2system/parser | src/String/Adapters/Shortcodes.php | Shortcodes.isValidEngine | protected function isValidEngine($engine)
{
if ($engine instanceof \O2System\Parser\String\Engines\Shortcodes) {
return true;
}
return false;
} | php | protected function isValidEngine($engine)
{
if ($engine instanceof \O2System\Parser\String\Engines\Shortcodes) {
return true;
}
return false;
} | [
"protected",
"function",
"isValidEngine",
"(",
"$",
"engine",
")",
"{",
"if",
"(",
"$",
"engine",
"instanceof",
"\\",
"O2System",
"\\",
"Parser",
"\\",
"String",
"\\",
"Engines",
"\\",
"Shortcodes",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
... | Shortcodes::isValidEngine
Checks if is a valid Object Engine.
@param object $engine Engine Object Resource.
@return bool | [
"Shortcodes",
"::",
"isValidEngine"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/String/Adapters/Shortcodes.php#L88-L95 |
dphn/ScContent | src/ScContent/Service/Installation/LayoutService.php | LayoutService.getRegions | public function getRegions($themeName)
{
$translator = $this->getTranslator();
$options = $this->getModuleOptions();
$theme = $options->getThemeByName($themeName);
$map = [];
if (! isset($theme['frontend']['regions'])
|| ! is_array($theme['frontend']['regions'])
... | php | public function getRegions($themeName)
{
$translator = $this->getTranslator();
$options = $this->getModuleOptions();
$theme = $options->getThemeByName($themeName);
$map = [];
if (! isset($theme['frontend']['regions'])
|| ! is_array($theme['frontend']['regions'])
... | [
"public",
"function",
"getRegions",
"(",
"$",
"themeName",
")",
"{",
"$",
"translator",
"=",
"$",
"this",
"->",
"getTranslator",
"(",
")",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"getModuleOptions",
"(",
")",
";",
"$",
"theme",
"=",
"$",
"options"... | Get the existing regions from the module options.
@param string $themeName
@return array Regions <code>string[string]</code>
<code>(string) region name [(string) widget name]</code> | [
"Get",
"the",
"existing",
"regions",
"from",
"the",
"module",
"options",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Service/Installation/LayoutService.php#L198-L230 |
o2system/parser | src/Template/Adapters/Noodle.php | Noodle.initialize | public function initialize(array $config = [])
{
$config = array_merge($this->config, $config);
if (empty($this->engine)) {
$this->engine = new \O2System\Parser\Template\Engines\Noodle($config);
}
return $this;
} | php | public function initialize(array $config = [])
{
$config = array_merge($this->config, $config);
if (empty($this->engine)) {
$this->engine = new \O2System\Parser\Template\Engines\Noodle($config);
}
return $this;
} | [
"public",
"function",
"initialize",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"config",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"config",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"engine",
")",
... | Noodle::initialize
@param array $config
@return static | [
"Noodle",
"::",
"initialize"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Adapters/Noodle.php#L34-L43 |
Webklex/translator | src/Translator/Handlers/FileHandler.php | FileHandler.load | public function load($locale)
{
if ($this->files->exists($full = $this->path."/".$locale.".lang")) {
return $this->loadFileData($this->files->get($full));
}
return [];
} | php | public function load($locale)
{
if ($this->files->exists($full = $this->path."/".$locale.".lang")) {
return $this->loadFileData($this->files->get($full));
}
return [];
} | [
"public",
"function",
"load",
"(",
"$",
"locale",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"full",
"=",
"$",
"this",
"->",
"path",
".",
"\"/\"",
".",
"$",
"locale",
".",
"\".lang\"",
")",
")",
"{",
"return",
"$",... | Load the messages for the given locale.
@param string $locale
@return array | [
"Load",
"the",
"messages",
"for",
"the",
"given",
"locale",
"."
] | train | https://github.com/Webklex/translator/blob/6bef2c68da1c05df7d759da8458037eee5203986/src/Translator/Handlers/FileHandler.php#L51-L57 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/AbstractPropertyStorage.php | AbstractPropertyStorage.getApplicablePropertyModelClassNames | protected static function getApplicablePropertyModelClassNames($id)
{
if (isset(static::$applicablePropertyModelClassNames[$id]) === false) {
$subQuery = PropertyPropertyGroup::find()
->from(PropertyPropertyGroup::tableName() . ' ppg')
->select('pg.applicable_prop... | php | protected static function getApplicablePropertyModelClassNames($id)
{
if (isset(static::$applicablePropertyModelClassNames[$id]) === false) {
$subQuery = PropertyPropertyGroup::find()
->from(PropertyPropertyGroup::tableName() . ' ppg')
->select('pg.applicable_prop... | [
"protected",
"static",
"function",
"getApplicablePropertyModelClassNames",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"applicablePropertyModelClassNames",
"[",
"$",
"id",
"]",
")",
"===",
"false",
")",
"{",
"$",
"subQuery",
"=",
... | Get applicable property model class names by property id.
@param int $id
@return ActiveRecord[] | HasProperties[] | PropertiesTrait[] | [
"Get",
"applicable",
"property",
"model",
"class",
"names",
"by",
"property",
"id",
"."
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/AbstractPropertyStorage.php#L48-L63 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/AbstractPropertyStorage.php | AbstractPropertyStorage.valueByReturnType | protected static function valueByReturnType(
$returnType,
$tmpQuery,
$result,
$className,
$dependency,
$cacheLifetime = 86400
)
{
switch ($returnType) {
case Filter::RETURN_COUNT:
$result += $className::getDb()->cache(
... | php | protected static function valueByReturnType(
$returnType,
$tmpQuery,
$result,
$className,
$dependency,
$cacheLifetime = 86400
)
{
switch ($returnType) {
case Filter::RETURN_COUNT:
$result += $className::getDb()->cache(
... | [
"protected",
"static",
"function",
"valueByReturnType",
"(",
"$",
"returnType",
",",
"$",
"tmpQuery",
",",
"$",
"result",
",",
"$",
"className",
",",
"$",
"dependency",
",",
"$",
"cacheLifetime",
"=",
"86400",
")",
"{",
"switch",
"(",
"$",
"returnType",
")... | Helper method
@param $returnType
@param ActiveQuery $tmpQuery
@param $result
@param $className
@param Dependency $dependency
@param int $cacheLifetime
@return array|int | [
"Helper",
"method"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/AbstractPropertyStorage.php#L90-L128 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/AbstractPropertyStorage.php | AbstractPropertyStorage.prepareParams | protected static function prepareParams($params, $column)
{
if (is_string($params)) {
$params = str_replace('[column]', $column, $params);
return $params;
} elseif (is_array($params)) {
$params = Json::decode(str_replace('[column]', $column, Json::encode($params))... | php | protected static function prepareParams($params, $column)
{
if (is_string($params)) {
$params = str_replace('[column]', $column, $params);
return $params;
} elseif (is_array($params)) {
$params = Json::decode(str_replace('[column]', $column, Json::encode($params))... | [
"protected",
"static",
"function",
"prepareParams",
"(",
"$",
"params",
",",
"$",
"column",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"str_replace",
"(",
"'[column]'",
",",
"$",
"column",
",",
"$",
"params... | @param $params
@param $column
@return mixed
@throws Exception | [
"@param",
"$params",
"@param",
"$column"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/AbstractPropertyStorage.php#L137-L148 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/AbstractPropertyStorage.php | AbstractPropertyStorage.unionQueriesToOne | protected static function unionQueriesToOne($queries)
{
if (count($queries) === 0) {
throw new Exception(Module::t('app', 'Nothing to union'));
}
$query = array_reduce(
$queries,
function ($query, $item) {
/**
* @var $quer... | php | protected static function unionQueriesToOne($queries)
{
if (count($queries) === 0) {
throw new Exception(Module::t('app', 'Nothing to union'));
}
$query = array_reduce(
$queries,
function ($query, $item) {
/**
* @var $quer... | [
"protected",
"static",
"function",
"unionQueriesToOne",
"(",
"$",
"queries",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"queries",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"Exception",
"(",
"Module",
"::",
"t",
"(",
"'app'",
",",
"'Nothing to union'",
")"... | @param Query[] $queries
@return Query
@throws Exception | [
"@param",
"Query",
"[]",
"$queries"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/AbstractPropertyStorage.php#L156-L178 |
DevGroup-ru/yii2-data-structure-tools | src/propertyStorage/AbstractPropertyStorage.php | AbstractPropertyStorage.dependencyHelper | protected static function dependencyHelper($customDependency, $tags)
{
if (is_null($customDependency)) {
$dependency = new TagDependency(['tags' => $tags]);
return $dependency;
} elseif (is_string($customDependency)) {
$tags[] = $customDependency;
$dep... | php | protected static function dependencyHelper($customDependency, $tags)
{
if (is_null($customDependency)) {
$dependency = new TagDependency(['tags' => $tags]);
return $dependency;
} elseif (is_string($customDependency)) {
$tags[] = $customDependency;
$dep... | [
"protected",
"static",
"function",
"dependencyHelper",
"(",
"$",
"customDependency",
",",
"$",
"tags",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"customDependency",
")",
")",
"{",
"$",
"dependency",
"=",
"new",
"TagDependency",
"(",
"[",
"'tags'",
"=>",
"$... | @param $customDependency
@param $tags
@return ChainedDependency|TagDependency | [
"@param",
"$customDependency",
"@param",
"$tags"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/AbstractPropertyStorage.php#L186-L201 |
phastlight/phastlight | src/Phastlight/System.php | System.import | public function import($name)
{
$object = null;
if (!isset($this->modules[$name])) {
if (isset($this->moduleMap[$name])) {
$object_class = $this->moduleMap[$name];
$object = new $object_class();
$object->setSystem($this);
$o... | php | public function import($name)
{
$object = null;
if (!isset($this->modules[$name])) {
if (isset($this->moduleMap[$name])) {
$object_class = $this->moduleMap[$name];
$object = new $object_class();
$object->setSystem($this);
$o... | [
"public",
"function",
"import",
"(",
"$",
"name",
")",
"{",
"$",
"object",
"=",
"null",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"modules",
"[",
"$",
"name",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"moduleMa... | import a module based on name, similar to node.js's require | [
"import",
"a",
"module",
"based",
"on",
"name",
"similar",
"to",
"node",
".",
"js",
"s",
"require"
] | train | https://github.com/phastlight/phastlight/blob/3fef01898fe56a0185511b56ec45ec44a75a74d9/src/Phastlight/System.php#L79-L97 |
PandaPlatform/framework | src/Panda/Routing/Validators/MethodValidator.php | MethodValidator.matches | public function matches(Route $route, Request $request)
{
return in_array($request->getMethod(), $route->getMethods());
} | php | public function matches(Route $route, Request $request)
{
return in_array($request->getMethod(), $route->getMethods());
} | [
"public",
"function",
"matches",
"(",
"Route",
"$",
"route",
",",
"Request",
"$",
"request",
")",
"{",
"return",
"in_array",
"(",
"$",
"request",
"->",
"getMethod",
"(",
")",
",",
"$",
"route",
"->",
"getMethods",
"(",
")",
")",
";",
"}"
] | Validate a given rule against a route and request.
@param Route $route
@param Request $request
@return bool | [
"Validate",
"a",
"given",
"rule",
"against",
"a",
"route",
"and",
"request",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Validators/MethodValidator.php#L31-L34 |
DevGroup-ru/yii2-data-structure-tools | src/search/base/SearchQuery.php | SearchQuery.pagination | public function pagination($config)
{
if (is_array($config) || $config === true) {
$config = $config === true ? ['class' => Pagination::class] : $config;
$this->pagination = Yii::createObject($config);
} elseif (is_object($config)) {
$this->pagination = &$config;
... | php | public function pagination($config)
{
if (is_array($config) || $config === true) {
$config = $config === true ? ['class' => Pagination::class] : $config;
$this->pagination = Yii::createObject($config);
} elseif (is_object($config)) {
$this->pagination = &$config;
... | [
"public",
"function",
"pagination",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"config",
")",
"||",
"$",
"config",
"===",
"true",
")",
"{",
"$",
"config",
"=",
"$",
"config",
"===",
"true",
"?",
"[",
"'class'",
"=>",
"Pagination",... | @param array|Pagination|string|bool $config Array of component configuration, component instance or classname.
@return $this | [
"@param",
"array|Pagination|string|bool",
"$config",
"Array",
"of",
"component",
"configuration",
"component",
"instance",
"or",
"classname",
"."
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/search/base/SearchQuery.php#L140-L155 |
PandaPlatform/framework | src/Panda/Localization/Helpers/LocaleHelper.php | LocaleHelper.getLocaleFallbackList | public static function getLocaleFallbackList($locale, $fallbackLocale = '')
{
// Check arguments
if (empty($locale)) {
throw new InvalidArgumentException(__METHOD__ . ': The given locale is empty');
}
// Create a priority fallback list to check for different locale.
... | php | public static function getLocaleFallbackList($locale, $fallbackLocale = '')
{
// Check arguments
if (empty($locale)) {
throw new InvalidArgumentException(__METHOD__ . ': The given locale is empty');
}
// Create a priority fallback list to check for different locale.
... | [
"public",
"static",
"function",
"getLocaleFallbackList",
"(",
"$",
"locale",
",",
"$",
"fallbackLocale",
"=",
"''",
")",
"{",
"// Check arguments",
"if",
"(",
"empty",
"(",
"$",
"locale",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"__METHO... | Get a locale fallback list to check while translating.
@param string $locale
@param string $fallbackLocale
@return array
@throws InvalidArgumentException | [
"Get",
"a",
"locale",
"fallback",
"list",
"to",
"check",
"while",
"translating",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Localization/Helpers/LocaleHelper.php#L32-L55 |
PandaPlatform/framework | src/Panda/Localization/Helpers/LocaleHelper.php | LocaleHelper.getFallbackList | private static function getFallbackList($locale)
{
$fallbackList = [];
// Add different locale variations
$fallbackList[] = strtolower(str_replace('_', '-', $locale));
$fallbackList[] = str_replace('_', '-', $locale);
$fallbackList[] = strtolower(str_replace('-', '_', $local... | php | private static function getFallbackList($locale)
{
$fallbackList = [];
// Add different locale variations
$fallbackList[] = strtolower(str_replace('_', '-', $locale));
$fallbackList[] = str_replace('_', '-', $locale);
$fallbackList[] = strtolower(str_replace('-', '_', $local... | [
"private",
"static",
"function",
"getFallbackList",
"(",
"$",
"locale",
")",
"{",
"$",
"fallbackList",
"=",
"[",
"]",
";",
"// Add different locale variations",
"$",
"fallbackList",
"[",
"]",
"=",
"strtolower",
"(",
"str_replace",
"(",
"'_'",
",",
"'-'",
",",
... | @param string $locale
@return array | [
"@param",
"string",
"$locale"
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Localization/Helpers/LocaleHelper.php#L62-L79 |
liuguangw/mvc | src/data/DataMap.php | DataMap.getValue | public function getValue(string $key, $defaultValue = null)
{
if ($this->offsetExists($key)) {
return $this->offsetGet($key);
} else {
return $defaultValue;
}
} | php | public function getValue(string $key, $defaultValue = null)
{
if ($this->offsetExists($key)) {
return $this->offsetGet($key);
} else {
return $defaultValue;
}
} | [
"public",
"function",
"getValue",
"(",
"string",
"$",
"key",
",",
"$",
"defaultValue",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"offsetGet",
"(",
"$",
"key",
"... | 读取键值,或者不存在时默认值
@param string $key
键名
@param mixed $defaultValue
当键名不存在时,返回的默认值
@return mixed | [
"读取键值",
"或者不存在时默认值"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/data/DataMap.php#L174-L181 |
liuguangw/mvc | src/data/DataMap.php | DataMap.mergeArray | public function mergeArray(array $arr): DataMap
{
$this->data = array_merge($this->data, $arr);
return $this;
} | php | public function mergeArray(array $arr): DataMap
{
$this->data = array_merge($this->data, $arr);
return $this;
} | [
"public",
"function",
"mergeArray",
"(",
"array",
"$",
"arr",
")",
":",
"DataMap",
"{",
"$",
"this",
"->",
"data",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"arr",
")",
";",
"return",
"$",
"this",
";",
"}"
] | 将数据进行合并
@param array $arr
数据数组
@return DataMap | [
"将数据进行合并"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/data/DataMap.php#L236-L240 |
liuguangw/mvc | src/data/DataMap.php | DataMap.loadFromPhpFile | public static function loadFromPhpFile(string $filePath): DataMap
{
if (! is_file($filePath)) {
throw new CoreException(CoreException::FILE_NOT_FOUND, '找不到php文件: ' . $filePath, $filePath);
}
$data = include $filePath;
return new static($data);
} | php | public static function loadFromPhpFile(string $filePath): DataMap
{
if (! is_file($filePath)) {
throw new CoreException(CoreException::FILE_NOT_FOUND, '找不到php文件: ' . $filePath, $filePath);
}
$data = include $filePath;
return new static($data);
} | [
"public",
"static",
"function",
"loadFromPhpFile",
"(",
"string",
"$",
"filePath",
")",
":",
"DataMap",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"filePath",
")",
")",
"{",
"throw",
"new",
"CoreException",
"(",
"CoreException",
"::",
"FILE_NOT_FOUND",
",",
... | 从php文件加载数据
@param string $filePath
@throws CoreException
@return DataMap | [
"从php文件加载数据"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/data/DataMap.php#L261-L268 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/HTMLDefinition.php | HTMLPurifier_Printer_HTMLDefinition.renderChildren | protected function renderChildren($def) {
$context = new HTMLPurifier_Context();
$ret = '';
$ret .= $this->start('tr');
$elements = array();
$attr = array();
if (isset($def->elements)) {
if ($def->type == 'strictblockquote') {
... | php | protected function renderChildren($def) {
$context = new HTMLPurifier_Context();
$ret = '';
$ret .= $this->start('tr');
$elements = array();
$attr = array();
if (isset($def->elements)) {
if ($def->type == 'strictblockquote') {
... | [
"protected",
"function",
"renderChildren",
"(",
"$",
"def",
")",
"{",
"$",
"context",
"=",
"new",
"HTMLPurifier_Context",
"(",
")",
";",
"$",
"ret",
"=",
"''",
";",
"$",
"ret",
".=",
"$",
"this",
"->",
"start",
"(",
"'tr'",
")",
";",
"$",
"elements",... | Renders a row describing the allowed children of an element
@param $def HTMLPurifier_ChildDef of pertinent element | [
"Renders",
"a",
"row",
"describing",
"the",
"allowed",
"children",
"of",
"an",
"element"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/HTMLDefinition.php#L170-L215 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/HTMLDefinition.php | HTMLPurifier_Printer_HTMLDefinition.listifyTagLookup | protected function listifyTagLookup($array) {
ksort($array);
$list = array();
foreach ($array as $name => $discard) {
if ($name !== '#PCDATA' && !isset($this->def->info[$name])) continue;
$list[] = $name;
}
return $this->listify($list);
} | php | protected function listifyTagLookup($array) {
ksort($array);
$list = array();
foreach ($array as $name => $discard) {
if ($name !== '#PCDATA' && !isset($this->def->info[$name])) continue;
$list[] = $name;
}
return $this->listify($list);
} | [
"protected",
"function",
"listifyTagLookup",
"(",
"$",
"array",
")",
"{",
"ksort",
"(",
"$",
"array",
")",
";",
"$",
"list",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"name",
"=>",
"$",
"discard",
")",
"{",
"if",
"(",
... | Listifies a tag lookup table.
@param $array Tag lookup array in form of array('tagname' => true) | [
"Listifies",
"a",
"tag",
"lookup",
"table",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/HTMLDefinition.php#L221-L229 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/HTMLDefinition.php | HTMLPurifier_Printer_HTMLDefinition.listifyAttr | protected function listifyAttr($array) {
ksort($array);
$list = array();
foreach ($array as $name => $obj) {
if ($obj === false) continue;
$list[] = "$name = <i>" . $this->getClass($obj, 'AttrDef_') . '</i>';
}
return $this->listify($list);
} | php | protected function listifyAttr($array) {
ksort($array);
$list = array();
foreach ($array as $name => $obj) {
if ($obj === false) continue;
$list[] = "$name = <i>" . $this->getClass($obj, 'AttrDef_') . '</i>';
}
return $this->listify($list);
} | [
"protected",
"function",
"listifyAttr",
"(",
"$",
"array",
")",
"{",
"ksort",
"(",
"$",
"array",
")",
";",
"$",
"list",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"name",
"=>",
"$",
"obj",
")",
"{",
"if",
"(",
"$",
"o... | Listifies a hash of attributes to AttrDef classes
@param $array Array hash in form of array('attrname' => HTMLPurifier_AttrDef) | [
"Listifies",
"a",
"hash",
"of",
"attributes",
"to",
"AttrDef",
"classes"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/HTMLDefinition.php#L249-L257 |
Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/LogEntry.php | LogEntry.addDimension | public function addDimension($name, $value, $increment = 1)
{
$dimension = new LogDimension($name, $value);
$dimension->setIncrement($increment);
$this->dimensions[] = $dimension;
return $this;
} | php | public function addDimension($name, $value, $increment = 1)
{
$dimension = new LogDimension($name, $value);
$dimension->setIncrement($increment);
$this->dimensions[] = $dimension;
return $this;
} | [
"public",
"function",
"addDimension",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"increment",
"=",
"1",
")",
"{",
"$",
"dimension",
"=",
"new",
"LogDimension",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"$",
"dimension",
"->",
"setIncrement",
... | Add a dimension to the entry.
@param string $name
@param string $value
@param int $increment
@return $this | [
"Add",
"a",
"dimension",
"to",
"the",
"entry",
"."
] | train | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/LogEntry.php#L118-L126 |
DevGroup-ru/yii2-data-structure-tools | src/searchOld/elastic/helpers/IndexHelper.php | IndexHelper.classToIndex | public static function classToIndex($className)
{
if (false === is_string($className)) {
return '';
}
$modelClass = strtolower($className);
return StringHelper::basename($modelClass);
} | php | public static function classToIndex($className)
{
if (false === is_string($className)) {
return '';
}
$modelClass = strtolower($className);
return StringHelper::basename($modelClass);
} | [
"public",
"static",
"function",
"classToIndex",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"className",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"modelClass",
"=",
"strtolower",
"(",
"$",
"className",
")",
"... | Builds index name according to given model class
@param string $className
@return string | [
"Builds",
"index",
"name",
"according",
"to",
"given",
"model",
"class"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/helpers/IndexHelper.php#L23-L30 |
DevGroup-ru/yii2-data-structure-tools | src/searchOld/elastic/helpers/IndexHelper.php | IndexHelper.storageClassToType | public static function storageClassToType($storageClass)
{
if (false === is_string($storageClass)) {
return '';
}
$name = StringHelper::basename($storageClass);
return Inflector::camel2id($name, '_');
} | php | public static function storageClassToType($storageClass)
{
if (false === is_string($storageClass)) {
return '';
}
$name = StringHelper::basename($storageClass);
return Inflector::camel2id($name, '_');
} | [
"public",
"static",
"function",
"storageClassToType",
"(",
"$",
"storageClass",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"storageClass",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"name",
"=",
"StringHelper",
"::",
"basename",
"(",
... | Builds index type according to given property storage class name
@param $storageClass
@return string | [
"Builds",
"index",
"type",
"according",
"to",
"given",
"property",
"storage",
"class",
"name"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/helpers/IndexHelper.php#L38-L45 |
DevGroup-ru/yii2-data-structure-tools | src/searchOld/elastic/helpers/IndexHelper.php | IndexHelper.primaryKeysByCondition | public static function primaryKeysByCondition($client, $condition)
{
$primaryKeys = [];
$count = $client->count($condition);
$count = empty($count['count']) ? 10 : $count['count'];
$condition['size'] = $count;
$condition['_source'] = true;
$res = $client->search($cond... | php | public static function primaryKeysByCondition($client, $condition)
{
$primaryKeys = [];
$count = $client->count($condition);
$count = empty($count['count']) ? 10 : $count['count'];
$condition['size'] = $count;
$condition['_source'] = true;
$res = $client->search($cond... | [
"public",
"static",
"function",
"primaryKeysByCondition",
"(",
"$",
"client",
",",
"$",
"condition",
")",
"{",
"$",
"primaryKeys",
"=",
"[",
"]",
";",
"$",
"count",
"=",
"$",
"client",
"->",
"count",
"(",
"$",
"condition",
")",
";",
"$",
"count",
"=",
... | Performs fast scan for docs ids in elasticsearch indices
@param Client $client
@param array $condition query condition to find docs
@return array | [
"Performs",
"fast",
"scan",
"for",
"docs",
"ids",
"in",
"elasticsearch",
"indices"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/helpers/IndexHelper.php#L54-L74 |
MissAllSunday/Ohara | src/Suki/Tools.php | Tools.checkScheme | public function checkScheme($url = '', $secure = false)
{
$parsed = [];
$parsed = parse_url($url);
$pos = strpos($url, '//');
// Perhaps this is a schema less url? parse_url should detect schema less urls .___.
if (empty($parsed['scheme']) && strpos($url, '//') !== false)
return $url;
elseif (empty($p... | php | public function checkScheme($url = '', $secure = false)
{
$parsed = [];
$parsed = parse_url($url);
$pos = strpos($url, '//');
// Perhaps this is a schema less url? parse_url should detect schema less urls .___.
if (empty($parsed['scheme']) && strpos($url, '//') !== false)
return $url;
elseif (empty($p... | [
"public",
"function",
"checkScheme",
"(",
"$",
"url",
"=",
"''",
",",
"$",
"secure",
"=",
"false",
")",
"{",
"$",
"parsed",
"=",
"[",
"]",
";",
"$",
"parsed",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"ur... | Checks if a string contains a scheme. Adds one if necessary
checks for schemaless urls.
@param string $url The data to be converted, needs to be an array.
@param boolean $secure If a scheme has to be added, check if https should be used.
@access public
@return string The passed string. | [
"Checks",
"if",
"a",
"string",
"contains",
"a",
"scheme",
".",
"Adds",
"one",
"if",
"necessary",
"checks",
"for",
"schemaless",
"urls",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Tools.php#L34-L49 |
MissAllSunday/Ohara | src/Suki/Tools.php | Tools.jsonResponse | public function jsonResponse($data = [])
{
global $db_show_debug;
$json = '';
$result = false;
// Defensive programming anyone?
if (empty($data))
return false;
// This is pretty simply, just encode the supplied data and be done with it.
$json = json_encode($data);
$result = json_last_error() == ... | php | public function jsonResponse($data = [])
{
global $db_show_debug;
$json = '';
$result = false;
// Defensive programming anyone?
if (empty($data))
return false;
// This is pretty simply, just encode the supplied data and be done with it.
$json = json_encode($data);
$result = json_last_error() == ... | [
"public",
"function",
"jsonResponse",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"global",
"$",
"db_show_debug",
";",
"$",
"json",
"=",
"''",
";",
"$",
"result",
"=",
"false",
";",
"// Defensive programming anyone?",
"if",
"(",
"empty",
"(",
"$",
"data",... | Outputs a json encoded string
It assumes the data is a valid array.
@param array $data The data to be converted, needs to be an array
@access public
@return boolean whether or not the data was encoded and outputted | [
"Outputs",
"a",
"json",
"encoded",
"string",
"It",
"assumes",
"the",
"data",
"is",
"a",
"valid",
"array",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Tools.php#L58-L99 |
MissAllSunday/Ohara | src/Suki/Tools.php | Tools.parser | public function parser($text, $replacements = []): string
{
global $context;
if (empty($text) || empty($replacements) || !is_array($replacements))
return '';
// Split the replacements up into two arrays, for use with str_replace.
$find = [];
$replace = [];
foreach ($replacements as $f => $r)
{
$... | php | public function parser($text, $replacements = []): string
{
global $context;
if (empty($text) || empty($replacements) || !is_array($replacements))
return '';
// Split the replacements up into two arrays, for use with str_replace.
$find = [];
$replace = [];
foreach ($replacements as $f => $r)
{
$... | [
"public",
"function",
"parser",
"(",
"$",
"text",
",",
"$",
"replacements",
"=",
"[",
"]",
")",
":",
"string",
"{",
"global",
"$",
"context",
";",
"if",
"(",
"empty",
"(",
"$",
"text",
")",
"||",
"empty",
"(",
"$",
"replacements",
")",
"||",
"!",
... | Parses and replace tokens by their given values.
also automatically adds the session var for href tokens.
@access public
@param string $text The raw text.
@param array $replacements a key => value array containing all tokens to be replaced.
@return string | [
"Parses",
"and",
"replace",
"tokens",
"by",
"their",
"given",
"values",
".",
"also",
"automatically",
"adds",
"the",
"session",
"var",
"for",
"href",
"tokens",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Tools.php#L109-L128 |
MissAllSunday/Ohara | src/Suki/Tools.php | Tools.commaSeparated | public function commaSeparated($string, $type = 'alphanumeric', $delimiter = ',')
{
if (empty($string))
return false;
// This is why we can't have nice things...
$t = isset($this->_commaCases[$type]) ? $this->_commaCases[$type] : $this->_commaCases['alphanumeric'];
return empty($string) ? false : implode(... | php | public function commaSeparated($string, $type = 'alphanumeric', $delimiter = ',')
{
if (empty($string))
return false;
// This is why we can't have nice things...
$t = isset($this->_commaCases[$type]) ? $this->_commaCases[$type] : $this->_commaCases['alphanumeric'];
return empty($string) ? false : implode(... | [
"public",
"function",
"commaSeparated",
"(",
"$",
"string",
",",
"$",
"type",
"=",
"'alphanumeric'",
",",
"$",
"delimiter",
"=",
"','",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"string",
")",
")",
"return",
"false",
";",
"// This is why we can't have nice thi... | Checks and returns a comma separated string.
@access public
@param string $string The string to check and format
@param string $type The type to check against. Accepts "numeric", "alpha" and "alphanumeric".
@param string $delimiter Used for explode/imploding the string.
@return string|bool | [
"Checks",
"and",
"returns",
"a",
"comma",
"separated",
"string",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Tools.php#L138-L154 |
MissAllSunday/Ohara | src/Suki/Tools.php | Tools.formatBytes | public function formatBytes($bytes, $showUnits = false, $log = 1024): string
{
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log($log));
$pow = min($pow, count($units) - 1);
$bytes /= (1 << (10 * $pow));
return round($bytes, 2) . ($showUnit... | php | public function formatBytes($bytes, $showUnits = false, $log = 1024): string
{
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log($log));
$pow = min($pow, count($units) - 1);
$bytes /= (1 << (10 * $pow));
return round($bytes, 2) . ($showUnit... | [
"public",
"function",
"formatBytes",
"(",
"$",
"bytes",
",",
"$",
"showUnits",
"=",
"false",
",",
"$",
"log",
"=",
"1024",
")",
":",
"string",
"{",
"$",
"units",
"=",
"array",
"(",
"'B'",
",",
"'KB'",
",",
"'MB'",
",",
"'GB'",
",",
"'TB'",
")",
"... | Returns a formatted string.
@access public
@param string|int $bytes A number of bytes.
@param bool $showUnits To show the unit symbol or not.
@param int $log the log used, either 1024 or 1000.
@return string | [
"Returns",
"a",
"formatted",
"string",
"."
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Tools.php#L164-L173 |
MissAllSunday/Ohara | src/Suki/Tools.php | Tools.redirect | public function redirect($url, $options = [])
{
global $context;
// Why do you even bother?
if (empty($url))
return false;
// Toc toc token?
if (!empty($options['token']))
{
// No name? why?
$name = !is_string($options['token']) ? ($this->_app->name .'_re') : $options['token'];
createToken($... | php | public function redirect($url, $options = [])
{
global $context;
// Why do you even bother?
if (empty($url))
return false;
// Toc toc token?
if (!empty($options['token']))
{
// No name? why?
$name = !is_string($options['token']) ? ($this->_app->name .'_re') : $options['token'];
createToken($... | [
"public",
"function",
"redirect",
"(",
"$",
"url",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"global",
"$",
"context",
";",
"// Why do you even bother?",
"if",
"(",
"empty",
"(",
"$",
"url",
")",
")",
"return",
"false",
";",
"// Toc toc token?",
"if"... | Wrapper function for SMF's redirectexit()
@access public
@param string $url A string, identical to what you would normally pass to redirectexit, IE, no $scripturl.
@param array $options An array of options:
- token string If defined, sets a token using the string given, if no string is provided, uses a generic name cre... | [
"Wrapper",
"function",
"for",
"SMF",
"s",
"redirectexit",
"()"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Tools.php#L185-L208 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer/DirectLex.php | HTMLPurifier_Lexer_DirectLex.parseAttributeString | public function parseAttributeString($string, $config, $context) {
$string = (string) $string; // quick typecast
if ($string == '') return array(); // no attributes
$e = false;
if ($config->get('Core.CollectErrors')) {
$e =& $context->get('ErrorCollector');
}
... | php | public function parseAttributeString($string, $config, $context) {
$string = (string) $string; // quick typecast
if ($string == '') return array(); // no attributes
$e = false;
if ($config->get('Core.CollectErrors')) {
$e =& $context->get('ErrorCollector');
}
... | [
"public",
"function",
"parseAttributeString",
"(",
"$",
"string",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"$",
"string",
"=",
"(",
"string",
")",
"$",
"string",
";",
"// quick typecast",
"if",
"(",
"$",
"string",
"==",
"''",
")",
"return",
"... | Takes the inside of an HTML tag and makes an assoc array of attributes.
@param $string Inside of tag excluding name.
@returns Assoc array of attributes. | [
"Takes",
"the",
"inside",
"of",
"an",
"HTML",
"tag",
"and",
"makes",
"an",
"assoc",
"array",
"of",
"attributes",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Lexer/DirectLex.php#L342-L486 |
joomla-projects/jorobo | src/Tasks/JTask.php | JTask.checkFolders | public function checkFolders()
{
$dirHandle = opendir($this->getSourceFolder());
if ($dirHandle === false)
{
$this->printTaskError('Can not open ' . $this->getSourceFolder() . ' for parsing');
return false;
}
return true;
} | php | public function checkFolders()
{
$dirHandle = opendir($this->getSourceFolder());
if ($dirHandle === false)
{
$this->printTaskError('Can not open ' . $this->getSourceFolder() . ' for parsing');
return false;
}
return true;
} | [
"public",
"function",
"checkFolders",
"(",
")",
"{",
"$",
"dirHandle",
"=",
"opendir",
"(",
"$",
"this",
"->",
"getSourceFolder",
"(",
")",
")",
";",
"if",
"(",
"$",
"dirHandle",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"printTaskError",
"(",
"'Can... | Function to check if folders are existing / writable (Code Base etc.)
@return bool
@since 1.0 | [
"Function",
"to",
"check",
"if",
"folders",
"are",
"existing",
"/",
"writable",
"(",
"Code",
"Base",
"etc",
".",
")"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/JTask.php#L86-L98 |
joomla-projects/jorobo | src/Tasks/JTask.php | JTask.determineSourceFolder | private function determineSourceFolder()
{
$this->sourceFolder = JPATH_BASE . "/" . $this->getJConfig()->source;
if (!is_dir($this->sourceFolder))
{
$this->say('Warning - Directory: ' . $this->sourceFolder . ' is not available');
}
} | php | private function determineSourceFolder()
{
$this->sourceFolder = JPATH_BASE . "/" . $this->getJConfig()->source;
if (!is_dir($this->sourceFolder))
{
$this->say('Warning - Directory: ' . $this->sourceFolder . ' is not available');
}
} | [
"private",
"function",
"determineSourceFolder",
"(",
")",
"{",
"$",
"this",
"->",
"sourceFolder",
"=",
"JPATH_BASE",
".",
"\"/\"",
".",
"$",
"this",
"->",
"getJConfig",
"(",
")",
"->",
"source",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"s... | Sets the source folder
@return void
@since 1.0 | [
"Sets",
"the",
"source",
"folder"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/JTask.php#L167-L175 |
joomla-projects/jorobo | src/Tasks/JTask.php | JTask.determineOperatingSystem | private function determineOperatingSystem()
{
$this->os = strtoupper(substr(PHP_OS, 0, 3));
if ($this->os === 'WIN')
{
$this->fileExtension = '.exe';
}
} | php | private function determineOperatingSystem()
{
$this->os = strtoupper(substr(PHP_OS, 0, 3));
if ($this->os === 'WIN')
{
$this->fileExtension = '.exe';
}
} | [
"private",
"function",
"determineOperatingSystem",
"(",
")",
"{",
"$",
"this",
"->",
"os",
"=",
"strtoupper",
"(",
"substr",
"(",
"PHP_OS",
",",
"0",
",",
"3",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"os",
"===",
"'WIN'",
")",
"{",
"$",
"this"... | Sets the operating system
@return void
@since 1.0 | [
"Sets",
"the",
"operating",
"system"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/JTask.php#L184-L192 |
joomla-projects/jorobo | src/Tasks/JTask.php | JTask.loadConfiguration | private function loadConfiguration($params)
{
if (!is_null(self::$jConfig))
{
return true;
}
// Load config as object
$jConfig = json_decode(json_encode(parse_ini_file(JPATH_BASE . '/jorobo.ini', true)), false);
if (!$jConfig)
{
$this->say('Error: Config file jorobo.ini not available');
throw... | php | private function loadConfiguration($params)
{
if (!is_null(self::$jConfig))
{
return true;
}
// Load config as object
$jConfig = json_decode(json_encode(parse_ini_file(JPATH_BASE . '/jorobo.ini', true)), false);
if (!$jConfig)
{
$this->say('Error: Config file jorobo.ini not available');
throw... | [
"private",
"function",
"loadConfiguration",
"(",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"self",
"::",
"$",
"jConfig",
")",
")",
"{",
"return",
"true",
";",
"}",
"// Load config as object",
"$",
"jConfig",
"=",
"json_decode",
"(",
"json_en... | Load config
@param array $params Optional Params
@return bool|void
@since 1.0
@throws FileNotFoundException | [
"Load",
"config"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/JTask.php#L204-L242 |
joomla-projects/jorobo | src/Tasks/JTask.php | JTask.determineTarget | private function determineTarget($jConfig)
{
if (!isset($jConfig->extension))
{
return 'unnamed';
}
$target = "/dist/" . $jConfig->extension;
if (!empty($jConfig->version))
{
$target = "/dist/" . $jConfig->extension . "-" . $jConfig->version;
return $target;
}
return $target;
} | php | private function determineTarget($jConfig)
{
if (!isset($jConfig->extension))
{
return 'unnamed';
}
$target = "/dist/" . $jConfig->extension;
if (!empty($jConfig->version))
{
$target = "/dist/" . $jConfig->extension . "-" . $jConfig->version;
return $target;
}
return $target;
} | [
"private",
"function",
"determineTarget",
"(",
"$",
"jConfig",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"jConfig",
"->",
"extension",
")",
")",
"{",
"return",
"'unnamed'",
";",
"}",
"$",
"target",
"=",
"\"/dist/\"",
".",
"$",
"jConfig",
"->",
"exte... | Get target
@param object $jConfig - The JoRobo config
@return string
@since 1.0 | [
"Get",
"target"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/JTask.php#L267-L284 |
vi-kon/laravel-parser | src/ViKon/Parser/Token.php | Token.clear | public function clear($key) {
if ($this->exists($key)) {
unset($this->data[$key]);
return true;
}
return false;
} | php | public function clear($key) {
if ($this->exists($key)) {
unset($this->data[$key]);
return true;
}
return false;
} | [
"public",
"function",
"clear",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
"$",
"key",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
"]",
")",
";",
"return",
"true",
";",
"}",
"return",
"... | Clear (delete) data stored under specific key
@param string $key data key
@return bool return TRUE if data existed and cleared | [
"Clear",
"(",
"delete",
")",
"data",
"stored",
"under",
"specific",
"key"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/Token.php#L101-L109 |
pantera-digital/yii2-seo | controllers/PresetsController.php | PresetsController.actionCreate | public function actionCreate()
{
$model = new SeoPresets();
$model->loadDefaultValues();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if(Yii::$app->request->post('action') === 'apply') {
return $this->redirect(['update', 'id' => $model->id]);
... | php | public function actionCreate()
{
$model = new SeoPresets();
$model->loadDefaultValues();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if(Yii::$app->request->post('action') === 'apply') {
return $this->redirect(['update', 'id' => $model->id]);
... | [
"public",
"function",
"actionCreate",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"SeoPresets",
"(",
")",
";",
"$",
"model",
"->",
"loadDefaultValues",
"(",
")",
";",
"if",
"(",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
... | Creates a new SeoPresets model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed | [
"Creates",
"a",
"new",
"SeoPresets",
"model",
".",
"If",
"creation",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/controllers/PresetsController.php#L80-L95 |
pantera-digital/yii2-seo | controllers/PresetsController.php | PresetsController.actionUpdate | public function actionUpdate($id)
{
$model = $this->findModel($id);
$model->loadDefaultValues();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if(Yii::$app->request->post('action') === 'apply') {
return $this->redirect(['update', 'id' => $model... | php | public function actionUpdate($id)
{
$model = $this->findModel($id);
$model->loadDefaultValues();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if(Yii::$app->request->post('action') === 'apply') {
return $this->redirect(['update', 'id' => $model... | [
"public",
"function",
"actionUpdate",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"$",
"model",
"->",
"loadDefaultValues",
"(",
")",
";",
"if",
"(",
"$",
"model",
"->",
"load",
"(",
"Yii",
... | Updates an existing SeoPresets model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
@throws NotFoundHttpException if the model cannot be found | [
"Updates",
"an",
"existing",
"SeoPresets",
"model",
".",
"If",
"update",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/controllers/PresetsController.php#L104-L119 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/URIParser.php | HTMLPurifier_URIParser.parse | public function parse($uri) {
$uri = $this->percentEncoder->normalize($uri);
// Regexp is as per Appendix B.
// Note that ["<>] are an addition to the RFC's recommended
// characters, because they represent external delimeters.
$r_URI = '!'.
'(([^:/?#"<>]+):)?'. // ... | php | public function parse($uri) {
$uri = $this->percentEncoder->normalize($uri);
// Regexp is as per Appendix B.
// Note that ["<>] are an addition to the RFC's recommended
// characters, because they represent external delimeters.
$r_URI = '!'.
'(([^:/?#"<>]+):)?'. // ... | [
"public",
"function",
"parse",
"(",
"$",
"uri",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"percentEncoder",
"->",
"normalize",
"(",
"$",
"uri",
")",
";",
"// Regexp is as per Appendix B.",
"// Note that [\"<>] are an addition to the RFC's recommended",
"// charact... | Parses a URI.
@param $uri string URI to parse
@return HTMLPurifier_URI representation of URI. This representation has
not been validated yet and may not conform to RFC. | [
"Parses",
"a",
"URI",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/URIParser.php#L25-L66 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.parse | public function parse(TokenStream $stream) : RootNode
{
if (! $this->runtime) {
throw new AegisError('Runtime needs to be set before parsing');
}
$this->prepare($stream);
$this->parseOutsideTag();
if ($this->cursor !== $this->lastTokenIndex) {
$this-... | php | public function parse(TokenStream $stream) : RootNode
{
if (! $this->runtime) {
throw new AegisError('Runtime needs to be set before parsing');
}
$this->prepare($stream);
$this->parseOutsideTag();
if ($this->cursor !== $this->lastTokenIndex) {
$this-... | [
"public",
"function",
"parse",
"(",
"TokenStream",
"$",
"stream",
")",
":",
"RootNode",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"runtime",
")",
"{",
"throw",
"new",
"AegisError",
"(",
"'Runtime needs to be set before parsing'",
")",
";",
"}",
"$",
"this",
... | Parses the given TokenStream into a RootNode (AST)
@param TokenStream $stream
@return RootNode
@throws AegisError | [
"Parses",
"the",
"given",
"TokenStream",
"into",
"a",
"RootNode",
"(",
"AST",
")"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L65-L79 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.prepare | public function prepare(TokenStream $stream) :void
{
$this->root = $this->scope = new RootNode();
$this->stream = $stream;
$this->lastTokenIndex = max(0, count($this->stream->getTokens()) - 1);
$this->cursor = 0;
} | php | public function prepare(TokenStream $stream) :void
{
$this->root = $this->scope = new RootNode();
$this->stream = $stream;
$this->lastTokenIndex = max(0, count($this->stream->getTokens()) - 1);
$this->cursor = 0;
} | [
"public",
"function",
"prepare",
"(",
"TokenStream",
"$",
"stream",
")",
":",
"void",
"{",
"$",
"this",
"->",
"root",
"=",
"$",
"this",
"->",
"scope",
"=",
"new",
"RootNode",
"(",
")",
";",
"$",
"this",
"->",
"stream",
"=",
"$",
"stream",
";",
"$",... | Prepares the parser for parsing
@param TokenStream $stream
@return void | [
"Prepares",
"the",
"parser",
"for",
"parsing"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L87-L93 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.parseOutsideTag | public function parseOutsideTag() : void
{
if (!count($this->stream->getTokens())) {
return;
}
if ($this->accept(Token::T_TEXT)) {
$this->insert(new TextNode($this->getCurrentToken()->getValue()));
$this->advance();
}
if ($this->skip(Toke... | php | public function parseOutsideTag() : void
{
if (!count($this->stream->getTokens())) {
return;
}
if ($this->accept(Token::T_TEXT)) {
$this->insert(new TextNode($this->getCurrentToken()->getValue()));
$this->advance();
}
if ($this->skip(Toke... | [
"public",
"function",
"parseOutsideTag",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"stream",
"->",
"getTokens",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"accept",
"(",
"Token",
... | Parses outside of tags
@return void | [
"Parses",
"outside",
"of",
"tags"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L100-L114 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.parseText | public function parseText() : void
{
if (!count($this->stream->getTokens())) {
return;
}
if ($this->accept(Token::T_TEXT)) {
$this->insert(new TextNode($this->getCurrentToken()->getValue()));
$this->advance();
}
} | php | public function parseText() : void
{
if (!count($this->stream->getTokens())) {
return;
}
if ($this->accept(Token::T_TEXT)) {
$this->insert(new TextNode($this->getCurrentToken()->getValue()));
$this->advance();
}
} | [
"public",
"function",
"parseText",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"stream",
"->",
"getTokens",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"accept",
"(",
"Token",
"::",
... | Parses text
@return void | [
"Parses",
"text"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L121-L131 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.expect | public function expect(int $type, $value = null) : bool
{
if (!$this->accept($type, $value)) {
$this->syntaxError('Expected '.Token::getStringRepresentation($type, $value).' got '.$this->getCurrentToken());
}
return true;
} | php | public function expect(int $type, $value = null) : bool
{
if (!$this->accept($type, $value)) {
$this->syntaxError('Expected '.Token::getStringRepresentation($type, $value).' got '.$this->getCurrentToken());
}
return true;
} | [
"public",
"function",
"expect",
"(",
"int",
"$",
"type",
",",
"$",
"value",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"accept",
"(",
"$",
"type",
",",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"syntaxError",
"... | Expects the current token to be of given type and optionally has given value
@param int $type
@param null $value
@return bool
@throws ParseError | [
"Expects",
"the",
"current",
"token",
"to",
"be",
"of",
"given",
"type",
"and",
"optionally",
"has",
"given",
"value"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L151-L158 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.expectNext | public function expectNext(int $type, $value = null) : bool
{
if (!$this->acceptNext($type, $value)) {
$this->syntaxError('Expected '.Token::getStringRepresentation($type, $value).' got '.$this->getNextToken());
}
return true;
} | php | public function expectNext(int $type, $value = null) : bool
{
if (!$this->acceptNext($type, $value)) {
$this->syntaxError('Expected '.Token::getStringRepresentation($type, $value).' got '.$this->getNextToken());
}
return true;
} | [
"public",
"function",
"expectNext",
"(",
"int",
"$",
"type",
",",
"$",
"value",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"acceptNext",
"(",
"$",
"type",
",",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"syntaxErr... | Expects the next token to be of given type and optionally has given value
@param int $type
@param null $value
@return bool
@throws ParseError | [
"Expects",
"the",
"next",
"token",
"to",
"be",
"of",
"given",
"type",
"and",
"optionally",
"has",
"given",
"value"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L168-L175 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.skip | public function skip(int $type, $value = null) : bool
{
if ($this->accept($type, $value)) {
$this->advance();
return true;
}
return false;
} | php | public function skip(int $type, $value = null) : bool
{
if ($this->accept($type, $value)) {
$this->advance();
return true;
}
return false;
} | [
"public",
"function",
"skip",
"(",
"int",
"$",
"type",
",",
"$",
"value",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"accept",
"(",
"$",
"type",
",",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"advance",
"(",
")",
... | Skips the current token if it's of given type and optionally has given value
@param int $type
@param null $value
@return bool | [
"Skips",
"the",
"current",
"token",
"if",
"it",
"s",
"of",
"given",
"type",
"and",
"optionally",
"has",
"given",
"value"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L184-L193 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.accept | public function accept(int $type, $value = null) : bool
{
if ($this->getCurrentToken()->getType() === $type) {
if ($value) {
if ($this->getCurrentToken()->getValue() === $value) {
return true;
}
return false;
}
... | php | public function accept(int $type, $value = null) : bool
{
if ($this->getCurrentToken()->getType() === $type) {
if ($value) {
if ($this->getCurrentToken()->getValue() === $value) {
return true;
}
return false;
}
... | [
"public",
"function",
"accept",
"(",
"int",
"$",
"type",
",",
"$",
"value",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"getCurrentToken",
"(",
")",
"->",
"getType",
"(",
")",
"===",
"$",
"type",
")",
"{",
"if",
"(",
"$",
... | Accepts the current token if it's of given type and optionally has given value
@param int $type
@param null $value
@return bool | [
"Accepts",
"the",
"current",
"token",
"if",
"it",
"s",
"of",
"given",
"type",
"and",
"optionally",
"has",
"given",
"value"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L202-L217 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.acceptNext | public function acceptNext(int $type, $value = null) : bool
{
if ($this->getNextToken()->getType() === $type) {
if ($value) {
if ($this->getNextToken()->getValue() === $value) {
return true;
}
return false;
}
... | php | public function acceptNext(int $type, $value = null) : bool
{
if ($this->getNextToken()->getType() === $type) {
if ($value) {
if ($this->getNextToken()->getValue() === $value) {
return true;
}
return false;
}
... | [
"public",
"function",
"acceptNext",
"(",
"int",
"$",
"type",
",",
"$",
"value",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"getNextToken",
"(",
")",
"->",
"getType",
"(",
")",
"===",
"$",
"type",
")",
"{",
"if",
"(",
"$",
... | Accepts the next token if it's of given type and optionally has given value
@param int $type
@param null $value
@return bool | [
"Accepts",
"the",
"next",
"token",
"if",
"it",
"s",
"of",
"given",
"type",
"and",
"optionally",
"has",
"given",
"value"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L226-L241 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.traverseDown | public function traverseDown() : void
{
try {
$parent = $this->getScope()->getParent();
} catch (AegisError $e) {
throw new ParseError($e->getMessage());
}
$this->setScope($parent);
} | php | public function traverseDown() : void
{
try {
$parent = $this->getScope()->getParent();
} catch (AegisError $e) {
throw new ParseError($e->getMessage());
}
$this->setScope($parent);
} | [
"public",
"function",
"traverseDown",
"(",
")",
":",
"void",
"{",
"try",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getScope",
"(",
")",
"->",
"getParent",
"(",
")",
";",
"}",
"catch",
"(",
"AegisError",
"$",
"e",
")",
"{",
"throw",
"new",
"Parse... | Moves outside the current scope
@return void
@throws ParseError | [
"Moves",
"outside",
"the",
"current",
"scope"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L320-L329 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.advance | public function advance() : void
{
if ($this->cursor < count($this->stream->getTokens()) - 1) {
++$this->cursor;
}
} | php | public function advance() : void
{
if ($this->cursor < count($this->stream->getTokens()) - 1) {
++$this->cursor;
}
} | [
"public",
"function",
"advance",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"cursor",
"<",
"count",
"(",
"$",
"this",
"->",
"stream",
"->",
"getTokens",
"(",
")",
")",
"-",
"1",
")",
"{",
"++",
"$",
"this",
"->",
"cursor",
";",
"... | Advances the cursor
@return void | [
"Advances",
"the",
"cursor"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L336-L341 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.wrap | public function wrap(Node $node) : void
{
$last = $this->scope->getLastChild(); // Get the last inserted node
$this->scope->removeLastChild(); // Remove it
$this->insert($node);
$this->traverseUp();
$this->insert($last);
} | php | public function wrap(Node $node) : void
{
$last = $this->scope->getLastChild(); // Get the last inserted node
$this->scope->removeLastChild(); // Remove it
$this->insert($node);
$this->traverseUp();
$this->insert($last);
} | [
"public",
"function",
"wrap",
"(",
"Node",
"$",
"node",
")",
":",
"void",
"{",
"$",
"last",
"=",
"$",
"this",
"->",
"scope",
"->",
"getLastChild",
"(",
")",
";",
"// Get the last inserted node",
"$",
"this",
"->",
"scope",
"->",
"removeLastChild",
"(",
"... | Wraps the last inserted node with the given node
@param Node $node
@return void | [
"Wraps",
"the",
"last",
"inserted",
"node",
"with",
"the",
"given",
"node"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L359-L368 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.setAttribute | public function setAttribute() : void
{
$last = $this->scope->getLastChild(); // Get the last inserted node
$this->scope->removeLastChild(); // Remove it
$this->scope->setAttribute($last);
} | php | public function setAttribute() : void
{
$last = $this->scope->getLastChild(); // Get the last inserted node
$this->scope->removeLastChild(); // Remove it
$this->scope->setAttribute($last);
} | [
"public",
"function",
"setAttribute",
"(",
")",
":",
"void",
"{",
"$",
"last",
"=",
"$",
"this",
"->",
"scope",
"->",
"getLastChild",
"(",
")",
";",
"// Get the last inserted node",
"$",
"this",
"->",
"scope",
"->",
"removeLastChild",
"(",
")",
";",
"// Re... | Sets the last inserted node as attribute
@return void | [
"Sets",
"the",
"last",
"inserted",
"node",
"as",
"attribute"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L375-L380 |
reinvanoyen/aegis | lib/Aegis/Parser.php | Parser.insert | public function insert(Node $node) : void
{
$node->setParent($this->scope);
$this->scope->insert($node);
} | php | public function insert(Node $node) : void
{
$node->setParent($this->scope);
$this->scope->insert($node);
} | [
"public",
"function",
"insert",
"(",
"Node",
"$",
"node",
")",
":",
"void",
"{",
"$",
"node",
"->",
"setParent",
"(",
"$",
"this",
"->",
"scope",
")",
";",
"$",
"this",
"->",
"scope",
"->",
"insert",
"(",
"$",
"node",
")",
";",
"}"
] | Inserts the given node
@param Node $node
@return void | [
"Inserts",
"the",
"given",
"node"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Parser.php#L388-L392 |
mamuz/MamuzBlog | src/MamuzBlog/Controller/TagQueryController.php | TagQueryController.listAction | public function listAction()
{
$this->routeParam()->mapPageTo($this->queryService);
$collection = $this->queryService->findUsedTags();
return $this->viewModelFactory()->createFor($collection);
} | php | public function listAction()
{
$this->routeParam()->mapPageTo($this->queryService);
$collection = $this->queryService->findUsedTags();
return $this->viewModelFactory()->createFor($collection);
} | [
"public",
"function",
"listAction",
"(",
")",
"{",
"$",
"this",
"->",
"routeParam",
"(",
")",
"->",
"mapPageTo",
"(",
"$",
"this",
"->",
"queryService",
")",
";",
"$",
"collection",
"=",
"$",
"this",
"->",
"queryService",
"->",
"findUsedTags",
"(",
")",
... | Tag list retrieval
@return ModelInterface | [
"Tag",
"list",
"retrieval"
] | train | https://github.com/mamuz/MamuzBlog/blob/cb43be5c39031e3dcc939283e284824c4d07da38/src/MamuzBlog/Controller/TagQueryController.php#L31-L37 |
mimmi20/Wurfl | src/Handlers/NintendoHandler.php | NintendoHandler.canHandle | public function canHandle($userAgent)
{
if (Utils::isDesktopBrowser($userAgent)) {
return false;
}
if (Utils::checkIfContains($userAgent, 'Nintendo')) {
return true;
}
return Utils::checkIfStartsWith($userAgent, 'Mozilla/')
&& Utils::chec... | php | public function canHandle($userAgent)
{
if (Utils::isDesktopBrowser($userAgent)) {
return false;
}
if (Utils::checkIfContains($userAgent, 'Nintendo')) {
return true;
}
return Utils::checkIfStartsWith($userAgent, 'Mozilla/')
&& Utils::chec... | [
"public",
"function",
"canHandle",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"Utils",
"::",
"isDesktopBrowser",
"(",
"$",
"userAgent",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"Utils",
"::",
"checkIfContains",
"(",
"$",
"userAgent",
",",
... | @param string $userAgent
@return bool | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/NintendoHandler.php#L46-L58 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.