id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
25,600 | RudyMas/Emvc_Login | src/Login.php | Login.translateData | private function translateData(): void
{
foreach ($this->db->data as $key => $value) {
$this->data[$key] = $value;
}
} | php | private function translateData(): void
{
foreach ($this->db->data as $key => $value) {
$this->data[$key] = $value;
}
} | [
"private",
"function",
"translateData",
"(",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"db",
"->",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
... | Transform clean SQL data to normal data | [
"Transform",
"clean",
"SQL",
"data",
"to",
"normal",
"data"
] | 9bcb50b08836d0639338ca2bc173182bc6b4bce3 | https://github.com/RudyMas/Emvc_Login/blob/9bcb50b08836d0639338ca2bc173182bc6b4bce3/src/Login.php#L358-L363 |
25,601 | RudyMas/Emvc_Login | src/Login.php | Login.setData | public function setData(string $key, $value): bool
{
if ($key !== 'password' || $key !== 'salt' || $key !== 'remember_md') {
$this->data[$key] = $value;
return true;
} else {
return false;
}
} | php | public function setData(string $key, $value): bool
{
if ($key !== 'password' || $key !== 'salt' || $key !== 'remember_md') {
$this->data[$key] = $value;
return true;
} else {
return false;
}
} | [
"public",
"function",
"setData",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"key",
"!==",
"'password'",
"||",
"$",
"key",
"!==",
"'salt'",
"||",
"$",
"key",
"!==",
"'remember_md'",
")",
"{",
"$",
"this",
"-... | Set any other field from the table
@param string $key
@param mixed $value
@return bool | [
"Set",
"any",
"other",
"field",
"from",
"the",
"table"
] | 9bcb50b08836d0639338ca2bc173182bc6b4bce3 | https://github.com/RudyMas/Emvc_Login/blob/9bcb50b08836d0639338ca2bc173182bc6b4bce3/src/Login.php#L460-L468 |
25,602 | RudyMas/Emvc_Login | src/Login.php | Login.getData | public function getData(string $key)
{
return ($key !== 'password' || $key !== 'salt' || $key !== 'remember_me') ? $this->data[$key] : false;
} | php | public function getData(string $key)
{
return ($key !== 'password' || $key !== 'salt' || $key !== 'remember_me') ? $this->data[$key] : false;
} | [
"public",
"function",
"getData",
"(",
"string",
"$",
"key",
")",
"{",
"return",
"(",
"$",
"key",
"!==",
"'password'",
"||",
"$",
"key",
"!==",
"'salt'",
"||",
"$",
"key",
"!==",
"'remember_me'",
")",
"?",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
... | Get any other field from the table
Will return 'false' is key 'password', 'salt' or 'remember_me' is accessed
@param string $key
@return bool|mixed | [
"Get",
"any",
"other",
"field",
"from",
"the",
"table",
"Will",
"return",
"false",
"is",
"key",
"password",
"salt",
"or",
"remember_me",
"is",
"accessed"
] | 9bcb50b08836d0639338ca2bc173182bc6b4bce3 | https://github.com/RudyMas/Emvc_Login/blob/9bcb50b08836d0639338ca2bc173182bc6b4bce3/src/Login.php#L477-L480 |
25,603 | wb-crowdfusion/crowdfusion | system/core/classes/systemdb/plugins/PluginDAO.php | PluginDAO.postCacheTranslateObject | public function postCacheTranslateObject(ModelObject $obj)
{
if(strpos($obj->Path, $this->rootPath) === FALSE)
$obj->setPath($this->rootPath.DIRECTORY_SEPARATOR.$obj->Path);
return $obj;
} | php | public function postCacheTranslateObject(ModelObject $obj)
{
if(strpos($obj->Path, $this->rootPath) === FALSE)
$obj->setPath($this->rootPath.DIRECTORY_SEPARATOR.$obj->Path);
return $obj;
} | [
"public",
"function",
"postCacheTranslateObject",
"(",
"ModelObject",
"$",
"obj",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"obj",
"->",
"Path",
",",
"$",
"this",
"->",
"rootPath",
")",
"===",
"FALSE",
")",
"$",
"obj",
"->",
"setPath",
"(",
"$",
"this",... | Sets the path and returns the object
@param ModelObject $obj The plugin
@return ModelObject | [
"Sets",
"the",
"path",
"and",
"returns",
"the",
"object"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/plugins/PluginDAO.php#L62-L67 |
25,604 | koolkode/http | src/UriBuilder.php | UriBuilder.param | public function param($name, $value)
{
if(is_integer($name))
{
if(array_key_exists($name, $this->pathParamNames))
{
$this->path[$this->pathParamNames[$name]] = $value;
return $this;
}
throw new \OutOfBoundsException(sprintf('No path param at position %u', $name));
}
if(in_array(... | php | public function param($name, $value)
{
if(is_integer($name))
{
if(array_key_exists($name, $this->pathParamNames))
{
$this->path[$this->pathParamNames[$name]] = $value;
return $this;
}
throw new \OutOfBoundsException(sprintf('No path param at position %u', $name));
}
if(in_array(... | [
"public",
"function",
"param",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_integer",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"pathParamNames",
")",
")",
"{",
"$",
... | Assign a value to a path or query param depending on the URI pattern checking
the name of the param.
@param string $name
@param string $value
@return UriBuilder | [
"Assign",
"a",
"value",
"to",
"a",
"path",
"or",
"query",
"param",
"depending",
"on",
"the",
"URI",
"pattern",
"checking",
"the",
"name",
"of",
"the",
"param",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/UriBuilder.php#L167-L191 |
25,605 | koolkode/http | src/UriBuilder.php | UriBuilder.pathParam | public function pathParam($name, $value)
{
if(is_integer($name))
{
if(array_key_exists($name, $this->pathParamNames))
{
$this->path[$this->pathParamNames[$name]] = $value;
return $this;
}
throw new \OutOfBoundsException(sprintf('Path param %u not found in pattern "%s"', $name, $this->uri)... | php | public function pathParam($name, $value)
{
if(is_integer($name))
{
if(array_key_exists($name, $this->pathParamNames))
{
$this->path[$this->pathParamNames[$name]] = $value;
return $this;
}
throw new \OutOfBoundsException(sprintf('Path param %u not found in pattern "%s"', $name, $this->uri)... | [
"public",
"function",
"pathParam",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_integer",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"pathParamNames",
")",
")",
"{",
"$... | Assign a value to a path param.
@param string $name
@param string $value
@return UriBuilder
@throws \OutOfBoundsException When no such param (name or index) exists. | [
"Assign",
"a",
"value",
"to",
"a",
"path",
"param",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/UriBuilder.php#L212-L234 |
25,606 | koolkode/http | src/UriBuilder.php | UriBuilder.queryParam | public function queryParam($name, $value)
{
if($value === NULL)
{
unset($this->query[(string)$name]);
}
else
{
$this->query[(string)$name] = $value;
}
return $this;
} | php | public function queryParam($name, $value)
{
if($value === NULL)
{
unset($this->query[(string)$name]);
}
else
{
$this->query[(string)$name] = $value;
}
return $this;
} | [
"public",
"function",
"queryParam",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"NULL",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"query",
"[",
"(",
"string",
")",
"$",
"name",
"]",
")",
";",
"}",
"else",
"{"... | Assign a value to a query param, assigning a NULL value will remove the query param.
@param string $name
@param mixed $value
@return UriBuilder | [
"Assign",
"a",
"value",
"to",
"a",
"query",
"param",
"assigning",
"a",
"NULL",
"value",
"will",
"remove",
"the",
"query",
"param",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/UriBuilder.php#L243-L255 |
25,607 | koolkode/http | src/UriBuilder.php | UriBuilder.queryParams | public function queryParams(array $query)
{
$this->query = Arrays::mergeDeep($this->query, $query);
return $this;
} | php | public function queryParams(array $query)
{
$this->query = Arrays::mergeDeep($this->query, $query);
return $this;
} | [
"public",
"function",
"queryParams",
"(",
"array",
"$",
"query",
")",
"{",
"$",
"this",
"->",
"query",
"=",
"Arrays",
"::",
"mergeDeep",
"(",
"$",
"this",
"->",
"query",
",",
"$",
"query",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Merges query params recursively.
@param array<string, mixed> $query
@return UriBuilder | [
"Merges",
"query",
"params",
"recursively",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/UriBuilder.php#L263-L268 |
25,608 | koolkode/http | src/UriBuilder.php | UriBuilder.setParams | public function setParams(array $params)
{
$this->path = [];
$this->query = [];
foreach($params as $k => $v)
{
if(is_integer($k))
{
if(array_key_exists($k, $this->pathParamNames))
{
$this->path[$this->pathParamNames[$k]] = $v;
continue;
}
throw new \OutOfBoundsExce... | php | public function setParams(array $params)
{
$this->path = [];
$this->query = [];
foreach($params as $k => $v)
{
if(is_integer($k))
{
if(array_key_exists($k, $this->pathParamNames))
{
$this->path[$this->pathParamNames[$k]] = $v;
continue;
}
throw new \OutOfBoundsExce... | [
"public",
"function",
"setParams",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"this",
"->",
"path",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"query",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
... | Removes all param values from path and query and re-populates using the given values.
@param array<string, mixed> $params Path and query params to be set.
@return UriBuilder | [
"Removes",
"all",
"param",
"values",
"from",
"path",
"and",
"query",
"and",
"re",
"-",
"populates",
"using",
"the",
"given",
"values",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/UriBuilder.php#L288-L318 |
25,609 | koolkode/http | src/UriBuilder.php | UriBuilder.fragment | public function fragment($fragment)
{
$this->fragment = ($fragment === NULL || $fragment == '') ? NULL : (string)$fragment;
return $this;
} | php | public function fragment($fragment)
{
$this->fragment = ($fragment === NULL || $fragment == '') ? NULL : (string)$fragment;
return $this;
} | [
"public",
"function",
"fragment",
"(",
"$",
"fragment",
")",
"{",
"$",
"this",
"->",
"fragment",
"=",
"(",
"$",
"fragment",
"===",
"NULL",
"||",
"$",
"fragment",
"==",
"''",
")",
"?",
"NULL",
":",
"(",
"string",
")",
"$",
"fragment",
";",
"return",
... | Set or remove the fragment part of this URI.
@param string $fragment
@return UriBuilder | [
"Set",
"or",
"remove",
"the",
"fragment",
"part",
"of",
"this",
"URI",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/UriBuilder.php#L326-L331 |
25,610 | koolkode/http | src/UriBuilder.php | UriBuilder.build | public function build($trailingSlash = false)
{
$result = '';
foreach(preg_split("'(\\{(?:(?>[^\\{\\}]+)|(?R))+\\})'S", $this->uri, -1, PREG_SPLIT_DELIM_CAPTURE) as $part)
{
if(substr($part, 0, 1) == '{')
{
$result .= Uri::encode($this->path[substr($part, 1, -1)]);
}
else
{
$result .= $... | php | public function build($trailingSlash = false)
{
$result = '';
foreach(preg_split("'(\\{(?:(?>[^\\{\\}]+)|(?R))+\\})'S", $this->uri, -1, PREG_SPLIT_DELIM_CAPTURE) as $part)
{
if(substr($part, 0, 1) == '{')
{
$result .= Uri::encode($this->path[substr($part, 1, -1)]);
}
else
{
$result .= $... | [
"public",
"function",
"build",
"(",
"$",
"trailingSlash",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"''",
";",
"foreach",
"(",
"preg_split",
"(",
"\"'(\\\\{(?:(?>[^\\\\{\\\\}]+)|(?R))+\\\\})'S\"",
",",
"$",
"this",
"->",
"uri",
",",
"-",
"1",
",",
"PREG_SP... | Build a URI from template and assigned parameters.
@param boolean $trailingSlash
@return Uri
@throws \OutOfBoundsException When at least one path parameter value is missing. | [
"Build",
"a",
"URI",
"from",
"template",
"and",
"assigned",
"parameters",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/UriBuilder.php#L341-L386 |
25,611 | shgysk8zer0/core_api | traits/console.php | Console._formatLocation | final protected function _formatLocation($file, $line, $format = self::LOG_FORMAT)
{
return sprintf($format, $file, $line);
} | php | final protected function _formatLocation($file, $line, $format = self::LOG_FORMAT)
{
return sprintf($format, $file, $line);
} | [
"final",
"protected",
"function",
"_formatLocation",
"(",
"$",
"file",
",",
"$",
"line",
",",
"$",
"format",
"=",
"self",
"::",
"LOG_FORMAT",
")",
"{",
"return",
"sprintf",
"(",
"$",
"format",
",",
"$",
"file",
",",
"$",
"line",
")",
";",
"}"
] | formats the location from backtrace using sprintf
@param string $file the file the log was created in
@param int $line the line the log was created on
@param string $format output format
@return string location formatted according to $format | [
"formats",
"the",
"location",
"from",
"backtrace",
"using",
"sprintf"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/console.php#L154-L157 |
25,612 | shgysk8zer0/core_api | traits/console.php | Console._convert | final protected function _convert($object)
{
// if this isn't an object then just return it
if (!is_object($object)) {
return $object;
}
//Mark this object as processed so we don't convert it twice and it
//Also avoid recursion when objects refer to each other
$this->_processed[] = $object;
$object_as... | php | final protected function _convert($object)
{
// if this isn't an object then just return it
if (!is_object($object)) {
return $object;
}
//Mark this object as processed so we don't convert it twice and it
//Also avoid recursion when objects refer to each other
$this->_processed[] = $object;
$object_as... | [
"final",
"protected",
"function",
"_convert",
"(",
"$",
"object",
")",
"{",
"// if this isn't an object then just return it",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"return",
"$",
"object",
";",
"}",
"//Mark this object as processed so we do... | converts an object to a better format for logging
@param Object
@return array | [
"converts",
"an",
"object",
"to",
"a",
"better",
"format",
"for",
"logging"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/console.php#L192-L236 |
25,613 | shgysk8zer0/core_api | traits/console.php | Console._getPropertyKey | final protected function _getPropertyKey(\ReflectionProperty $property)
{
$static = $property->isStatic() ? ' static' : '';
if ($property->isPublic()) {
return 'public' . $static . ' ' . $property->getName();
}
if ($property->isProtected()) {
return 'protected' . $static . ' ' . $property->getName();
}... | php | final protected function _getPropertyKey(\ReflectionProperty $property)
{
$static = $property->isStatic() ? ' static' : '';
if ($property->isPublic()) {
return 'public' . $static . ' ' . $property->getName();
}
if ($property->isProtected()) {
return 'protected' . $static . ' ' . $property->getName();
}... | [
"final",
"protected",
"function",
"_getPropertyKey",
"(",
"\\",
"ReflectionProperty",
"$",
"property",
")",
"{",
"$",
"static",
"=",
"$",
"property",
"->",
"isStatic",
"(",
")",
"?",
"' static'",
":",
"''",
";",
"if",
"(",
"$",
"property",
"->",
"isPublic"... | takes a reflection property and returns a nicely formatted key of the property name
@param ReflectionProperty
@return string | [
"takes",
"a",
"reflection",
"property",
"and",
"returns",
"a",
"nicely",
"formatted",
"key",
"of",
"the",
"property",
"name"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/console.php#L244-L256 |
25,614 | OxfordInfoLabs/kinikit-core | src/Util/Caching/CachingHeaders.php | CachingHeaders.addCachingHeaders | public function addCachingHeaders($numberOfMinutes = 60, $mustRevalidate = true) {
// Add cache control header if revalidate
$numberOfSeconds = $numberOfMinutes * 60;
$header = "Cache-Control: public, max-age=" . ($numberOfSeconds);
if ($mustRevalidate)
$header .= ", must-re... | php | public function addCachingHeaders($numberOfMinutes = 60, $mustRevalidate = true) {
// Add cache control header if revalidate
$numberOfSeconds = $numberOfMinutes * 60;
$header = "Cache-Control: public, max-age=" . ($numberOfSeconds);
if ($mustRevalidate)
$header .= ", must-re... | [
"public",
"function",
"addCachingHeaders",
"(",
"$",
"numberOfMinutes",
"=",
"60",
",",
"$",
"mustRevalidate",
"=",
"true",
")",
"{",
"// Add cache control header if revalidate",
"$",
"numberOfSeconds",
"=",
"$",
"numberOfMinutes",
"*",
"60",
";",
"$",
"header",
"... | Add caching headers to the current request. | [
"Add",
"caching",
"headers",
"to",
"the",
"current",
"request",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Caching/CachingHeaders.php#L43-L67 |
25,615 | freialib/freia.autoloader | src/SymbolEnvironment.php | SymbolEnvironment.autoresolve | function autoresolve($symbol) {
// is the symbol an alias?
if (\array_key_exists($symbol, $this->state['aliases'])) {
// then resolve the alias
// you can only alias to know symbols so the following will succeed
$this->autoresolve($this->state['aliases'][$symbol]);
// and afterwards alias the symbol
... | php | function autoresolve($symbol) {
// is the symbol an alias?
if (\array_key_exists($symbol, $this->state['aliases'])) {
// then resolve the alias
// you can only alias to know symbols so the following will succeed
$this->autoresolve($this->state['aliases'][$symbol]);
// and afterwards alias the symbol
... | [
"function",
"autoresolve",
"(",
"$",
"symbol",
")",
"{",
"// is the symbol an alias?",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"symbol",
",",
"$",
"this",
"->",
"state",
"[",
"'aliases'",
"]",
")",
")",
"{",
"// then resolve the alias",
"// you can only a... | Attempt to auto-resolve a symbol based on past state. | [
"Attempt",
"to",
"auto",
"-",
"resolve",
"a",
"symbol",
"based",
"on",
"past",
"state",
"."
] | 45e0dfcd56d55cf533f12255db647e8a05fcd494 | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolEnvironment.php#L408-L427 |
25,616 | freialib/freia.autoloader | src/SymbolEnvironment.php | SymbolEnvironment.save | function save() {
if ($this->cacheConf['type'] == 'noop') {
// do nothing
}
else { // non-noop
$stateCopy = $this->state;
$stateCopy['loaded'] = [];
if ($this->cacheConf['type'] == 'file') {
$username = \get_current_user();
$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['pat... | php | function save() {
if ($this->cacheConf['type'] == 'noop') {
// do nothing
}
else { // non-noop
$stateCopy = $this->state;
$stateCopy['loaded'] = [];
if ($this->cacheConf['type'] == 'file') {
$username = \get_current_user();
$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['pat... | [
"function",
"save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheConf",
"[",
"'type'",
"]",
"==",
"'noop'",
")",
"{",
"// do nothing",
"}",
"else",
"{",
"// non-noop",
"$",
"stateCopy",
"=",
"$",
"this",
"->",
"state",
";",
"$",
"stateCopy",
"[... | Save current state to persistent store | [
"Save",
"current",
"state",
"to",
"persistent",
"store"
] | 45e0dfcd56d55cf533f12255db647e8a05fcd494 | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolEnvironment.php#L467-L504 |
25,617 | freialib/freia.autoloader | src/SymbolEnvironment.php | SymbolEnvironment.load | function load() {
if ($this->cacheConf['type'] == 'noop') {
return null; // do nothing
}
else { // non-noop
$loadedState = null;
if ($this->cacheConf['type'] == 'file') {
$username = \get_current_user();
$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['path'], '\\/'));
$cach... | php | function load() {
if ($this->cacheConf['type'] == 'noop') {
return null; // do nothing
}
else { // non-noop
$loadedState = null;
if ($this->cacheConf['type'] == 'file') {
$username = \get_current_user();
$cacheDir = realpath($this->syspath.'/'.\trim($this->cacheConf['path'], '\\/'));
$cach... | [
"function",
"load",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheConf",
"[",
"'type'",
"]",
"==",
"'noop'",
")",
"{",
"return",
"null",
";",
"// do nothing",
"}",
"else",
"{",
"// non-noop",
"$",
"loadedState",
"=",
"null",
";",
"if",
"(",
"$",... | Load state from persistent store
@return array previously saved state | [
"Load",
"state",
"from",
"persistent",
"store"
] | 45e0dfcd56d55cf533f12255db647e8a05fcd494 | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolEnvironment.php#L511-L561 |
25,618 | stubbles/stubbles-streams | src/main/php/file/FileInputStream.php | FileInputStream.castFrom | public static function castFrom($value): InputStream
{
if ($value instanceof InputStream) {
return $value;
}
if (is_string($value)) {
return new self($value);
}
throw new \InvalidArgumentException(
'Given value is neither an instance ... | php | public static function castFrom($value): InputStream
{
if ($value instanceof InputStream) {
return $value;
}
if (is_string($value)) {
return new self($value);
}
throw new \InvalidArgumentException(
'Given value is neither an instance ... | [
"public",
"static",
"function",
"castFrom",
"(",
"$",
"value",
")",
":",
"InputStream",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"InputStream",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"... | casts given value to an input stream
@param \stubbles\streams\InputStream|string $value
@return \stubbles\streams\InputStream
@throws \InvalidArgumentException
@since 5.2.0 | [
"casts",
"given",
"value",
"to",
"an",
"input",
"stream"
] | 99b0dace5fcf71584d1456b4b5408017b896bdf5 | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/file/FileInputStream.php#L81-L95 |
25,619 | stubbles/stubbles-streams | src/main/php/file/FileInputStream.php | FileInputStream.getResourceLength | protected function getResourceLength(): int
{
if (null === $this->fileName) {
return parent::getResourceLength();
}
if (substr($this->fileName, 0, 16) === 'compress.zlib://') {
return filesize(substr($this->fileName, 16));
} elseif (substr($this->fileName, 0,... | php | protected function getResourceLength(): int
{
if (null === $this->fileName) {
return parent::getResourceLength();
}
if (substr($this->fileName, 0, 16) === 'compress.zlib://') {
return filesize(substr($this->fileName, 16));
} elseif (substr($this->fileName, 0,... | [
"protected",
"function",
"getResourceLength",
"(",
")",
":",
"int",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"fileName",
")",
"{",
"return",
"parent",
"::",
"getResourceLength",
"(",
")",
";",
"}",
"if",
"(",
"substr",
"(",
"$",
"this",
"->",
... | helper method to retrieve the length of the resource
@return int | [
"helper",
"method",
"to",
"retrieve",
"the",
"length",
"of",
"the",
"resource"
] | 99b0dace5fcf71584d1456b4b5408017b896bdf5 | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/file/FileInputStream.php#L102-L115 |
25,620 | stubbles/stubbles-streams | src/main/php/file/FileInputStream.php | FileInputStream.tell | public function tell(): int
{
if (null === $this->handle) {
throw new \LogicException('Can not read from closed input stream.');
}
$position = @ftell($this->handle);
if (false === $position) {
throw new StreamException(
'Can not read curre... | php | public function tell(): int
{
if (null === $this->handle) {
throw new \LogicException('Can not read from closed input stream.');
}
$position = @ftell($this->handle);
if (false === $position) {
throw new StreamException(
'Can not read curre... | [
"public",
"function",
"tell",
"(",
")",
":",
"int",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"handle",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Can not read from closed input stream.'",
")",
";",
"}",
"$",
"position",
"=",
"@",
"... | return current position
@return int
@throws \LogicException
@throws \stubbles\streams\StreamException | [
"return",
"current",
"position"
] | 99b0dace5fcf71584d1456b4b5408017b896bdf5 | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/file/FileInputStream.php#L140-L155 |
25,621 | afroware/jwtauth | src/Http/Middleware/BaseMiddleware.php | BaseMiddleware.checkForToken | public function checkForToken(Request $request)
{
if (! $this->auth->parser()->setRequest($request)->hasToken()) {
throw new UnauthorizedHttpException('jwTauth', 'Token not provided');
}
} | php | public function checkForToken(Request $request)
{
if (! $this->auth->parser()->setRequest($request)->hasToken()) {
throw new UnauthorizedHttpException('jwTauth', 'Token not provided');
}
} | [
"public",
"function",
"checkForToken",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"auth",
"->",
"parser",
"(",
")",
"->",
"setRequest",
"(",
"$",
"request",
")",
"->",
"hasToken",
"(",
")",
")",
"{",
"throw",
"new",
... | Check the request for the presence of a token.
@param \Illuminate\Http\Request $request
@throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
@return void | [
"Check",
"the",
"request",
"for",
"the",
"presence",
"of",
"a",
"token",
"."
] | 54a0aebd811d87bfdd2b3668696fd53f50490cc1 | https://github.com/afroware/jwtauth/blob/54a0aebd811d87bfdd2b3668696fd53f50490cc1/src/Http/Middleware/BaseMiddleware.php#L49-L54 |
25,622 | Danack/Weaver | src/Weaver/ImplementWeaveGenerator.php | ImplementWeaveGenerator.addDecoratedMethod | function addDecoratedMethod(MethodReflection $sourceMethod, MethodReflection $decoratorMethodReflection ) {
$weavedMethod = MethodGenerator::fromReflection($sourceMethod);
$newBody = $decoratorMethodReflection->getBody();
$newBody = trimBody($newBody);
$parameters = $sourceMethod->getP... | php | function addDecoratedMethod(MethodReflection $sourceMethod, MethodReflection $decoratorMethodReflection ) {
$weavedMethod = MethodGenerator::fromReflection($sourceMethod);
$newBody = $decoratorMethodReflection->getBody();
$newBody = trimBody($newBody);
$parameters = $sourceMethod->getP... | [
"function",
"addDecoratedMethod",
"(",
"MethodReflection",
"$",
"sourceMethod",
",",
"MethodReflection",
"$",
"decoratorMethodReflection",
")",
"{",
"$",
"weavedMethod",
"=",
"MethodGenerator",
"::",
"fromReflection",
"(",
"$",
"sourceMethod",
")",
";",
"$",
"newBody"... | Decorate the method and call the instance.
@param MethodReflection $sourceMethod
@param MethodReflection $decoratorMethodReflection | [
"Decorate",
"the",
"method",
"and",
"call",
"the",
"instance",
"."
] | 414894cd397daff22d2c71e4988784a1f71b702e | https://github.com/Danack/Weaver/blob/414894cd397daff22d2c71e4988784a1f71b702e/src/Weaver/ImplementWeaveGenerator.php#L112-L140 |
25,623 | Danack/Weaver | src/Weaver/ImplementWeaveGenerator.php | ImplementWeaveGenerator.addPlainMethod | function addPlainMethod(MethodReflection $sourceMethod) {
$parameters = $sourceMethod->getParameters();
$paramArray = [];
foreach ($parameters as $parameter) {
$paramArray[] = '$'.$parameter->getName();
}
$paramList = implode(', ', $paramArray);
$weavedMeth... | php | function addPlainMethod(MethodReflection $sourceMethod) {
$parameters = $sourceMethod->getParameters();
$paramArray = [];
foreach ($parameters as $parameter) {
$paramArray[] = '$'.$parameter->getName();
}
$paramList = implode(', ', $paramArray);
$weavedMeth... | [
"function",
"addPlainMethod",
"(",
"MethodReflection",
"$",
"sourceMethod",
")",
"{",
"$",
"parameters",
"=",
"$",
"sourceMethod",
"->",
"getParameters",
"(",
")",
";",
"$",
"paramArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"p... | Add a call to the instance method.
@param MethodReflection $sourceMethod | [
"Add",
"a",
"call",
"to",
"the",
"instance",
"method",
"."
] | 414894cd397daff22d2c71e4988784a1f71b702e | https://github.com/Danack/Weaver/blob/414894cd397daff22d2c71e4988784a1f71b702e/src/Weaver/ImplementWeaveGenerator.php#L147-L168 |
25,624 | Danack/Weaver | src/Weaver/ImplementWeaveGenerator.php | ImplementWeaveGenerator.addSourceMethods | function addSourceMethods() {
$methodBindingArray = $this->implementWeaveInfo->getMethodBindingArray();
$methods = $this->sourceClassReflection->getMethods();
foreach ($methods as $sourceMethod) {
if ($sourceMethod->getName() === '__construct') {
continue... | php | function addSourceMethods() {
$methodBindingArray = $this->implementWeaveInfo->getMethodBindingArray();
$methods = $this->sourceClassReflection->getMethods();
foreach ($methods as $sourceMethod) {
if ($sourceMethod->getName() === '__construct') {
continue... | [
"function",
"addSourceMethods",
"(",
")",
"{",
"$",
"methodBindingArray",
"=",
"$",
"this",
"->",
"implementWeaveInfo",
"->",
"getMethodBindingArray",
"(",
")",
";",
"$",
"methods",
"=",
"$",
"this",
"->",
"sourceClassReflection",
"->",
"getMethods",
"(",
")",
... | For all of the methods in that need to be decorated, generate the decorated version
and all the to the generator.
@TODO Shouldn't this only implement the methods in the interface that is being exposed? | [
"For",
"all",
"of",
"the",
"methods",
"in",
"that",
"need",
"to",
"be",
"decorated",
"generate",
"the",
"decorated",
"version",
"and",
"all",
"the",
"to",
"the",
"generator",
"."
] | 414894cd397daff22d2c71e4988784a1f71b702e | https://github.com/Danack/Weaver/blob/414894cd397daff22d2c71e4988784a1f71b702e/src/Weaver/ImplementWeaveGenerator.php#L175-L201 |
25,625 | drdplusinfo/drdplus-background | DrdPlus/Background/BackgroundParts/Partials/AbstractBackgroundAdvantage.php | AbstractBackgroundAdvantage.getSpentBackgroundPoints | public function getSpentBackgroundPoints(): PositiveIntegerObject
{
if ($this->spentBackgroundPoints === null) {
$this->spentBackgroundPoints = new PositiveIntegerObject($this->getValue());
}
return $this->spentBackgroundPoints;
} | php | public function getSpentBackgroundPoints(): PositiveIntegerObject
{
if ($this->spentBackgroundPoints === null) {
$this->spentBackgroundPoints = new PositiveIntegerObject($this->getValue());
}
return $this->spentBackgroundPoints;
} | [
"public",
"function",
"getSpentBackgroundPoints",
"(",
")",
":",
"PositiveIntegerObject",
"{",
"if",
"(",
"$",
"this",
"->",
"spentBackgroundPoints",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"spentBackgroundPoints",
"=",
"new",
"PositiveIntegerObject",
"(",
"$"... | Spent background points are the same as advantage level.
@return PositiveIntegerObject | [
"Spent",
"background",
"points",
"are",
"the",
"same",
"as",
"advantage",
"level",
"."
] | 70aca51902e6c151c4b0e5d9066c6043c777435c | https://github.com/drdplusinfo/drdplus-background/blob/70aca51902e6c151c4b0e5d9066c6043c777435c/DrdPlus/Background/BackgroundParts/Partials/AbstractBackgroundAdvantage.php#L31-L38 |
25,626 | wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.addClass | public function addClass(ResponsiveImageClass $class)
{
$this->classes_added = true;
if (array_key_exists($class->getName(), $this->classes)) {
throw new \Exception(sprintf('A responsive image class with name "%s" is already registered', $class->getName()));
}
if ($this->... | php | public function addClass(ResponsiveImageClass $class)
{
$this->classes_added = true;
if (array_key_exists($class->getName(), $this->classes)) {
throw new \Exception(sprintf('A responsive image class with name "%s" is already registered', $class->getName()));
}
if ($this->... | [
"public",
"function",
"addClass",
"(",
"ResponsiveImageClass",
"$",
"class",
")",
"{",
"$",
"this",
"->",
"classes_added",
"=",
"true",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"class",
"->",
"getName",
"(",
")",
",",
"$",
"this",
"->",
"classes",
"... | Add a ResponsiveImageClass object to the registered responsive image classes
@param ResponsiveImageClass $class The ResponsiveImageClass object
@throws \Exception | [
"Add",
"a",
"ResponsiveImageClass",
"object",
"to",
"the",
"registered",
"responsive",
"image",
"classes"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L102-L121 |
25,627 | wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.getClass | public function getClass($classname)
{
if ((string) $classname == '' || !array_key_exists($classname, $this->classes)) {
throw new ImageClassNotRegisteredException($classname);
}
return $this->classes[$classname];
} | php | public function getClass($classname)
{
if ((string) $classname == '' || !array_key_exists($classname, $this->classes)) {
throw new ImageClassNotRegisteredException($classname);
}
return $this->classes[$classname];
} | [
"public",
"function",
"getClass",
"(",
"$",
"classname",
")",
"{",
"if",
"(",
"(",
"string",
")",
"$",
"classname",
"==",
"''",
"||",
"!",
"array_key_exists",
"(",
"$",
"classname",
",",
"$",
"this",
"->",
"classes",
")",
")",
"{",
"throw",
"new",
"I... | Get a ResponsiveImageClass by it's name
@param string $classname
@return ResponsiveImageClass | [
"Get",
"a",
"ResponsiveImageClass",
"by",
"it",
"s",
"name"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L140-L146 |
25,628 | wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.makeImgElementResponsive | public function makeImgElementResponsive(
\DOMElement &$img,
$class,
$change_src_attr = false,
$add_default_dimension_attrs = false
)
{
if ($img->tagName != 'img') throw new \InvalidArgumentException('$img must be an "img" element');
if ((string) $class == '' |... | php | public function makeImgElementResponsive(
\DOMElement &$img,
$class,
$change_src_attr = false,
$add_default_dimension_attrs = false
)
{
if ($img->tagName != 'img') throw new \InvalidArgumentException('$img must be an "img" element');
if ((string) $class == '' |... | [
"public",
"function",
"makeImgElementResponsive",
"(",
"\\",
"DOMElement",
"&",
"$",
"img",
",",
"$",
"class",
",",
"$",
"change_src_attr",
"=",
"false",
",",
"$",
"add_default_dimension_attrs",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"img",
"->",
"tagName",... | Add srcset and sizes attributes to an HTML "img" tag
This method reads the image URL from the "src" attribute of an "img" element, calculates the URLs and dimensions of
the various available image sizes according to the given "responsive image class", and adds the "srcset" and
"sizes" attribute value.
Optionally, it ... | [
"Add",
"srcset",
"and",
"sizes",
"attributes",
"to",
"an",
"HTML",
"img",
"tag"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L170-L200 |
25,629 | wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageHelper.php | ResponsiveImageHelper.createResizedImageVersions | public function createResizedImageVersions($imageurl, $imageclass)
{
if (!$this->resizer instanceof ImageResizer) {
throw new \LogicException('no ImageResizer available, set it using ResponsiveImageHelper::setResizer()');
}
$image = $this->getResponsiveImage($imageurl, $imageclas... | php | public function createResizedImageVersions($imageurl, $imageclass)
{
if (!$this->resizer instanceof ImageResizer) {
throw new \LogicException('no ImageResizer available, set it using ResponsiveImageHelper::setResizer()');
}
$image = $this->getResponsiveImage($imageurl, $imageclas... | [
"public",
"function",
"createResizedImageVersions",
"(",
"$",
"imageurl",
",",
"$",
"imageclass",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"resizer",
"instanceof",
"ImageResizer",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'no ImageResizer avail... | Create the resized image versions for an image and a given image class
@param string $imageurl
@param string $imageclass
@throws \Exception | [
"Create",
"the",
"resized",
"image",
"versions",
"for",
"an",
"image",
"and",
"a",
"given",
"image",
"class"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageHelper.php#L263-L270 |
25,630 | Dhii/exception-helper-base | src/CreateExceptionCapableTrait.php | CreateExceptionCapableTrait._createException | protected function _createException($message = null, $code = null, $previous = null)
{
return new Exception($message, $code, $previous);
} | php | protected function _createException($message = null, $code = null, $previous = null)
{
return new Exception($message, $code, $previous);
} | [
"protected",
"function",
"_createException",
"(",
"$",
"message",
"=",
"null",
",",
"$",
"code",
"=",
"null",
",",
"$",
"previous",
"=",
"null",
")",
"{",
"return",
"new",
"Exception",
"(",
"$",
"message",
",",
"$",
"code",
",",
"$",
"previous",
")",
... | Creates a new basic Dhii exception.
@since [*next-version*]
@param string|Stringable|int|float|bool|null $message The message, if any.
@param int|float|string|Stringable|null $code The numeric error code, if any.
@param RootException|null $previous The inner exception, if any.
@return Th... | [
"Creates",
"a",
"new",
"basic",
"Dhii",
"exception",
"."
] | e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5 | https://github.com/Dhii/exception-helper-base/blob/e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5/src/CreateExceptionCapableTrait.php#L26-L29 |
25,631 | Mandarin-Medien/MMCmfContentBundle | EventListeners/PageHookListener.php | PageHookListener.postLoad | public function postLoad(Page $page, LifecycleEventArgs $args)
{
$hookManager = $this->container->get('mm_cmf_content.page_hook_manager');
foreach($hookManager->getHooks() as $hook) {
$hook->process($page, $this->container->get('request_stack')->getCurrentRequest());
};
} | php | public function postLoad(Page $page, LifecycleEventArgs $args)
{
$hookManager = $this->container->get('mm_cmf_content.page_hook_manager');
foreach($hookManager->getHooks() as $hook) {
$hook->process($page, $this->container->get('request_stack')->getCurrentRequest());
};
} | [
"public",
"function",
"postLoad",
"(",
"Page",
"$",
"page",
",",
"LifecycleEventArgs",
"$",
"args",
")",
"{",
"$",
"hookManager",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'mm_cmf_content.page_hook_manager'",
")",
";",
"foreach",
"(",
"$",
"hoo... | postLoad Callback for Page entity, gets all defined PageHooks and calls it
@param Page $page
@param LifecycleEventArgs $args | [
"postLoad",
"Callback",
"for",
"Page",
"entity",
"gets",
"all",
"defined",
"PageHooks",
"and",
"calls",
"it"
] | 503ab31cef3ce068f767de5b72f833526355b726 | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/EventListeners/PageHookListener.php#L42-L49 |
25,632 | eureka-framework/component-notification | src/Notification/NotificationBootstrap.php | NotificationBootstrap.getCss | public function getCss()
{
switch ($this->type) {
case self::TYPE_ERROR:
$css = 'danger';
break;
case self::TYPE_WARNING:
$css = 'warning';
break;
case self::TYPE_INFO:
$css = 'info';
... | php | public function getCss()
{
switch ($this->type) {
case self::TYPE_ERROR:
$css = 'danger';
break;
case self::TYPE_WARNING:
$css = 'warning';
break;
case self::TYPE_INFO:
$css = 'info';
... | [
"public",
"function",
"getCss",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"type",
")",
"{",
"case",
"self",
"::",
"TYPE_ERROR",
":",
"$",
"css",
"=",
"'danger'",
";",
"break",
";",
"case",
"self",
"::",
"TYPE_WARNING",
":",
"$",
"css",
"=",
... | Get css used.
@return string | [
"Get",
"css",
"used",
"."
] | 346c2932cf4ebdbae651aae513ac350df8f8c33a | https://github.com/eureka-framework/component-notification/blob/346c2932cf4ebdbae651aae513ac350df8f8c33a/src/Notification/NotificationBootstrap.php#L24-L45 |
25,633 | eureka-framework/component-notification | src/Notification/NotificationBootstrap.php | NotificationBootstrap.getHeader | public function getHeader()
{
switch ($this->type) {
case self::TYPE_ERROR:
$header = 'Error!';
break;
case self::TYPE_WARNING:
$header = 'Warning!';
break;
case self::TYPE_INFO:
$header = 'In... | php | public function getHeader()
{
switch ($this->type) {
case self::TYPE_ERROR:
$header = 'Error!';
break;
case self::TYPE_WARNING:
$header = 'Warning!';
break;
case self::TYPE_INFO:
$header = 'In... | [
"public",
"function",
"getHeader",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"type",
")",
"{",
"case",
"self",
"::",
"TYPE_ERROR",
":",
"$",
"header",
"=",
"'Error!'",
";",
"break",
";",
"case",
"self",
"::",
"TYPE_WARNING",
":",
"$",
"header",
... | Get header title.
@return string | [
"Get",
"header",
"title",
"."
] | 346c2932cf4ebdbae651aae513ac350df8f8c33a | https://github.com/eureka-framework/component-notification/blob/346c2932cf4ebdbae651aae513ac350df8f8c33a/src/Notification/NotificationBootstrap.php#L52-L73 |
25,634 | AnonymPHP/Anonym-Route | Matchers/NewMatcher.php | NewMatcher.match | public function match($url = null)
{
$match = parent::match($url);
$find = $this->replaceParameters();
if (false !== $find || true === $match) {
return true;
} else {
return false;
}
} | php | public function match($url = null)
{
$match = parent::match($url);
$find = $this->replaceParameters();
if (false !== $find || true === $match) {
return true;
} else {
return false;
}
} | [
"public",
"function",
"match",
"(",
"$",
"url",
"=",
"null",
")",
"{",
"$",
"match",
"=",
"parent",
"::",
"match",
"(",
"$",
"url",
")",
";",
"$",
"find",
"=",
"$",
"this",
"->",
"replaceParameters",
"(",
")",
";",
"if",
"(",
"false",
"!==",
"$",... | make the match
@param string|null $url
@return bool | [
"make",
"the",
"match"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/Matchers/NewMatcher.php#L51-L62 |
25,635 | AnonymPHP/Anonym-Route | Matchers/NewMatcher.php | NewMatcher.resolvePregCallback | private function resolvePregCallback($finded)
{
$matchEx = explode(' ', $this->getMatchUrl());
$requestEx = explode(' ', $this->getRequestedUrl());
$key = array_search($finded[0], $matchEx);
$cln = $finded[1];
if (strstr($cln, ':')) {
list($cln, $filter) = explo... | php | private function resolvePregCallback($finded)
{
$matchEx = explode(' ', $this->getMatchUrl());
$requestEx = explode(' ', $this->getRequestedUrl());
$key = array_search($finded[0], $matchEx);
$cln = $finded[1];
if (strstr($cln, ':')) {
list($cln, $filter) = explo... | [
"private",
"function",
"resolvePregCallback",
"(",
"$",
"finded",
")",
"{",
"$",
"matchEx",
"=",
"explode",
"(",
"' '",
",",
"$",
"this",
"->",
"getMatchUrl",
"(",
")",
")",
";",
"$",
"requestEx",
"=",
"explode",
"(",
"' '",
",",
"$",
"this",
"->",
"... | resolve the preg callback
@param array $finded
@return bool|string | [
"resolve",
"the",
"preg",
"callback"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/Matchers/NewMatcher.php#L99-L125 |
25,636 | AnonymPHP/Anonym-Route | Matchers/NewMatcher.php | NewMatcher.runFilter | private function runFilter($filter, $parameter)
{
if (!strstr($filter, '(') && !strstr($filter, ')')) {
if (!$filter = $this->getFilter($filter)) {
return false;
}
}
return preg_match('@' . $filter . '@si', $parameter) ?: false;
} | php | private function runFilter($filter, $parameter)
{
if (!strstr($filter, '(') && !strstr($filter, ')')) {
if (!$filter = $this->getFilter($filter)) {
return false;
}
}
return preg_match('@' . $filter . '@si', $parameter) ?: false;
} | [
"private",
"function",
"runFilter",
"(",
"$",
"filter",
",",
"$",
"parameter",
")",
"{",
"if",
"(",
"!",
"strstr",
"(",
"$",
"filter",
",",
"'('",
")",
"&&",
"!",
"strstr",
"(",
"$",
"filter",
",",
"')'",
")",
")",
"{",
"if",
"(",
"!",
"$",
"fi... | execute a filter
@param string $filter
@param string $parameter
@return bool|int | [
"execute",
"a",
"filter"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/Matchers/NewMatcher.php#L134-L143 |
25,637 | bseries/base_tag | models/Tags.php | Tags.depend | public function depend($entity, $type) {
$depend = $type === 'count' ? 0 : [];
foreach (static::_dependent() as $model) {
$results = $model::find($type, [
'conditions' => [
'tags' => $entity->name
]
]);
if (!$results) {
continue;
}
if ($type === 'count') {
$depend += $results;
... | php | public function depend($entity, $type) {
$depend = $type === 'count' ? 0 : [];
foreach (static::_dependent() as $model) {
$results = $model::find($type, [
'conditions' => [
'tags' => $entity->name
]
]);
if (!$results) {
continue;
}
if ($type === 'count') {
$depend += $results;
... | [
"public",
"function",
"depend",
"(",
"$",
"entity",
",",
"$",
"type",
")",
"{",
"$",
"depend",
"=",
"$",
"type",
"===",
"'count'",
"?",
"0",
":",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"_dependent",
"(",
")",
"as",
"$",
"model",
")",
"{",... | Do not use in performance criticial parts. | [
"Do",
"not",
"use",
"in",
"performance",
"criticial",
"parts",
"."
] | b66e817ac8268813790677fed259d8904b6dbb92 | https://github.com/bseries/base_tag/blob/b66e817ac8268813790677fed259d8904b6dbb92/models/Tags.php#L79-L100 |
25,638 | nicodevs/laito | src/Laito/Database.php | Database.reset | public function reset()
{
$this->table = '';
$this->columns = [];
$this->joins = [];
$this->wheres = [];
$this->whereIn = [];
$this->groupBy = false;
$this->orderBy = false;
$this->offset = 0;
$this->limit = 10;
$this->fields = [];
... | php | public function reset()
{
$this->table = '';
$this->columns = [];
$this->joins = [];
$this->wheres = [];
$this->whereIn = [];
$this->groupBy = false;
$this->orderBy = false;
$this->offset = 0;
$this->limit = 10;
$this->fields = [];
... | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"table",
"=",
"''",
";",
"$",
"this",
"->",
"columns",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"joins",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"wheres",
"=",
"[",
"]",
";",
"$",
... | Reset to default values
@return object Database instance | [
"Reset",
"to",
"default",
"values"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L101-L114 |
25,639 | nicodevs/laito | src/Laito/Database.php | Database.select | public function select($columns)
{
if (is_array($columns)) {
$this->columns = $columns;
} elseif ($columns === '*') {
$this->columns = ['*'];
}
return $this;
} | php | public function select($columns)
{
if (is_array($columns)) {
$this->columns = $columns;
} elseif ($columns === '*') {
$this->columns = ['*'];
}
return $this;
} | [
"public",
"function",
"select",
"(",
"$",
"columns",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"columns",
")",
")",
"{",
"$",
"this",
"->",
"columns",
"=",
"$",
"columns",
";",
"}",
"elseif",
"(",
"$",
"columns",
"===",
"'*'",
")",
"{",
"$",
"th... | Sets the columns to be selected
@param array $columns Columns to select
@return object Database instance | [
"Sets",
"the",
"columns",
"to",
"be",
"selected"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L122-L130 |
25,640 | nicodevs/laito | src/Laito/Database.php | Database.join | public function join($table, $first, $operator, $second, $type = 'LEFT')
{
$this->joins[] = [
'table' => $table,
'first' => $first,
'operator' => $operator,
'second' => $second,
'type' => $type
];
return $this;
} | php | public function join($table, $first, $operator, $second, $type = 'LEFT')
{
$this->joins[] = [
'table' => $table,
'first' => $first,
'operator' => $operator,
'second' => $second,
'type' => $type
];
return $this;
} | [
"public",
"function",
"join",
"(",
"$",
"table",
",",
"$",
"first",
",",
"$",
"operator",
",",
"$",
"second",
",",
"$",
"type",
"=",
"'LEFT'",
")",
"{",
"$",
"this",
"->",
"joins",
"[",
"]",
"=",
"[",
"'table'",
"=>",
"$",
"table",
",",
"'first'"... | Sets a table to JOIN with
@param string $table Table name
@param string $first Left key for the ON condition
@param string $operator Operator for the ON condition
@param string $second Right key for the ON condition
@param string $type Join type
@return object Database instance | [
"Sets",
"a",
"table",
"to",
"JOIN",
"with"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L169-L179 |
25,641 | nicodevs/laito | src/Laito/Database.php | Database.where | public function where($column, $value, $operator = '=', $table = null)
{
$table = $table? $table : $this->table;
$this->wheres[] = [
'table' => $table,
'column' => $column,
'value' => $value,
'operator' => $operator
];
return $this;
... | php | public function where($column, $value, $operator = '=', $table = null)
{
$table = $table? $table : $this->table;
$this->wheres[] = [
'table' => $table,
'column' => $column,
'value' => $value,
'operator' => $operator
];
return $this;
... | [
"public",
"function",
"where",
"(",
"$",
"column",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"'='",
",",
"$",
"table",
"=",
"null",
")",
"{",
"$",
"table",
"=",
"$",
"table",
"?",
"$",
"table",
":",
"$",
"this",
"->",
"table",
";",
"$",
"th... | Sets a WHERE condition
@param string $column Column name
@param string $value Value to match
@param string $operator Operator to compare with
@param string $table Table
@return object Database instance | [
"Sets",
"a",
"WHERE",
"condition"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L190-L200 |
25,642 | nicodevs/laito | src/Laito/Database.php | Database.whereIn | public function whereIn($column, $values, $table = null)
{
$table = isset($table)? $table : $this->table;
$this->whereIn[] = [
'table' => $table,
'column' => $column,
'values' => $values
];
return $this;
} | php | public function whereIn($column, $values, $table = null)
{
$table = isset($table)? $table : $this->table;
$this->whereIn[] = [
'table' => $table,
'column' => $column,
'values' => $values
];
return $this;
} | [
"public",
"function",
"whereIn",
"(",
"$",
"column",
",",
"$",
"values",
",",
"$",
"table",
"=",
"null",
")",
"{",
"$",
"table",
"=",
"isset",
"(",
"$",
"table",
")",
"?",
"$",
"table",
":",
"$",
"this",
"->",
"table",
";",
"$",
"this",
"->",
"... | Sets a WHERE IN condition
@param string $column Column name
@param string $values Values to match
@param string $table Table
@return object Database instance | [
"Sets",
"a",
"WHERE",
"IN",
"condition"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L210-L219 |
25,643 | nicodevs/laito | src/Laito/Database.php | Database.get | public function get()
{
// Define columns
$columns = count($this->columns)? $this->getColumnsString() : $this->table . '.*';
// Define root
$root = 'SELECT ' . $columns . ' FROM ' . $this->table;
// Define joins
$joins = count($this->joins)? $this->getJoinString() :... | php | public function get()
{
// Define columns
$columns = count($this->columns)? $this->getColumnsString() : $this->table . '.*';
// Define root
$root = 'SELECT ' . $columns . ' FROM ' . $this->table;
// Define joins
$joins = count($this->joins)? $this->getJoinString() :... | [
"public",
"function",
"get",
"(",
")",
"{",
"// Define columns",
"$",
"columns",
"=",
"count",
"(",
"$",
"this",
"->",
"columns",
")",
"?",
"$",
"this",
"->",
"getColumnsString",
"(",
")",
":",
"$",
"this",
"->",
"table",
".",
"'.*'",
";",
"// Define r... | Performs a SELECT query
@return bool|array Array of results, or false | [
"Performs",
"a",
"SELECT",
"query"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L290-L345 |
25,644 | nicodevs/laito | src/Laito/Database.php | Database.count | public function count($column)
{
// Set a really hight limit
$this->limit(pow(100, 3));
// Select only the COUNT column and get
$result = $this->select(['COUNT(' . $this->table . '.' . $column .') as count'])->get();
// Reset
$this->reset();
// Return numbe... | php | public function count($column)
{
// Set a really hight limit
$this->limit(pow(100, 3));
// Select only the COUNT column and get
$result = $this->select(['COUNT(' . $this->table . '.' . $column .') as count'])->get();
// Reset
$this->reset();
// Return numbe... | [
"public",
"function",
"count",
"(",
"$",
"column",
")",
"{",
"// Set a really hight limit",
"$",
"this",
"->",
"limit",
"(",
"pow",
"(",
"100",
",",
"3",
")",
")",
";",
"// Select only the COUNT column and get",
"$",
"result",
"=",
"$",
"this",
"->",
"select... | Performs a SELECT COUNT query
@param string $column Column to count by
@return int Number of rows matching the SELECT query | [
"Performs",
"a",
"SELECT",
"COUNT",
"query"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L367-L380 |
25,645 | nicodevs/laito | src/Laito/Database.php | Database.update | public function update($fields)
{
// Set fields
$this->fields($fields);
// Resolve fields
$fields = $this->getUpdateFieldsString();
// Define wheres
$where = $this->getWhereString();
// Build query
$this->query = 'UPDATE ' . $this->table . ' SET ' .... | php | public function update($fields)
{
// Set fields
$this->fields($fields);
// Resolve fields
$fields = $this->getUpdateFieldsString();
// Define wheres
$where = $this->getWhereString();
// Build query
$this->query = 'UPDATE ' . $this->table . ' SET ' .... | [
"public",
"function",
"update",
"(",
"$",
"fields",
")",
"{",
"// Set fields",
"$",
"this",
"->",
"fields",
"(",
"$",
"fields",
")",
";",
"// Resolve fields",
"$",
"fields",
"=",
"$",
"this",
"->",
"getUpdateFieldsString",
"(",
")",
";",
"// Define wheres",
... | Performs an UPDATE query
@param array $fields Array of columns names and values to insert
@return bool Query success or fail | [
"Performs",
"an",
"UPDATE",
"query"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L438-L471 |
25,646 | nicodevs/laito | src/Laito/Database.php | Database.getWhereString | private function getWhereString()
{
// If there are not where conditions, return empty
if (!count($this->wheres)) {
return 'WHERE 1=1 ';
}
// Create where named placeholders
$wheres = array_map(function ($where) {
return $where['table'] . '.' . $where... | php | private function getWhereString()
{
// If there are not where conditions, return empty
if (!count($this->wheres)) {
return 'WHERE 1=1 ';
}
// Create where named placeholders
$wheres = array_map(function ($where) {
return $where['table'] . '.' . $where... | [
"private",
"function",
"getWhereString",
"(",
")",
"{",
"// If there are not where conditions, return empty",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"wheres",
")",
")",
"{",
"return",
"'WHERE 1=1 '",
";",
"}",
"// Create where named placeholders",
"$",
"wh... | Returns the wheres array as a WHERE string
@return string WHERE string | [
"Returns",
"the",
"wheres",
"array",
"as",
"a",
"WHERE",
"string"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L542-L556 |
25,647 | nicodevs/laito | src/Laito/Database.php | Database.getWhereInString | private function getWhereInString()
{
// String holder
$string = '';
// If there are not where in conditions, return empty
if (!count($this->whereIn)) {
return $string;
}
// Iterate where creating the full conditions
foreach ($this->whereIn as $w... | php | private function getWhereInString()
{
// String holder
$string = '';
// If there are not where in conditions, return empty
if (!count($this->whereIn)) {
return $string;
}
// Iterate where creating the full conditions
foreach ($this->whereIn as $w... | [
"private",
"function",
"getWhereInString",
"(",
")",
"{",
"// String holder",
"$",
"string",
"=",
"''",
";",
"// If there are not where in conditions, return empty",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"whereIn",
")",
")",
"{",
"return",
"$",
"strin... | Returns the where in array as a WHERE IN string
@return string WHERE string | [
"Returns",
"the",
"where",
"in",
"array",
"as",
"a",
"WHERE",
"IN",
"string"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L563-L580 |
25,648 | nicodevs/laito | src/Laito/Database.php | Database.getColumnsString | private function getColumnsString()
{
if (count($this->columns) === 1 && $this->columns[0] === '*') {
return '*';
}
$columns = array_map(function ($column) {
return (strpos($column, '.') === false)? $this->table . '.' . $column : $column;
}, $this->columns);
... | php | private function getColumnsString()
{
if (count($this->columns) === 1 && $this->columns[0] === '*') {
return '*';
}
$columns = array_map(function ($column) {
return (strpos($column, '.') === false)? $this->table . '.' . $column : $column;
}, $this->columns);
... | [
"private",
"function",
"getColumnsString",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"columns",
")",
"===",
"1",
"&&",
"$",
"this",
"->",
"columns",
"[",
"0",
"]",
"===",
"'*'",
")",
"{",
"return",
"'*'",
";",
"}",
"$",
"columns",
... | Returns the columns array as a field list string
@return string Field list string | [
"Returns",
"the",
"columns",
"array",
"as",
"a",
"field",
"list",
"string"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L587-L596 |
25,649 | nicodevs/laito | src/Laito/Database.php | Database.getJoinString | private function getJoinString()
{
// If there are not joins, return empty
if (!count($this->orderBy)) {
return '';
}
// Create join strings
$joins = array_map(function ($join) {
return $join['type'] . ' JOIN ' . $join['table'] . ' ON ' . $this->table... | php | private function getJoinString()
{
// If there are not joins, return empty
if (!count($this->orderBy)) {
return '';
}
// Create join strings
$joins = array_map(function ($join) {
return $join['type'] . ' JOIN ' . $join['table'] . ' ON ' . $this->table... | [
"private",
"function",
"getJoinString",
"(",
")",
"{",
"// If there are not joins, return empty",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"orderBy",
")",
")",
"{",
"return",
"''",
";",
"}",
"// Create join strings",
"$",
"joins",
"=",
"array_map",
"("... | Returns the joins array as a JOIN string
@return string JOIN string | [
"Returns",
"the",
"joins",
"array",
"as",
"a",
"JOIN",
"string"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L603-L617 |
25,650 | nicodevs/laito | src/Laito/Database.php | Database.getInsertFieldsString | private function getInsertFieldsString()
{
// Get field keys
$fieldKeys = array_keys($this->fields);
// Create placeholders
$fieldsPlaceholders = array_map(function ($field) {
return ':' . $field;
}, $fieldKeys);
// Return complete fields string
... | php | private function getInsertFieldsString()
{
// Get field keys
$fieldKeys = array_keys($this->fields);
// Create placeholders
$fieldsPlaceholders = array_map(function ($field) {
return ':' . $field;
}, $fieldKeys);
// Return complete fields string
... | [
"private",
"function",
"getInsertFieldsString",
"(",
")",
"{",
"// Get field keys",
"$",
"fieldKeys",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"fields",
")",
";",
"// Create placeholders",
"$",
"fieldsPlaceholders",
"=",
"array_map",
"(",
"function",
"(",
"$",
... | Returns the fields array as a VALUES string for inserts
@return string VALUES string for inserts | [
"Returns",
"the",
"fields",
"array",
"as",
"a",
"VALUES",
"string",
"for",
"inserts"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L640-L652 |
25,651 | nicodevs/laito | src/Laito/Database.php | Database.bindWheres | private function bindWheres()
{
foreach ($this->wheres as $where) {
$this->statement->bindValue(':' . $where['table'] . $where['column'], $where['value']);
}
} | php | private function bindWheres()
{
foreach ($this->wheres as $where) {
$this->statement->bindValue(':' . $where['table'] . $where['column'], $where['value']);
}
} | [
"private",
"function",
"bindWheres",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"wheres",
"as",
"$",
"where",
")",
"{",
"$",
"this",
"->",
"statement",
"->",
"bindValue",
"(",
"':'",
".",
"$",
"where",
"[",
"'table'",
"]",
".",
"$",
"where",
... | Binds the values of the WHERE conditions | [
"Binds",
"the",
"values",
"of",
"the",
"WHERE",
"conditions"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L674-L679 |
25,652 | nicodevs/laito | src/Laito/Database.php | Database.bindFields | private function bindFields()
{
foreach ($this->fields as $key => $value) {
$this->statement->bindValue(':' . $key, $value);
}
} | php | private function bindFields()
{
foreach ($this->fields as $key => $value) {
$this->statement->bindValue(':' . $key, $value);
}
} | [
"private",
"function",
"bindFields",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"statement",
"->",
"bindValue",
"(",
"':'",
".",
"$",
"key",
",",
"$",
"value",
")",... | Binds the values of the fields to insert or update | [
"Binds",
"the",
"values",
"of",
"the",
"fields",
"to",
"insert",
"or",
"update"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Database.php#L685-L690 |
25,653 | Hnto/nuki | src/Handlers/Http/Files.php | Files.file | public function file($key) {
if (!isset($this->files[$key])) {
return null;
}
return $this->createFile($this->files[$key]);
} | php | public function file($key) {
if (!isset($this->files[$key])) {
return null;
}
return $this->createFile($this->files[$key]);
} | [
"public",
"function",
"file",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"files",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"createFile",
"(",
"$",
"this",
"->... | Get file by key
@param int $key
@return \Nuki\Models\Data\File | [
"Get",
"file",
"by",
"key"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Http/Files.php#L31-L37 |
25,654 | Hnto/nuki | src/Handlers/Http/Files.php | Files.createFile | private function createFile(array $fileInfo = []) {
$file = new \Nuki\Models\Data\File($fileInfo['tmp_name'], $fileInfo['size']);
$file->setExtension(pathinfo($fileInfo['name'], PATHINFO_EXTENSION));
$file->setName(pathinfo($fileInfo['name'], PATHINFO_BASENAME));
return $file;
} | php | private function createFile(array $fileInfo = []) {
$file = new \Nuki\Models\Data\File($fileInfo['tmp_name'], $fileInfo['size']);
$file->setExtension(pathinfo($fileInfo['name'], PATHINFO_EXTENSION));
$file->setName(pathinfo($fileInfo['name'], PATHINFO_BASENAME));
return $file;
} | [
"private",
"function",
"createFile",
"(",
"array",
"$",
"fileInfo",
"=",
"[",
"]",
")",
"{",
"$",
"file",
"=",
"new",
"\\",
"Nuki",
"\\",
"Models",
"\\",
"Data",
"\\",
"File",
"(",
"$",
"fileInfo",
"[",
"'tmp_name'",
"]",
",",
"$",
"fileInfo",
"[",
... | Create file object
@param array $fileInfo
@return \Nuki\Models\Data\File | [
"Create",
"file",
"object"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Http/Files.php#L61-L68 |
25,655 | stubbles/stubbles-streams | src/main/php/file/FileOutputStream.php | FileOutputStream.openFile | protected function openFile(string $file, string $mode)
{
$fp = @fopen($file, $mode);
if (false === $fp) {
throw new StreamException(
'Can not open file ' . $file . ' with mode ' . $mode . ': '
.
str_replace('fopen(' . $file . '... | php | protected function openFile(string $file, string $mode)
{
$fp = @fopen($file, $mode);
if (false === $fp) {
throw new StreamException(
'Can not open file ' . $file . ' with mode ' . $mode . ': '
.
str_replace('fopen(' . $file . '... | [
"protected",
"function",
"openFile",
"(",
"string",
"$",
"file",
",",
"string",
"$",
"mode",
")",
"{",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"file",
",",
"$",
"mode",
")",
";",
"if",
"(",
"false",
"===",
"$",
"fp",
")",
"{",
"throw",
"new",
"... | helper method to open a file handle
@param string $file
@param string $mode
@return resource
@throws \stubbles\streams\StreamException | [
"helper",
"method",
"to",
"open",
"a",
"file",
"handle"
] | 99b0dace5fcf71584d1456b4b5408017b896bdf5 | https://github.com/stubbles/stubbles-streams/blob/99b0dace5fcf71584d1456b4b5408017b896bdf5/src/main/php/file/FileOutputStream.php#L108-L120 |
25,656 | leogitpro/php-zf3-base-module | module/src/Controller/BaseController.php | BaseController.addData | protected function addData($key, $data = null)
{
$this->data[self::RS_KEY_DATA]->{$key} = $data;
} | php | protected function addData($key, $data = null)
{
$this->data[self::RS_KEY_DATA]->{$key} = $data;
} | [
"protected",
"function",
"addData",
"(",
"$",
"key",
",",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"self",
"::",
"RS_KEY_DATA",
"]",
"->",
"{",
"$",
"key",
"}",
"=",
"$",
"data",
";",
"}"
] | Add data to result object
@param string $key
@param null|string|array|\stdClass $data | [
"Add",
"data",
"to",
"result",
"object"
] | 596fc89c25033eaef8f796418a4a3399c47a9638 | https://github.com/leogitpro/php-zf3-base-module/blob/596fc89c25033eaef8f796418a4a3399c47a9638/module/src/Controller/BaseController.php#L87-L90 |
25,657 | loevgaard/dandomain-foundation-entities | src/Entity/Product.php | Product.findPriceByCurrency | public function findPriceByCurrency($currency): ?PriceInterface
{
if ($currency instanceof \Money\Currency) {
$currency = $currency->getCode();
} elseif ($currency instanceof CurrencyInterface) {
$currency = $currency->getIsoCodeAlpha();
}
if (!is_string($cur... | php | public function findPriceByCurrency($currency): ?PriceInterface
{
if ($currency instanceof \Money\Currency) {
$currency = $currency->getCode();
} elseif ($currency instanceof CurrencyInterface) {
$currency = $currency->getIsoCodeAlpha();
}
if (!is_string($cur... | [
"public",
"function",
"findPriceByCurrency",
"(",
"$",
"currency",
")",
":",
"?",
"PriceInterface",
"{",
"if",
"(",
"$",
"currency",
"instanceof",
"\\",
"Money",
"\\",
"Currency",
")",
"{",
"$",
"currency",
"=",
"$",
"currency",
"->",
"getCode",
"(",
")",
... | Will try to find a price based on currency.
@param string|\Money\Currency|CurrencyInterface $currency
@return PriceInterface|null | [
"Will",
"try",
"to",
"find",
"a",
"price",
"based",
"on",
"currency",
"."
] | 256f7aa8b40d2bd9488046c3c2b1e04e982d78ad | https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Product.php#L669-L688 |
25,658 | loevgaard/dandomain-foundation-entities | src/Entity/Product.php | Product.findPrice | protected function findPrice(PriceInterface $searchPrice): ?PriceInterface
{
foreach ($this->prices as $price) {
if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getI... | php | protected function findPrice(PriceInterface $searchPrice): ?PriceInterface
{
foreach ($this->prices as $price) {
if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getI... | [
"protected",
"function",
"findPrice",
"(",
"PriceInterface",
"$",
"searchPrice",
")",
":",
"?",
"PriceInterface",
"{",
"foreach",
"(",
"$",
"this",
"->",
"prices",
"as",
"$",
"price",
")",
"{",
"if",
"(",
"$",
"price",
"->",
"getAmount",
"(",
")",
"==",
... | This method will try to find a price based on the unique constraint defined in price.
@param PriceInterface $searchPrice
@return PriceInterface|null | [
"This",
"method",
"will",
"try",
"to",
"find",
"a",
"price",
"based",
"on",
"the",
"unique",
"constraint",
"defined",
"in",
"price",
"."
] | 256f7aa8b40d2bd9488046c3c2b1e04e982d78ad | https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Entity/Product.php#L1756-L1765 |
25,659 | helikopterspark/FlashMsg | src/FlashMsg/FlashMsg.php | FlashMsg.setMessage | public function setMessage($type, $message) {
if (!$this->session->has('flashmsgs')) {
$this->session->set('flashmsgs', array());
}
$temp = $this->session->get('flashmsgs');
$temp[] = array('type' => $type, 'content' => $message);
$this->session->set('flashmsgs', $temp);
} | php | public function setMessage($type, $message) {
if (!$this->session->has('flashmsgs')) {
$this->session->set('flashmsgs', array());
}
$temp = $this->session->get('flashmsgs');
$temp[] = array('type' => $type, 'content' => $message);
$this->session->set('flashmsgs', $temp);
} | [
"public",
"function",
"setMessage",
"(",
"$",
"type",
",",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"session",
"->",
"has",
"(",
"'flashmsgs'",
")",
")",
"{",
"$",
"this",
"->",
"session",
"->",
"set",
"(",
"'flashmsgs'",
",",
"... | Add message to session array
@param $type string with message type
@param $message string with message text
@return void | [
"Add",
"message",
"to",
"session",
"array"
] | 85c2f16ca94db6dd800ed292d84f2e7422b3e7f5 | https://github.com/helikopterspark/FlashMsg/blob/85c2f16ca94db6dd800ed292d84f2e7422b3e7f5/src/FlashMsg/FlashMsg.php#L20-L27 |
25,660 | helikopterspark/FlashMsg | src/FlashMsg/FlashMsg.php | FlashMsg.outputMsgs | public function outputMsgs() {
$messages = $this->session->get('flashmsgs');
$output = null;
if ($messages) {
foreach ($messages as $key => $message) {
$output .= '<div class="' . $message['type'] . '"><p>' . $message['content'] . '</p></div>';
}
}
return $output;
} | php | public function outputMsgs() {
$messages = $this->session->get('flashmsgs');
$output = null;
if ($messages) {
foreach ($messages as $key => $message) {
$output .= '<div class="' . $message['type'] . '"><p>' . $message['content'] . '</p></div>';
}
}
return $output;
} | [
"public",
"function",
"outputMsgs",
"(",
")",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"'flashmsgs'",
")",
";",
"$",
"output",
"=",
"null",
";",
"if",
"(",
"$",
"messages",
")",
"{",
"foreach",
"(",
"$",
"messages",
... | Build HTML of messages in session array
@return $output HTML string with messages | [
"Build",
"HTML",
"of",
"messages",
"in",
"session",
"array"
] | 85c2f16ca94db6dd800ed292d84f2e7422b3e7f5 | https://github.com/helikopterspark/FlashMsg/blob/85c2f16ca94db6dd800ed292d84f2e7422b3e7f5/src/FlashMsg/FlashMsg.php#L100-L111 |
25,661 | vpg/titon.utility | src/Titon/Utility/Sanitize.php | Sanitize.escape | public static function escape($value, array $options = array()) {
$options = $options + array(
'encoding' => 'UTF-8',
'flags' => ENT_QUOTES,
'double' => false
);
return htmlentities($value, $options['flags'], $options['encoding'], $options['double']);
} | php | public static function escape($value, array $options = array()) {
$options = $options + array(
'encoding' => 'UTF-8',
'flags' => ENT_QUOTES,
'double' => false
);
return htmlentities($value, $options['flags'], $options['encoding'], $options['double']);
} | [
"public",
"static",
"function",
"escape",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"$",
"options",
"+",
"array",
"(",
"'encoding'",
"=>",
"'UTF-8'",
",",
"'flags'",
"=>",
"ENT_QUOTES",
",",... | Escape a string using the apps encoding.
@param string $value
@param array $options {
@type string $encoding Character encoding set; defaults to UTF-8
@type int $flags Encoding flags; defaults to ENT_QUOTES
@type bool $double Will double escape existing entities
}
@return string | [
"Escape",
"a",
"string",
"using",
"the",
"apps",
"encoding",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Sanitize.php#L39-L47 |
25,662 | vpg/titon.utility | src/Titon/Utility/Sanitize.php | Sanitize.html | public static function html($value, array $options = array()) {
$options = $options + array(
'strip' => true,
'whitelist' => ''
);
if ($options['strip']) {
$value = strip_tags($value, $options['whitelist']);
}
return static::escape($value, $o... | php | public static function html($value, array $options = array()) {
$options = $options + array(
'strip' => true,
'whitelist' => ''
);
if ($options['strip']) {
$value = strip_tags($value, $options['whitelist']);
}
return static::escape($value, $o... | [
"public",
"static",
"function",
"html",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"$",
"options",
"+",
"array",
"(",
"'strip'",
"=>",
"true",
",",
"'whitelist'",
"=>",
"''",
")",
";",
"i... | Sanitize a string by removing xor escaping HTML characters and entities.
@param string $value
@param array $options {
@type bool $strip Will remove HTML tags
@type string $whitelist List of tags to not strip
}
@return string | [
"Sanitize",
"a",
"string",
"by",
"removing",
"xor",
"escaping",
"HTML",
"characters",
"and",
"entities",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Sanitize.php#L69-L80 |
25,663 | vpg/titon.utility | src/Titon/Utility/Sanitize.php | Sanitize.newlines | public static function newlines($value, array $options = array()) {
$options = $options + array(
'cr' => true,
'lf' => true,
'crlf' => true,
'limit' => 2,
'trim' => true
);
if ($options['limit']) {
$pattern = '/(?:%s){' . $... | php | public static function newlines($value, array $options = array()) {
$options = $options + array(
'cr' => true,
'lf' => true,
'crlf' => true,
'limit' => 2,
'trim' => true
);
if ($options['limit']) {
$pattern = '/(?:%s){' . $... | [
"public",
"static",
"function",
"newlines",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"$",
"options",
"+",
"array",
"(",
"'cr'",
"=>",
"true",
",",
"'lf'",
"=>",
"true",
",",
"'crlf'",
"... | Sanitize a string by removing excess CRLF characters.
@param string $value
@param array $options {
@type bool $cr Will remove carriage returns \r
@type bool $lf Will remove line feeds \n
@type bool $crlf Will remove CRLF \r\n
@type bool $trim Will remove whitespace and newlines around the edges
@type i... | [
"Sanitize",
"a",
"string",
"by",
"removing",
"excess",
"CRLF",
"characters",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Sanitize.php#L106-L140 |
25,664 | vpg/titon.utility | src/Titon/Utility/Sanitize.php | Sanitize.whitespace | public static function whitespace($value, array $options = array()) {
$options = $options + array(
'space' => true,
'tab' => true,
'limit' => 2,
'strip' => true,
'trim' => true
);
if ($options['limit']) {
$pattern = '/%s{' ... | php | public static function whitespace($value, array $options = array()) {
$options = $options + array(
'space' => true,
'tab' => true,
'limit' => 2,
'strip' => true,
'trim' => true
);
if ($options['limit']) {
$pattern = '/%s{' ... | [
"public",
"static",
"function",
"whitespace",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"$",
"options",
"+",
"array",
"(",
"'space'",
"=>",
"true",
",",
"'tab'",
"=>",
"true",
",",
"'limit... | Sanitize a string by removing excess whitespace and tab characters.
@param string $value
@param array $options {
@type bool $space Will remove white space
@type bool $tab Will remove tabs
@type bool $strip Will remove non-standard white space character
@type bool $trim Will remove whitespace and newlines ar... | [
"Sanitize",
"a",
"string",
"by",
"removing",
"excess",
"whitespace",
"and",
"tab",
"characters",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Sanitize.php#L166-L200 |
25,665 | ezra-obiwale/dSCore | src/Core/AService.php | AService.setModel | public function setModel(IModel $model, $initRepo = true) {
$this->model = $model;
if ($initRepo)
$this->initRepository();
return $this;
} | php | public function setModel(IModel $model, $initRepo = true) {
$this->model = $model;
if ($initRepo)
$this->initRepository();
return $this;
} | [
"public",
"function",
"setModel",
"(",
"IModel",
"$",
"model",
",",
"$",
"initRepo",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"model",
"=",
"$",
"model",
";",
"if",
"(",
"$",
"initRepo",
")",
"$",
"this",
"->",
"initRepository",
"(",
")",
";",
"re... | Sets the model to class
@param IModel $model | [
"Sets",
"the",
"model",
"to",
"class"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AService.php#L43-L48 |
25,666 | ezra-obiwale/dSCore | src/Core/AService.php | AService.initRepository | protected function initRepository() {
if ($this->model === null ||
($this->model !== null && !in_array('DScribe\Core\IModel', class_implements($this->model))))
return false;
if ($this->repository !== null && $this->model->getTableName() === $this->repository->getTableName())... | php | protected function initRepository() {
if ($this->model === null ||
($this->model !== null && !in_array('DScribe\Core\IModel', class_implements($this->model))))
return false;
if ($this->repository !== null && $this->model->getTableName() === $this->repository->getTableName())... | [
"protected",
"function",
"initRepository",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"model",
"===",
"null",
"||",
"(",
"$",
"this",
"->",
"model",
"!==",
"null",
"&&",
"!",
"in_array",
"(",
"'DScribe\\Core\\IModel'",
",",
"class_implements",
"(",
"$",
... | Initializes the repository
@return boolean | [
"Initializes",
"the",
"repository"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AService.php#L72-L82 |
25,667 | ezra-obiwale/dSCore | src/Core/AService.php | AService.prepareInject | protected function prepareInject() {
$model = ($this->model) ? $this->model : $this->getModule() . '\Models\\' . $this->getClassName();
if (is_object($model))
$model = get_class($model);
if (!class_exists($model))
return array_merge(parent::prepareInject(), $this->getCo... | php | protected function prepareInject() {
$model = ($this->model) ? $this->model : $this->getModule() . '\Models\\' . $this->getClassName();
if (is_object($model))
$model = get_class($model);
if (!class_exists($model))
return array_merge(parent::prepareInject(), $this->getCo... | [
"protected",
"function",
"prepareInject",
"(",
")",
"{",
"$",
"model",
"=",
"(",
"$",
"this",
"->",
"model",
")",
"?",
"$",
"this",
"->",
"model",
":",
"$",
"this",
"->",
"getModule",
"(",
")",
".",
"'\\Models\\\\'",
".",
"$",
"this",
"->",
"getClass... | prepares injection of classes
@return array | [
"prepares",
"injection",
"of",
"classes"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AService.php#L103-L117 |
25,668 | davedevelopment/pimple-aware-event-dispatcher | src/PimpleAwareEventDispatcher/PimpleAwareEventDispatcher.php | PimpleAwareEventDispatcher.addSubscriberService | public function addSubscriberService($serviceId, $class)
{
$rfc = new \ReflectionClass($class);
if (!$rfc->implementsInterface('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
throw new \InvalidArgumentException(
"$class must implement Symfony\Component\Ev... | php | public function addSubscriberService($serviceId, $class)
{
$rfc = new \ReflectionClass($class);
if (!$rfc->implementsInterface('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
throw new \InvalidArgumentException(
"$class must implement Symfony\Component\Ev... | [
"public",
"function",
"addSubscriberService",
"(",
"$",
"serviceId",
",",
"$",
"class",
")",
"{",
"$",
"rfc",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"!",
"$",
"rfc",
"->",
"implementsInterface",
"(",
"'Symfony\\Compone... | Adds a service as event subscriber
@param string $serviceId The service ID of the subscriber service
@param string $class The service's class name (which must implement EventSubscriberInterface) | [
"Adds",
"a",
"service",
"as",
"event",
"subscriber"
] | e0864988219da254c46690379634bce3f22a0eba | https://github.com/davedevelopment/pimple-aware-event-dispatcher/blob/e0864988219da254c46690379634bce3f22a0eba/src/PimpleAwareEventDispatcher/PimpleAwareEventDispatcher.php#L102-L122 |
25,669 | brain-diminished/schema-version-control | src/Utils/SchemaNormalizer.php | SchemaNormalizer.normalize | public function normalize(Schema $schema): array
{
$this->schema = $schema;
$schemaDesc = [];
$schemaDesc['tables'] = [];
foreach ($schema->getTables() as $table) {
$schemaDesc['tables'][$table->getName()] = $this->normalizeTable($table);
}
return $schemaD... | php | public function normalize(Schema $schema): array
{
$this->schema = $schema;
$schemaDesc = [];
$schemaDesc['tables'] = [];
foreach ($schema->getTables() as $table) {
$schemaDesc['tables'][$table->getName()] = $this->normalizeTable($table);
}
return $schemaD... | [
"public",
"function",
"normalize",
"(",
"Schema",
"$",
"schema",
")",
":",
"array",
"{",
"$",
"this",
"->",
"schema",
"=",
"$",
"schema",
";",
"$",
"schemaDesc",
"=",
"[",
"]",
";",
"$",
"schemaDesc",
"[",
"'tables'",
"]",
"=",
"[",
"]",
";",
"fore... | Normalize a Schema object into an array descriptor
@param Schema $schema
@return array | [
"Normalize",
"a",
"Schema",
"object",
"into",
"an",
"array",
"descriptor"
] | 215dd96394072720b61a682e10a55a6520470c46 | https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/Utils/SchemaNormalizer.php#L26-L35 |
25,670 | ekyna/MediaBundle | Model/Import/MediaUpload.php | MediaUpload.removeMedia | public function removeMedia(MediaInterface $media)
{
if ($this->medias->contains($media)) {
$this->medias->removeElement($media);
}
return $this;
} | php | public function removeMedia(MediaInterface $media)
{
if ($this->medias->contains($media)) {
$this->medias->removeElement($media);
}
return $this;
} | [
"public",
"function",
"removeMedia",
"(",
"MediaInterface",
"$",
"media",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"medias",
"->",
"contains",
"(",
"$",
"media",
")",
")",
"{",
"$",
"this",
"->",
"medias",
"->",
"removeElement",
"(",
"$",
"media",
")",
... | Removes the media.
@param MediaInterface $media
@return MediaUpload | [
"Removes",
"the",
"media",
"."
] | 512cf86c801a130a9f17eba8b48d646d23acdbab | https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Model/Import/MediaUpload.php#L49-L55 |
25,671 | Subscribo/klarna-invoice-sdk-wrapped | src/klarnapclass.php | KlarnaPClass.toArray | public function toArray()
{
return array(
'eid' => $this->eid,
'id' => $this->id,
'description' => $this->description,
'months' => $this->months,
'startfee' => $this->startFee,
'invo... | php | public function toArray()
{
return array(
'eid' => $this->eid,
'id' => $this->id,
'description' => $this->description,
'months' => $this->months,
'startfee' => $this->startFee,
'invo... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"array",
"(",
"'eid'",
"=>",
"$",
"this",
"->",
"eid",
",",
"'id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'description'",
"=>",
"$",
"this",
"->",
"description",
",",
"'months'",
"=>",
"$",
"th... | Returns an associative array mirroring this PClass.
@return array | [
"Returns",
"an",
"associative",
"array",
"mirroring",
"this",
"PClass",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnapclass.php#L268-L283 |
25,672 | Subscribo/klarna-invoice-sdk-wrapped | src/klarnapclass.php | KlarnaPClass.isValid | public function isValid($now = null)
{
if ($this->expire == null
|| $this->expire == '-'
|| $this->expire <= 0
) {
//No expire, or unset? assume valid.
return true;
}
if ($now === null || !is_numeric($now)) {
$now = time();... | php | public function isValid($now = null)
{
if ($this->expire == null
|| $this->expire == '-'
|| $this->expire <= 0
) {
//No expire, or unset? assume valid.
return true;
}
if ($now === null || !is_numeric($now)) {
$now = time();... | [
"public",
"function",
"isValid",
"(",
"$",
"now",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"expire",
"==",
"null",
"||",
"$",
"this",
"->",
"expire",
"==",
"'-'",
"||",
"$",
"this",
"->",
"expire",
"<=",
"0",
")",
"{",
"//No expire, or ... | Checks whether this PClass is valid.
@param int $now Unix timestamp
@return bool | [
"Checks",
"whether",
"this",
"PClass",
"is",
"valid",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnapclass.php#L459-L475 |
25,673 | Kris-Kuiper/sFire-Framework | src/MVC/MVCTrait.php | MVCTrait.helper | protected function helper($classname) {
$directories = explode('.', $classname); //Convert dots to directory seperators
$amount = count($directories) - 1;
$namespace = Router :: getRoute() -> getModule() . '\\' . str_replace(DIRECTORY_SEPARATOR, '\\', Application :: get(['directory', 'helper']));
f... | php | protected function helper($classname) {
$directories = explode('.', $classname); //Convert dots to directory seperators
$amount = count($directories) - 1;
$namespace = Router :: getRoute() -> getModule() . '\\' . str_replace(DIRECTORY_SEPARATOR, '\\', Application :: get(['directory', 'helper']));
f... | [
"protected",
"function",
"helper",
"(",
"$",
"classname",
")",
"{",
"$",
"directories",
"=",
"explode",
"(",
"'.'",
",",
"$",
"classname",
")",
";",
"//Convert dots to directory seperators\r",
"$",
"amount",
"=",
"count",
"(",
"$",
"directories",
")",
"-",
"... | Loads a helper class in current module directory
@param string $classname
@return Object | [
"Loads",
"a",
"helper",
"class",
"in",
"current",
"module",
"directory"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/MVCTrait.php#L26-L44 |
25,674 | Kris-Kuiper/sFire-Framework | src/MVC/MVCTrait.php | MVCTrait.fails | protected function fails($fieldname = null) {
$helper = new StringToArray();
return $helper -> execute($fieldname, null, Message :: getErrors(true));
} | php | protected function fails($fieldname = null) {
$helper = new StringToArray();
return $helper -> execute($fieldname, null, Message :: getErrors(true));
} | [
"protected",
"function",
"fails",
"(",
"$",
"fieldname",
"=",
"null",
")",
"{",
"$",
"helper",
"=",
"new",
"StringToArray",
"(",
")",
";",
"return",
"$",
"helper",
"->",
"execute",
"(",
"$",
"fieldname",
",",
"null",
",",
"Message",
"::",
"getErrors",
... | Get the error message from the validator by fieldname
@param string $fieldname
@return string | [
"Get",
"the",
"error",
"message",
"from",
"the",
"validator",
"by",
"fieldname"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/MVCTrait.php#L52-L56 |
25,675 | Kris-Kuiper/sFire-Framework | src/MVC/MVCTrait.php | MVCTrait.passes | protected function passes($fieldname = null) {
$helper = new StringToArray();
return true === Request :: isPost() && null === $helper -> execute($fieldname, null, Message :: getErrors(true));
} | php | protected function passes($fieldname = null) {
$helper = new StringToArray();
return true === Request :: isPost() && null === $helper -> execute($fieldname, null, Message :: getErrors(true));
} | [
"protected",
"function",
"passes",
"(",
"$",
"fieldname",
"=",
"null",
")",
"{",
"$",
"helper",
"=",
"new",
"StringToArray",
"(",
")",
";",
"return",
"true",
"===",
"Request",
"::",
"isPost",
"(",
")",
"&&",
"null",
"===",
"$",
"helper",
"->",
"execute... | Returns if there is no validation error for the given fieldname when request method is equal to POST
@param string $fieldname
@return boolean | [
"Returns",
"if",
"there",
"is",
"no",
"validation",
"error",
"for",
"the",
"given",
"fieldname",
"when",
"request",
"method",
"is",
"equal",
"to",
"POST"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/MVCTrait.php#L64-L68 |
25,676 | ekyna/MediaBundle | Form/Type/Step/MediaImportSelectionType.php | MediaImportSelectionType.buildKeysChoices | public function buildKeysChoices(MediaImport $import)
{
$prefix = $import->getFilesystem();
$fs = $this->mountManager->getFilesystem($prefix);
$contents = $fs->listContents('', true);
$choices = [];
foreach ($contents as $object) {
if (!($object['type'] == 'dir' |... | php | public function buildKeysChoices(MediaImport $import)
{
$prefix = $import->getFilesystem();
$fs = $this->mountManager->getFilesystem($prefix);
$contents = $fs->listContents('', true);
$choices = [];
foreach ($contents as $object) {
if (!($object['type'] == 'dir' |... | [
"public",
"function",
"buildKeysChoices",
"(",
"MediaImport",
"$",
"import",
")",
"{",
"$",
"prefix",
"=",
"$",
"import",
"->",
"getFilesystem",
"(",
")",
";",
"$",
"fs",
"=",
"$",
"this",
"->",
"mountManager",
"->",
"getFilesystem",
"(",
"$",
"prefix",
... | Builds the keys choices.
@param MediaImport $import
@return array | [
"Builds",
"the",
"keys",
"choices",
"."
] | 512cf86c801a130a9f17eba8b48d646d23acdbab | https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Form/Type/Step/MediaImportSelectionType.php#L64-L77 |
25,677 | shrink0r/monatic | src/Eventually.php | Eventually.bind | public function bind(callable $codeBlock)
{
assert($this->result === null, "'Eventually' instance may not be mutated after code-block execution.");
return static::unit(function ($success) use ($codeBlock) {
$this->run(function ($value) use ($codeBlock, $success) {
return... | php | public function bind(callable $codeBlock)
{
assert($this->result === null, "'Eventually' instance may not be mutated after code-block execution.");
return static::unit(function ($success) use ($codeBlock) {
$this->run(function ($value) use ($codeBlock, $success) {
return... | [
"public",
"function",
"bind",
"(",
"callable",
"$",
"codeBlock",
")",
"{",
"assert",
"(",
"$",
"this",
"->",
"result",
"===",
"null",
",",
"\"'Eventually' instance may not be mutated after code-block execution.\"",
")",
";",
"return",
"static",
"::",
"unit",
"(",
... | Binds the given callable to the monad's managed code-block's successful execution.
@param callable $codeBlock Is expected to return an instance of Eventually.
@return Eventually | [
"Binds",
"the",
"given",
"callable",
"to",
"the",
"monad",
"s",
"managed",
"code",
"-",
"block",
"s",
"successful",
"execution",
"."
] | f39b8b2ef68a397d31d844341487412b335fd107 | https://github.com/shrink0r/monatic/blob/f39b8b2ef68a397d31d844341487412b335fd107/src/Eventually.php#L70-L79 |
25,678 | kaiohken1982/NeobazaarDocumentModule | src/Document/Utils/AbstractImage.php | AbstractImage.isNoDateStrategy | public function isNoDateStrategy(Document $doc = null, $prefix = '150_')
{
$prefix = 'ups/';
return file_exists($this->cdnPath . $prefix . $doc->getTitle());
} | php | public function isNoDateStrategy(Document $doc = null, $prefix = '150_')
{
$prefix = 'ups/';
return file_exists($this->cdnPath . $prefix . $doc->getTitle());
} | [
"public",
"function",
"isNoDateStrategy",
"(",
"Document",
"$",
"doc",
"=",
"null",
",",
"$",
"prefix",
"=",
"'150_'",
")",
"{",
"$",
"prefix",
"=",
"'ups/'",
";",
"return",
"file_exists",
"(",
"$",
"this",
"->",
"cdnPath",
".",
"$",
"prefix",
".",
"$"... | Check using no date strategy | [
"Check",
"using",
"no",
"date",
"strategy"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Utils/AbstractImage.php#L39-L43 |
25,679 | FuzeWorks/Core | src/FuzeWorks/Config.php | Config.getConfig | public function getConfig($configName, array $configPaths = array()): ConfigORM
{
// First determine what directories to use
$directories = (empty($configPaths) ? $this->configPaths : $configPaths);
// Determine the config name
$configName = strtolower($configName);
... | php | public function getConfig($configName, array $configPaths = array()): ConfigORM
{
// First determine what directories to use
$directories = (empty($configPaths) ? $this->configPaths : $configPaths);
// Determine the config name
$configName = strtolower($configName);
... | [
"public",
"function",
"getConfig",
"(",
"$",
"configName",
",",
"array",
"$",
"configPaths",
"=",
"array",
"(",
")",
")",
":",
"ConfigORM",
"{",
"// First determine what directories to use",
"$",
"directories",
"=",
"(",
"empty",
"(",
"$",
"configPaths",
")",
... | Retrieve a config file object
@param string $configName Name of the config file. Eg. 'main'
@param array $configPaths Optional array of where to look for the config files
@return ConfigORM of the config file. Allows for easy reading and editing of the file
@throws ConfigException | [
"Retrieve",
"a",
"config",
"file",
"object"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Config.php#L78-L95 |
25,680 | FuzeWorks/Core | src/FuzeWorks/Config.php | Config.loadConfigFile | protected function loadConfigFile($configName, array $configPaths): ConfigORM
{
// Cycle through all directories
foreach ($configPaths as $directory)
{
// If file exists, load it and break the loop
$file = $directory . DS . 'config.'.$configName.'.php';
i... | php | protected function loadConfigFile($configName, array $configPaths): ConfigORM
{
// Cycle through all directories
foreach ($configPaths as $directory)
{
// If file exists, load it and break the loop
$file = $directory . DS . 'config.'.$configName.'.php';
i... | [
"protected",
"function",
"loadConfigFile",
"(",
"$",
"configName",
",",
"array",
"$",
"configPaths",
")",
":",
"ConfigORM",
"{",
"// Cycle through all directories",
"foreach",
"(",
"$",
"configPaths",
"as",
"$",
"directory",
")",
"{",
"// If file exists, load it and b... | Determine whether the file exists and, if so, load the ConfigORM
@param string $configName Name of the config file. Eg. 'main'
@param array $configPaths Required array of where to look for the config files
@return ConfigORM of the config file. Allows for easy reading and editing of the file
@throws ConfigException | [
"Determine",
"whether",
"the",
"file",
"exists",
"and",
"if",
"so",
"load",
"the",
"ConfigORM"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Config.php#L123-L147 |
25,681 | FuzeWorks/Core | src/FuzeWorks/Config.php | Config.removeConfigPath | public function removeConfigPath($directory)
{
if (($key = array_search($directory, $this->configPaths)) !== false)
{
unset($this->configPaths[$key]);
}
} | php | public function removeConfigPath($directory)
{
if (($key = array_search($directory, $this->configPaths)) !== false)
{
unset($this->configPaths[$key]);
}
} | [
"public",
"function",
"removeConfigPath",
"(",
"$",
"directory",
")",
"{",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"directory",
",",
"$",
"this",
"->",
"configPaths",
")",
")",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"this",
"... | Remove a path where config files can be found
@param string $directory The directory
@return void | [
"Remove",
"a",
"path",
"where",
"config",
"files",
"can",
"be",
"found"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Config.php#L169-L175 |
25,682 | nguyenanhung/requests | src/GetContents.php | GetContents.getContent | public function getContent()
{
try {
if ($this->response) {
if (isset($this->response['content'])) {
return $this->response['content'];
} else {
return $this->response;
}
}
}
catch... | php | public function getContent()
{
try {
if ($this->response) {
if (isset($this->response['content'])) {
return $this->response['content'];
} else {
return $this->response;
}
}
}
catch... | [
"public",
"function",
"getContent",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"response",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"response",
"[",
"'content'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"response"... | Function getContent - Get Body Content from Request
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:08
@return array|mixed|string Return Response content if exists
Full Response content if $this->response['content'] not exists
Exception Error Message if Exception Error
Null if Not | [
"Function",
"getContent",
"-",
"Get",
"Body",
"Content",
"from",
"Request"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L249-L268 |
25,683 | nguyenanhung/requests | src/GetContents.php | GetContents.sendRequest | public function sendRequest()
{
try {
if (mb_strlen($this->url) >= 9) {
$response = $this->useFileGetContents();
$this->response = $response;
return $response;
}
}
catch (Exception $e) {
$message = "Er... | php | public function sendRequest()
{
try {
if (mb_strlen($this->url) >= 9) {
$response = $this->useFileGetContents();
$this->response = $response;
return $response;
}
}
catch (Exception $e) {
$message = "Er... | [
"public",
"function",
"sendRequest",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"mb_strlen",
"(",
"$",
"this",
"->",
"url",
")",
">=",
"9",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"useFileGetContents",
"(",
")",
";",
"$",
"this",
"->",
"respo... | Let's go to Request
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:12
@return array|null|string Response from Request if Exists
Exception Error Message if Exception Error
Null if Not | [
"Let",
"s",
"go",
"to",
"Request"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L329-L347 |
25,684 | nguyenanhung/requests | src/GetContents.php | GetContents.getPostBody | public function getPostBody()
{
$output = '';
if ($this->isJson) {
$jsonPretty = ($this->isJsonPretty ? JSON_PRETTY_PRINT : NULL);
if (count($this->data) > 0) {
$output = json_encode($this->data, $jsonPretty);
}
} elseif ($this->isXML) {
... | php | public function getPostBody()
{
$output = '';
if ($this->isJson) {
$jsonPretty = ($this->isJsonPretty ? JSON_PRETTY_PRINT : NULL);
if (count($this->data) > 0) {
$output = json_encode($this->data, $jsonPretty);
}
} elseif ($this->isXML) {
... | [
"public",
"function",
"getPostBody",
"(",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"isJson",
")",
"{",
"$",
"jsonPretty",
"=",
"(",
"$",
"this",
"->",
"isJsonPretty",
"?",
"JSON_PRETTY_PRINT",
":",
"NULL",
")",
";",
"if"... | Get the post body - either JSON encoded or ready to be sent as a form post
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:19
@return array|false|string Data to be sent Request | [
"Get",
"the",
"post",
"body",
"-",
"either",
"JSON",
"encoded",
"or",
"ready",
"to",
"be",
"sent",
"as",
"a",
"form",
"post"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L497-L512 |
25,685 | nguyenanhung/requests | src/GetContents.php | GetContents.getQueryString | public function getQueryString()
{
$query_string = '';
if (count($this->query_string) > 0) {
$query_string .= http_build_query($this->query_string);
}
if ($this->method != 'POST') {
if (count($this->data) > 0) {
$query_string .= http_build_quer... | php | public function getQueryString()
{
$query_string = '';
if (count($this->query_string) > 0) {
$query_string .= http_build_query($this->query_string);
}
if ($this->method != 'POST') {
if (count($this->data) > 0) {
$query_string .= http_build_quer... | [
"public",
"function",
"getQueryString",
"(",
")",
"{",
"$",
"query_string",
"=",
"''",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"query_string",
")",
">",
"0",
")",
"{",
"$",
"query_string",
".=",
"http_build_query",
"(",
"$",
"this",
"->",
"que... | Get the query string by merging any supplied string
with that of the generated components.
@return string The query string
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:19 | [
"Get",
"the",
"query",
"string",
"by",
"merging",
"any",
"supplied",
"string",
"with",
"that",
"of",
"the",
"generated",
"components",
"."
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L523-L539 |
25,686 | nguyenanhung/requests | src/GetContents.php | GetContents.setMethod | public function setMethod($method = '')
{
if (mb_strlen($method) == 0) {
$this->debug->debug(__FUNCTION__, 'Set Default Method = GET if $method is does not exist');
$method = 'GET';
} else {
$method = strtoupper($method);
$validMethods = [
... | php | public function setMethod($method = '')
{
if (mb_strlen($method) == 0) {
$this->debug->debug(__FUNCTION__, 'Set Default Method = GET if $method is does not exist');
$method = 'GET';
} else {
$method = strtoupper($method);
$validMethods = [
... | [
"public",
"function",
"setMethod",
"(",
"$",
"method",
"=",
"''",
")",
"{",
"if",
"(",
"mb_strlen",
"(",
"$",
"method",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"debug",
"->",
"debug",
"(",
"__FUNCTION__",
",",
"'Set Default Method = GET if $method is ... | Set the HTTP method
GET, HEAD, PUT, POST are valid
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:15
@param string $method Method to Request GET, HEAD, PUT, POST are valid
@return $this|string Method | [
"Set",
"the",
"HTTP",
"method",
"GET",
"HEAD",
"PUT",
"POST",
"are",
"valid"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L589-L613 |
25,687 | nguyenanhung/requests | src/GetContents.php | GetContents.setData | public function setData($data = [])
{
if (!is_array($data) && is_string($data)) {
$data = parse_str($data);
}
if (count($data) == 0) {
$this->data = [];
} else {
$this->data = $data;
}
$this->debug->debug(__FUNCTION__, 'Data into Re... | php | public function setData($data = [])
{
if (!is_array($data) && is_string($data)) {
$data = parse_str($data);
}
if (count($data) == 0) {
$this->data = [];
} else {
$this->data = $data;
}
$this->debug->debug(__FUNCTION__, 'Data into Re... | [
"public",
"function",
"setData",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
"&&",
"is_string",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"parse_str",
"(",
"$",
"data",
")",
";",
"}",
... | Set Data contents
Must be supplied as an array
@param array $data The contents to be sent to the target URL
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:18 | [
"Set",
"Data",
"contents",
"Must",
"be",
"supplied",
"as",
"an",
"array"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L624-L635 |
25,688 | nguyenanhung/requests | src/GetContents.php | GetContents.setQueryString | public function setQueryString($query_string = [])
{
if (!is_array($query_string) && is_string($query_string)) {
$query_string = parse_str($query_string);
}
if (count($query_string) == 0) {
$this->query_string = [];
} else {
$this->query_string = $... | php | public function setQueryString($query_string = [])
{
if (!is_array($query_string) && is_string($query_string)) {
$query_string = parse_str($query_string);
}
if (count($query_string) == 0) {
$this->query_string = [];
} else {
$this->query_string = $... | [
"public",
"function",
"setQueryString",
"(",
"$",
"query_string",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"query_string",
")",
"&&",
"is_string",
"(",
"$",
"query_string",
")",
")",
"{",
"$",
"query_string",
"=",
"parse_str",
"(",
... | Set query string data
Must be supplied as an array
@param array $query_string The query string to be sent to the target URL
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 01:36 | [
"Set",
"query",
"string",
"data",
"Must",
"be",
"supplied",
"as",
"an",
"array"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L646-L656 |
25,689 | nguyenanhung/requests | src/GetContents.php | GetContents.setCookies | public function setCookies($cookies = [])
{
if (!is_array($cookies)) {
$this->cookies = [];
} else {
$this->cookies = $cookies;
$this->trackCookies = TRUE;
}
} | php | public function setCookies($cookies = [])
{
if (!is_array($cookies)) {
$this->cookies = [];
} else {
$this->cookies = $cookies;
$this->trackCookies = TRUE;
}
} | [
"public",
"function",
"setCookies",
"(",
"$",
"cookies",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"cookies",
")",
")",
"{",
"$",
"this",
"->",
"cookies",
"=",
"[",
"]",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"cookies",
... | Set any cookies to be included in the headers
Must be supplied as an array
@param array $cookies The array of cookies to be sent
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:18 | [
"Set",
"any",
"cookies",
"to",
"be",
"included",
"in",
"the",
"headers",
"Must",
"be",
"supplied",
"as",
"an",
"array"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L685-L693 |
25,690 | nguyenanhung/requests | src/GetContents.php | GetContents.setTrackCookies | public function setTrackCookies($value = FALSE)
{
if (!$value) {
$this->trackCookies = FALSE;
} else {
$this->trackCookies = TRUE;
}
} | php | public function setTrackCookies($value = FALSE)
{
if (!$value) {
$this->trackCookies = FALSE;
} else {
$this->trackCookies = TRUE;
}
} | [
"public",
"function",
"setTrackCookies",
"(",
"$",
"value",
"=",
"FALSE",
")",
"{",
"if",
"(",
"!",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"trackCookies",
"=",
"FALSE",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"trackCookies",
"=",
"TRUE",
";",
... | Should cookies be tracked?
@param boolean $value true to track cookies
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:18 | [
"Should",
"cookies",
"be",
"tracked?"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L703-L710 |
25,691 | nguyenanhung/requests | src/GetContents.php | GetContents.setJsonPretty | public function setJsonPretty($value = FALSE)
{
if (!$value) {
$this->isJsonPretty = FALSE;
} else {
$this->isJsonPretty = TRUE;
}
} | php | public function setJsonPretty($value = FALSE)
{
if (!$value) {
$this->isJsonPretty = FALSE;
} else {
$this->isJsonPretty = TRUE;
}
} | [
"public",
"function",
"setJsonPretty",
"(",
"$",
"value",
"=",
"FALSE",
")",
"{",
"if",
"(",
"!",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"isJsonPretty",
"=",
"FALSE",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"isJsonPretty",
"=",
"TRUE",
";",
"... | Should JSON being sent be encoded in an easily readable format?
Only useful for debugging
@param boolean $value true for JSON_PRETTY_PRINT
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:17 | [
"Should",
"JSON",
"being",
"sent",
"be",
"encoded",
"in",
"an",
"easily",
"readable",
"format?",
"Only",
"useful",
"for",
"debugging"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L755-L762 |
25,692 | nguyenanhung/requests | src/GetContents.php | GetContents.setVerifyPeer | public function setVerifyPeer($value = FALSE)
{
if (!$value) {
$this->verifyPeer = FALSE;
} else {
$this->verifyPeer = TRUE;
}
} | php | public function setVerifyPeer($value = FALSE)
{
if (!$value) {
$this->verifyPeer = FALSE;
} else {
$this->verifyPeer = TRUE;
}
} | [
"public",
"function",
"setVerifyPeer",
"(",
"$",
"value",
"=",
"FALSE",
")",
"{",
"if",
"(",
"!",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"verifyPeer",
"=",
"FALSE",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"verifyPeer",
"=",
"TRUE",
";",
"}",
... | Should SSL peers be verified?
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:17
@param bool $value | [
"Should",
"SSL",
"peers",
"be",
"verified?"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L772-L779 |
25,693 | nguyenanhung/requests | src/GetContents.php | GetContents.parseReturnHeaders | public function parseReturnHeaders($headers)
{
$head = [];
foreach ($headers as $k => $v) {
$t = explode(':', $v, 2);
if (isset($t[1])) {
$head[trim($t[0])] = trim($t[1]);
} else {
$head[] = $v;
if (preg_match("#HTTP... | php | public function parseReturnHeaders($headers)
{
$head = [];
foreach ($headers as $k => $v) {
$t = explode(':', $v, 2);
if (isset($t[1])) {
$head[trim($t[0])] = trim($t[1]);
} else {
$head[] = $v;
if (preg_match("#HTTP... | [
"public",
"function",
"parseReturnHeaders",
"(",
"$",
"headers",
")",
"{",
"$",
"head",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"t",
"=",
"explode",
"(",
"':'",
",",
"$",
"v",
",",
"2",... | Parse HTTP response headers
@author: 713uk13m <dev@nguyenanhung.com>
@time : 10/7/18 02:17
@param array $headers
@return array Header Response | [
"Parse",
"HTTP",
"response",
"headers"
] | fae98614a256be6a3ff9bea34a273d182a3ae730 | https://github.com/nguyenanhung/requests/blob/fae98614a256be6a3ff9bea34a273d182a3ae730/src/GetContents.php#L806-L823 |
25,694 | Hnto/nuki | src/Application/Application.php | Application.registerService | public function registerService($service, $name = '') {
if (empty($name)) {
$name = Assist::classNameShort($service);
}
static::$container->offsetSet(strtolower($name), $service);
} | php | public function registerService($service, $name = '') {
if (empty($name)) {
$name = Assist::classNameShort($service);
}
static::$container->offsetSet(strtolower($name), $service);
} | [
"public",
"function",
"registerService",
"(",
"$",
"service",
",",
"$",
"name",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"Assist",
"::",
"classNameShort",
"(",
"$",
"service",
")",
";",
"}",
"stati... | Register a service
@param object $service
@param string $name | [
"Register",
"a",
"service"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Application/Application.php#L155-L161 |
25,695 | Hnto/nuki | src/Application/Application.php | Application.run | public function run()
{
/** @var Request $request */
$request = $this->getService('request-handler');
//Process incoming request
$request->incoming($this);
//Register helper services
$helpers = static::$container['helpers'];
foreach($helpers as $helper => $... | php | public function run()
{
/** @var Request $request */
$request = $this->getService('request-handler');
//Process incoming request
$request->incoming($this);
//Register helper services
$helpers = static::$container['helpers'];
foreach($helpers as $helper => $... | [
"public",
"function",
"run",
"(",
")",
"{",
"/** @var Request $request */",
"$",
"request",
"=",
"$",
"this",
"->",
"getService",
"(",
"'request-handler'",
")",
";",
"//Process incoming request",
"$",
"request",
"->",
"incoming",
"(",
"$",
"this",
")",
";",
"/... | Run the application
- Incoming request will be handled
- Registration in the application will be done
- Session will be started
- Service will be executed
@return mixed | [
"Run",
"the",
"application",
"-",
"Incoming",
"request",
"will",
"be",
"handled",
"-",
"Registration",
"in",
"the",
"application",
"will",
"be",
"done",
"-",
"Session",
"will",
"be",
"started",
"-",
"Service",
"will",
"be",
"executed"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Application/Application.php#L278-L306 |
25,696 | Hnto/nuki | src/Application/Application.php | Application.executeUnitExtenders | public function executeUnitExtenders(string $unit)
{
$extenders = $this->getService('unit-extenders');
if (!is_array($extenders)) {
return;
}
foreach ($extenders as $extender) {
if (!class_exists($extender)) {
continue;
}
... | php | public function executeUnitExtenders(string $unit)
{
$extenders = $this->getService('unit-extenders');
if (!is_array($extenders)) {
return;
}
foreach ($extenders as $extender) {
if (!class_exists($extender)) {
continue;
}
... | [
"public",
"function",
"executeUnitExtenders",
"(",
"string",
"$",
"unit",
")",
"{",
"$",
"extenders",
"=",
"$",
"this",
"->",
"getService",
"(",
"'unit-extenders'",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"extenders",
")",
")",
"{",
"return",
";"... | Execute unit extenders
@param string $unit | [
"Execute",
"unit",
"extenders"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Application/Application.php#L313-L341 |
25,697 | Hnto/nuki | src/Application/Application.php | Application.terminate | public function terminate()
{
/** @var EventHandler $eventHandler */
$eventHandler = $this->getService('event-handler');
$eventHandler->getEvent(TerminateApplication::class)->attach(new LogBeforeTerminate());
$eventHandler->getEvent(TerminateApplication::class)->attach(new ExitAppli... | php | public function terminate()
{
/** @var EventHandler $eventHandler */
$eventHandler = $this->getService('event-handler');
$eventHandler->getEvent(TerminateApplication::class)->attach(new LogBeforeTerminate());
$eventHandler->getEvent(TerminateApplication::class)->attach(new ExitAppli... | [
"public",
"function",
"terminate",
"(",
")",
"{",
"/** @var EventHandler $eventHandler */",
"$",
"eventHandler",
"=",
"$",
"this",
"->",
"getService",
"(",
"'event-handler'",
")",
";",
"$",
"eventHandler",
"->",
"getEvent",
"(",
"TerminateApplication",
"::",
"class"... | Fire TerminateApplication event
with two framework watchers.
One to log and one to actually exit. | [
"Fire",
"TerminateApplication",
"event",
"with",
"two",
"framework",
"watchers",
".",
"One",
"to",
"log",
"and",
"one",
"to",
"actually",
"exit",
"."
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Application/Application.php#L391-L400 |
25,698 | geniv/nette-general-form | src/GeneralControl.php | GeneralControl.createComponentForm | protected function createComponentForm(string $name): Form
{
$form = new Form($this, $name);
$form->setTranslator($this->translator);
$this->formContainer->getForm($form);
$form->onSuccess[] = $this->eventContainer;
return $form;
} | php | protected function createComponentForm(string $name): Form
{
$form = new Form($this, $name);
$form->setTranslator($this->translator);
$this->formContainer->getForm($form);
$form->onSuccess[] = $this->eventContainer;
return $form;
} | [
"protected",
"function",
"createComponentForm",
"(",
"string",
"$",
"name",
")",
":",
"Form",
"{",
"$",
"form",
"=",
"new",
"Form",
"(",
"$",
"this",
",",
"$",
"name",
")",
";",
"$",
"form",
"->",
"setTranslator",
"(",
"$",
"this",
"->",
"translator",
... | Create component form.
@param string $name
@return Form | [
"Create",
"component",
"form",
"."
] | 0d0548b63cf7db58c17ee12d6933f2dd995a64e6 | https://github.com/geniv/nette-general-form/blob/0d0548b63cf7db58c17ee12d6933f2dd995a64e6/src/GeneralControl.php#L79-L87 |
25,699 | ekyna/SettingBundle | Validator/Constraints/RedirectionValidator.php | RedirectionValidator.isPathAccessible | private function isPathAccessible($path)
{
$uri = $this->httpUtils->generateUri($this->requestStack->getMasterRequest(), $path);
/** @var \Buzz\Message\Response $res */
$res = $this->browser->get($uri);
if ($res->isSuccessful()) {
return true;
}
return f... | php | private function isPathAccessible($path)
{
$uri = $this->httpUtils->generateUri($this->requestStack->getMasterRequest(), $path);
/** @var \Buzz\Message\Response $res */
$res = $this->browser->get($uri);
if ($res->isSuccessful()) {
return true;
}
return f... | [
"private",
"function",
"isPathAccessible",
"(",
"$",
"path",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"httpUtils",
"->",
"generateUri",
"(",
"$",
"this",
"->",
"requestStack",
"->",
"getMasterRequest",
"(",
")",
",",
"$",
"path",
")",
";",
"/** @var... | Returns whether the given path is accessible through http or not.
@param $path
@return bool | [
"Returns",
"whether",
"the",
"given",
"path",
"is",
"accessible",
"through",
"http",
"or",
"not",
"."
] | df58f83eb3a01ef56cd76ea73639322c581e75c1 | https://github.com/ekyna/SettingBundle/blob/df58f83eb3a01ef56cd76ea73639322c581e75c1/Validator/Constraints/RedirectionValidator.php#L84-L95 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.