repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
WellCommerce/PaymentBundle
Client/Przelewy24.php
Przelewy24.trnRequest
public function trnRequest($token, $redirect = true) { if ($redirect) { header("Location:".$this->hostLive."trnRequest/".$token); return ""; } else { return $this->hostLive."trnRequest/".$token; } }
php
public function trnRequest($token, $redirect = true) { if ($redirect) { header("Location:".$this->hostLive."trnRequest/".$token); return ""; } else { return $this->hostLive."trnRequest/".$token; } }
[ "public", "function", "trnRequest", "(", "$", "token", ",", "$", "redirect", "=", "true", ")", "{", "if", "(", "$", "redirect", ")", "{", "header", "(", "\"Location:\"", ".", "$", "this", "->", "hostLive", ".", "\"trnRequest/\"", ".", "$", "token", ")"...
Redirects or returns URL to a P24 payment screen @param string $token Token @param bool $redirect If set to true redirects to P24 payment screen. If set to false function returns URL to redirect to P24 payment screen @return string URL to P24 payment screen
[ "Redirects", "or", "returns", "URL", "to", "a", "P24", "payment", "screen" ]
7fdeb0b5155646f2b638082d2135bec05eb8be98
https://github.com/WellCommerce/PaymentBundle/blob/7fdeb0b5155646f2b638082d2135bec05eb8be98/Client/Przelewy24.php#L178-L189
train
Saritasa/php-eloquent-custom
src/Scopes/SortByName.php
SortByName.apply
public function apply(Builder $builder, Model $model): void { $builder->orderBy(self::NAME_ATTRIBUTE); }
php
public function apply(Builder $builder, Model $model): void { $builder->orderBy(self::NAME_ATTRIBUTE); }
[ "public", "function", "apply", "(", "Builder", "$", "builder", ",", "Model", "$", "model", ")", ":", "void", "{", "$", "builder", "->", "orderBy", "(", "self", "::", "NAME_ATTRIBUTE", ")", ";", "}" ]
Apply the sort by name scope to a given Eloquent query builder. @param Builder $builder Builder to attach query scope to @param Model $model Queried model @return void
[ "Apply", "the", "sort", "by", "name", "scope", "to", "a", "given", "Eloquent", "query", "builder", "." ]
54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a
https://github.com/Saritasa/php-eloquent-custom/blob/54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a/src/Scopes/SortByName.php#L24-L27
train
OxfordInfoLabs/kinikit-core
src/Util/HTTP/HttpSession.php
HttpSession.setValue
public function setValue($key, $value) { $this->startSession(); $_SESSION [$key] = $value; $this->sessionData = null; session_write_close(); }
php
public function setValue($key, $value) { $this->startSession(); $_SESSION [$key] = $value; $this->sessionData = null; session_write_close(); }
[ "public", "function", "setValue", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "startSession", "(", ")", ";", "$", "_SESSION", "[", "$", "key", "]", "=", "$", "value", ";", "$", "this", "->", "sessionData", "=", "null", ";", "...
Set a session value by key and invalidate the session data @param string $key @param mixed $value
[ "Set", "a", "session", "value", "by", "key", "and", "invalidate", "the", "session", "data" ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/HttpSession.php#L30-L35
train
OxfordInfoLabs/kinikit-core
src/Util/HTTP/HttpSession.php
HttpSession.getValue
public function getValue($key, $lockSession = false) { $allValues = $this->getAllValues($lockSession); if (isset($allValues[$key])) { return $allValues[$key]; } else { return null; } }
php
public function getValue($key, $lockSession = false) { $allValues = $this->getAllValues($lockSession); if (isset($allValues[$key])) { return $allValues[$key]; } else { return null; } }
[ "public", "function", "getValue", "(", "$", "key", ",", "$", "lockSession", "=", "false", ")", "{", "$", "allValues", "=", "$", "this", "->", "getAllValues", "(", "$", "lockSession", ")", ";", "if", "(", "isset", "(", "$", "allValues", "[", "$", "key...
Get a session value by key @param unknown_type $key
[ "Get", "a", "session", "value", "by", "key" ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/HttpSession.php#L42-L49
train
OxfordInfoLabs/kinikit-core
src/Util/HTTP/HttpSession.php
HttpSession.getAllValues
public function getAllValues($lockSession = false) { if (!$this->sessionData || $lockSession) { $this->startSession(); $this->sessionData = isset($_SESSION) ? $_SESSION : array(); if (!$lockSession) session_write_close(); } return $this->sess...
php
public function getAllValues($lockSession = false) { if (!$this->sessionData || $lockSession) { $this->startSession(); $this->sessionData = isset($_SESSION) ? $_SESSION : array(); if (!$lockSession) session_write_close(); } return $this->sess...
[ "public", "function", "getAllValues", "(", "$", "lockSession", "=", "false", ")", "{", "if", "(", "!", "$", "this", "->", "sessionData", "||", "$", "lockSession", ")", "{", "$", "this", "->", "startSession", "(", ")", ";", "$", "this", "->", "sessionDa...
Get all values - return as array and close session to prevent threading locks.
[ "Get", "all", "values", "-", "return", "as", "array", "and", "close", "session", "to", "prevent", "threading", "locks", "." ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/HttpSession.php#L54-L64
train
rollerworks/search-core
SearchCondition.php
SearchCondition.assertFieldSetName
public function assertFieldSetName(string ...$name) { if (!\in_array($providedName = $this->fieldSet->getSetName(), $name, true)) { throw new UnsupportedFieldSetException($name, $providedName); } }
php
public function assertFieldSetName(string ...$name) { if (!\in_array($providedName = $this->fieldSet->getSetName(), $name, true)) { throw new UnsupportedFieldSetException($name, $providedName); } }
[ "public", "function", "assertFieldSetName", "(", "string", "...", "$", "name", ")", "{", "if", "(", "!", "\\", "in_array", "(", "$", "providedName", "=", "$", "this", "->", "fieldSet", "->", "getSetName", "(", ")", ",", "$", "name", ",", "true", ")", ...
Checks that the FieldSet of this condition is supported by the contexts it's used in. @param string ...$name One or more FieldSet names to check for
[ "Checks", "that", "the", "FieldSet", "of", "this", "condition", "is", "supported", "by", "the", "contexts", "it", "s", "used", "in", "." ]
6b5671b8c4d6298906ded768261b0a59845140fb
https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/SearchCondition.php#L78-L83
train
locomotivemtl/charcoal-factory
src/Charcoal/Factory/AbstractFactory.php
AbstractFactory.create
final public function create($type, array $args = null, callable $cb = null) { if (!is_string($type)) { throw new InvalidArgumentException( sprintf( '%s: Type must be a string.', get_called_class() ) ); }...
php
final public function create($type, array $args = null, callable $cb = null) { if (!is_string($type)) { throw new InvalidArgumentException( sprintf( '%s: Type must be a string.', get_called_class() ) ); }...
[ "final", "public", "function", "create", "(", "$", "type", ",", "array", "$", "args", "=", "null", ",", "callable", "$", "cb", "=", "null", ")", "{", "if", "(", "!", "is_string", "(", "$", "type", ")", ")", "{", "throw", "new", "InvalidArgumentExcept...
Create a new instance of a class, by type. Unlike `get()`, this method *always* return a new instance of the requested class. ## Object callback It is possible to pass a callback method that will be executed upon object instanciation. The callable should have a signature: `function($obj);` where $obj is the newly cre...
[ "Create", "a", "new", "instance", "of", "a", "class", "by", "type", "." ]
c64d40e1e39ef987a0bd0ad0e22379f55acf8f92
https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L121-L181
train
locomotivemtl/charcoal-factory
src/Charcoal/Factory/AbstractFactory.php
AbstractFactory.setBaseClass
public function setBaseClass($type) { if (!is_string($type) || empty($type)) { throw new InvalidArgumentException( 'Class name or type must be a non-empty string.' ); } $exists = (class_exists($type) || interface_exists($type)); if ($exists) {...
php
public function setBaseClass($type) { if (!is_string($type) || empty($type)) { throw new InvalidArgumentException( 'Class name or type must be a non-empty string.' ); } $exists = (class_exists($type) || interface_exists($type)); if ($exists) {...
[ "public", "function", "setBaseClass", "(", "$", "type", ")", "{", "if", "(", "!", "is_string", "(", "$", "type", ")", "||", "empty", "(", "$", "type", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Class name or type must be a non-empty stri...
If a base class is set, then it must be ensured that the created objects are `instanceof` this base class. @param string $type The FQN of the class, or "type" of object, to set as base class. @throws InvalidArgumentException If the class is not a string or is not an existing class / interface. @return self
[ "If", "a", "base", "class", "is", "set", "then", "it", "must", "be", "ensured", "that", "the", "created", "objects", "are", "instanceof", "this", "base", "class", "." ]
c64d40e1e39ef987a0bd0ad0e22379f55acf8f92
https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L217-L242
train
locomotivemtl/charcoal-factory
src/Charcoal/Factory/AbstractFactory.php
AbstractFactory.resolve
public function resolve($type) { if (!is_string($type)) { throw new InvalidArgumentException( 'Can not resolve class ident: type must be a string' ); } $map = $this->map(); if (isset($map[$type])) { $type = $map[$type]; } ...
php
public function resolve($type) { if (!is_string($type)) { throw new InvalidArgumentException( 'Can not resolve class ident: type must be a string' ); } $map = $this->map(); if (isset($map[$type])) { $type = $map[$type]; } ...
[ "public", "function", "resolve", "(", "$", "type", ")", "{", "if", "(", "!", "is_string", "(", "$", "type", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Can not resolve class ident: type must be a string'", ")", ";", "}", "$", "map", "=", ...
The Generic factory resolves the class name from an exact FQN. @param string $type The "type" of object to resolve (the object ident). @throws InvalidArgumentException If the type parameter is not a string. @return string The resolved class name (FQN).
[ "The", "Generic", "factory", "resolves", "the", "class", "name", "from", "an", "exact", "FQN", "." ]
c64d40e1e39ef987a0bd0ad0e22379f55acf8f92
https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L336-L356
train
locomotivemtl/charcoal-factory
src/Charcoal/Factory/AbstractFactory.php
AbstractFactory.isResolvable
public function isResolvable($type) { if (!is_string($type)) { throw new InvalidArgumentException( 'Can not check resolvable: type must be a string' ); } $map = $this->map(); if (isset($map[$type])) { $type = $map[$type]; }...
php
public function isResolvable($type) { if (!is_string($type)) { throw new InvalidArgumentException( 'Can not check resolvable: type must be a string' ); } $map = $this->map(); if (isset($map[$type])) { $type = $map[$type]; }...
[ "public", "function", "isResolvable", "(", "$", "type", ")", "{", "if", "(", "!", "is_string", "(", "$", "type", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Can not check resolvable: type must be a string'", ")", ";", "}", "$", "map", "="...
Whether a `type` is resolvable. The Generic Factory simply checks if the _FQN_ `type` class exists. @param string $type The "type" of object to resolve (the object ident). @throws InvalidArgumentException If the type parameter is not a string. @return boolean
[ "Whether", "a", "type", "is", "resolvable", ".", "The", "Generic", "Factory", "simply", "checks", "if", "the", "_FQN_", "type", "class", "exists", "." ]
c64d40e1e39ef987a0bd0ad0e22379f55acf8f92
https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L365-L389
train
locomotivemtl/charcoal-factory
src/Charcoal/Factory/AbstractFactory.php
AbstractFactory.createClass
protected function createClass($className, $args) { if ($args === null) { return new $className; } if (!is_array($args)) { return new $className($args); } if (count(array_filter(array_keys($args), 'is_string')) > 0) { return new $className(...
php
protected function createClass($className, $args) { if ($args === null) { return new $className; } if (!is_array($args)) { return new $className($args); } if (count(array_filter(array_keys($args), 'is_string')) > 0) { return new $className(...
[ "protected", "function", "createClass", "(", "$", "className", ",", "$", "args", ")", "{", "if", "(", "$", "args", "===", "null", ")", "{", "return", "new", "$", "className", ";", "}", "if", "(", "!", "is_array", "(", "$", "args", ")", ")", "{", ...
Create a class instance with given arguments. How the constructor arguments are passed depends on its type: - if null, no arguments are passed at all. - if it's not an array, it's passed as a single argument. - if it's an associative array, it's passed as a sing argument. - if it's a sequential (numeric keys) array, ...
[ "Create", "a", "class", "instance", "with", "given", "arguments", "." ]
c64d40e1e39ef987a0bd0ad0e22379f55acf8f92
https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L406-L424
train
locomotivemtl/charcoal-factory
src/Charcoal/Factory/AbstractFactory.php
AbstractFactory.addClassToMap
protected function addClassToMap($type, $className) { if (!is_string($type)) { throw new InvalidArgumentException( 'Type (class key) must be a string' ); } $this->map[$type] = $className; return $this; }
php
protected function addClassToMap($type, $className) { if (!is_string($type)) { throw new InvalidArgumentException( 'Type (class key) must be a string' ); } $this->map[$type] = $className; return $this; }
[ "protected", "function", "addClassToMap", "(", "$", "type", ",", "$", "className", ")", "{", "if", "(", "!", "is_string", "(", "$", "type", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Type (class key) must be a string'", ")", ";", "}", ...
Add a class name to the available types _map_. @param string $type The type (class ident). @param string $className The FQN of the class. @throws InvalidArgumentException If the $type parameter is not a striing or the $className class does not exist. @return self
[ "Add", "a", "class", "name", "to", "the", "available", "types", "_map_", "." ]
c64d40e1e39ef987a0bd0ad0e22379f55acf8f92
https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L452-L462
train
locomotivemtl/charcoal-factory
src/Charcoal/Factory/AbstractFactory.php
AbstractFactory.setMap
private function setMap(array $map) { // Resets (overwrites) map. $this->map = []; foreach ($map as $type => $className) { $this->addClassToMap($type, $className); } return $this; }
php
private function setMap(array $map) { // Resets (overwrites) map. $this->map = []; foreach ($map as $type => $className) { $this->addClassToMap($type, $className); } return $this; }
[ "private", "function", "setMap", "(", "array", "$", "map", ")", "{", "// Resets (overwrites) map.", "$", "this", "->", "map", "=", "[", "]", ";", "foreach", "(", "$", "map", "as", "$", "type", "=>", "$", "className", ")", "{", "$", "this", "->", "add...
Add multiple types, in a an array of `type` => `className`. @param string[] $map The map (key=>classname) to use. @return self
[ "Add", "multiple", "types", "in", "a", "an", "array", "of", "type", "=", ">", "className", "." ]
c64d40e1e39ef987a0bd0ad0e22379f55acf8f92
https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L480-L488
train
shrink0r/php-schema
src/Property/AssocProperty.php
AssocProperty.validate
public function validate($value) { return is_array($value) ? $this->valueSchema->validate($value) : Error::unit([ Error::NON_ARRAY ]); }
php
public function validate($value) { return is_array($value) ? $this->valueSchema->validate($value) : Error::unit([ Error::NON_ARRAY ]); }
[ "public", "function", "validate", "(", "$", "value", ")", "{", "return", "is_array", "(", "$", "value", ")", "?", "$", "this", "->", "valueSchema", "->", "validate", "(", "$", "value", ")", ":", "Error", "::", "unit", "(", "[", "Error", "::", "NON_AR...
Tells if a given value adhere's to the property's value schema. @param mixed $value @return ResultInterface Returns Ok if the value is valid, otherwise an Error is returned.
[ "Tells", "if", "a", "given", "value", "adhere", "s", "to", "the", "property", "s", "value", "schema", "." ]
94293fe897af376dd9d05962e2c516079409dd29
https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Property/AssocProperty.php#L39-L42
train
shrink0r/php-schema
src/Property/AssocProperty.php
AssocProperty.createValueSchema
protected function createValueSchema(array $definition) { if (!isset($definition['properties'])) { throw new Exception("Missing required key 'properties' within assoc definition."); } return $this->getSchema()->getFactory()->createSchema( $this->getName().'_type', ...
php
protected function createValueSchema(array $definition) { if (!isset($definition['properties'])) { throw new Exception("Missing required key 'properties' within assoc definition."); } return $this->getSchema()->getFactory()->createSchema( $this->getName().'_type', ...
[ "protected", "function", "createValueSchema", "(", "array", "$", "definition", ")", "{", "if", "(", "!", "isset", "(", "$", "definition", "[", "'properties'", "]", ")", ")", "{", "throw", "new", "Exception", "(", "\"Missing required key 'properties' within assoc d...
Creates a schema instance that will be used to proxy the property's validation to. @param mixed[] $definition @return SchemaInterface
[ "Creates", "a", "schema", "instance", "that", "will", "be", "used", "to", "proxy", "the", "property", "s", "validation", "to", "." ]
94293fe897af376dd9d05962e2c516079409dd29
https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Property/AssocProperty.php#L51-L61
train
CalderaWP/caldera-interop
src/Traits/ConvertsInteropModelToArray.php
ConvertsInteropModelToArray.toArray
public function toArray(): array { $array = [ 'id' => $this->getId(), ]; foreach (get_object_vars($this) as $prop => $value) { $array[$prop] = is_callable([$this->$prop,'toArray'])? $this->$prop->toArray() : $this->$prop; } return $array; }
php
public function toArray(): array { $array = [ 'id' => $this->getId(), ]; foreach (get_object_vars($this) as $prop => $value) { $array[$prop] = is_callable([$this->$prop,'toArray'])? $this->$prop->toArray() : $this->$prop; } return $array; }
[ "public", "function", "toArray", "(", ")", ":", "array", "{", "$", "array", "=", "[", "'id'", "=>", "$", "this", "->", "getId", "(", ")", ",", "]", ";", "foreach", "(", "get_object_vars", "(", "$", "this", ")", "as", "$", "prop", "=>", "$", "valu...
Convert Interoperable Model to an array @return array
[ "Convert", "Interoperable", "Model", "to", "an", "array" ]
d25c4bc930200b314fbd42d084080b5d85261c94
https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Traits/ConvertsInteropModelToArray.php#L18-L28
train
flipbox/spark
src/services/traits/ObjectByString.php
ObjectByString.findCacheByString
public function findCacheByString(string $string) { // Check if already in cache if (!$this->isCachedByString($string)) { return null; } return $this->cacheByString[$string]; }
php
public function findCacheByString(string $string) { // Check if already in cache if (!$this->isCachedByString($string)) { return null; } return $this->cacheByString[$string]; }
[ "public", "function", "findCacheByString", "(", "string", "$", "string", ")", "{", "// Check if already in cache", "if", "(", "!", "$", "this", "->", "isCachedByString", "(", "$", "string", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", ...
Find an existing cache by string @param string $string @return null
[ "Find", "an", "existing", "cache", "by", "string" ]
9d75fd3d95744b9c9187921c4f3b9eea42c035d4
https://github.com/flipbox/spark/blob/9d75fd3d95744b9c9187921c4f3b9eea42c035d4/src/services/traits/ObjectByString.php#L147-L156
train
Topolis/FunctionLibrary
src/Path.php
Path.real
public static function real($input, $separator = self::SEPARATOR_BOTH){ $parsed = self::parse($input, $separator); if(!self::validate($parsed["path"])) throw new \Exception("Path is invalid"); $elements_in = self::explode($parsed["path"], $separator); $elements_out = array(...
php
public static function real($input, $separator = self::SEPARATOR_BOTH){ $parsed = self::parse($input, $separator); if(!self::validate($parsed["path"])) throw new \Exception("Path is invalid"); $elements_in = self::explode($parsed["path"], $separator); $elements_out = array(...
[ "public", "static", "function", "real", "(", "$", "input", ",", "$", "separator", "=", "self", "::", "SEPARATOR_BOTH", ")", "{", "$", "parsed", "=", "self", "::", "parse", "(", "$", "input", ",", "$", "separator", ")", ";", "if", "(", "!", "self", ...
Resolve a path and return a cleaned real path without checking physical files on any device @static @param $input @param string $separator @return string @throws \Exception
[ "Resolve", "a", "path", "and", "return", "a", "cleaned", "real", "path", "without", "checking", "physical", "files", "on", "any", "device" ]
bc57f465932fbf297927c2a32765255131b907eb
https://github.com/Topolis/FunctionLibrary/blob/bc57f465932fbf297927c2a32765255131b907eb/src/Path.php#L22-L53
train
Topolis/FunctionLibrary
src/Path.php
Path.validate
public static function validate($input, $separator = self::SEPARATOR_BOTH){ $pattern = addcslashes(self::ALLOWED_CHARS . $separator, "[].-_/\\"); $invalid = preg_match("/[^".$pattern."]+/", $input); return $invalid ? false : true; }
php
public static function validate($input, $separator = self::SEPARATOR_BOTH){ $pattern = addcslashes(self::ALLOWED_CHARS . $separator, "[].-_/\\"); $invalid = preg_match("/[^".$pattern."]+/", $input); return $invalid ? false : true; }
[ "public", "static", "function", "validate", "(", "$", "input", ",", "$", "separator", "=", "self", "::", "SEPARATOR_BOTH", ")", "{", "$", "pattern", "=", "addcslashes", "(", "self", "::", "ALLOWED_CHARS", ".", "$", "separator", ",", "\"[].-_/\\\\\"", ")", ...
Check if a path contains valid characters @static @param $input @param string $separator @return bool
[ "Check", "if", "a", "path", "contains", "valid", "characters" ]
bc57f465932fbf297927c2a32765255131b907eb
https://github.com/Topolis/FunctionLibrary/blob/bc57f465932fbf297927c2a32765255131b907eb/src/Path.php#L67-L73
train
Topolis/FunctionLibrary
src/Path.php
Path.extension
public static function extension($file, $separator = self::SEPARATOR_BOTH){ return self::validate($file, $separator) ? substr($file, strrpos($file, '.') + 1) : false; }
php
public static function extension($file, $separator = self::SEPARATOR_BOTH){ return self::validate($file, $separator) ? substr($file, strrpos($file, '.') + 1) : false; }
[ "public", "static", "function", "extension", "(", "$", "file", ",", "$", "separator", "=", "self", "::", "SEPARATOR_BOTH", ")", "{", "return", "self", "::", "validate", "(", "$", "file", ",", "$", "separator", ")", "?", "substr", "(", "$", "file", ",",...
Return the extension of a file or false on invalid filenames @static @param string $file @param string $separator @return bool|string
[ "Return", "the", "extension", "of", "a", "file", "or", "false", "on", "invalid", "filenames" ]
bc57f465932fbf297927c2a32765255131b907eb
https://github.com/Topolis/FunctionLibrary/blob/bc57f465932fbf297927c2a32765255131b907eb/src/Path.php#L146-L148
train
subjective-php/spl-datastructures
src/ImmutableArrayObject.php
ImmutableArrayObject.createFromMutable
public static function createFromMutable(\ArrayObject $arrayObject) : ImmutableArrayObject { return new static($arrayObject->getArrayCopy(), $arrayObject->getFlags(), $arrayObject->getIteratorClass()); }
php
public static function createFromMutable(\ArrayObject $arrayObject) : ImmutableArrayObject { return new static($arrayObject->getArrayCopy(), $arrayObject->getFlags(), $arrayObject->getIteratorClass()); }
[ "public", "static", "function", "createFromMutable", "(", "\\", "ArrayObject", "$", "arrayObject", ")", ":", "ImmutableArrayObject", "{", "return", "new", "static", "(", "$", "arrayObject", "->", "getArrayCopy", "(", ")", ",", "$", "arrayObject", "->", "getFlags...
Creates a new ImmutableArrayObject from the given mutable ArrayObject instance. @param \ArrayObject $arrayObject The mutable array object. @return ImmutableArrayObject
[ "Creates", "a", "new", "ImmutableArrayObject", "from", "the", "given", "mutable", "ArrayObject", "instance", "." ]
621b0c47be9449299cfd22686d11ef9750f9841d
https://github.com/subjective-php/spl-datastructures/blob/621b0c47be9449299cfd22686d11ef9750f9841d/src/ImmutableArrayObject.php#L74-L77
train
eureka-framework/component-cache
src/Cache/CacheWrapperMemcache.php
CacheWrapperMemcache.connect
public function connect($host = '127.0.0.1', $port = 11211) { if (!isset($this->servers[$host . ':' . $port])) { $this->server = new \Memcache(); $this->server->connect($host, $port); $this->servers[$host . ':' . $port] = $this->server; } else { $this...
php
public function connect($host = '127.0.0.1', $port = 11211) { if (!isset($this->servers[$host . ':' . $port])) { $this->server = new \Memcache(); $this->server->connect($host, $port); $this->servers[$host . ':' . $port] = $this->server; } else { $this...
[ "public", "function", "connect", "(", "$", "host", "=", "'127.0.0.1'", ",", "$", "port", "=", "11211", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "servers", "[", "$", "host", ".", "':'", ".", "$", "port", "]", ")", ")", "{", "$"...
Connect and use specified server. @param string $host @param int $port @return bool
[ "Connect", "and", "use", "specified", "server", "." ]
c110441ac7bb20edd2ecd8162f4302596d875785
https://github.com/eureka-framework/component-cache/blob/c110441ac7bb20edd2ecd8162f4302596d875785/src/Cache/CacheWrapperMemcache.php#L36-L48
train
byjg/authuser
src/UsersBase.php
UsersBase.addUser
public function addUser($name, $userName, $email, $password) { $model = $this->getUserDefinition()->modelInstance(); $model->setName($name); $model->setEmail($email); $model->setUsername($userName); $model->setPassword($password); $this->save($model); }
php
public function addUser($name, $userName, $email, $password) { $model = $this->getUserDefinition()->modelInstance(); $model->setName($name); $model->setEmail($email); $model->setUsername($userName); $model->setPassword($password); $this->save($model); }
[ "public", "function", "addUser", "(", "$", "name", ",", "$", "userName", ",", "$", "email", ",", "$", "password", ")", "{", "$", "model", "=", "$", "this", "->", "getUserDefinition", "(", ")", "->", "modelInstance", "(", ")", ";", "$", "model", "->",...
Add new user in database @param string $name @param string $userName @param string $email @param string $password @return void @throws \ByJG\Serializer\Exception\InvalidArgumentException
[ "Add", "new", "user", "in", "database" ]
2ca520e921e559257d14dd933c746a1df28eaf9f
https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L73-L82
train
byjg/authuser
src/UsersBase.php
UsersBase.getByEmail
public function getByEmail($email) { $filter = new IteratorFilter(); $filter->addRelation($this->getUserDefinition()->getEmail(), Relation::EQUAL, strtolower($email)); return $this->getUser($filter); }
php
public function getByEmail($email) { $filter = new IteratorFilter(); $filter->addRelation($this->getUserDefinition()->getEmail(), Relation::EQUAL, strtolower($email)); return $this->getUser($filter); }
[ "public", "function", "getByEmail", "(", "$", "email", ")", "{", "$", "filter", "=", "new", "IteratorFilter", "(", ")", ";", "$", "filter", "->", "addRelation", "(", "$", "this", "->", "getUserDefinition", "(", ")", "->", "getEmail", "(", ")", ",", "Re...
Get the user based on his email. Return Row if user was found; null, otherwise @param string $email @return UserModel @throws \ByJG\Serializer\Exception\InvalidArgumentException
[ "Get", "the", "user", "based", "on", "his", "email", ".", "Return", "Row", "if", "user", "was", "found", ";", "null", "otherwise" ]
2ca520e921e559257d14dd933c746a1df28eaf9f
https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L121-L126
train
byjg/authuser
src/UsersBase.php
UsersBase.getByUsername
public function getByUsername($username) { $filter = new IteratorFilter(); $filter->addRelation($this->getUserDefinition()->getUsername(), Relation::EQUAL, $username); return $this->getUser($filter); }
php
public function getByUsername($username) { $filter = new IteratorFilter(); $filter->addRelation($this->getUserDefinition()->getUsername(), Relation::EQUAL, $username); return $this->getUser($filter); }
[ "public", "function", "getByUsername", "(", "$", "username", ")", "{", "$", "filter", "=", "new", "IteratorFilter", "(", ")", ";", "$", "filter", "->", "addRelation", "(", "$", "this", "->", "getUserDefinition", "(", ")", "->", "getUsername", "(", ")", "...
Get the user based on his username. Return Row if user was found; null, otherwise @param $username @return UserModel @throws \ByJG\Serializer\Exception\InvalidArgumentException
[ "Get", "the", "user", "based", "on", "his", "username", ".", "Return", "Row", "if", "user", "was", "found", ";", "null", "otherwise" ]
2ca520e921e559257d14dd933c746a1df28eaf9f
https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L136-L141
train
byjg/authuser
src/UsersBase.php
UsersBase.getById
public function getById($userid) { $filter = new IteratorFilter(); $filter->addRelation($this->getUserDefinition()->getUserid(), Relation::EQUAL, $userid); return $this->getUser($filter); }
php
public function getById($userid) { $filter = new IteratorFilter(); $filter->addRelation($this->getUserDefinition()->getUserid(), Relation::EQUAL, $userid); return $this->getUser($filter); }
[ "public", "function", "getById", "(", "$", "userid", ")", "{", "$", "filter", "=", "new", "IteratorFilter", "(", ")", ";", "$", "filter", "->", "addRelation", "(", "$", "this", "->", "getUserDefinition", "(", ")", "->", "getUserid", "(", ")", ",", "Rel...
Get the user based on his id. Return Row if user was found; null, otherwise @param string $userid @return UserModel @throws \ByJG\Serializer\Exception\InvalidArgumentException
[ "Get", "the", "user", "based", "on", "his", "id", ".", "Return", "Row", "if", "user", "was", "found", ";", "null", "otherwise" ]
2ca520e921e559257d14dd933c746a1df28eaf9f
https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L167-L172
train
byjg/authuser
src/UsersBase.php
UsersBase.isValidUser
public function isValidUser($userName, $password) { $filter = new IteratorFilter(); $passwordGenerator = $this->getUserDefinition()->getClosureForUpdate('password'); $filter->addRelation($this->getUserDefinition()->loginField(), Relation::EQUAL, strtolower($userName)); $filter->addRe...
php
public function isValidUser($userName, $password) { $filter = new IteratorFilter(); $passwordGenerator = $this->getUserDefinition()->getClosureForUpdate('password'); $filter->addRelation($this->getUserDefinition()->loginField(), Relation::EQUAL, strtolower($userName)); $filter->addRe...
[ "public", "function", "isValidUser", "(", "$", "userName", ",", "$", "password", ")", "{", "$", "filter", "=", "new", "IteratorFilter", "(", ")", ";", "$", "passwordGenerator", "=", "$", "this", "->", "getUserDefinition", "(", ")", "->", "getClosureForUpdate...
Validate if the user and password exists in the file Return Row if user exists; null, otherwise @param string $userName User login @param string $password Plain text password @return UserModel @throws \ByJG\Serializer\Exception\InvalidArgumentException
[ "Validate", "if", "the", "user", "and", "password", "exists", "in", "the", "file", "Return", "Row", "if", "user", "exists", ";", "null", "otherwise" ]
2ca520e921e559257d14dd933c746a1df28eaf9f
https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L191-L202
train
byjg/authuser
src/UsersBase.php
UsersBase.hasProperty
public function hasProperty($userId, $propertyName, $value = null) { //anydataset.Row $user = $this->getById($userId); if (empty($user)) { return false; } if ($this->isAdmin($userId)) { return true; } $values = $user->get($propertyNa...
php
public function hasProperty($userId, $propertyName, $value = null) { //anydataset.Row $user = $this->getById($userId); if (empty($user)) { return false; } if ($this->isAdmin($userId)) { return true; } $values = $user->get($propertyNa...
[ "public", "function", "hasProperty", "(", "$", "userId", ",", "$", "propertyName", ",", "$", "value", "=", "null", ")", "{", "//anydataset.Row", "$", "user", "=", "$", "this", "->", "getById", "(", "$", "userId", ")", ";", "if", "(", "empty", "(", "$...
Check if the user have a property and it have a specific value. Return True if have rights; false, otherwise @param mixed $userId User identification @param string $propertyName @param string $value Property value @return bool @throws \ByJG\Authenticate\Exception\UserNotFoundException @throws \ByJG\Serializer\Exceptio...
[ "Check", "if", "the", "user", "have", "a", "property", "and", "it", "have", "a", "specific", "value", ".", "Return", "True", "if", "have", "rights", ";", "false", "otherwise" ]
2ca520e921e559257d14dd933c746a1df28eaf9f
https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L215-L230
train
byjg/authuser
src/UsersBase.php
UsersBase.getProperty
public function getProperty($userId, $propertyName) { //anydataset.Row $user = $this->getById($userId); if ($user !== null) { $values = $user->get($propertyName); if ($this->isAdmin($userId)) { return array("admin" => "admin"); } ...
php
public function getProperty($userId, $propertyName) { //anydataset.Row $user = $this->getById($userId); if ($user !== null) { $values = $user->get($propertyName); if ($this->isAdmin($userId)) { return array("admin" => "admin"); } ...
[ "public", "function", "getProperty", "(", "$", "userId", ",", "$", "propertyName", ")", "{", "//anydataset.Row", "$", "user", "=", "$", "this", "->", "getById", "(", "$", "userId", ")", ";", "if", "(", "$", "user", "!==", "null", ")", "{", "$", "valu...
Return all sites from a specific user Return String vector with all sites @param string $userId User ID @param string $propertyName Property name @return array @throws \ByJG\Authenticate\Exception\UserNotFoundException @throws \ByJG\Serializer\Exception\InvalidArgumentException
[ "Return", "all", "sites", "from", "a", "specific", "user", "Return", "String", "vector", "with", "all", "sites" ]
2ca520e921e559257d14dd933c746a1df28eaf9f
https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L242-L257
train
byjg/authuser
src/UsersBase.php
UsersBase.createAuthToken
public function createAuthToken( $login, $password, $jwtWrapper, $expires = 1200, $updateUserInfo = [], $updateTokenInfo = [] ) { if (!isset($login) || !isset($password)) { throw new InvalidArgumentException('Neither username or password can be emp...
php
public function createAuthToken( $login, $password, $jwtWrapper, $expires = 1200, $updateUserInfo = [], $updateTokenInfo = [] ) { if (!isset($login) || !isset($password)) { throw new InvalidArgumentException('Neither username or password can be emp...
[ "public", "function", "createAuthToken", "(", "$", "login", ",", "$", "password", ",", "$", "jwtWrapper", ",", "$", "expires", "=", "1200", ",", "$", "updateUserInfo", "=", "[", "]", ",", "$", "updateTokenInfo", "=", "[", "]", ")", "{", "if", "(", "!...
Authenticate a user and create a token if it is valid @param string $login @param string $password @param JwtWrapper $jwtWrapper @param int $expires @param array $updateUserInfo @param array $updateTokenInfo @return string the TOKEN or false if dont. @throws UserNotFoundException @throws \ByJG\Serializer\Exception\Inv...
[ "Authenticate", "a", "user", "and", "create", "a", "token", "if", "it", "is", "valid" ]
2ca520e921e559257d14dd933c746a1df28eaf9f
https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L320-L354
train
byjg/authuser
src/UsersBase.php
UsersBase.isValidToken
public function isValidToken($login, $jwtWrapper, $token) { $user = $this->getByLoginField($login); if (is_null($user)) { throw new UserNotFoundException('User not found!'); } if ($user->get('TOKEN_HASH') !== sha1($token)) { throw new NotAuthenticatedExcepti...
php
public function isValidToken($login, $jwtWrapper, $token) { $user = $this->getByLoginField($login); if (is_null($user)) { throw new UserNotFoundException('User not found!'); } if ($user->get('TOKEN_HASH') !== sha1($token)) { throw new NotAuthenticatedExcepti...
[ "public", "function", "isValidToken", "(", "$", "login", ",", "$", "jwtWrapper", ",", "$", "token", ")", "{", "$", "user", "=", "$", "this", "->", "getByLoginField", "(", "$", "login", ")", ";", "if", "(", "is_null", "(", "$", "user", ")", ")", "{"...
Check if the Auth Token is valid @param string $login @param JwtWrapper $jwtWrapper @param string $token @return array @throws NotAuthenticatedException @throws UserNotFoundException @throws \ByJG\Serializer\Exception\InvalidArgumentException @throws \ByJG\Util\JwtWrapperException
[ "Check", "if", "the", "Auth", "Token", "is", "valid" ]
2ca520e921e559257d14dd933c746a1df28eaf9f
https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L368-L388
train
samsonos/cms_app_user
src/Application.php
Application.__async_save
public function __async_save() { // If form has been sent if (isset($_POST)) { // Create or find user depending on UserID passed /** @var \samson\activerecord\user $db_user */ $db_user = null; if (!dbQuery('user')->UserID($_POST['UserID'])->Active(1)-...
php
public function __async_save() { // If form has been sent if (isset($_POST)) { // Create or find user depending on UserID passed /** @var \samson\activerecord\user $db_user */ $db_user = null; if (!dbQuery('user')->UserID($_POST['UserID'])->Active(1)-...
[ "public", "function", "__async_save", "(", ")", "{", "// If form has been sent", "if", "(", "isset", "(", "$", "_POST", ")", ")", "{", "// Create or find user depending on UserID passed", "/** @var \\samson\\activerecord\\user $db_user */", "$", "db_user", "=", "null", ";...
Save user data
[ "Save", "user", "data" ]
48b9de772a7443de7cc1a64e7d01ffddcb3e7a52
https://github.com/samsonos/cms_app_user/blob/48b9de772a7443de7cc1a64e7d01ffddcb3e7a52/src/Application.php#L39-L69
train
samsonos/cms_app_user
src/Application.php
Application.__async_table
public function __async_table() { // Create query to get users $query = dbQuery('user')->Active(1)->order_by('UserID'); // Create generic table for users $table = new Table($query); return array ('status'=>1, 'table'=>$table->render()); }
php
public function __async_table() { // Create query to get users $query = dbQuery('user')->Active(1)->order_by('UserID'); // Create generic table for users $table = new Table($query); return array ('status'=>1, 'table'=>$table->render()); }
[ "public", "function", "__async_table", "(", ")", "{", "// Create query to get users", "$", "query", "=", "dbQuery", "(", "'user'", ")", "->", "Active", "(", "1", ")", "->", "order_by", "(", "'UserID'", ")", ";", "// Create generic table for users", "$", "table",...
Method for rendering table @return array - AJAX Response
[ "Method", "for", "rendering", "table" ]
48b9de772a7443de7cc1a64e7d01ffddcb3e7a52
https://github.com/samsonos/cms_app_user/blob/48b9de772a7443de7cc1a64e7d01ffddcb3e7a52/src/Application.php#L102-L111
train
RhubarbPHP/Module.Leaf.Table
src/Leaves/Columns/ModelColumn.php
ModelColumn.createTableColumnForSchemaColumn
public static function createTableColumnForSchemaColumn(Column $column, $label) { if ($column instanceof TimeColumn) { new \Rhubarb\Leaf\Table\Leaves\Columns\TimeColumn($column->columnName, $label); } if ($column instanceof DateColumn || $column instanceof MySqlDateTimeColumn) {...
php
public static function createTableColumnForSchemaColumn(Column $column, $label) { if ($column instanceof TimeColumn) { new \Rhubarb\Leaf\Table\Leaves\Columns\TimeColumn($column->columnName, $label); } if ($column instanceof DateColumn || $column instanceof MySqlDateTimeColumn) {...
[ "public", "static", "function", "createTableColumnForSchemaColumn", "(", "Column", "$", "column", ",", "$", "label", ")", "{", "if", "(", "$", "column", "instanceof", "TimeColumn", ")", "{", "new", "\\", "Rhubarb", "\\", "Leaf", "\\", "Table", "\\", "Leaves"...
Creates the correct type of table column for the supplied model column. @param \Rhubarb\Stem\Schema\Columns\Column $column @param $label @return DateColumn|ModelColumn
[ "Creates", "the", "correct", "type", "of", "table", "column", "for", "the", "supplied", "model", "column", "." ]
1de09307177cc809ca6b2a50093ccad06ab49e45
https://github.com/RhubarbPHP/Module.Leaf.Table/blob/1de09307177cc809ca6b2a50093ccad06ab49e45/src/Leaves/Columns/ModelColumn.php#L87-L119
train
SagittariusX/Beluga.Translation
src/Beluga/Translation/Source/AbstractSource.php
AbstractSource.getOption
function getOption( string $name, $defaultValue = false ) { if ( ! $this->hasOption( $name ) ) { if ( \is_null( $defaultValue ) ) { return $defaultValue; } $this->_options[ $name ] = $defaultValue; } return $this->_options[ $name ]; }
php
function getOption( string $name, $defaultValue = false ) { if ( ! $this->hasOption( $name ) ) { if ( \is_null( $defaultValue ) ) { return $defaultValue; } $this->_options[ $name ] = $defaultValue; } return $this->_options[ $name ]; }
[ "function", "getOption", "(", "string", "$", "name", ",", "$", "defaultValue", "=", "false", ")", "{", "if", "(", "!", "$", "this", "->", "hasOption", "(", "$", "name", ")", ")", "{", "if", "(", "\\", "is_null", "(", "$", "defaultValue", ")", ")", ...
Gets the option value of option with defined name or FALSE if the option is unknown. @param string $name The name of the option. @param mixed $defaultValue This value is remembered and returned if the option not exists. If the value is NULL the value is not set, it is only returned in this case. @return mixed
[ "Gets", "the", "option", "value", "of", "option", "with", "defined", "name", "or", "FALSE", "if", "the", "option", "is", "unknown", "." ]
8f66c4fef6fa4494413972ca56bd8e13f5a7e444
https://github.com/SagittariusX/Beluga.Translation/blob/8f66c4fef6fa4494413972ca56bd8e13f5a7e444/src/Beluga/Translation/Source/AbstractSource.php#L95-L109
train
koolkode/http
src/HttpRequest.php
HttpRequest.getMethod
public function getMethod($allowOverride = true) { if($allowOverride && $this->methodOverride !== NULL && $this->method == Http::METHOD_POST) { return $this->methodOverride; } return $this->method; }
php
public function getMethod($allowOverride = true) { if($allowOverride && $this->methodOverride !== NULL && $this->method == Http::METHOD_POST) { return $this->methodOverride; } return $this->method; }
[ "public", "function", "getMethod", "(", "$", "allowOverride", "=", "true", ")", "{", "if", "(", "$", "allowOverride", "&&", "$", "this", "->", "methodOverride", "!==", "NULL", "&&", "$", "this", "->", "method", "==", "Http", "::", "METHOD_POST", ")", "{"...
Get the HTTP request method. @param boolean $allowOverride Allow method override in POST request? @return string The name of the HTTP request method being used.
[ "Get", "the", "HTTP", "request", "method", "." ]
3c1626d409d5ce5d71d26f0e8f31ae3683a2a966
https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L109-L117
train
koolkode/http
src/HttpRequest.php
HttpRequest.setMethod
public function setMethod($method) { $method = strtoupper($method); if(!preg_match("'^[A-Z]{2,}$'", $method)) { throw new \InvalidArgumentException(sprintf('Invalid HTTP request method: "%s"', $method)); } $this->method = $method; return $this; }
php
public function setMethod($method) { $method = strtoupper($method); if(!preg_match("'^[A-Z]{2,}$'", $method)) { throw new \InvalidArgumentException(sprintf('Invalid HTTP request method: "%s"', $method)); } $this->method = $method; return $this; }
[ "public", "function", "setMethod", "(", "$", "method", ")", "{", "$", "method", "=", "strtoupper", "(", "$", "method", ")", ";", "if", "(", "!", "preg_match", "(", "\"'^[A-Z]{2,}$'\"", ",", "$", "method", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Set the HTTP request method. @param string $method The name of the HTTP method (uppercase). @return HttpRequest @throws \InvalidArgumentException When the given HTTP method is invalid.
[ "Set", "the", "HTTP", "request", "method", "." ]
3c1626d409d5ce5d71d26f0e8f31ae3683a2a966
https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L127-L139
train
koolkode/http
src/HttpRequest.php
HttpRequest.setMethodOverride
public function setMethodOverride($method = NULL) { if($method === NULL) { $this->methodOverride = NULL; } else { $method = strtoupper($method); if(!preg_match("'^[A-Z]{2,}$'", $method)) { throw new \InvalidArgumentException(sprintf('Invalid HTTP request method: "%s"', $method)); } ...
php
public function setMethodOverride($method = NULL) { if($method === NULL) { $this->methodOverride = NULL; } else { $method = strtoupper($method); if(!preg_match("'^[A-Z]{2,}$'", $method)) { throw new \InvalidArgumentException(sprintf('Invalid HTTP request method: "%s"', $method)); } ...
[ "public", "function", "setMethodOverride", "(", "$", "method", "=", "NULL", ")", "{", "if", "(", "$", "method", "===", "NULL", ")", "{", "$", "this", "->", "methodOverride", "=", "NULL", ";", "}", "else", "{", "$", "method", "=", "strtoupper", "(", "...
Set method override for a POST request. @param string $method The method to be used. @return HttpRequest @throws \InvalidArgumentException When the given HTTP method is invalid.
[ "Set", "method", "override", "for", "a", "POST", "request", "." ]
3c1626d409d5ce5d71d26f0e8f31ae3683a2a966
https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L149-L168
train
koolkode/http
src/HttpRequest.php
HttpRequest.setCookie
public function setCookie($name, $value) { if(!preg_match("'^[a-z_0-9\-\.]+$'i", $name)) { throw new \InvalidArgumentException(sprintf('Invalid cookie name: "%s"', $name)); } $this->cookies[$name] = $value; return $this; }
php
public function setCookie($name, $value) { if(!preg_match("'^[a-z_0-9\-\.]+$'i", $name)) { throw new \InvalidArgumentException(sprintf('Invalid cookie name: "%s"', $name)); } $this->cookies[$name] = $value; return $this; }
[ "public", "function", "setCookie", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "!", "preg_match", "(", "\"'^[a-z_0-9\\-\\.]+$'i\"", ",", "$", "name", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Inva...
Set a cookie value in the request. @param string $name @param mixed $value @return HttpRequest @throws \InvalidArgumentException When an invalid cookie name is passed.
[ "Set", "a", "cookie", "value", "in", "the", "request", "." ]
3c1626d409d5ce5d71d26f0e8f31ae3683a2a966
https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L406-L416
train
koolkode/http
src/HttpRequest.php
HttpRequest.setCookies
public function setCookies(array $cookies) { $this->cookies = []; foreach($cookies as $name => $value) { $this->setCookie($name, $value); } return $this; }
php
public function setCookies(array $cookies) { $this->cookies = []; foreach($cookies as $name => $value) { $this->setCookie($name, $value); } return $this; }
[ "public", "function", "setCookies", "(", "array", "$", "cookies", ")", "{", "$", "this", "->", "cookies", "=", "[", "]", ";", "foreach", "(", "$", "cookies", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "this", "->", "setCookie", "(", "$",...
Set all cookies found in the given array. @param array<string, mixed> $cookies @return HttpRequest
[ "Set", "all", "cookies", "found", "in", "the", "given", "array", "." ]
3c1626d409d5ce5d71d26f0e8f31ae3683a2a966
https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L447-L457
train
MinyFramework/Miny-Core
src/Utils/ArrayUtils.php
ArrayUtils.merge
public static function merge(array $array1, array $array2, $overwrite = true) { foreach ($array2 as $key => $value) { if (isset($array1[$key])) { if (self::isArray($array1[$key]) && self::isArray($value)) { $array1[$key] = self::merge($array1[$key], $value, $o...
php
public static function merge(array $array1, array $array2, $overwrite = true) { foreach ($array2 as $key => $value) { if (isset($array1[$key])) { if (self::isArray($array1[$key]) && self::isArray($value)) { $array1[$key] = self::merge($array1[$key], $value, $o...
[ "public", "static", "function", "merge", "(", "array", "$", "array1", ",", "array", "$", "array2", ",", "$", "overwrite", "=", "true", ")", "{", "foreach", "(", "$", "array2", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "isset", "(",...
Merge two arrays recursively. @param array $array1 @param array $array2 @param bool $overwrite Overwrite value if it exists in $array1. @return array The merged array
[ "Merge", "two", "arrays", "recursively", "." ]
a1bfe801a44a49cf01f16411cb4663473e9c827c
https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/Utils/ArrayUtils.php#L177-L192
train
gplcart/cli
controllers/commands/Order.php
Order.cmdGetOrder
public function cmdGetOrder() { $result = $this->getListOrder(); $this->outputFormat($result); $this->outputFormatTableOrder($result); $this->output(); }
php
public function cmdGetOrder() { $result = $this->getListOrder(); $this->outputFormat($result); $this->outputFormatTableOrder($result); $this->output(); }
[ "public", "function", "cmdGetOrder", "(", ")", "{", "$", "result", "=", "$", "this", "->", "getListOrder", "(", ")", ";", "$", "this", "->", "outputFormat", "(", "$", "result", ")", ";", "$", "this", "->", "outputFormatTableOrder", "(", "$", "result", ...
Callback for "order-get" command
[ "Callback", "for", "order", "-", "get", "command" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Order.php#L40-L46
train
gplcart/cli
controllers/commands/Order.php
Order.cmdAddOrder
public function cmdAddOrder() { $submitted = $this->getParam(); $this->setSubmitted(null, $submitted); $this->setSubmittedJson('data'); $this->validateComponent('order'); if ($this->isError()) { $this->output(); } $id = $this->order->add($this-...
php
public function cmdAddOrder() { $submitted = $this->getParam(); $this->setSubmitted(null, $submitted); $this->setSubmittedJson('data'); $this->validateComponent('order'); if ($this->isError()) { $this->output(); } $id = $this->order->add($this-...
[ "public", "function", "cmdAddOrder", "(", ")", "{", "$", "submitted", "=", "$", "this", "->", "getParam", "(", ")", ";", "$", "this", "->", "setSubmitted", "(", "null", ",", "$", "submitted", ")", ";", "$", "this", "->", "setSubmittedJson", "(", "'data...
Callback for "order-add" command
[ "Callback", "for", "order", "-", "add", "command" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Order.php#L105-L126
train
gplcart/cli
controllers/commands/Order.php
Order.cmdUpdateOrder
public function cmdUpdateOrder() { $params = $this->getParam(); if (empty($params[0]) || count($params) < 2) { $this->errorAndExit($this->text('Invalid command')); } if (!is_numeric($params[0])) { $this->errorAndExit($this->text('Invalid argument')); ...
php
public function cmdUpdateOrder() { $params = $this->getParam(); if (empty($params[0]) || count($params) < 2) { $this->errorAndExit($this->text('Invalid command')); } if (!is_numeric($params[0])) { $this->errorAndExit($this->text('Invalid argument')); ...
[ "public", "function", "cmdUpdateOrder", "(", ")", "{", "$", "params", "=", "$", "this", "->", "getParam", "(", ")", ";", "if", "(", "empty", "(", "$", "params", "[", "0", "]", ")", "||", "count", "(", "$", "params", ")", "<", "2", ")", "{", "$"...
Callback for "order-update" command
[ "Callback", "for", "order", "-", "update", "command" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Order.php#L131-L158
train
dubhunter/talon
src/Mvc/View/Template.php
Template.set
public function set($key, $value) { $this->validateValue($value); $this->variables[$key] = $value; }
php
public function set($key, $value) { $this->validateValue($value); $this->variables[$key] = $value; }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "validateValue", "(", "$", "value", ")", ";", "$", "this", "->", "variables", "[", "$", "key", "]", "=", "$", "value", ";", "}" ]
Set a given key to a view value @param string $key The key to set @param string $value The value to set @return void
[ "Set", "a", "given", "key", "to", "a", "view", "value" ]
308b7284556dfaff0d9ac4c7739dc6a46930ef36
https://github.com/dubhunter/talon/blob/308b7284556dfaff0d9ac4c7739dc6a46930ef36/src/Mvc/View/Template.php#L44-L47
train
dubhunter/talon
src/Mvc/View/Template.php
Template.add
public function add($key, $value) { $this->validateValue($value); if (!isset($this->variables[$key])) { $this->variables[$key] = []; } if (!is_array($this->variables[$key])) { $this->variables[$key] = [$this->variables[$key]]; } $this->variables[$key][] = $value; }
php
public function add($key, $value) { $this->validateValue($value); if (!isset($this->variables[$key])) { $this->variables[$key] = []; } if (!is_array($this->variables[$key])) { $this->variables[$key] = [$this->variables[$key]]; } $this->variables[$key][] = $value; }
[ "public", "function", "add", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "validateValue", "(", "$", "value", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "variables", "[", "$", "key", "]", ")", ")", "{", "$", ...
Adds a value to a collection, collection will be created if it does not already exist @param string $key The collection key @param $value
[ "Adds", "a", "value", "to", "a", "collection", "collection", "will", "be", "created", "if", "it", "does", "not", "already", "exist" ]
308b7284556dfaff0d9ac4c7739dc6a46930ef36
https://github.com/dubhunter/talon/blob/308b7284556dfaff0d9ac4c7739dc6a46930ef36/src/Mvc/View/Template.php#L54-L65
train
OxfordInfoLabs/kinikit-core
src/Util/Annotation/ClassAnnotations.php
ClassAnnotations.getMethodAnnotationsForMatchingTag
public function getMethodAnnotationsForMatchingTag($tag, $methodName = null) { if ($methodName) { return isset($this->methodAnnotations[$methodName][$tag]) ? $this->methodAnnotations[$methodName][$tag] : array(); } else { $matchingAnnotations = array(); foreach ($this...
php
public function getMethodAnnotationsForMatchingTag($tag, $methodName = null) { if ($methodName) { return isset($this->methodAnnotations[$methodName][$tag]) ? $this->methodAnnotations[$methodName][$tag] : array(); } else { $matchingAnnotations = array(); foreach ($this...
[ "public", "function", "getMethodAnnotationsForMatchingTag", "(", "$", "tag", ",", "$", "methodName", "=", "null", ")", "{", "if", "(", "$", "methodName", ")", "{", "return", "isset", "(", "$", "this", "->", "methodAnnotations", "[", "$", "methodName", "]", ...
Get any method annotations with a matching tag. Return these indexed by field name. @param $tag @param $methodName @return null
[ "Get", "any", "method", "annotations", "with", "a", "matching", "tag", ".", "Return", "these", "indexed", "by", "field", "name", "." ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotations.php#L110-L123
train
OxfordInfoLabs/kinikit-core
src/Util/Annotation/ClassAnnotations.php
ClassAnnotations.getFieldAnnotationsForMatchingTag
public function getFieldAnnotationsForMatchingTag($tag, $fieldName = null) { if ($fieldName) { return isset($this->fieldAnnotations[$fieldName][$tag]) ? $this->fieldAnnotations[$fieldName][$tag] : array(); } else { $matchingAnnotations = array(); foreach ($this->get...
php
public function getFieldAnnotationsForMatchingTag($tag, $fieldName = null) { if ($fieldName) { return isset($this->fieldAnnotations[$fieldName][$tag]) ? $this->fieldAnnotations[$fieldName][$tag] : array(); } else { $matchingAnnotations = array(); foreach ($this->get...
[ "public", "function", "getFieldAnnotationsForMatchingTag", "(", "$", "tag", ",", "$", "fieldName", "=", "null", ")", "{", "if", "(", "$", "fieldName", ")", "{", "return", "isset", "(", "$", "this", "->", "fieldAnnotations", "[", "$", "fieldName", "]", "[",...
Get any field annotations with a matching tag. Return these indexed by field name. @param $string
[ "Get", "any", "field", "annotations", "with", "a", "matching", "tag", ".", "Return", "these", "indexed", "by", "field", "name", "." ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotations.php#L131-L147
train
OxfordInfoLabs/kinikit-core
src/Util/Annotation/ClassAnnotations.php
ClassAnnotations.getFieldAnnotationsContainingMatchingTag
public function getFieldAnnotationsContainingMatchingTag($tag) { $matchingAnnotations = array(); foreach ($this->getFieldAnnotations() as $field => $fieldAnnotations) { if (isset($fieldAnnotations[$tag])) { $matchingAnnotations[$field] = $fieldAnnotations; } ...
php
public function getFieldAnnotationsContainingMatchingTag($tag) { $matchingAnnotations = array(); foreach ($this->getFieldAnnotations() as $field => $fieldAnnotations) { if (isset($fieldAnnotations[$tag])) { $matchingAnnotations[$field] = $fieldAnnotations; } ...
[ "public", "function", "getFieldAnnotationsContainingMatchingTag", "(", "$", "tag", ")", "{", "$", "matchingAnnotations", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getFieldAnnotations", "(", ")", "as", "$", "field", "=>", "$", "fieldAnnot...
Get the full set of field annotations for any fields containing a tag. @param $tag
[ "Get", "the", "full", "set", "of", "field", "annotations", "for", "any", "fields", "containing", "a", "tag", "." ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotations.php#L155-L165
train
OxfordInfoLabs/kinikit-core
src/Util/Annotation/ClassAnnotations.php
ClassAnnotations.getFieldAnnotationsNotContainingTags
public function getFieldAnnotationsNotContainingTags($tags = array()) { $matchingAnnotations = array(); foreach ($this->getFieldAnnotations() as $field => $fieldAnnotations) { $fieldAnnotationKeys = array_keys($fieldAnnotations); if (!array_intersect($fieldAnnotationKeys, $tags)...
php
public function getFieldAnnotationsNotContainingTags($tags = array()) { $matchingAnnotations = array(); foreach ($this->getFieldAnnotations() as $field => $fieldAnnotations) { $fieldAnnotationKeys = array_keys($fieldAnnotations); if (!array_intersect($fieldAnnotationKeys, $tags)...
[ "public", "function", "getFieldAnnotationsNotContainingTags", "(", "$", "tags", "=", "array", "(", ")", ")", "{", "$", "matchingAnnotations", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getFieldAnnotations", "(", ")", "as", "$", "field",...
Get all field annotations not containing passed tags. @param array $tags @return array
[ "Get", "all", "field", "annotations", "not", "containing", "passed", "tags", "." ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotations.php#L174-L185
train
SCLInternet/SclZfGenericMapper
src/SclZfGenericMapper/Exception/InvalidArgumentException.php
InvalidArgumentException.invalidEntityType
public static function invalidEntityType($expected, $actual) { return new self(sprintf( 'Entity must be an instance of "%s"; got "%s".', $expected, is_object($actual) ? get_class($actual) : gettype($actual) )); }
php
public static function invalidEntityType($expected, $actual) { return new self(sprintf( 'Entity must be an instance of "%s"; got "%s".', $expected, is_object($actual) ? get_class($actual) : gettype($actual) )); }
[ "public", "static", "function", "invalidEntityType", "(", "$", "expected", ",", "$", "actual", ")", "{", "return", "new", "self", "(", "sprintf", "(", "'Entity must be an instance of \"%s\"; got \"%s\".'", ",", "$", "expected", ",", "is_object", "(", "$", "actual"...
'Entity must be an instance of "%s"; got "%s".' @param string $expected @param object $actual @return InvalidArgumentException
[ "Entity", "must", "be", "an", "instance", "of", "%s", ";", "got", "%s", "." ]
c61c61546bfbc07e9c9a4b425e8e02fd7182d80b
https://github.com/SCLInternet/SclZfGenericMapper/blob/c61c61546bfbc07e9c9a4b425e8e02fd7182d80b/src/SclZfGenericMapper/Exception/InvalidArgumentException.php#L26-L33
train
jenskooij/cloudcontrol
src/storage/factories/DocumentFolderFactory.php
DocumentFolderFactory.createDocumentFolderFromPostValues
public static function createDocumentFolderFromPostValues($postValues) { if (isset($postValues['title'], $postValues['path'], $postValues['content'])) { $documentFolderObject = new Document(); $documentFolderObject->title = $postValues['title']; $documentFolderObject->slu...
php
public static function createDocumentFolderFromPostValues($postValues) { if (isset($postValues['title'], $postValues['path'], $postValues['content'])) { $documentFolderObject = new Document(); $documentFolderObject->title = $postValues['title']; $documentFolderObject->slu...
[ "public", "static", "function", "createDocumentFolderFromPostValues", "(", "$", "postValues", ")", "{", "if", "(", "isset", "(", "$", "postValues", "[", "'title'", "]", ",", "$", "postValues", "[", "'path'", "]", ",", "$", "postValues", "[", "'content'", "]"...
Create folder from post values @param $postValues @return Document @throws \Exception
[ "Create", "folder", "from", "post", "values" ]
76e5d9ac8f9c50d06d39a995d13cc03742536548
https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/factories/DocumentFolderFactory.php#L24-L37
train
zhaoxianfang/tools
src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PropertyTrait.php
PropertyTrait.property
final public function property($name, $value) { $this->definition->setProperty($name, static::processValue($value, true)); return $this; }
php
final public function property($name, $value) { $this->definition->setProperty($name, static::processValue($value, true)); return $this; }
[ "final", "public", "function", "property", "(", "$", "name", ",", "$", "value", ")", "{", "$", "this", "->", "definition", "->", "setProperty", "(", "$", "name", ",", "static", "::", "processValue", "(", "$", "value", ",", "true", ")", ")", ";", "ret...
Sets a specific property. @param string $name @param mixed $value @return $this
[ "Sets", "a", "specific", "property", "." ]
d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7
https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PropertyTrait.php#L24-L29
train
mossphp/moss-storage
Moss/Storage/Query/InsertQuery.php
InsertQuery.assignValue
protected function assignValue(FieldInterface $field) { $value = $this->accessor->getPropertyValue($this->instance, $field->name()); if ($value === null && $field->attribute('autoincrement')) { return; } if ($value === null) { $this->getValueFromReferencedEn...
php
protected function assignValue(FieldInterface $field) { $value = $this->accessor->getPropertyValue($this->instance, $field->name()); if ($value === null && $field->attribute('autoincrement')) { return; } if ($value === null) { $this->getValueFromReferencedEn...
[ "protected", "function", "assignValue", "(", "FieldInterface", "$", "field", ")", "{", "$", "value", "=", "$", "this", "->", "accessor", "->", "getPropertyValue", "(", "$", "this", "->", "instance", ",", "$", "field", "->", "name", "(", ")", ")", ";", ...
Assigns value to query @param FieldInterface $field
[ "Assigns", "value", "to", "query" ]
0d123e7ae6bbfce1e2a18e73bf70997277b430c1
https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/InsertQuery.php#L69-L85
train
ZendExperts/phpids
lib/IDS/Log/Composite.php
IDS_Log_Composite.execute
public function execute(IDS_Report $data) { // make sure request uri is set right on IIS if (!isset($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1); if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) { $_SERVE...
php
public function execute(IDS_Report $data) { // make sure request uri is set right on IIS if (!isset($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1); if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) { $_SERVE...
[ "public", "function", "execute", "(", "IDS_Report", "$", "data", ")", "{", "// make sure request uri is set right on IIS", "if", "(", "!", "isset", "(", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ")", ")", "{", "$", "_SERVER", "[", "'REQUEST_URI'", "]", "=", ...
Iterates through registered loggers and executes them @param object $data IDS_Report object @return void
[ "Iterates", "through", "registered", "loggers", "and", "executes", "them" ]
f30df04eea47b94d056e2ae9ec8fea1c626f1c03
https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Log/Composite.php#L69-L87
train
ZendExperts/phpids
lib/IDS/Log/Composite.php
IDS_Log_Composite.addLogger
public function addLogger() { $args = func_get_args(); foreach ($args as $class) { if (!in_array($class, $this->loggers) && ($class instanceof IDS_Log_Interface)) { $this->loggers[] = $class; } } }
php
public function addLogger() { $args = func_get_args(); foreach ($args as $class) { if (!in_array($class, $this->loggers) && ($class instanceof IDS_Log_Interface)) { $this->loggers[] = $class; } } }
[ "public", "function", "addLogger", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "foreach", "(", "$", "args", "as", "$", "class", ")", "{", "if", "(", "!", "in_array", "(", "$", "class", ",", "$", "this", "->", "loggers", ")", ...
Registers a new logging wrapper Only valid IDS_Log_Interface instances passed to this function will be registered @return void
[ "Registers", "a", "new", "logging", "wrapper" ]
f30df04eea47b94d056e2ae9ec8fea1c626f1c03
https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Log/Composite.php#L97-L108
train
ZendExperts/phpids
lib/IDS/Log/Composite.php
IDS_Log_Composite.removeLogger
public function removeLogger(IDS_Log_Interface $logger) { $key = array_search($logger, $this->loggers); if (isset($this->loggers[$key])) { unset($this->loggers[$key]); return true; } return false; }
php
public function removeLogger(IDS_Log_Interface $logger) { $key = array_search($logger, $this->loggers); if (isset($this->loggers[$key])) { unset($this->loggers[$key]); return true; } return false; }
[ "public", "function", "removeLogger", "(", "IDS_Log_Interface", "$", "logger", ")", "{", "$", "key", "=", "array_search", "(", "$", "logger", ",", "$", "this", "->", "loggers", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "loggers", "[", "$", ...
Removes a logger @param object $logger IDS_Log_Interface object @return boolean
[ "Removes", "a", "logger" ]
f30df04eea47b94d056e2ae9ec8fea1c626f1c03
https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Log/Composite.php#L117-L127
train
libreworks/caridea-validate
src/Parser.php
Parser.parse
public function parse($rules): Rule\Set { $isArray = is_array($rules); $isAssoc = $isArray && self::isAssociative($rules); $set = null; if (is_string($rules) || is_object($rules) || $isAssoc) { $set = $this->getRule($rules); } elseif ($isArray) { forea...
php
public function parse($rules): Rule\Set { $isArray = is_array($rules); $isAssoc = $isArray && self::isAssociative($rules); $set = null; if (is_string($rules) || is_object($rules) || $isAssoc) { $set = $this->getRule($rules); } elseif ($isArray) { forea...
[ "public", "function", "parse", "(", "$", "rules", ")", ":", "Rule", "\\", "Set", "{", "$", "isArray", "=", "is_array", "(", "$", "rules", ")", ";", "$", "isAssoc", "=", "$", "isArray", "&&", "self", "::", "isAssociative", "(", "$", "rules", ")", ";...
Turns a number of rule definitions into an actual Rule Set. @param string|object|array $rules The rules to parse @return \Caridea\Validate\Rule\Set The set of Rules
[ "Turns", "a", "number", "of", "rule", "definitions", "into", "an", "actual", "Rule", "Set", "." ]
625835694d34591bfb1e3b2ce60c2cc28a28d006
https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Parser.php#L62-L76
train
libreworks/caridea-validate
src/Parser.php
Parser.getRule
public function getRule($rule, $arg = null): Rule\Set { $rules = new Rule\Set(); if (is_string($rule)) { $vrule = $this->registry->factory($rule, $arg); if ($vrule instanceof Draft) { $vrule = $vrule->finish($this->registry); } $rules->...
php
public function getRule($rule, $arg = null): Rule\Set { $rules = new Rule\Set(); if (is_string($rule)) { $vrule = $this->registry->factory($rule, $arg); if ($vrule instanceof Draft) { $vrule = $vrule->finish($this->registry); } $rules->...
[ "public", "function", "getRule", "(", "$", "rule", ",", "$", "arg", "=", "null", ")", ":", "Rule", "\\", "Set", "{", "$", "rules", "=", "new", "Rule", "\\", "Set", "(", ")", ";", "if", "(", "is_string", "(", "$", "rule", ")", ")", "{", "$", "...
Parses rule definitions. @param string|object|array $rule Either a string name, an associative array, or an object with name → arguments @param mixed $arg Optional constructor argument, or an array of arguments @return \Caridea\Validate\Rule\Set An set of instantiated rules
[ "Parses", "rule", "definitions", "." ]
625835694d34591bfb1e3b2ce60c2cc28a28d006
https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Parser.php#L86-L101
train
OxfordInfoLabs/kinikit-core
src/Template/Parser/PHPTemplateParser.php
PHPTemplateParser.parseTemplateText
public function parseTemplateText($viewText, &$model) { // Extract all template parameters into scope. extract($model); // Store defined variables before we evaluate $preVariables = get_defined_vars() ? get_defined_vars() : array(); unset($preVariables["model"]); // No...
php
public function parseTemplateText($viewText, &$model) { // Extract all template parameters into scope. extract($model); // Store defined variables before we evaluate $preVariables = get_defined_vars() ? get_defined_vars() : array(); unset($preVariables["model"]); // No...
[ "public", "function", "parseTemplateText", "(", "$", "viewText", ",", "&", "$", "model", ")", "{", "// Extract all template parameters into scope.", "extract", "(", "$", "model", ")", ";", "// Store defined variables before we evaluate", "$", "preVariables", "=", "get_d...
Parse the view as PHP. This also allows for new variables to be defined within a view and as such these will be merged into the model for use in a parent view if required. @param $viewText @param $model
[ "Parse", "the", "view", "as", "PHP", ".", "This", "also", "allows", "for", "new", "variables", "to", "be", "defined", "within", "a", "view", "and", "as", "such", "these", "will", "be", "merged", "into", "the", "model", "for", "use", "in", "a", "parent"...
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Template/Parser/PHPTemplateParser.php#L22-L48
train
modulusphp/security
Hash.php
Hash.random
public static function random(int $length = 10, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') : string { $pieces = []; $max = mb_strlen($keyspace, '8bit') - 1; for ($i = 0; $i < $length; ++$i) { $pieces[] = $keyspace[random_int(0, $max)]; } return implo...
php
public static function random(int $length = 10, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') : string { $pieces = []; $max = mb_strlen($keyspace, '8bit') - 1; for ($i = 0; $i < $length; ++$i) { $pieces[] = $keyspace[random_int(0, $max)]; } return implo...
[ "public", "static", "function", "random", "(", "int", "$", "length", "=", "10", ",", "string", "$", "keyspace", "=", "'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'", ")", ":", "string", "{", "$", "pieces", "=", "[", "]", ";", "$", "max", "="...
Creating a random string @param int $length @param string $keyspace @return string
[ "Creating", "a", "random", "string" ]
7a0b7f7a23f682588a3582b810d61266f7c14567
https://github.com/modulusphp/security/blob/7a0b7f7a23f682588a3582b810d61266f7c14567/Hash.php#L35-L43
train
modulusphp/security
Hash.php
Hash.safe
public static function safe(string $string) : string { $split = str_split($string); foreach($split as $k => $char) { if (str_contains('~!@#$%^&*()_-=+<>/\?;:{}[]|,.', $char)) { unset($split[$k]); } } return implode('', $split); }
php
public static function safe(string $string) : string { $split = str_split($string); foreach($split as $k => $char) { if (str_contains('~!@#$%^&*()_-=+<>/\?;:{}[]|,.', $char)) { unset($split[$k]); } } return implode('', $split); }
[ "public", "static", "function", "safe", "(", "string", "$", "string", ")", ":", "string", "{", "$", "split", "=", "str_split", "(", "$", "string", ")", ";", "foreach", "(", "$", "split", "as", "$", "k", "=>", "$", "char", ")", "{", "if", "(", "st...
Remove special char's from string @param string $string @return string
[ "Remove", "special", "char", "s", "from", "string" ]
7a0b7f7a23f682588a3582b810d61266f7c14567
https://github.com/modulusphp/security/blob/7a0b7f7a23f682588a3582b810d61266f7c14567/Hash.php#L69-L80
train
rzajac/phptools
src/Helper/Arr.php
Arr.range
public static function range($max, $start = 1, $step = 1) { if ($step < 1) { return []; } $array = []; for ($i = $start; $i <= $max; $i += $step) { $array[] = $i; } return $array; }
php
public static function range($max, $start = 1, $step = 1) { if ($step < 1) { return []; } $array = []; for ($i = $start; $i <= $max; $i += $step) { $array[] = $i; } return $array; }
[ "public", "static", "function", "range", "(", "$", "max", ",", "$", "start", "=", "1", ",", "$", "step", "=", "1", ")", "{", "if", "(", "$", "step", "<", "1", ")", "{", "return", "[", "]", ";", "}", "$", "array", "=", "[", "]", ";", "for", ...
Fill an array with a range of numbers. @param int $max The maximum ending number @param int $start The start number @param int $step The stepping @return array
[ "Fill", "an", "array", "with", "a", "range", "of", "numbers", "." ]
3cbece7645942d244603c14ba897d8a676ee3088
https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Helper/Arr.php#L92-L104
train
rzajac/phptools
src/Helper/Arr.php
Arr.fetch
public static function fetch($array, $path, $default = null) { // $array must be an array if (!is_array($array)) { return $default; } if ($path === '') { return $array; } $path = is_array($path) ? $path : explode('.', $path); $levels ...
php
public static function fetch($array, $path, $default = null) { // $array must be an array if (!is_array($array)) { return $default; } if ($path === '') { return $array; } $path = is_array($path) ? $path : explode('.', $path); $levels ...
[ "public", "static", "function", "fetch", "(", "$", "array", ",", "$", "path", ",", "$", "default", "=", "null", ")", "{", "// $array must be an array", "if", "(", "!", "is_array", "(", "$", "array", ")", ")", "{", "return", "$", "default", ";", "}", ...
Fetch nested array value by dot notation path. Arr::fetch('key1.key2', $arr); @param array $array The array to get value from. @param string|array $path The key in dot notation. You can also pass array with keys. @param mixed $default The default value if key does not exist. @return mixed
[ "Fetch", "nested", "array", "value", "by", "dot", "notation", "path", "." ]
3cbece7645942d244603c14ba897d8a676ee3088
https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Helper/Arr.php#L135-L167
train
ekyna/Resource
Model/TranslationTrait.php
TranslationTrait.setTranslatable
public function setTranslatable(TranslatableInterface $translatable = null) { if ($translatable === $this->translatable) { return $this; } $previousTranslatable = $this->translatable; $this->translatable = $translatable; /** @var TranslationInterface $this */ ...
php
public function setTranslatable(TranslatableInterface $translatable = null) { if ($translatable === $this->translatable) { return $this; } $previousTranslatable = $this->translatable; $this->translatable = $translatable; /** @var TranslationInterface $this */ ...
[ "public", "function", "setTranslatable", "(", "TranslatableInterface", "$", "translatable", "=", "null", ")", "{", "if", "(", "$", "translatable", "===", "$", "this", "->", "translatable", ")", "{", "return", "$", "this", ";", "}", "$", "previousTranslatable",...
Sets the translatable. @param TranslatableInterface $translatable @return TranslationInterface|$this
[ "Sets", "the", "translatable", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Model/TranslationTrait.php#L29-L48
train
MetaModels/phpunit-contao-database
src/Contao/Database/FakeQuery.php
FakeQuery.escapeParameters
protected function escapeParameters() { $parameters = $this->parameters; foreach ($parameters as $k => $v) { switch (gettype($v)) { case 'string': $parameters[$k] = $this->stringEscape($v); break; case 'boolean': ...
php
protected function escapeParameters() { $parameters = $this->parameters; foreach ($parameters as $k => $v) { switch (gettype($v)) { case 'string': $parameters[$k] = $this->stringEscape($v); break; case 'boolean': ...
[ "protected", "function", "escapeParameters", "(", ")", "{", "$", "parameters", "=", "$", "this", "->", "parameters", ";", "foreach", "(", "$", "parameters", "as", "$", "k", "=>", "$", "v", ")", "{", "switch", "(", "gettype", "(", "$", "v", ")", ")", ...
Escape the parameters and return them. @return array
[ "Escape", "the", "parameters", "and", "return", "them", "." ]
aeb2ee10dac532fa73e2deb6457b6a167a1c01c7
https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeQuery.php#L164-L192
train
MetaModels/phpunit-contao-database
src/Contao/Database/FakeQuery.php
FakeQuery.compileQuery
protected function compileQuery() { $query = $this->sql; // Auto-generate the SET/VALUES subpart if (strncasecmp($query, 'INSERT', 6) === 0 || strncasecmp($query, 'UPDATE', 6) === 0) { $query = str_replace('%s', '%p', $query); } // Replace wildcards $chu...
php
protected function compileQuery() { $query = $this->sql; // Auto-generate the SET/VALUES subpart if (strncasecmp($query, 'INSERT', 6) === 0 || strncasecmp($query, 'UPDATE', 6) === 0) { $query = str_replace('%s', '%p', $query); } // Replace wildcards $chu...
[ "protected", "function", "compileQuery", "(", ")", "{", "$", "query", "=", "$", "this", "->", "sql", ";", "// Auto-generate the SET/VALUES subpart", "if", "(", "strncasecmp", "(", "$", "query", ",", "'INSERT'", ",", "6", ")", "===", "0", "||", "strncasecmp",...
Compile the query into a string. @return void @throws \Exception When the arguments do not match the query.
[ "Compile", "the", "query", "into", "a", "string", "." ]
aeb2ee10dac532fa73e2deb6457b6a167a1c01c7
https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeQuery.php#L201-L232
train
MetaModels/phpunit-contao-database
src/Contao/Database/FakeQuery.php
FakeQuery.matches
public function matches($sqlQuery) { if (empty($this->compiledQuery)) { $this->compileQuery(); } return $sqlQuery === $this->compiledQuery; }
php
public function matches($sqlQuery) { if (empty($this->compiledQuery)) { $this->compileQuery(); } return $sqlQuery === $this->compiledQuery; }
[ "public", "function", "matches", "(", "$", "sqlQuery", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "compiledQuery", ")", ")", "{", "$", "this", "->", "compileQuery", "(", ")", ";", "}", "return", "$", "sqlQuery", "===", "$", "this", "->", ...
Check if the query matches against the query and parameters. @param string $sqlQuery The query to match against. @return bool
[ "Check", "if", "the", "query", "matches", "against", "the", "query", "and", "parameters", "." ]
aeb2ee10dac532fa73e2deb6457b6a167a1c01c7
https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeQuery.php#L241-L248
train
bfansports/CloudProcessingEngine-Client-SDK-PHP
src/SA/CpeClientSdk.php
CpeClientSdk.receive_message
public function receive_message($client, $timeout) { $decodedClient = is_object($client) ? $client : json_decode($client); $queue = $decodedClient->{'queues'}->{'output'}; if ($this->debug) $this->log_out( "DEBUG", "Polling from '$queue' ..." ...
php
public function receive_message($client, $timeout) { $decodedClient = is_object($client) ? $client : json_decode($client); $queue = $decodedClient->{'queues'}->{'output'}; if ($this->debug) $this->log_out( "DEBUG", "Polling from '$queue' ..." ...
[ "public", "function", "receive_message", "(", "$", "client", ",", "$", "timeout", ")", "{", "$", "decodedClient", "=", "is_object", "(", "$", "client", ")", "?", "$", "client", ":", "json_decode", "(", "$", "client", ")", ";", "$", "queue", "=", "$", ...
Poll for incoming SQS messages using this method. Call this method in a loop in your client application. If a new message is polled, it is returned to the caller. @param string|object $client JSON string or PHP Object created using json_decode. This contains your client SQS configuration which list your application `...
[ "Poll", "for", "incoming", "SQS", "messages", "using", "this", "method", "." ]
f6336a53da81d1a1b4b7079dd4280344db452e67
https://github.com/bfansports/CloudProcessingEngine-Client-SDK-PHP/blob/f6336a53da81d1a1b4b7079dd4280344db452e67/src/SA/CpeClientSdk.php#L118-L149
train
bfansports/CloudProcessingEngine-Client-SDK-PHP
src/SA/CpeClientSdk.php
CpeClientSdk.delete_message
public function delete_message($client, $msg) { $decodedClient = is_object($client) ? $client : json_decode($client); $this->sqs->deleteMessage(array( 'QueueUrl' => $decodedClient->{'queues'}->{'output'}, 'ReceiptHandle' => $msg['ReceiptHandle'])); ...
php
public function delete_message($client, $msg) { $decodedClient = is_object($client) ? $client : json_decode($client); $this->sqs->deleteMessage(array( 'QueueUrl' => $decodedClient->{'queues'}->{'output'}, 'ReceiptHandle' => $msg['ReceiptHandle'])); ...
[ "public", "function", "delete_message", "(", "$", "client", ",", "$", "msg", ")", "{", "$", "decodedClient", "=", "is_object", "(", "$", "client", ")", "?", "$", "client", ":", "json_decode", "(", "$", "client", ")", ";", "$", "this", "->", "sqs", "-...
Delete the provided message from the SQS queue Call this method from your client application after receiving a message You must clean the SQS yourself, or you will keep processing the same messages @param string|object $client JSON string or PHP Object created using json_decode. This contains your client SQS configur...
[ "Delete", "the", "provided", "message", "from", "the", "SQS", "queue" ]
f6336a53da81d1a1b4b7079dd4280344db452e67
https://github.com/bfansports/CloudProcessingEngine-Client-SDK-PHP/blob/f6336a53da81d1a1b4b7079dd4280344db452e67/src/SA/CpeClientSdk.php#L162-L170
train
bfansports/CloudProcessingEngine-Client-SDK-PHP
src/SA/CpeClientSdk.php
CpeClientSdk.start_job
public function start_job($client, $input, $jobId = null) { $decodedClient = is_object($client) ? $client : json_decode($client); $decodedInput = is_object($input) ? $input : json_decode($input); if (!$decodedClient) { throw new \InvalidArgumentException( "Invali...
php
public function start_job($client, $input, $jobId = null) { $decodedClient = is_object($client) ? $client : json_decode($client); $decodedInput = is_object($input) ? $input : json_decode($input); if (!$decodedClient) { throw new \InvalidArgumentException( "Invali...
[ "public", "function", "start_job", "(", "$", "client", ",", "$", "input", ",", "$", "jobId", "=", "null", ")", "{", "$", "decodedClient", "=", "is_object", "(", "$", "client", ")", "?", "$", "client", ":", "json_decode", "(", "$", "client", ")", ";",...
Send a `start_job` command to CPE Call this method from your client application to start a new job. You can pass an object or a JSON string as input payload. You can also specify your own jobId, or it will generate it for you. @param string|object $client JSON string or PHP Object created using json_decode. This cont...
[ "Send", "a", "start_job", "command", "to", "CPE" ]
f6336a53da81d1a1b4b7079dd4280344db452e67
https://github.com/bfansports/CloudProcessingEngine-Client-SDK-PHP/blob/f6336a53da81d1a1b4b7079dd4280344db452e67/src/SA/CpeClientSdk.php#L186-L216
train
bfansports/CloudProcessingEngine-Client-SDK-PHP
src/SA/CpeClientSdk.php
CpeClientSdk.craft_new_msg
private function craft_new_msg($type, $jobId, $client, $data) { // Add client info to data $data->{'client'} = $client; // Build msg to send out $msg = array( 'time' => microtime(true), 'type' => $type, 'jobId' => $jobId, 'data' ...
php
private function craft_new_msg($type, $jobId, $client, $data) { // Add client info to data $data->{'client'} = $client; // Build msg to send out $msg = array( 'time' => microtime(true), 'type' => $type, 'jobId' => $jobId, 'data' ...
[ "private", "function", "craft_new_msg", "(", "$", "type", ",", "$", "jobId", ",", "$", "client", ",", "$", "data", ")", "{", "// Add client info to data", "$", "data", "->", "{", "'client'", "}", "=", "$", "client", ";", "// Build msg to send out", "$", "m...
Craft the object to be sent out to SQS @param string $type Type of CPE command you send @param string $jobId Job ID for the command @param string $data Data payload to be sent out
[ "Craft", "the", "object", "to", "be", "sent", "out", "to", "SQS" ]
f6336a53da81d1a1b4b7079dd4280344db452e67
https://github.com/bfansports/CloudProcessingEngine-Client-SDK-PHP/blob/f6336a53da81d1a1b4b7079dd4280344db452e67/src/SA/CpeClientSdk.php#L244-L257
train
bfansports/CloudProcessingEngine-Client-SDK-PHP
src/SA/CpeClientSdk.php
CpeClientSdk.validate_client
private function validate_client($client) { if (!isset($client->{"name"})) throw new \Exception("'client' has no 'name'!"); if (!isset($client->{"queues"})) throw new \Exception("'client' has no 'queues'!"); if (!isset($client->{"queues"}->{'input'})) thro...
php
private function validate_client($client) { if (!isset($client->{"name"})) throw new \Exception("'client' has no 'name'!"); if (!isset($client->{"queues"})) throw new \Exception("'client' has no 'queues'!"); if (!isset($client->{"queues"}->{'input'})) thro...
[ "private", "function", "validate_client", "(", "$", "client", ")", "{", "if", "(", "!", "isset", "(", "$", "client", "->", "{", "\"name\"", "}", ")", ")", "throw", "new", "\\", "Exception", "(", "\"'client' has no 'name'!\"", ")", ";", "if", "(", "!", ...
Validate Client object structure @param string|object $client JSON string or PHP Object created using json_decode. This contains your client SQS configuration which list your application `input` and `output` queues.
[ "Validate", "Client", "object", "structure" ]
f6336a53da81d1a1b4b7079dd4280344db452e67
https://github.com/bfansports/CloudProcessingEngine-Client-SDK-PHP/blob/f6336a53da81d1a1b4b7079dd4280344db452e67/src/SA/CpeClientSdk.php#L264-L274
train
SagittariusX/Beluga.Drawing
src/Beluga/Drawing/ColorTool.php
ColorTool.Color2Rgb
public static function Color2Rgb( $colorDefinition ) { if ( \is_array( $colorDefinition ) ) { if ( \count( $colorDefinition ) > 2 && \count( $colorDefinition ) < 5 ) { return $colorDefinition; } throw new ArgumentError( 'colorDefinition', ...
php
public static function Color2Rgb( $colorDefinition ) { if ( \is_array( $colorDefinition ) ) { if ( \count( $colorDefinition ) > 2 && \count( $colorDefinition ) < 5 ) { return $colorDefinition; } throw new ArgumentError( 'colorDefinition', ...
[ "public", "static", "function", "Color2Rgb", "(", "$", "colorDefinition", ")", "{", "if", "(", "\\", "is_array", "(", "$", "colorDefinition", ")", ")", "{", "if", "(", "\\", "count", "(", "$", "colorDefinition", ")", ">", "2", "&&", "\\", "count", "(",...
Converts the defined color into a RGB color definition (a numeric indicated array 0=R 1=G 2=B @param string|array $colorDefinition Color name or hexadecimal color definition @return array Or boolean FALSE @throws \Beluga\ArgumentError
[ "Converts", "the", "defined", "color", "into", "a", "RGB", "color", "definition", "(", "a", "numeric", "indicated", "array", "0", "=", "R", "1", "=", "G", "2", "=", "B" ]
9c82874cf4ec68cb0af78757b65f19783540004a
https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/ColorTool.php#L198-L234
train
SagittariusX/Beluga.Drawing
src/Beluga/Drawing/ColorTool.php
ColorTool.Color2Hex
public static function Color2Hex( $colorDefinition ) { if ( \is_array( $colorDefinition ) ) { if ( \count( $colorDefinition ) != 3 ) { throw new ArgumentError( 'colorDefinition', $colorDefinition, 'Drawing', 'A rgb...
php
public static function Color2Hex( $colorDefinition ) { if ( \is_array( $colorDefinition ) ) { if ( \count( $colorDefinition ) != 3 ) { throw new ArgumentError( 'colorDefinition', $colorDefinition, 'Drawing', 'A rgb...
[ "public", "static", "function", "Color2Hex", "(", "$", "colorDefinition", ")", "{", "if", "(", "\\", "is_array", "(", "$", "colorDefinition", ")", ")", "{", "if", "(", "\\", "count", "(", "$", "colorDefinition", ")", "!=", "3", ")", "{", "throw", "new"...
Converts the defined Color definition into hexadecimal representation. @param string|array $colorDefinition Color name, RGB color array or Hex color definition @return string|FALSE @throws \Beluga\ArgumentError
[ "Converts", "the", "defined", "Color", "definition", "into", "hexadecimal", "representation", "." ]
9c82874cf4ec68cb0af78757b65f19783540004a
https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/ColorTool.php#L243-L279
train
SagittariusX/Beluga.Drawing
src/Beluga/Drawing/ColorTool.php
ColorTool.Hex2Rgb
public static function Hex2Rgb( string $color ) { if ( $color[ 0 ] == '#' ) { $color = \substr( $color, 1 ); } if ( \strlen( $color ) == 8 ) { $color = \substr( $color, 2 ); } if ( \strlen( $color ) == 6 ) { $r = $color[ 0 ] . $color[ 1 ];...
php
public static function Hex2Rgb( string $color ) { if ( $color[ 0 ] == '#' ) { $color = \substr( $color, 1 ); } if ( \strlen( $color ) == 8 ) { $color = \substr( $color, 2 ); } if ( \strlen( $color ) == 6 ) { $r = $color[ 0 ] . $color[ 1 ];...
[ "public", "static", "function", "Hex2Rgb", "(", "string", "$", "color", ")", "{", "if", "(", "$", "color", "[", "0", "]", "==", "'#'", ")", "{", "$", "color", "=", "\\", "substr", "(", "$", "color", ",", "1", ")", ";", "}", "if", "(", "\\", "...
Convert a color from hexadecimal notation to RGB array. @param string $color @return array|bool
[ "Convert", "a", "color", "from", "hexadecimal", "notation", "to", "RGB", "array", "." ]
9c82874cf4ec68cb0af78757b65f19783540004a
https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/ColorTool.php#L287-L325
train
SagittariusX/Beluga.Drawing
src/Beluga/Drawing/ColorTool.php
ColorTool.Rgb2Hex
public static function Rgb2Hex( $r, int $g = -1, int $b = -1 ) { if ( \is_array( $r ) ) { if ( \count( $r ) != 3 ) { return false; } \array_change_key_case( $r, \CASE_LOWER ); if ( isset( $r[ 'r' ] ) && isset( $r[ 'g' ] ) && isset( $r[ 'b' ] ) ...
php
public static function Rgb2Hex( $r, int $g = -1, int $b = -1 ) { if ( \is_array( $r ) ) { if ( \count( $r ) != 3 ) { return false; } \array_change_key_case( $r, \CASE_LOWER ); if ( isset( $r[ 'r' ] ) && isset( $r[ 'g' ] ) && isset( $r[ 'b' ] ) ...
[ "public", "static", "function", "Rgb2Hex", "(", "$", "r", ",", "int", "$", "g", "=", "-", "1", ",", "int", "$", "b", "=", "-", "1", ")", "{", "if", "(", "\\", "is_array", "(", "$", "r", ")", ")", "{", "if", "(", "\\", "count", "(", "$", "...
Converts a RGB array or the 3 r, g, b values into a hexadecimal color representation. @param array|integer $r RGB Array or the red bit value. @param int $g The green bit value. @param int $b The blue bit value @return string|FALSE
[ "Converts", "a", "RGB", "array", "or", "the", "3", "r", "g", "b", "values", "into", "a", "hexadecimal", "color", "representation", "." ]
9c82874cf4ec68cb0af78757b65f19783540004a
https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/ColorTool.php#L335-L392
train
WellCommerce/ThemeBundle
EventListener/ThemeSubscriber.php
ThemeSubscriber.onKernelController
public function onKernelController() { $themeContext = $this->container->get('theme.context.front'); $themeContext->setCurrentTheme($this->getShopStorage()->getCurrentShop()->getTheme()); }
php
public function onKernelController() { $themeContext = $this->container->get('theme.context.front'); $themeContext->setCurrentTheme($this->getShopStorage()->getCurrentShop()->getTheme()); }
[ "public", "function", "onKernelController", "(", ")", "{", "$", "themeContext", "=", "$", "this", "->", "container", "->", "get", "(", "'theme.context.front'", ")", ";", "$", "themeContext", "->", "setCurrentTheme", "(", "$", "this", "->", "getShopStorage", "(...
Sets shop context related session variables
[ "Sets", "shop", "context", "related", "session", "variables" ]
9130bb91b3b9bce7b0a941f0c7ef7c09c7d2fe4b
https://github.com/WellCommerce/ThemeBundle/blob/9130bb91b3b9bce7b0a941f0c7ef7c09c7d2fe4b/EventListener/ThemeSubscriber.php#L37-L41
train
praxigento/mobi_mod_downline
Repo/Dao/Snap.php
Snap.getStateOnDate
public function getStateOnDate($datestamp, $addCountryCode = false) { $result = []; $bind = []; $bind[QBldMax::BND_ON_DATE] = $datestamp; $query = $this->qbuildSnapOnDate->build(); if ($addCountryCode) { /* define tables aliases */ $as = self::AS_TBL_D...
php
public function getStateOnDate($datestamp, $addCountryCode = false) { $result = []; $bind = []; $bind[QBldMax::BND_ON_DATE] = $datestamp; $query = $this->qbuildSnapOnDate->build(); if ($addCountryCode) { /* define tables aliases */ $as = self::AS_TBL_D...
[ "public", "function", "getStateOnDate", "(", "$", "datestamp", ",", "$", "addCountryCode", "=", "false", ")", "{", "$", "result", "=", "[", "]", ";", "$", "bind", "=", "[", "]", ";", "$", "bind", "[", "QBldMax", "::", "BND_ON_DATE", "]", "=", "$", ...
Select downline tree state on the given datestamp. @param $datestamp string 'YYYYMMDD' @param $addCountryCode 'true' to add actual country code for customer's attributes @return array
[ "Select", "downline", "tree", "state", "on", "the", "given", "datestamp", "." ]
0f3c276dfff1aa029f9fd205ccfc56f207a2e75b
https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Repo/Dao/Snap.php#L92-L121
train
AdamB7586/menu-builder
src/Helpers/Sorting.php
Sorting.sortByOrder
protected static function sortByOrder($a, $b) { if(!isset($a['link_order']) && isset($b['link_order'])){$a['link_order'] = ($b['link_order'] + 1);} if(!isset($b['link_order']) && isset($a['link_order'])){$b['link_order'] = ($a['link_order'] + 1);} if(isset($a['link_order']) && isset($b['link_ord...
php
protected static function sortByOrder($a, $b) { if(!isset($a['link_order']) && isset($b['link_order'])){$a['link_order'] = ($b['link_order'] + 1);} if(!isset($b['link_order']) && isset($a['link_order'])){$b['link_order'] = ($a['link_order'] + 1);} if(isset($a['link_order']) && isset($b['link_ord...
[ "protected", "static", "function", "sortByOrder", "(", "$", "a", ",", "$", "b", ")", "{", "if", "(", "!", "isset", "(", "$", "a", "[", "'link_order'", "]", ")", "&&", "isset", "(", "$", "b", "[", "'link_order'", "]", ")", ")", "{", "$", "a", "[...
Comparison for the uasort method @param array $a This should be the information of the first link @param array $b This should be the information of the second link @return int
[ "Comparison", "for", "the", "uasort", "method" ]
dbc192bca7d59475068c19d1a07a039e5f997ee4
https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Helpers/Sorting.php#L12-L19
train
AdamB7586/menu-builder
src/Helpers/Sorting.php
Sorting.sortChildElements
protected static function sortChildElements($array) { foreach($array as $i => $item){ if(isset($item['children']) && is_array($item['children'])){ uasort($array[$i]['children'], 'self::sortByOrder'); $array[$i]['children'] = array_values(self::sortChildElements($array...
php
protected static function sortChildElements($array) { foreach($array as $i => $item){ if(isset($item['children']) && is_array($item['children'])){ uasort($array[$i]['children'], 'self::sortByOrder'); $array[$i]['children'] = array_values(self::sortChildElements($array...
[ "protected", "static", "function", "sortChildElements", "(", "$", "array", ")", "{", "foreach", "(", "$", "array", "as", "$", "i", "=>", "$", "item", ")", "{", "if", "(", "isset", "(", "$", "item", "[", "'children'", "]", ")", "&&", "is_array", "(", ...
Sort child elements from the menu array @param array $array This should be a menu item array @return array
[ "Sort", "child", "elements", "from", "the", "menu", "array" ]
dbc192bca7d59475068c19d1a07a039e5f997ee4
https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Helpers/Sorting.php#L26-L34
train
Kris-Kuiper/sFire-Framework
src/Template/Match/MatchUserDefined.php
MatchUserDefined.setAction
public function setAction($action) { if(false === is_string($action)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($action)), E_USER_ERROR); } $this -> action = $action; }
php
public function setAction($action) { if(false === is_string($action)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($action)), E_USER_ERROR); } $this -> action = $action; }
[ "public", "function", "setAction", "(", "$", "action", ")", "{", "if", "(", "false", "===", "is_string", "(", "$", "action", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 1 passed to %s() must be of the type string, \"%s\" given'", ",", ...
Set the action @param string $action
[ "Set", "the", "action" ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Template/Match/MatchUserDefined.php#L52-L59
train
alpixel/AlpixelUserBundle
DependencyInjection/AlpixelUserExtension.php
AlpixelUserExtension.bindParameters
public function bindParameters(ContainerBuilder $container, $name, $config) { $container->setParameter('alpixel_user.role_descriptions', $config['role_descriptions']); $container->setParameter('alpixel_user.firewall_templates', $config['firewall_templates']); $container->setParameter('alpixe...
php
public function bindParameters(ContainerBuilder $container, $name, $config) { $container->setParameter('alpixel_user.role_descriptions', $config['role_descriptions']); $container->setParameter('alpixel_user.firewall_templates', $config['firewall_templates']); $container->setParameter('alpixe...
[ "public", "function", "bindParameters", "(", "ContainerBuilder", "$", "container", ",", "$", "name", ",", "$", "config", ")", "{", "$", "container", "->", "setParameter", "(", "'alpixel_user.role_descriptions'", ",", "$", "config", "[", "'role_descriptions'", "]",...
Binds the params from config. @param ContainerBuilder $container Containerbuilder @param string $name Alias name @param array $config Configuration Array
[ "Binds", "the", "params", "from", "config", "." ]
92cbe3f8e5fd27370d311cb332d2c50d6f1fbd72
https://github.com/alpixel/AlpixelUserBundle/blob/92cbe3f8e5fd27370d311cb332d2c50d6f1fbd72/DependencyInjection/AlpixelUserExtension.php#L32-L38
train
mamasu/mama-parameter
src/parameter/AbstractConfig.php
AbstractConfig.addConfigVars
public function addConfigVars($path = 'config.ini') { if ($path === 'config.php') { $arrayIniParams = parse_ini_file(dirname(__FILE__).'/'.$path,true); } else { $arrayIniParams = parse_ini_file($path, true); } foreach ($arrayIniParams as $key => $iniParam) { ...
php
public function addConfigVars($path = 'config.ini') { if ($path === 'config.php') { $arrayIniParams = parse_ini_file(dirname(__FILE__).'/'.$path,true); } else { $arrayIniParams = parse_ini_file($path, true); } foreach ($arrayIniParams as $key => $iniParam) { ...
[ "public", "function", "addConfigVars", "(", "$", "path", "=", "'config.ini'", ")", "{", "if", "(", "$", "path", "===", "'config.php'", ")", "{", "$", "arrayIniParams", "=", "parse_ini_file", "(", "dirname", "(", "__FILE__", ")", ".", "'/'", ".", "$", "pa...
Add Config Vars from a new .ini file @param string $path
[ "Add", "Config", "Vars", "from", "a", "new", ".", "ini", "file" ]
d48529a75d471da2f9f80b9c2ea1fc3d57f0ba4d
https://github.com/mamasu/mama-parameter/blob/d48529a75d471da2f9f80b9c2ea1fc3d57f0ba4d/src/parameter/AbstractConfig.php#L37-L46
train
CascadeEnergy/php-symfony-event-dispatcher
src/EventDispatcherConsumerTrait.php
EventDispatcherConsumerTrait.dispatchEvent
public function dispatchEvent($eventName, Event $event = null) { if ($this->eventDispatcher instanceof EventDispatcherInterface) { $this->eventDispatcher->dispatch($eventName, $event); } }
php
public function dispatchEvent($eventName, Event $event = null) { if ($this->eventDispatcher instanceof EventDispatcherInterface) { $this->eventDispatcher->dispatch($eventName, $event); } }
[ "public", "function", "dispatchEvent", "(", "$", "eventName", ",", "Event", "$", "event", "=", "null", ")", "{", "if", "(", "$", "this", "->", "eventDispatcher", "instanceof", "EventDispatcherInterface", ")", "{", "$", "this", "->", "eventDispatcher", "->", ...
Dispatches an event to the event dispatcher, if one has been configured. @param string $eventName The name of the event to dispatch @param Event|null $event The (optional) event object
[ "Dispatches", "an", "event", "to", "the", "event", "dispatcher", "if", "one", "has", "been", "configured", "." ]
2bbaf6aeeefc74e84f8093116fc5a8ae967d6359
https://github.com/CascadeEnergy/php-symfony-event-dispatcher/blob/2bbaf6aeeefc74e84f8093116fc5a8ae967d6359/src/EventDispatcherConsumerTrait.php#L27-L32
train
Innmind/Math
src/Quantile/Quantile.php
Quantile.quartile
public function quartile(int $index): Quartile { switch ($index) { case 0: return $this->min; case 1: return $this->firstQuartile; case 2: return $this->median; case 3: return $this->thirdQuartile...
php
public function quartile(int $index): Quartile { switch ($index) { case 0: return $this->min; case 1: return $this->firstQuartile; case 2: return $this->median; case 3: return $this->thirdQuartile...
[ "public", "function", "quartile", "(", "int", "$", "index", ")", ":", "Quartile", "{", "switch", "(", "$", "index", ")", "{", "case", "0", ":", "return", "$", "this", "->", "min", ";", "case", "1", ":", "return", "$", "this", "->", "firstQuartile", ...
Return the quartile at the wished index @param int $index @return Quartile
[ "Return", "the", "quartile", "at", "the", "wished", "index" ]
ac9ad4dd1852c145e90f5edc0f38a873b125a50b
https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Quantile/Quantile.php#L92-L108
train
Innmind/Math
src/Quantile/Quantile.php
Quantile.buildMin
private function buildMin(Dataset $dataset): self { $this->min = new Quartile(min(...$dataset->ordinates())); return $this; }
php
private function buildMin(Dataset $dataset): self { $this->min = new Quartile(min(...$dataset->ordinates())); return $this; }
[ "private", "function", "buildMin", "(", "Dataset", "$", "dataset", ")", ":", "self", "{", "$", "this", "->", "min", "=", "new", "Quartile", "(", "min", "(", "...", "$", "dataset", "->", "ordinates", "(", ")", ")", ")", ";", "return", "$", "this", "...
Extract the minimum value from the dataset @param Dataset $dataset @return self
[ "Extract", "the", "minimum", "value", "from", "the", "dataset" ]
ac9ad4dd1852c145e90f5edc0f38a873b125a50b
https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Quantile/Quantile.php#L117-L122
train
Innmind/Math
src/Quantile/Quantile.php
Quantile.buildMax
private function buildMax(Dataset $dataset): self { $this->max = new Quartile(max(...$dataset->ordinates())); return $this; }
php
private function buildMax(Dataset $dataset): self { $this->max = new Quartile(max(...$dataset->ordinates())); return $this; }
[ "private", "function", "buildMax", "(", "Dataset", "$", "dataset", ")", ":", "self", "{", "$", "this", "->", "max", "=", "new", "Quartile", "(", "max", "(", "...", "$", "dataset", "->", "ordinates", "(", ")", ")", ")", ";", "return", "$", "this", "...
Extract the maximum value from the dataset @param Dataset $dataset @return self
[ "Extract", "the", "maximum", "value", "from", "the", "dataset" ]
ac9ad4dd1852c145e90f5edc0f38a873b125a50b
https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Quantile/Quantile.php#L131-L136
train
Innmind/Math
src/Quantile/Quantile.php
Quantile.buildMean
private function buildMean(Dataset $dataset): self { $this->mean = mean(...$dataset->ordinates()); return $this; }
php
private function buildMean(Dataset $dataset): self { $this->mean = mean(...$dataset->ordinates()); return $this; }
[ "private", "function", "buildMean", "(", "Dataset", "$", "dataset", ")", ":", "self", "{", "$", "this", "->", "mean", "=", "mean", "(", "...", "$", "dataset", "->", "ordinates", "(", ")", ")", ";", "return", "$", "this", ";", "}" ]
Build the mean value from the dataset @param Dataset $dataset @return self
[ "Build", "the", "mean", "value", "from", "the", "dataset" ]
ac9ad4dd1852c145e90f5edc0f38a873b125a50b
https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Quantile/Quantile.php#L145-L150
train
Innmind/Math
src/Quantile/Quantile.php
Quantile.buildMedian
private function buildMedian(Dataset $dataset): self { $this->median = new Quartile(median(...$dataset->ordinates())); return $this; }
php
private function buildMedian(Dataset $dataset): self { $this->median = new Quartile(median(...$dataset->ordinates())); return $this; }
[ "private", "function", "buildMedian", "(", "Dataset", "$", "dataset", ")", ":", "self", "{", "$", "this", "->", "median", "=", "new", "Quartile", "(", "median", "(", "...", "$", "dataset", "->", "ordinates", "(", ")", ")", ")", ";", "return", "$", "t...
Extract the median from the dataset @param Dataset $dataset @return self
[ "Extract", "the", "median", "from", "the", "dataset" ]
ac9ad4dd1852c145e90f5edc0f38a873b125a50b
https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Quantile/Quantile.php#L159-L164
train
Innmind/Math
src/Quantile/Quantile.php
Quantile.buildQuartile
private function buildQuartile( Number $percentage, ColumnVector $dataset ): Number { $dimension = $dataset->dimension(); if ($dimension->value() === 2) { return divide( add($dataset->get(0), $dataset->get(1)), 2 ); } e...
php
private function buildQuartile( Number $percentage, ColumnVector $dataset ): Number { $dimension = $dataset->dimension(); if ($dimension->value() === 2) { return divide( add($dataset->get(0), $dataset->get(1)), 2 ); } e...
[ "private", "function", "buildQuartile", "(", "Number", "$", "percentage", ",", "ColumnVector", "$", "dataset", ")", ":", "Number", "{", "$", "dimension", "=", "$", "dataset", "->", "dimension", "(", ")", ";", "if", "(", "$", "dimension", "->", "value", "...
Return the value describing the the quartile at the given percentage @param Number $percentage @param ColumnVector $dataset @return float
[ "Return", "the", "value", "describing", "the", "the", "quartile", "at", "the", "given", "percentage" ]
ac9ad4dd1852c145e90f5edc0f38a873b125a50b
https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Quantile/Quantile.php#L208-L232
train
ndavison/groundwork-framework
src/Groundwork/Classes/Request.php
Request.routeParams
public function routeParams($params = '') { if (!empty($params)) { // Set the property if (is_a($params, 'stdClass')) { $this->routeParams = $params; } else { return false; } } else { // Get the property ...
php
public function routeParams($params = '') { if (!empty($params)) { // Set the property if (is_a($params, 'stdClass')) { $this->routeParams = $params; } else { return false; } } else { // Get the property ...
[ "public", "function", "routeParams", "(", "$", "params", "=", "''", ")", "{", "if", "(", "!", "empty", "(", "$", "params", ")", ")", "{", "// Set the property", "if", "(", "is_a", "(", "$", "params", ",", "'stdClass'", ")", ")", "{", "$", "this", "...
Get or set the routeParams property. @param object $params @return void|object|boolean
[ "Get", "or", "set", "the", "routeParams", "property", "." ]
c3d22a1410c8d8a07b4ca1f99a35a1181516cd6c
https://github.com/ndavison/groundwork-framework/blob/c3d22a1410c8d8a07b4ca1f99a35a1181516cd6c/src/Groundwork/Classes/Request.php#L140-L153
train
libreworks/caridea-auth
src/Adapter/AbstractAdapter.php
AbstractAdapter.checkBlank
protected function checkBlank($object, string $fieldName) { if ($object === null || strlen(trim($object)) === 0) { throw new \InvalidArgumentException("The \"$fieldName\" argument is required; it cannot be null, empty, nor containing only whitespace"); } return $object; }
php
protected function checkBlank($object, string $fieldName) { if ($object === null || strlen(trim($object)) === 0) { throw new \InvalidArgumentException("The \"$fieldName\" argument is required; it cannot be null, empty, nor containing only whitespace"); } return $object; }
[ "protected", "function", "checkBlank", "(", "$", "object", ",", "string", "$", "fieldName", ")", "{", "if", "(", "$", "object", "===", "null", "||", "strlen", "(", "trim", "(", "$", "object", ")", ")", "===", "0", ")", "{", "throw", "new", "\\", "I...
Checks that a string argument isn't null, empty, or just whitespace. @param string $object The value to check for blankness @param string $fieldName The name of the parameter (for Exception message) @return mixed Returns `$object` @throws \InvalidArgumentException if the value is null, empty, or whitespace
[ "Checks", "that", "a", "string", "argument", "isn", "t", "null", "empty", "or", "just", "whitespace", "." ]
1bf965c57716942b18ca3204629f6bda99cf876a
https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Adapter/AbstractAdapter.php#L39-L45
train
libreworks/caridea-auth
src/Adapter/AbstractAdapter.php
AbstractAdapter.ensure
protected function ensure(array &$source, string $key) { if (!isset($source[$key]) || !$source[$key]) { throw new \Caridea\Auth\Exception\MissingCredentials(); } return $source[$key]; }
php
protected function ensure(array &$source, string $key) { if (!isset($source[$key]) || !$source[$key]) { throw new \Caridea\Auth\Exception\MissingCredentials(); } return $source[$key]; }
[ "protected", "function", "ensure", "(", "array", "&", "$", "source", ",", "string", "$", "key", ")", "{", "if", "(", "!", "isset", "(", "$", "source", "[", "$", "key", "]", ")", "||", "!", "$", "source", "[", "$", "key", "]", ")", "{", "throw",...
Throws a `MissingCredentials` if the value is empty. @param array $source The params array @param string $key The array offset @return mixed Returns the value of `$source[$key]` @throws \Caridea\Auth\Exception\MissingCredentials If `$source[$key]` is empty
[ "Throws", "a", "MissingCredentials", "if", "the", "value", "is", "empty", "." ]
1bf965c57716942b18ca3204629f6bda99cf876a
https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Adapter/AbstractAdapter.php#L55-L61
train
libreworks/caridea-auth
src/Adapter/AbstractAdapter.php
AbstractAdapter.verify
protected function verify(string $input, string $hash) { if (!password_verify($input, $hash)) { throw new \Caridea\Auth\Exception\InvalidPassword(); } }
php
protected function verify(string $input, string $hash) { if (!password_verify($input, $hash)) { throw new \Caridea\Auth\Exception\InvalidPassword(); } }
[ "protected", "function", "verify", "(", "string", "$", "input", ",", "string", "$", "hash", ")", "{", "if", "(", "!", "password_verify", "(", "$", "input", ",", "$", "hash", ")", ")", "{", "throw", "new", "\\", "Caridea", "\\", "Auth", "\\", "Excepti...
Verifies a user-provided password against a hash. @param string $input The user-provided password @param string $hash The stored password hash @throws \Caridea\Auth\Exception\MissingCredentials If the user-provided password is empty @throws \Caridea\Auth\Exception\InvalidPassword If the password fails to verify
[ "Verifies", "a", "user", "-", "provided", "password", "against", "a", "hash", "." ]
1bf965c57716942b18ca3204629f6bda99cf876a
https://github.com/libreworks/caridea-auth/blob/1bf965c57716942b18ca3204629f6bda99cf876a/src/Adapter/AbstractAdapter.php#L71-L76
train
ScaraMVC/Framework
src/Scara/Console/Console.php
Console.register
public function register($command) { $classexp = explode('/', $command); for ($i = 0; $i < count($classexp); $i++) { $classexp[$i] = ucwords($classexp[$i]); } $class = __NAMESPACE__.'\\'.implode('\\', $classexp); return new $class(); }
php
public function register($command) { $classexp = explode('/', $command); for ($i = 0; $i < count($classexp); $i++) { $classexp[$i] = ucwords($classexp[$i]); } $class = __NAMESPACE__.'\\'.implode('\\', $classexp); return new $class(); }
[ "public", "function", "register", "(", "$", "command", ")", "{", "$", "classexp", "=", "explode", "(", "'/'", ",", "$", "command", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "count", "(", "$", "classexp", ")", ";", "$", "i", ...
Register console command class. @param string $command @return mixed
[ "Register", "console", "command", "class", "." ]
199b08b45fadf5dae14ac4732af03b36e15bbef2
https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Console/Console.php#L17-L27
train
bseddon/XPath20
XPath2NodeIterator/Enumerator.php
Enumerator.getCurrent
public function getCurrent() { if ( ! $this->iterationStarted || is_null( $this->current ) ) throw new InvalidOperationException(); return $this->current->Current; }
php
public function getCurrent() { if ( ! $this->iterationStarted || is_null( $this->current ) ) throw new InvalidOperationException(); return $this->current->Current; }
[ "public", "function", "getCurrent", "(", ")", "{", "if", "(", "!", "$", "this", "->", "iterationStarted", "||", "is_null", "(", "$", "this", "->", "current", ")", ")", "throw", "new", "InvalidOperationException", "(", ")", ";", "return", "$", "this", "->...
Get the current value of the iterator @return object
[ "Get", "the", "current", "value", "of", "the", "iterator" ]
69882b6efffaa5470a819d5fdd2f6473ddeb046d
https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/XPath2NodeIterator/Enumerator.php#L71-L76
train
kael-shipman/php-std-traits
src/AbstractConfig.php
AbstractConfig.getValidExecProfiles
protected function getValidExecProfiles(string $profileName = null) { $validProfs = [ 'production' => 'production', 'dev' => 'dev', 'staging' => 'staging', 'sandbox' => 'sandbox', 'demo' => 'demo', 'debug' => 'debug' ]; ...
php
protected function getValidExecProfiles(string $profileName = null) { $validProfs = [ 'production' => 'production', 'dev' => 'dev', 'staging' => 'staging', 'sandbox' => 'sandbox', 'demo' => 'demo', 'debug' => 'debug' ]; ...
[ "protected", "function", "getValidExecProfiles", "(", "string", "$", "profileName", "=", "null", ")", "{", "$", "validProfs", "=", "[", "'production'", "=>", "'production'", ",", "'dev'", "=>", "'dev'", ",", "'staging'", "=>", "'staging'", ",", "'sandbox'", "=...
Get this config's list of known profiles. The `getExecProfile` function should use this list to check the given profile against. This is a function that returns a simple array, such that derivative classes may easily add/change profiles by simply overriding the function and merging in new profile names or returning a ...
[ "Get", "this", "config", "s", "list", "of", "known", "profiles", "." ]
c21ddfc9dc682e6589e52f3717df81e0d2972c0e
https://github.com/kael-shipman/php-std-traits/blob/c21ddfc9dc682e6589e52f3717df81e0d2972c0e/src/AbstractConfig.php#L60-L80
train
kael-shipman/php-std-traits
src/AbstractConfig.php
AbstractConfig.get
protected function get(string $key) { if (!array_key_exists($key, $this->config)) throw new InvalidConfigException("Your configuration doesn't have a value for the key `$key`"); return $this->config[$key]; }
php
protected function get(string $key) { if (!array_key_exists($key, $this->config)) throw new InvalidConfigException("Your configuration doesn't have a value for the key `$key`"); return $this->config[$key]; }
[ "protected", "function", "get", "(", "string", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "config", ")", ")", "throw", "new", "InvalidConfigException", "(", "\"Your configuration doesn't have a value for th...
An internal method that ensures an error is thrown if the given key is not found in the configuration. @param string $key The key of the configuration value to get @return mixed Returns the configuration value at `$key` @throws InvalidConfigException in the even that a given config key isn't loaded
[ "An", "internal", "method", "that", "ensures", "an", "error", "is", "thrown", "if", "the", "given", "key", "is", "not", "found", "in", "the", "configuration", "." ]
c21ddfc9dc682e6589e52f3717df81e0d2972c0e
https://github.com/kael-shipman/php-std-traits/blob/c21ddfc9dc682e6589e52f3717df81e0d2972c0e/src/AbstractConfig.php#L90-L94
train
linpax/microphp-framework
src/web/html/HeadTagTrait.php
HeadTagTrait.link
public static function link($name, $url, array $attributes = []) { return static::openTag('link', array_merge($attributes, ['href' => $url])). $name. static::closeTag('link'); }
php
public static function link($name, $url, array $attributes = []) { return static::openTag('link', array_merge($attributes, ['href' => $url])). $name. static::closeTag('link'); }
[ "public", "static", "function", "link", "(", "$", "name", ",", "$", "url", ",", "array", "$", "attributes", "=", "[", "]", ")", "{", "return", "static", "::", "openTag", "(", "'link'", ",", "array_merge", "(", "$", "attributes", ",", "[", "'href'", "...
Render link tag @access public @param string $name name of element @param string $url url path @param array $attributes attributes tag @return string @static
[ "Render", "link", "tag" ]
11f3370f3f64c516cce9b84ecd8276c6e9ae8df9
https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/web/html/HeadTagTrait.php#L70-L75
train