repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
tonicospinelli/class-generation
src/ClassGeneration/Method.php
Method.init
public function init() { $this->setArgumentCollection(new ArgumentCollection()); $this->setDocBlock(new DocBlock()); $this->setVisibility(Visibility::TYPE_PUBLIC); }
php
public function init() { $this->setArgumentCollection(new ArgumentCollection()); $this->setDocBlock(new DocBlock()); $this->setVisibility(Visibility::TYPE_PUBLIC); }
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "setArgumentCollection", "(", "new", "ArgumentCollection", "(", ")", ")", ";", "$", "this", "->", "setDocBlock", "(", "new", "DocBlock", "(", ")", ")", ";", "$", "this", "->", "setVisibility...
{@inheritdoc}
[ "{" ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Method.php#L83-L88
tonicospinelli/class-generation
src/ClassGeneration/Method.php
Method.toStringFunction
protected function toStringFunction() { $string = ($this->isFinal() ? 'final ' : '') . ($this->isAbstract() ? 'abstract ' : '') . $this->getVisibility() . ' ' . ($this->isStatic() ? 'static ' : '') . 'function '; return $string; }
php
protected function toStringFunction() { $string = ($this->isFinal() ? 'final ' : '') . ($this->isAbstract() ? 'abstract ' : '') . $this->getVisibility() . ' ' . ($this->isStatic() ? 'static ' : '') . 'function '; return $string; }
[ "protected", "function", "toStringFunction", "(", ")", "{", "$", "string", "=", "(", "$", "this", "->", "isFinal", "(", ")", "?", "'final '", ":", "''", ")", ".", "(", "$", "this", "->", "isAbstract", "(", ")", "?", "'abstract '", ":", "''", ")", "...
Get string with method type. @return string
[ "Get", "string", "with", "method", "type", "." ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Method.php#L379-L388
tonicospinelli/class-generation
src/ClassGeneration/Method.php
Method.toStringCode
public function toStringCode() { if (!$this->isInterface() && !$this->isAbstract()) { $tabulationFormatted = $this->getTabulationFormatted(); $code = PHP_EOL . $tabulationFormatted . '{' . $this->codeToString() . $tabulationFormatted ...
php
public function toStringCode() { if (!$this->isInterface() && !$this->isAbstract()) { $tabulationFormatted = $this->getTabulationFormatted(); $code = PHP_EOL . $tabulationFormatted . '{' . $this->codeToString() . $tabulationFormatted ...
[ "public", "function", "toStringCode", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isInterface", "(", ")", "&&", "!", "$", "this", "->", "isAbstract", "(", ")", ")", "{", "$", "tabulationFormatted", "=", "$", "this", "->", "getTabulationFormatted",...
Get string code. @return string
[ "Get", "string", "code", "." ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Method.php#L394-L408
tonicospinelli/class-generation
src/ClassGeneration/Method.php
Method.createGetterFromProperty
public static function createGetterFromProperty(PropertyInterface $property) { $method = new self(); $method->setName('get_' . $property->getName()); $method->setCode('return $this->' . $property->getName() . ';'); return $method; }
php
public static function createGetterFromProperty(PropertyInterface $property) { $method = new self(); $method->setName('get_' . $property->getName()); $method->setCode('return $this->' . $property->getName() . ';'); return $method; }
[ "public", "static", "function", "createGetterFromProperty", "(", "PropertyInterface", "$", "property", ")", "{", "$", "method", "=", "new", "self", "(", ")", ";", "$", "method", "->", "setName", "(", "'get_'", ".", "$", "property", "->", "getName", "(", ")...
Create a Get Method from Property of Class. @param PropertyInterface $property @return Method
[ "Create", "a", "Get", "Method", "from", "Property", "of", "Class", "." ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Method.php#L417-L424
tonicospinelli/class-generation
src/ClassGeneration/Method.php
Method.createSetterFromProperty
public static function createSetterFromProperty(PropertyInterface $property) { $argument = Argument::createFromProperty($property); $code = "\$this->{$property->getName()} = {$argument->getNameFormatted()};" . PHP_EOL . 'return $this;'; $method = new self; $...
php
public static function createSetterFromProperty(PropertyInterface $property) { $argument = Argument::createFromProperty($property); $code = "\$this->{$property->getName()} = {$argument->getNameFormatted()};" . PHP_EOL . 'return $this;'; $method = new self; $...
[ "public", "static", "function", "createSetterFromProperty", "(", "PropertyInterface", "$", "property", ")", "{", "$", "argument", "=", "Argument", "::", "createFromProperty", "(", "$", "property", ")", ";", "$", "code", "=", "\"\\$this->{$property->getName()} = {$argu...
Generate Set Method from Property. Add a set method in the class based on Object Property. @param PropertyInterface $property @return Method
[ "Generate", "Set", "Method", "from", "Property", ".", "Add", "a", "set", "method", "in", "the", "class", "based", "on", "Object", "Property", "." ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Method.php#L434-L449
tonicospinelli/class-generation
src/ClassGeneration/Method.php
Method.createFromReflection
public static function createFromReflection(\ReflectionMethod $reflected) { $method = new self(); $method->setName($reflected->getName()); foreach ($reflected->getParameters() as $parameterReflected) { $argument = new Argument(); $argument->setName($parameterReflecte...
php
public static function createFromReflection(\ReflectionMethod $reflected) { $method = new self(); $method->setName($reflected->getName()); foreach ($reflected->getParameters() as $parameterReflected) { $argument = new Argument(); $argument->setName($parameterReflecte...
[ "public", "static", "function", "createFromReflection", "(", "\\", "ReflectionMethod", "$", "reflected", ")", "{", "$", "method", "=", "new", "self", "(", ")", ";", "$", "method", "->", "setName", "(", "$", "reflected", "->", "getName", "(", ")", ")", ";...
Creates a method from Reflection Method. @param \ReflectionMethod $reflected @return Method
[ "Creates", "a", "method", "from", "Reflection", "Method", "." ]
train
https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Method.php#L458-L470
discophp/framework
core/classes/Queue.class.php
Queue.push
public function push($job, $delay = 0, $vars = null){ if($vars==null){ $vars='disco-no-variable'; }//if else { $vars = base64_encode(serialize($vars)); }//el $domain = \App::domain(); if($job instanceof \Closure){ $obj = new \Jeremea...
php
public function push($job, $delay = 0, $vars = null){ if($vars==null){ $vars='disco-no-variable'; }//if else { $vars = base64_encode(serialize($vars)); }//el $domain = \App::domain(); if($job instanceof \Closure){ $obj = new \Jeremea...
[ "public", "function", "push", "(", "$", "job", ",", "$", "delay", "=", "0", ",", "$", "vars", "=", "null", ")", "{", "if", "(", "$", "vars", "==", "null", ")", "{", "$", "vars", "=", "'disco-no-variable'", ";", "}", "//if", "else", "{", "$", "v...
Push a job onto the Queue for processing. @param \Closure|string $job Either a `\Closure` to execute or a Class method pair like `DB@query`. @param int $delay The delay to wait before beginning execution of the `$job`. @param null|string|array $vars The variables to pass to the `$job`. @return void
[ "Push", "a", "job", "onto", "the", "Queue", "for", "processing", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Queue.class.php#L26-L66
discophp/framework
core/classes/Queue.class.php
Queue.jobs
public function jobs(){ exec('ps -ef | grep "php[[:space:]]' . \App::path() . '/public/index\.php[[:space:]]resolve"',$jobs); $f = 'php ' . \App::path(). '/public/index.php resolve'; $j = Array(); foreach($jobs as $k => $v){ if(stripos($v,$f) !== false){ $v ...
php
public function jobs(){ exec('ps -ef | grep "php[[:space:]]' . \App::path() . '/public/index\.php[[:space:]]resolve"',$jobs); $f = 'php ' . \App::path(). '/public/index.php resolve'; $j = Array(); foreach($jobs as $k => $v){ if(stripos($v,$f) !== false){ $v ...
[ "public", "function", "jobs", "(", ")", "{", "exec", "(", "'ps -ef | grep \"php[[:space:]]'", ".", "\\", "App", "::", "path", "(", ")", ".", "'/public/index\\.php[[:space:]]resolve\"'", ",", "$", "jobs", ")", ";", "$", "f", "=", "'php '", ".", "\\", "App", ...
Get the jobs that are currently queued. Returns the jobs as objects structured like : - pId = process ID of job. - time = time job was enetered. - delay = delay the job was told to wait before execution. - object = the actual object or Closure that will execute the job. - method = the method to call on the object. - ...
[ "Get", "the", "jobs", "that", "are", "currently", "queued", ".", "Returns", "the", "jobs", "as", "objects", "structured", "like", ":" ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Queue.class.php#L85-L111
discophp/framework
core/classes/Queue.class.php
Queue.killJob
public function killJob($pId){ $j = $this->jobs(); global $argv; foreach($j as $job){ if($job->pId == $pId){ exec('kill ' . $job->pId); if($argv[1] == 'kill-job'){ echo 'Killed Job # ' . $job->pId . ' Action:' . $job->object . '@...
php
public function killJob($pId){ $j = $this->jobs(); global $argv; foreach($j as $job){ if($job->pId == $pId){ exec('kill ' . $job->pId); if($argv[1] == 'kill-job'){ echo 'Killed Job # ' . $job->pId . ' Action:' . $job->object . '@...
[ "public", "function", "killJob", "(", "$", "pId", ")", "{", "$", "j", "=", "$", "this", "->", "jobs", "(", ")", ";", "global", "$", "argv", ";", "foreach", "(", "$", "j", "as", "$", "job", ")", "{", "if", "(", "$", "job", "->", "pId", "==", ...
Kill a Queued job by passing its process ID number @param integer $pId The jobs process ID. @return boolean Whether or not the job was killed.
[ "Kill", "a", "Queued", "job", "by", "passing", "its", "process", "ID", "number" ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Queue.class.php#L123-L145
FrenchFrogs/framework
src/Core/Validator.php
Validator.addValidator
public function addValidator($index, $method = null, array $params = [], $message = null) { // set up params array_unshift($params, $method); array_unshift($params, $index); call_user_func_array([$this->getValidator(), 'addRule'], $params); // Message management if ...
php
public function addValidator($index, $method = null, array $params = [], $message = null) { // set up params array_unshift($params, $method); array_unshift($params, $index); call_user_func_array([$this->getValidator(), 'addRule'], $params); // Message management if ...
[ "public", "function", "addValidator", "(", "$", "index", ",", "$", "method", "=", "null", ",", "array", "$", "params", "=", "[", "]", ",", "$", "message", "=", "null", ")", "{", "// set up params", "array_unshift", "(", "$", "params", ",", "$", "method...
Add a single validator with message to the validator container @param $index @param null $method @param array $params @param null $message @return $this
[ "Add", "a", "single", "validator", "with", "message", "to", "the", "validator", "container" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Core/Validator.php#L63-L77
digiaonline/json-helpers
src/JsonDecoder.php
JsonDecoder.decode
public static function decode(string $data, bool $assoc = false, int $depth = 512, int $options = 0) { $json = json_decode($data, $assoc, $depth, $options); $jsonLastError = json_last_error(); if ($jsonLastError !== JSON_ERROR_NONE) { throw new \InvalidArgumentException...
php
public static function decode(string $data, bool $assoc = false, int $depth = 512, int $options = 0) { $json = json_decode($data, $assoc, $depth, $options); $jsonLastError = json_last_error(); if ($jsonLastError !== JSON_ERROR_NONE) { throw new \InvalidArgumentException...
[ "public", "static", "function", "decode", "(", "string", "$", "data", ",", "bool", "$", "assoc", "=", "false", ",", "int", "$", "depth", "=", "512", ",", "int", "$", "options", "=", "0", ")", "{", "$", "json", "=", "json_decode", "(", "$", "data", ...
Decodes the specified JSON into an object @param string $data @param bool $assoc @param int $depth @param int $options @return mixed @throws \InvalidArgumentException
[ "Decodes", "the", "specified", "JSON", "into", "an", "object" ]
train
https://github.com/digiaonline/json-helpers/blob/596dfca3fb85fba026cc0a498fbcefbda6377a15/src/JsonDecoder.php#L25-L35
jasny/router
src/Router.php
Router.getRunner
public function getRunner() { if (!isset($this->runner)) { $this->runner = new Runner\Delegate(); } return $this->runner; }
php
public function getRunner() { if (!isset($this->runner)) { $this->runner = new Runner\Delegate(); } return $this->runner; }
[ "public", "function", "getRunner", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "runner", ")", ")", "{", "$", "this", "->", "runner", "=", "new", "Runner", "\\", "Delegate", "(", ")", ";", "}", "return", "$", "this", "->", "run...
Get Runner @return callable
[ "Get", "Runner" ]
train
https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router.php#L71-L78
jasny/router
src/Router.php
Router.add
public function add($path, $middleware = null) { if (!isset($middleware)) { $middleware = $path; $path = null; } if (!empty($path) && !ctype_digit($path) && $path[0] !== '/') { trigger_error("Middleware path '$path' doesn't start with a '/'", E_USER_NOTIC...
php
public function add($path, $middleware = null) { if (!isset($middleware)) { $middleware = $path; $path = null; } if (!empty($path) && !ctype_digit($path) && $path[0] !== '/') { trigger_error("Middleware path '$path' doesn't start with a '/'", E_USER_NOTIC...
[ "public", "function", "add", "(", "$", "path", ",", "$", "middleware", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "middleware", ")", ")", "{", "$", "middleware", "=", "$", "path", ";", "$", "path", "=", "null", ";", "}", "if", "(...
Add middleware call to router. @param string $path Middleware is only applied for this path (including subdirectories), may be omitted @param callable $middleware @return Router $this
[ "Add", "middleware", "call", "to", "router", "." ]
train
https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router.php#L104-L126
jasny/router
src/Router.php
Router.wrapMiddleware
protected function wrapMiddleware($path, $middleware) { return function( ServerRequestInterface $request, ResponseInterface $response, $next ) use ($middleware, $path) { $uriPath = $request->getUri()->getPath(); if ($uriPath === $path || s...
php
protected function wrapMiddleware($path, $middleware) { return function( ServerRequestInterface $request, ResponseInterface $response, $next ) use ($middleware, $path) { $uriPath = $request->getUri()->getPath(); if ($uriPath === $path || s...
[ "protected", "function", "wrapMiddleware", "(", "$", "path", ",", "$", "middleware", ")", "{", "return", "function", "(", "ServerRequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ",", "$", "next", ")", "use", "(", "$", "middleware",...
Wrap middleware, so it's only applied to a specified path @param string $path @param callable $middleware @return callable
[ "Wrap", "middleware", "so", "it", "s", "only", "applied", "to", "a", "specified", "path" ]
train
https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router.php#L135-L152
jasny/router
src/Router.php
Router.run
public function run(ServerRequestInterface $request, ResponseInterface $response, $next = null) { if (!$request->getAttribute('route') instanceof Route) { $route = $this->routes->getRoute($request); if (!$route) { return $this->notFound($request, $response); ...
php
public function run(ServerRequestInterface $request, ResponseInterface $response, $next = null) { if (!$request->getAttribute('route') instanceof Route) { $route = $this->routes->getRoute($request); if (!$route) { return $this->notFound($request, $response); ...
[ "public", "function", "run", "(", "ServerRequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ",", "$", "next", "=", "null", ")", "{", "if", "(", "!", "$", "request", "->", "getAttribute", "(", "'route'", ")", "instanceof", "Route", ...
Run the action. This method doesn't call the middlewares, but only run the action. @param ServerRequestInterface $request @param ResponseInterface $response @param callback $next @return ResponseInterface
[ "Run", "the", "action", ".", "This", "method", "doesn", "t", "call", "the", "middlewares", "but", "only", "run", "the", "action", "." ]
train
https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router.php#L202-L217
jasny/router
src/Router.php
Router.notFound
protected function notFound(ServerRequestInterface $request, ResponseInterface $response) { $notFound = $response ->withProtocolVersion($request->getProtocolVersion()) ->withStatus(404); $notFound->getBody()->write('Not Found'); return $notFound; }
php
protected function notFound(ServerRequestInterface $request, ResponseInterface $response) { $notFound = $response ->withProtocolVersion($request->getProtocolVersion()) ->withStatus(404); $notFound->getBody()->write('Not Found'); return $notFound; }
[ "protected", "function", "notFound", "(", "ServerRequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "$", "notFound", "=", "$", "response", "->", "withProtocolVersion", "(", "$", "request", "->", "getProtocolVersion", "(", ")", ...
Return 'Not Found' response @param ServerRequestInterface $request @param ResponseInterface $response @return ResponseInterface
[ "Return", "Not", "Found", "response" ]
train
https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router.php#L226-L235
puli/discovery
src/Api/Type/NoSuchParameterException.php
NoSuchParameterException.forParameterName
public static function forParameterName($parameterName, $typeName, Exception $cause = null) { return new static(sprintf( 'The parameter "%s" does not exist for type "%s".', $parameterName, $typeName ), 0, $cause); }
php
public static function forParameterName($parameterName, $typeName, Exception $cause = null) { return new static(sprintf( 'The parameter "%s" does not exist for type "%s".', $parameterName, $typeName ), 0, $cause); }
[ "public", "static", "function", "forParameterName", "(", "$", "parameterName", ",", "$", "typeName", ",", "Exception", "$", "cause", "=", "null", ")", "{", "return", "new", "static", "(", "sprintf", "(", "'The parameter \"%s\" does not exist for type \"%s\".'", ",",...
Creates a new exception for the given parameter name. @param string $parameterName The name of the parameter that was not found. @param string $typeName The name of the type that the parameter was searched on. @param Exception|null $cause The exception that caused this exception. @return ...
[ "Creates", "a", "new", "exception", "for", "the", "given", "parameter", "name", "." ]
train
https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Api/Type/NoSuchParameterException.php#L38-L45
harp-orm/query
src/Compiler/Condition.php
Condition.combine
public static function combine($conditions) { return Arr::join(' AND ', Arr::map(function ($condition) { return "(".Condition::render($condition).")"; }, $conditions)); }
php
public static function combine($conditions) { return Arr::join(' AND ', Arr::map(function ($condition) { return "(".Condition::render($condition).")"; }, $conditions)); }
[ "public", "static", "function", "combine", "(", "$", "conditions", ")", "{", "return", "Arr", "::", "join", "(", "' AND '", ",", "Arr", "::", "map", "(", "function", "(", "$", "condition", ")", "{", "return", "\"(\"", ".", "Condition", "::", "render", ...
Render multiple Condition objects @param SQL\Condition[]|null $conditions @return string|null
[ "Render", "multiple", "Condition", "objects" ]
train
https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Condition.php#L21-L26
harp-orm/query
src/Compiler/Condition.php
Condition.render
public static function render(SQL\Condition $condition) { $content = $condition->getContent(); $parameters = $condition->getParameters(); if ($parameters and is_string($content)) { $content = self::expandParameterArrays($content, $parameters); } return Compiler:...
php
public static function render(SQL\Condition $condition) { $content = $condition->getContent(); $parameters = $condition->getParameters(); if ($parameters and is_string($content)) { $content = self::expandParameterArrays($content, $parameters); } return Compiler:...
[ "public", "static", "function", "render", "(", "SQL", "\\", "Condition", "$", "condition", ")", "{", "$", "content", "=", "$", "condition", "->", "getContent", "(", ")", ";", "$", "parameters", "=", "$", "condition", "->", "getParameters", "(", ")", ";",...
Render a Condition object @param SQL\Condition $condition @return string
[ "Render", "a", "Condition", "object" ]
train
https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Condition.php#L34-L47
harp-orm/query
src/Compiler/Condition.php
Condition.expandParameterArrays
public static function expandParameterArrays($content, array $parameters) { return preg_replace_callback('/\?/', function () use (& $parameters) { $parameter = current(each($parameters)); return is_array($parameter) ? Compiler::toPlaceholders($parameter) : '?'; }, $content); ...
php
public static function expandParameterArrays($content, array $parameters) { return preg_replace_callback('/\?/', function () use (& $parameters) { $parameter = current(each($parameters)); return is_array($parameter) ? Compiler::toPlaceholders($parameter) : '?'; }, $content); ...
[ "public", "static", "function", "expandParameterArrays", "(", "$", "content", ",", "array", "$", "parameters", ")", "{", "return", "preg_replace_callback", "(", "'/\\?/'", ",", "function", "(", ")", "use", "(", "&", "$", "parameters", ")", "{", "$", "paramet...
Replace ? for arrays with (?, ?, ?) @param string $content @param array $parameters @return string
[ "Replace", "?", "for", "arrays", "with", "(", "?", "?", "?", ")" ]
train
https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Condition.php#L56-L63
axelitus/php-base
src/BigNum.php
BigNum.toInt
public static function toInt($value) { if (!static::is($value)) { throw new \InvalidArgumentException( "The \$value parameter must be numeric (or string representing a big number)." ); } if (is_int($value)) { return $value; } elsei...
php
public static function toInt($value) { if (!static::is($value)) { throw new \InvalidArgumentException( "The \$value parameter must be numeric (or string representing a big number)." ); } if (is_int($value)) { return $value; } elsei...
[ "public", "static", "function", "toInt", "(", "$", "value", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "value", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"The \\$value parameter must be numeric (or string representing a...
Gets the integer value of the given value. @param float|string $value The value to get the integer value from. @return int|string Returns the integer value of the given value. @throws \InvalidArgumentException
[ "Gets", "the", "integer", "value", "of", "the", "given", "value", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L56-L75
axelitus/php-base
src/BigNum.php
BigNum.toFloat
public static function toFloat($value) { if (!static::is($value)) { throw new \InvalidArgumentException( "The \$value parameter must be numeric (or string representing a big number)." ); } if (is_int($value) || is_float($value)) { return (...
php
public static function toFloat($value) { if (!static::is($value)) { throw new \InvalidArgumentException( "The \$value parameter must be numeric (or string representing a big number)." ); } if (is_int($value) || is_float($value)) { return (...
[ "public", "static", "function", "toFloat", "(", "$", "value", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "value", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"The \\$value parameter must be numeric (or string representing...
Converts the given number to float. @param int|float|string $value The value to convert. @return float|string Returns the value converted to float. @throws \InvalidArgumentException
[ "Converts", "the", "given", "number", "to", "float", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L85-L98
axelitus/php-base
src/BigNum.php
BigNum.inside
public static function inside($value, $lower, $upper) { return static::inRange($value, $lower, $upper, false, false); }
php
public static function inside($value, $lower, $upper) { return static::inRange($value, $lower, $upper, false, false); }
[ "public", "static", "function", "inside", "(", "$", "value", ",", "$", "lower", ",", "$", "upper", ")", "{", "return", "static", "::", "inRange", "(", "$", "value", ",", "$", "lower", ",", "$", "upper", ",", "false", ",", "false", ")", ";", "}" ]
Tests if a number is inside a range. It's an alias for BigNum::inRange($value, $lower, $upper, false, false) @param int|float|string $value The value to test in range. @param int|float|string $lower The range's lower limit. @param int|float|string $upper The range's upper limit. @return bool Whether the value is ins...
[ "Tests", "if", "a", "number", "is", "inside", "a", "range", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L201-L204
axelitus/php-base
src/BigNum.php
BigNum.between
public static function between($value, $lower, $upper) { return static::inRange($value, $lower, $upper, true, true); }
php
public static function between($value, $lower, $upper) { return static::inRange($value, $lower, $upper, true, true); }
[ "public", "static", "function", "between", "(", "$", "value", ",", "$", "lower", ",", "$", "upper", ")", "{", "return", "static", "::", "inRange", "(", "$", "value", ",", "$", "lower", ",", "$", "upper", ",", "true", ",", "true", ")", ";", "}" ]
Tests if a number is between a range. It's an alias for BigNum::inRange($value, $lower, $upper, true, true) @param int|float|string $value The value to test in range. @param int|float|string $lower The range's lower limit. @param int|float|string $upper The range's upper limit. @return bool Whether the value is betw...
[ "Tests", "if", "a", "number", "is", "between", "a", "range", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L218-L221
axelitus/php-base
src/BigNum.php
BigNum.add
public static function add($num1, $num2, $scale = null) { if (!static::is($num1) || !static::is($num2)) { throw new \InvalidArgumentException( "The \$num1 and \$num2 parameters must be numeric (or string representing a big number)." ); } if (Num::is($...
php
public static function add($num1, $num2, $scale = null) { if (!static::is($num1) || !static::is($num2)) { throw new \InvalidArgumentException( "The \$num1 and \$num2 parameters must be numeric (or string representing a big number)." ); } if (Num::is($...
[ "public", "static", "function", "add", "(", "$", "num1", ",", "$", "num2", ",", "$", "scale", "=", "null", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "num1", ")", "||", "!", "static", "::", "is", "(", "$", "num2", ")", ")", "{"...
Adds a number to another number. @param int|float|string $num1 The left operand. @param int|float|string $num2 The right operand. @param int $scale The scale to use for BCMath functions. If null is given the value set by {@link bcscale()} is used. @return int|float The result of the operation. @throws ...
[ "Adds", "a", "number", "to", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L239-L254
axelitus/php-base
src/BigNum.php
BigNum.sub
public static function sub($num1, $num2, $scale = null) { if (!static::is($num1) || !static::is($num2)) { throw new \InvalidArgumentException( "The \$num1 and \$num2 parameters must be numeric (or string representing a big number)." ); } if (Num::is($...
php
public static function sub($num1, $num2, $scale = null) { if (!static::is($num1) || !static::is($num2)) { throw new \InvalidArgumentException( "The \$num1 and \$num2 parameters must be numeric (or string representing a big number)." ); } if (Num::is($...
[ "public", "static", "function", "sub", "(", "$", "num1", ",", "$", "num2", ",", "$", "scale", "=", "null", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "num1", ")", "||", "!", "static", "::", "is", "(", "$", "num2", ")", ")", "{"...
Subtracts a number from another number. @param int|float|string $num1 The left operand. @param int|float|string $num2 The right operand. @param int $scale The scale to use for BCMath functions. If null is given the value set by {@link bcscale()} is used. @return int|float The result of the operation. @...
[ "Subtracts", "a", "number", "from", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L268-L283
axelitus/php-base
src/BigNum.php
BigNum.mul
public static function mul($num1, $num2, $scale = null) { if (!static::is($num1) || !static::is($num2)) { throw new \InvalidArgumentException( "The \$num1 and \$num2 parameters must be numeric (or string representing a big number)." ); } if (Num::is($...
php
public static function mul($num1, $num2, $scale = null) { if (!static::is($num1) || !static::is($num2)) { throw new \InvalidArgumentException( "The \$num1 and \$num2 parameters must be numeric (or string representing a big number)." ); } if (Num::is($...
[ "public", "static", "function", "mul", "(", "$", "num1", ",", "$", "num2", ",", "$", "scale", "=", "null", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "num1", ")", "||", "!", "static", "::", "is", "(", "$", "num2", ")", ")", "{"...
Multiplies a number by another number. @param int|float|string $num1 The left operand. @param int|float|string $num2 The right operand. @param int $scale The scale to use for BCMath functions. If null is given the value set by {@link bcscale()} is used. @return int|float The result of the operation. @t...
[ "Multiplies", "a", "number", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L297-L312
axelitus/php-base
src/BigNum.php
BigNum.div
public static function div($num1, $num2, $scale = null) { if (!static::is($num1) || !static::is($num2)) { throw new \InvalidArgumentException( "The \$num1 and \$num2 parameters must be numeric (or string representing a big number)." ); } if ($num2 == ...
php
public static function div($num1, $num2, $scale = null) { if (!static::is($num1) || !static::is($num2)) { throw new \InvalidArgumentException( "The \$num1 and \$num2 parameters must be numeric (or string representing a big number)." ); } if ($num2 == ...
[ "public", "static", "function", "div", "(", "$", "num1", ",", "$", "num2", ",", "$", "scale", "=", "null", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "num1", ")", "||", "!", "static", "::", "is", "(", "$", "num2", ")", ")", "{"...
Divides a number by another number. @param int|float|string $num1 The left operand. @param int|float|string $num2 The right operand. @param int $scale The scale to use for BCMath functions. If null is given the value set by {@link bcscale()} is used. @return int|float The result of the operation. @thro...
[ "Divides", "a", "number", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L326-L345
axelitus/php-base
src/BigNum.php
BigNum.pow
public static function pow($base, $exponent, $scale = null) { if (!static::is($base) || !static::is($exponent)) { throw new \InvalidArgumentException( "The \$base and \$exponent parameters must be numeric (or string representing a big number)." ); } i...
php
public static function pow($base, $exponent, $scale = null) { if (!static::is($base) || !static::is($exponent)) { throw new \InvalidArgumentException( "The \$base and \$exponent parameters must be numeric (or string representing a big number)." ); } i...
[ "public", "static", "function", "pow", "(", "$", "base", ",", "$", "exponent", ",", "$", "scale", "=", "null", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "base", ")", "||", "!", "static", "::", "is", "(", "$", "exponent", ")", ")...
Raises a number to the power of another number. @param int|float|string $base The base number. @param int|float|string $exponent The power exponent. @param int $scale The scale to use for BCMath functions. If null is given the value set by {@link bcscale()} is used. @return int|float The result of...
[ "Raises", "a", "number", "to", "the", "power", "of", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L359-L374
axelitus/php-base
src/BigNum.php
BigNum.mod
public static function mod($base, $modulus, $scale = null) { if (!static::is($base) || !static::is($modulus)) { throw new \InvalidArgumentException( "The \$base and \$modulus parameters must be numeric (or string representing a big number)." ); } if (...
php
public static function mod($base, $modulus, $scale = null) { if (!static::is($base) || !static::is($modulus)) { throw new \InvalidArgumentException( "The \$base and \$modulus parameters must be numeric (or string representing a big number)." ); } if (...
[ "public", "static", "function", "mod", "(", "$", "base", ",", "$", "modulus", ",", "$", "scale", "=", "null", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "base", ")", "||", "!", "static", "::", "is", "(", "$", "modulus", ")", ")",...
Gets the remainder of a number divided by another number. @param int|float|string $base The left operand. @param int|float|string $modulus The right operand. @param int $scale The scale to use for BCMath functions. If null is given the value set by {@link bcscale()} is used. @return float The result...
[ "Gets", "the", "remainder", "of", "a", "number", "divided", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L388-L410
axelitus/php-base
src/BigNum.php
BigNum.sqrt
public static function sqrt($base, $scale = null) { if (!static::is($base)) { throw new \InvalidArgumentException( "The \$base parameters must be numeric (or string representing a big number)." ); } if (Num::is($base)) { return sqrt($base)...
php
public static function sqrt($base, $scale = null) { if (!static::is($base)) { throw new \InvalidArgumentException( "The \$base parameters must be numeric (or string representing a big number)." ); } if (Num::is($base)) { return sqrt($base)...
[ "public", "static", "function", "sqrt", "(", "$", "base", ",", "$", "scale", "=", "null", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "base", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"The \\$base parameters mu...
Gets the square root of a number. @param int|float|string $base The base to use. @param int $scale The scale to use for BCMath functions. If null is given the value set by {@link bcscale()} is used. @return int|float The result of the operation. @throws \InvalidArgumentException @throws \RuntimeExceptio...
[ "Gets", "the", "square", "root", "of", "a", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigNum.php#L423-L438
RinkAttendant6/JsonI18n
src/Translate.php
Translate.addResource
public function addResource($resource, string $type = 'file'): void { if (is_array($resource)) { $this->addResourceArray($resource); return; } if (is_string($resource)) { switch ($type) { case 'json': $this->addResource...
php
public function addResource($resource, string $type = 'file'): void { if (is_array($resource)) { $this->addResourceArray($resource); return; } if (is_string($resource)) { switch ($type) { case 'json': $this->addResource...
[ "public", "function", "addResource", "(", "$", "resource", ",", "string", "$", "type", "=", "'file'", ")", ":", "void", "{", "if", "(", "is_array", "(", "$", "resource", ")", ")", "{", "$", "this", "->", "addResourceArray", "(", "$", "resource", ")", ...
Adds a resource @param mixed $resource The resource to add @param string $type The resource type. Defaults to "file"
[ "Adds", "a", "resource" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L46-L65
RinkAttendant6/JsonI18n
src/Translate.php
Translate.addResourceString
protected function addResourceString(string $resource): void { $data = json_decode($resource, true); if (json_last_error() !== \JSON_ERROR_NONE) { if (function_exists('json_last_error_msg')) { throw new \InvalidArgumentException(json_last_error_msg(), json_last_error()); ...
php
protected function addResourceString(string $resource): void { $data = json_decode($resource, true); if (json_last_error() !== \JSON_ERROR_NONE) { if (function_exists('json_last_error_msg')) { throw new \InvalidArgumentException(json_last_error_msg(), json_last_error()); ...
[ "protected", "function", "addResourceString", "(", "string", "$", "resource", ")", ":", "void", "{", "$", "data", "=", "json_decode", "(", "$", "resource", ",", "true", ")", ";", "if", "(", "json_last_error", "(", ")", "!==", "\\", "JSON_ERROR_NONE", ")", ...
Adds a resource represented in a JSON string @param string $resource The resource as JSON data @throws \InvalidArgumentException If the resource is not valid JSON
[ "Adds", "a", "resource", "represented", "in", "a", "JSON", "string" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L72-L83
RinkAttendant6/JsonI18n
src/Translate.php
Translate.addResourceArray
protected function addResourceArray(array $resource): void { foreach ($resource as $locale => $value) { if ($locale === '@metadata') { $this->parseMetadata($value); continue; } $this->addSubresource($value, $locale); } }
php
protected function addResourceArray(array $resource): void { foreach ($resource as $locale => $value) { if ($locale === '@metadata') { $this->parseMetadata($value); continue; } $this->addSubresource($value, $locale); } }
[ "protected", "function", "addResourceArray", "(", "array", "$", "resource", ")", ":", "void", "{", "foreach", "(", "$", "resource", "as", "$", "locale", "=>", "$", "value", ")", "{", "if", "(", "$", "locale", "===", "'@metadata'", ")", "{", "$", "this"...
Adds a resource array @param array $resource The resource array
[ "Adds", "a", "resource", "array" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L89-L98
RinkAttendant6/JsonI18n
src/Translate.php
Translate.addSubresource
public function addSubresource($subresource, string $locale): void { if ($subresource instanceof Resource) { $resource = $subresource; } elseif (is_string($subresource)) { $resource = ResourceBuilder::fromFile($subresource, $locale); } elseif (is_array($subresource)) ...
php
public function addSubresource($subresource, string $locale): void { if ($subresource instanceof Resource) { $resource = $subresource; } elseif (is_string($subresource)) { $resource = ResourceBuilder::fromFile($subresource, $locale); } elseif (is_array($subresource)) ...
[ "public", "function", "addSubresource", "(", "$", "subresource", ",", "string", "$", "locale", ")", ":", "void", "{", "if", "(", "$", "subresource", "instanceof", "Resource", ")", "{", "$", "resource", "=", "$", "subresource", ";", "}", "elseif", "(", "i...
Adds a sub-resource @param mixed $subresource The sub-resource value @param string $locale
[ "Adds", "a", "sub", "-", "resource" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L105-L122
RinkAttendant6/JsonI18n
src/Translate.php
Translate.parseMetadata
protected function parseMetadata(array $metadata): void { if (isset($metadata['arrayGroups'])) { foreach ($metadata['arrayGroups'] as $name => $values) { if (!isset($this->arrayGroups[$name])) { $this->arrayGroups[$name] = array(); } ...
php
protected function parseMetadata(array $metadata): void { if (isset($metadata['arrayGroups'])) { foreach ($metadata['arrayGroups'] as $name => $values) { if (!isset($this->arrayGroups[$name])) { $this->arrayGroups[$name] = array(); } ...
[ "protected", "function", "parseMetadata", "(", "array", "$", "metadata", ")", ":", "void", "{", "if", "(", "isset", "(", "$", "metadata", "[", "'arrayGroups'", "]", ")", ")", "{", "foreach", "(", "$", "metadata", "[", "'arrayGroups'", "]", "as", "$", "...
Parses resource file metadata @param array $metadata The metadata
[ "Parses", "resource", "file", "metadata" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L128-L141
RinkAttendant6/JsonI18n
src/Translate.php
Translate.addResourceFile
protected function addResourceFile(string $file): void { if (!is_file($file)) { throw new \InvalidArgumentException("$file is not a file"); } $contents = file_get_contents($file); if ($contents === false) { throw new \RuntimeException("Error ...
php
protected function addResourceFile(string $file): void { if (!is_file($file)) { throw new \InvalidArgumentException("$file is not a file"); } $contents = file_get_contents($file); if ($contents === false) { throw new \RuntimeException("Error ...
[ "protected", "function", "addResourceFile", "(", "string", "$", "file", ")", ":", "void", "{", "if", "(", "!", "is_file", "(", "$", "file", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"$file is not a file\"", ")", ";", "}", "$",...
Adds a resource file @param string $file The path to the resource file @throws \InvalidArgumentException If the filename provided is not a file @throws \RuntimeException If the file could not be read
[ "Adds", "a", "resource", "file" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L149-L162
RinkAttendant6/JsonI18n
src/Translate.php
Translate.setLanguage
public function setLanguage(string $lang): void { if (!is_string($lang) || empty($lang)) { throw new \InvalidArgumentException("Invalid language $lang"); } $this->lang = $lang; }
php
public function setLanguage(string $lang): void { if (!is_string($lang) || empty($lang)) { throw new \InvalidArgumentException("Invalid language $lang"); } $this->lang = $lang; }
[ "public", "function", "setLanguage", "(", "string", "$", "lang", ")", ":", "void", "{", "if", "(", "!", "is_string", "(", "$", "lang", ")", "||", "empty", "(", "$", "lang", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Invali...
Sets the default language @param string $lang The language @throws \InvalidArgumentException If the langauge is invalid
[ "Sets", "the", "default", "language" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L169-L176
RinkAttendant6/JsonI18n
src/Translate.php
Translate.__
public function __(string $key, ?string $lang = null): string { if ($lang === null) { $lang = $this->lang; } if (!isset($this->data[$lang])) { throw new \OutOfBoundsException("Invalid language: $lang"); } if (!isset($this->data[$lang]...
php
public function __(string $key, ?string $lang = null): string { if ($lang === null) { $lang = $this->lang; } if (!isset($this->data[$lang])) { throw new \OutOfBoundsException("Invalid language: $lang"); } if (!isset($this->data[$lang]...
[ "public", "function", "__", "(", "string", "$", "key", ",", "?", "string", "$", "lang", "=", "null", ")", ":", "string", "{", "if", "(", "$", "lang", "===", "null", ")", "{", "$", "lang", "=", "$", "this", "->", "lang", ";", "}", "if", "(", "...
Returns localized text Use this if you need to pass the localized string to another function such as ucwords() or ucfirst() @param string $key The key (description) of the localized text @param string $lang The output language. Default is default language. @return string The localized text @throws \OutOfBoundsException...
[ "Returns", "localized", "text", "Use", "this", "if", "you", "need", "to", "pass", "the", "localized", "string", "to", "another", "function", "such", "as", "ucwords", "()", "or", "ucfirst", "()" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L196-L211
RinkAttendant6/JsonI18n
src/Translate.php
Translate._e
public function _e(string $key, ?string $lang = null): void { echo $this->__($key, $lang); }
php
public function _e(string $key, ?string $lang = null): void { echo $this->__($key, $lang); }
[ "public", "function", "_e", "(", "string", "$", "key", ",", "?", "string", "$", "lang", "=", "null", ")", ":", "void", "{", "echo", "$", "this", "->", "__", "(", "$", "key", ",", "$", "lang", ")", ";", "}" ]
Prints localized text @param string $key The key (description) of the localized text @param string $lang The output language. Default is default language. @codeCoverageIgnore
[ "Prints", "localized", "text" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L219-L222
RinkAttendant6/JsonI18n
src/Translate.php
Translate._f
public function _f(string $key, $strings, ?string $lang = null): string { if ($lang === null) { $lang = $this->lang; } if (!isset($this->data[$lang])) { throw new \OutOfBoundsException("Invalid language: $lang"); } if (!isset($this->d...
php
public function _f(string $key, $strings, ?string $lang = null): string { if ($lang === null) { $lang = $this->lang; } if (!isset($this->data[$lang])) { throw new \OutOfBoundsException("Invalid language: $lang"); } if (!isset($this->d...
[ "public", "function", "_f", "(", "string", "$", "key", ",", "$", "strings", ",", "?", "string", "$", "lang", "=", "null", ")", ":", "string", "{", "if", "(", "$", "lang", "===", "null", ")", "{", "$", "lang", "=", "$", "this", "->", "lang", ";"...
Returns "formatted" localized text @param string $key The key (description) of the localized text @param string|array $strings See sprintf (string) and vsprintf (array) @param string $lang The output language. Default is default language. @return string The "formatted" localized text @throws \OutOfBoundsException If th...
[ "Returns", "formatted", "localized", "text" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L233-L260
RinkAttendant6/JsonI18n
src/Translate.php
Translate._ef
public function _ef(string $key, $strings, ?string $lang = null): void { echo $this->_f($key, $strings, $lang); }
php
public function _ef(string $key, $strings, ?string $lang = null): void { echo $this->_f($key, $strings, $lang); }
[ "public", "function", "_ef", "(", "string", "$", "key", ",", "$", "strings", ",", "?", "string", "$", "lang", "=", "null", ")", ":", "void", "{", "echo", "$", "this", "->", "_f", "(", "$", "key", ",", "$", "strings", ",", "$", "lang", ")", ";",...
Prints "formatted" localized text @param string $key The key (description) of the localized text @param string|array $strings See sprintf (string) and vsprintf (array) @param string $lang The output language. Default is default language. @codeCoverageIgnore
[ "Prints", "formatted", "localized", "text" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L269-L272
RinkAttendant6/JsonI18n
src/Translate.php
Translate.localizeDeepArray
public function localizeDeepArray(?array $arr, string $group, int $depth = 1, ?string $lang = null): ?array { if ($arr === null) { return null; } if ($depth < 0) { throw new \InvalidArgumentException("Depth must be a non-negative integer, $depth given"); ...
php
public function localizeDeepArray(?array $arr, string $group, int $depth = 1, ?string $lang = null): ?array { if ($arr === null) { return null; } if ($depth < 0) { throw new \InvalidArgumentException("Depth must be a non-negative integer, $depth given"); ...
[ "public", "function", "localizeDeepArray", "(", "?", "array", "$", "arr", ",", "string", "$", "group", ",", "int", "$", "depth", "=", "1", ",", "?", "string", "$", "lang", "=", "null", ")", ":", "?", "array", "{", "if", "(", "$", "arr", "===", "n...
Localizes a multidimensional array @param array $arr The array to localize @param string $group The name of the group of fields to flatten @param int $depth The depth of the array @param string $lang The output language. Default is default language. @return array
[ "Localizes", "a", "multidimensional", "array" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L282-L304
RinkAttendant6/JsonI18n
src/Translate.php
Translate.flatten
private function flatten(?array $arr, string $group, ?string $lang = null): ?array { if ($arr === null) { return null; } if (!isset($this->arrayGroups[$group])) { throw new \OutOfBoundsException("Invalid group: $group"); } if ($lang === null) { ...
php
private function flatten(?array $arr, string $group, ?string $lang = null): ?array { if ($arr === null) { return null; } if (!isset($this->arrayGroups[$group])) { throw new \OutOfBoundsException("Invalid group: $group"); } if ($lang === null) { ...
[ "private", "function", "flatten", "(", "?", "array", "$", "arr", ",", "string", "$", "group", ",", "?", "string", "$", "lang", "=", "null", ")", ":", "?", "array", "{", "if", "(", "$", "arr", "===", "null", ")", "{", "return", "null", ";", "}", ...
Flattens an array group @param array $arr The array to localize @param string $group The name of the group of fields to flatten @param string $lang The output language. Default is default language. @return array @throws \OutOfBoundsException If the group does not exist or if the array values do not contain the key in a...
[ "Flattens", "an", "array", "group" ]
train
https://github.com/RinkAttendant6/JsonI18n/blob/882cbd43d273f771a384eb09d205d327033aaae3/src/Translate.php#L314-L344
wpottier/WizadSettingsBundle
Model/Settings.php
Settings.save
public function save() { foreach ($this->data as $key => $value) { if (!empty($value)) { $this->parametersStorage->set($key, $value); } else { // Remove value to use default $this->parametersStorage->remove($key); } ...
php
public function save() { foreach ($this->data as $key => $value) { if (!empty($value)) { $this->parametersStorage->set($key, $value); } else { // Remove value to use default $this->parametersStorage->remove($key); } ...
[ "public", "function", "save", "(", ")", "{", "foreach", "(", "$", "this", "->", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "empty", "(", "$", "value", ")", ")", "{", "$", "this", "->", "parametersStorage", "->", "set"...
Save current model in the storage
[ "Save", "current", "model", "in", "the", "storage" ]
train
https://github.com/wpottier/WizadSettingsBundle/blob/92738c59d4da28d3a7376de854ce8505898159cb/Model/Settings.php#L160-L170
wpottier/WizadSettingsBundle
Model/Settings.php
Settings.offsetExists
public function offsetExists($offset) { if (strpos($offset, 'form_') === 0) { $offset = str_replace('form_', '', $offset); return array_key_exists($offset, $this->keyDict); } elseif (strpos($offset, 'setting_') === 0 || strpos($offset, 'default_setting_') === 0) { ...
php
public function offsetExists($offset) { if (strpos($offset, 'form_') === 0) { $offset = str_replace('form_', '', $offset); return array_key_exists($offset, $this->keyDict); } elseif (strpos($offset, 'setting_') === 0 || strpos($offset, 'default_setting_') === 0) { ...
[ "public", "function", "offsetExists", "(", "$", "offset", ")", "{", "if", "(", "strpos", "(", "$", "offset", ",", "'form_'", ")", "===", "0", ")", "{", "$", "offset", "=", "str_replace", "(", "'form_'", ",", "''", ",", "$", "offset", ")", ";", "ret...
(PHP 5 &gt;= 5.0.0)<br/> Whether a offset exists @link http://php.net/manual/en/arrayaccess.offsetexists.php @param mixed $offset <p> An offset to check for. </p> @return boolean true on success or false on failure. </p> <p> The return value will be casted to boolean if non-boolean was returned.
[ "(", "PHP", "5", "&gt", ";", "=", "5", ".", "0", ".", "0", ")", "<br", "/", ">", "Whether", "a", "offset", "exists" ]
train
https://github.com/wpottier/WizadSettingsBundle/blob/92738c59d4da28d3a7376de854ce8505898159cb/Model/Settings.php#L205-L218
phizzl/deployee
src/Bootstrap/RegisterConfigTrait.php
RegisterConfigTrait.registerConfigLoader
private function registerConfigLoader() { /** * @return ConfigLoaderInterface */ $this->getContainer()[ConfigLoaderInterface::CONTAINER_ID] = function(Container $container){ $defaultConfigFile = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTO...
php
private function registerConfigLoader() { /** * @return ConfigLoaderInterface */ $this->getContainer()[ConfigLoaderInterface::CONTAINER_ID] = function(Container $container){ $defaultConfigFile = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTO...
[ "private", "function", "registerConfigLoader", "(", ")", "{", "/**\n * @return ConfigLoaderInterface\n */", "$", "this", "->", "getContainer", "(", ")", "[", "ConfigLoaderInterface", "::", "CONTAINER_ID", "]", "=", "function", "(", "Container", "$", "con...
Register the config loader to the DI container
[ "Register", "the", "config", "loader", "to", "the", "DI", "container" ]
train
https://github.com/phizzl/deployee/blob/def884e49608589d9594b8d538f3ec9aa0e25add/src/Bootstrap/RegisterConfigTrait.php#L19-L53
phizzl/deployee
src/Bootstrap/RegisterConfigTrait.php
RegisterConfigTrait.registerConfig
private function registerConfig() { /** * @param Container $di * @return Config */ $this->getContainer()[Config::CONTAINER_ID] = function(Container $di){ /* @var ConfigLoaderInterface $loader */ $loader = $di[ConfigLoaderInterface::CONTAINER_ID]; ...
php
private function registerConfig() { /** * @param Container $di * @return Config */ $this->getContainer()[Config::CONTAINER_ID] = function(Container $di){ /* @var ConfigLoaderInterface $loader */ $loader = $di[ConfigLoaderInterface::CONTAINER_ID]; ...
[ "private", "function", "registerConfig", "(", ")", "{", "/**\n * @param Container $di\n * @return Config\n */", "$", "this", "->", "getContainer", "(", ")", "[", "Config", "::", "CONTAINER_ID", "]", "=", "function", "(", "Container", "$", "di", ...
Register the config to the DI container
[ "Register", "the", "config", "to", "the", "DI", "container" ]
train
https://github.com/phizzl/deployee/blob/def884e49608589d9594b8d538f3ec9aa0e25add/src/Bootstrap/RegisterConfigTrait.php#L58-L72
JoffreyPoreeCoding/MongoDB-ODM
src/Factory/RepositoryFactory.php
RepositoryFactory.getRepository
public function getRepository(DocumentManager $documentManager, $modelName, $collectionName, CacheProvider $repositoryCache = null) { $repIndex = $modelName . $collectionName; if (false != ($repository = $this->cache->fetch($repIndex))) { return $repository; } $classMeta...
php
public function getRepository(DocumentManager $documentManager, $modelName, $collectionName, CacheProvider $repositoryCache = null) { $repIndex = $modelName . $collectionName; if (false != ($repository = $this->cache->fetch($repIndex))) { return $repository; } $classMeta...
[ "public", "function", "getRepository", "(", "DocumentManager", "$", "documentManager", ",", "$", "modelName", ",", "$", "collectionName", ",", "CacheProvider", "$", "repositoryCache", "=", "null", ")", "{", "$", "repIndex", "=", "$", "modelName", ".", "$", "co...
Get a repository @param DocumentManager $documentManager Document manager @param string $modelName Class of the model @param string $collectionName Name of MongoDB Collection @param CacheProvider $repositoryCache Cache for the repository @return Repositor...
[ "Get", "a", "repository" ]
train
https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Factory/RepositoryFactory.php#L55-L102
JoffreyPoreeCoding/MongoDB-ODM
src/Factory/RepositoryFactory.php
RepositoryFactory.createCollection
private function createCollection(DocumentManager $documentManager, ClassMetadata $classMetadata, $collectionName) { $database = $documentManager->getDatabase(); $exists = false; foreach ($database->listCollections() as $collection) { if ($collection->getName() == $collectionNa...
php
private function createCollection(DocumentManager $documentManager, ClassMetadata $classMetadata, $collectionName) { $database = $documentManager->getDatabase(); $exists = false; foreach ($database->listCollections() as $collection) { if ($collection->getName() == $collectionNa...
[ "private", "function", "createCollection", "(", "DocumentManager", "$", "documentManager", ",", "ClassMetadata", "$", "classMetadata", ",", "$", "collectionName", ")", "{", "$", "database", "=", "$", "documentManager", "->", "getDatabase", "(", ")", ";", "$", "e...
Create the collection @param DocumentManager $documentManager Current document manager @param ClassMetadata $classMetadata Class metadata @param string $collectionName Name of collection @return Collection
[ "Create", "the", "collection" ]
train
https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Factory/RepositoryFactory.php#L112-L132
WindomZ/shmcache
src/Cache.php
Cache.saveCache
public static function saveCache(string $key, $value, int $seconds = 0): bool { return self::getInstance()->save($key, $value, $seconds); }
php
public static function saveCache(string $key, $value, int $seconds = 0): bool { return self::getInstance()->save($key, $value, $seconds); }
[ "public", "static", "function", "saveCache", "(", "string", "$", "key", ",", "$", "value", ",", "int", "$", "seconds", "=", "0", ")", ":", "bool", "{", "return", "self", "::", "getInstance", "(", ")", "->", "save", "(", "$", "key", ",", "$", "value...
Save $value by $key to cache @param string $key @param mixed $value @param int $seconds [optional] @return bool
[ "Save", "$value", "by", "$key", "to", "cache" ]
train
https://github.com/WindomZ/shmcache/blob/dfb1660b72e6807ba9c6eb4bed70169f4d7e0a7a/src/Cache.php#L50-L53
crossjoin/Css
src/Crossjoin/Css/Writer/Pretty.php
Pretty.getOptions
protected function getOptions($level) { $lineBreak = "\r\n"; $intendChar = "\t"; $intendNum = 1; $baseIntend = str_repeat($intendChar, $intendNum * $level); $nextIntend = str_repeat($intendChar, $intendNum * ($level + 1)); $extraLineBreak = ($level === 0 ? $lineBreak...
php
protected function getOptions($level) { $lineBreak = "\r\n"; $intendChar = "\t"; $intendNum = 1; $baseIntend = str_repeat($intendChar, $intendNum * $level); $nextIntend = str_repeat($intendChar, $intendNum * ($level + 1)); $extraLineBreak = ($level === 0 ? $lineBreak...
[ "protected", "function", "getOptions", "(", "$", "level", ")", "{", "$", "lineBreak", "=", "\"\\r\\n\"", ";", "$", "intendChar", "=", "\"\\t\"", ";", "$", "intendNum", "=", "1", ";", "$", "baseIntend", "=", "str_repeat", "(", "$", "intendChar", ",", "$",...
Gets the options for the CSS generation. @param int $level @return array
[ "Gets", "the", "options", "for", "the", "CSS", "generation", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Writer/Pretty.php#L13-L68
phizzl/deployee
src/Bootstrap/RegisterTaskDispatcherCollectionTrait.php
RegisterTaskDispatcherCollectionTrait.registerTaskDispatcherCollection
private function registerTaskDispatcherCollection() { $this->getContainer()[TaskDispatcherCollection::CONTAINER_ID] = function(){ $collection = new TaskDispatcherCollection(); $event = new TaskDispatcherCollectionInitializedEvent($this->container, $collection); $this->con...
php
private function registerTaskDispatcherCollection() { $this->getContainer()[TaskDispatcherCollection::CONTAINER_ID] = function(){ $collection = new TaskDispatcherCollection(); $event = new TaskDispatcherCollectionInitializedEvent($this->container, $collection); $this->con...
[ "private", "function", "registerTaskDispatcherCollection", "(", ")", "{", "$", "this", "->", "getContainer", "(", ")", "[", "TaskDispatcherCollection", "::", "CONTAINER_ID", "]", "=", "function", "(", ")", "{", "$", "collection", "=", "new", "TaskDispatcherCollect...
Register the config loader to the DI container
[ "Register", "the", "config", "loader", "to", "the", "DI", "container" ]
train
https://github.com/phizzl/deployee/blob/def884e49608589d9594b8d538f3ec9aa0e25add/src/Bootstrap/RegisterTaskDispatcherCollectionTrait.php#L17-L26
weavephp/weave
src/Middleware/Middleware.php
Middleware.execute
public function execute($pipelineName = null) { $request = $this->requestFactory->newIncomingRequest(); if ($this->adaptor->isDoublePass()) { $response = $this->responseFactory->newResponse(); } else { $response = null; } return $this->chain($pipelineName, $request, $response); }
php
public function execute($pipelineName = null) { $request = $this->requestFactory->newIncomingRequest(); if ($this->adaptor->isDoublePass()) { $response = $this->responseFactory->newResponse(); } else { $response = null; } return $this->chain($pipelineName, $request, $response); }
[ "public", "function", "execute", "(", "$", "pipelineName", "=", "null", ")", "{", "$", "request", "=", "$", "this", "->", "requestFactory", "->", "newIncomingRequest", "(", ")", ";", "if", "(", "$", "this", "->", "adaptor", "->", "isDoublePass", "(", ")"...
Create and execute the named pipeline as an initial entry pipeline. Similar to chaining but also sets up a Request based on the global data and, if needed, a Response object. @param string $pipelineName Optional pipeline name. @return Response A PSR7 response object.
[ "Create", "and", "execute", "the", "named", "pipeline", "as", "an", "initial", "entry", "pipeline", "." ]
train
https://github.com/weavephp/weave/blob/44183a5bcb9e3ed3754cc76aa9e0724d718caeec/src/Middleware/Middleware.php#L105-L114
weavephp/weave
src/Middleware/Middleware.php
Middleware.chain
public function chain($pipelineName, Request $request, Response $response = null) { $pipelineProvider = $this->pipelineProvider; $pipeline = $pipelineProvider($pipelineName); return $this->adaptor->executePipeline($pipeline, $request, $response); }
php
public function chain($pipelineName, Request $request, Response $response = null) { $pipelineProvider = $this->pipelineProvider; $pipeline = $pipelineProvider($pipelineName); return $this->adaptor->executePipeline($pipeline, $request, $response); }
[ "public", "function", "chain", "(", "$", "pipelineName", ",", "Request", "$", "request", ",", "Response", "$", "response", "=", "null", ")", "{", "$", "pipelineProvider", "=", "$", "this", "->", "pipelineProvider", ";", "$", "pipeline", "=", "$", "pipeline...
Create and execute a named pipeline chaining from an existing Request/Response. @param string $pipelineName The name of the pipeline to create. @param Request $request The PSR7 request object. @param Response|null $response The PSR7 response object (for double-pass pipelines). @return Response A...
[ "Create", "and", "execute", "a", "named", "pipeline", "chaining", "from", "an", "existing", "Request", "/", "Response", "." ]
train
https://github.com/weavephp/weave/blob/44183a5bcb9e3ed3754cc76aa9e0724d718caeec/src/Middleware/Middleware.php#L125-L130
WindomZ/shmcache
src/Block.php
Block.save
public function save(string $key, $value, int $seconds = 0): bool { if (empty($key)) { throw new \ErrorException('"key" should not be empty!'); } elseif (!$this->isEnable()) { return false; } $data = $this->read(); if (!is_array($data)) { ...
php
public function save(string $key, $value, int $seconds = 0): bool { if (empty($key)) { throw new \ErrorException('"key" should not be empty!'); } elseif (!$this->isEnable()) { return false; } $data = $this->read(); if (!is_array($data)) { ...
[ "public", "function", "save", "(", "string", "$", "key", ",", "$", "value", ",", "int", "$", "seconds", "=", "0", ")", ":", "bool", "{", "if", "(", "empty", "(", "$", "key", ")", ")", "{", "throw", "new", "\\", "ErrorException", "(", "'\"key\" shou...
Save $value by $key to cache @param string $key @param mixed $value @param int $seconds @return bool @throws \ErrorException
[ "Save", "$value", "by", "$key", "to", "cache" ]
train
https://github.com/WindomZ/shmcache/blob/dfb1660b72e6807ba9c6eb4bed70169f4d7e0a7a/src/Block.php#L81-L97
WindomZ/shmcache
src/Block.php
Block.get
public function get(string $key) { if (empty($key) || !$this->isEnable()) { return false; } $value = $this->read(); if (!is_array($value) || !isset($value[$key])) { return false; } return $value[$key]; }
php
public function get(string $key) { if (empty($key) || !$this->isEnable()) { return false; } $value = $this->read(); if (!is_array($value) || !isset($value[$key])) { return false; } return $value[$key]; }
[ "public", "function", "get", "(", "string", "$", "key", ")", "{", "if", "(", "empty", "(", "$", "key", ")", "||", "!", "$", "this", "->", "isEnable", "(", ")", ")", "{", "return", "false", ";", "}", "$", "value", "=", "$", "this", "->", "read",...
Get the $value by $key from cache @param string $key @return bool|mixed
[ "Get", "the", "$value", "by", "$key", "from", "cache" ]
train
https://github.com/WindomZ/shmcache/blob/dfb1660b72e6807ba9c6eb4bed70169f4d7e0a7a/src/Block.php#L104-L116
shawnsandy/ui-pages
src/Classes/Socializer.php
Socializer.findOrRegister
public function findOrRegister($user) { if ($userExist = User::where($user['email'])->first()) { return $userExist; } $newUser = User::create($user); return $newUser; }
php
public function findOrRegister($user) { if ($userExist = User::where($user['email'])->first()) { return $userExist; } $newUser = User::create($user); return $newUser; }
[ "public", "function", "findOrRegister", "(", "$", "user", ")", "{", "if", "(", "$", "userExist", "=", "User", "::", "where", "(", "$", "user", "[", "'email'", "]", ")", "->", "first", "(", ")", ")", "{", "return", "$", "userExist", ";", "}", "$", ...
Find or register user based on socialite credentials checks to see if the user exists or create a new user from user socialite credentials @param $user @return User object
[ "Find", "or", "register", "user", "based", "on", "socialite", "credentials", "checks", "to", "see", "if", "the", "user", "exists", "or", "create", "a", "new", "user", "from", "user", "socialite", "credentials" ]
train
https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Socializer.php#L35-L42
shawnsandy/ui-pages
src/Classes/Socializer.php
Socializer.registerAndLogin
public function registerAndLogin($user, $redirect) { $loginUser = $this->findOrRegister($user); $this->login($loginUser, $redirect); return false; }
php
public function registerAndLogin($user, $redirect) { $loginUser = $this->findOrRegister($user); $this->login($loginUser, $redirect); return false; }
[ "public", "function", "registerAndLogin", "(", "$", "user", ",", "$", "redirect", ")", "{", "$", "loginUser", "=", "$", "this", "->", "findOrRegister", "(", "$", "user", ")", ";", "$", "this", "->", "login", "(", "$", "loginUser", ",", "$", "redirect",...
Registers and login the user via socialite / oauth credentials @param $user @param $redirect @return bool
[ "Registers", "and", "login", "the", "user", "via", "socialite", "/", "oauth", "credentials" ]
train
https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Socializer.php#L64-L69
muxtor/yii2-pkk5-module
src/models/ParseForm.php
ParseForm.parse
public function parse() { if (!$this->validate()) { return null; } $parse = new Pkk5Component(['cache'=>true]); $data = $parse->getInfo($this->kadastr); if(!empty($data)){ $show = []; foreach ($data as $key => $value){ ...
php
public function parse() { if (!$this->validate()) { return null; } $parse = new Pkk5Component(['cache'=>true]); $data = $parse->getInfo($this->kadastr); if(!empty($data)){ $show = []; foreach ($data as $key => $value){ ...
[ "public", "function", "parse", "(", ")", "{", "if", "(", "!", "$", "this", "->", "validate", "(", ")", ")", "{", "return", "null", ";", "}", "$", "parse", "=", "new", "Pkk5Component", "(", "[", "'cache'", "=>", "true", "]", ")", ";", "$", "data",...
Parse @return boolean
[ "Parse" ]
train
https://github.com/muxtor/yii2-pkk5-module/blob/09be77ddd171c66df53ec89d229d0cc5c0a9ad94/src/models/ParseForm.php#L41-L68
mnapoli/assembly
src/ObjectDefinition.php
ObjectDefinition.addMethodCall
public function addMethodCall($methodName) { $arguments = func_get_args(); array_shift($arguments); $this->methodCalls[] = new MethodCall($methodName, $arguments); return $this; }
php
public function addMethodCall($methodName) { $arguments = func_get_args(); array_shift($arguments); $this->methodCalls[] = new MethodCall($methodName, $arguments); return $this; }
[ "public", "function", "addMethodCall", "(", "$", "methodName", ")", "{", "$", "arguments", "=", "func_get_args", "(", ")", ";", "array_shift", "(", "$", "arguments", ")", ";", "$", "this", "->", "methodCalls", "[", "]", "=", "new", "MethodCall", "(", "$"...
Set a method to be called after instantiating the class. After the $methodName parameter, this method take as many parameters as necessary. @param string $methodName Name of the method to call. @param string|number|bool|array|ReferenceDefinitionInterface... Can be a scalar value, an array of scalar or a reference to ...
[ "Set", "a", "method", "to", "be", "called", "after", "instantiating", "the", "class", "." ]
train
https://github.com/mnapoli/assembly/blob/bdaff7455d34958f2c2a5a3379de3d88b567b9fc/src/ObjectDefinition.php#L97-L105
Nayjest/Tree
src/ReadonlyNodeTrait.php
ReadonlyNodeTrait.children
public function children() { if ($this->readonlyCollection === null) { $this->readonlyCollection = new ReadonlyObjectCollection( $this->writableChildren() ); } return $this->readonlyCollection; }
php
public function children() { if ($this->readonlyCollection === null) { $this->readonlyCollection = new ReadonlyObjectCollection( $this->writableChildren() ); } return $this->readonlyCollection; }
[ "public", "function", "children", "(", ")", "{", "if", "(", "$", "this", "->", "readonlyCollection", "===", "null", ")", "{", "$", "this", "->", "readonlyCollection", "=", "new", "ReadonlyObjectCollection", "(", "$", "this", "->", "writableChildren", "(", ")...
Returns child components. @return ReadonlyObjectCollection
[ "Returns", "child", "components", "." ]
train
https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/ReadonlyNodeTrait.php#L21-L30
ekyna/GlsUniBox
Generator/NumberGenerator.php
NumberGenerator.readNumber
private function readNumber() { // Open if (false === $this->handle = fopen($this->path, 'c+')) { throw new RuntimeException("Failed to open file {$this->path}."); } // Exclusive lock if (!flock($this->handle, LOCK_EX)) { throw new RuntimeException("Fa...
php
private function readNumber() { // Open if (false === $this->handle = fopen($this->path, 'c+')) { throw new RuntimeException("Failed to open file {$this->path}."); } // Exclusive lock if (!flock($this->handle, LOCK_EX)) { throw new RuntimeException("Fa...
[ "private", "function", "readNumber", "(", ")", "{", "// Open", "if", "(", "false", "===", "$", "this", "->", "handle", "=", "fopen", "(", "$", "this", "->", "path", ",", "'c+'", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failed to open fi...
Reads the previous number. @return int
[ "Reads", "the", "previous", "number", "." ]
train
https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Generator/NumberGenerator.php#L54-L70
ekyna/GlsUniBox
Generator/NumberGenerator.php
NumberGenerator.writeNumber
private function writeNumber($number) { // Truncate if (!ftruncate($this->handle, 0)) { throw new RuntimeException("Failed to truncate file {$this->path}."); } // Reset if (0 > fseek($this->handle, 0)) { throw new RuntimeException("Failed to move point...
php
private function writeNumber($number) { // Truncate if (!ftruncate($this->handle, 0)) { throw new RuntimeException("Failed to truncate file {$this->path}."); } // Reset if (0 > fseek($this->handle, 0)) { throw new RuntimeException("Failed to move point...
[ "private", "function", "writeNumber", "(", "$", "number", ")", "{", "// Truncate", "if", "(", "!", "ftruncate", "(", "$", "this", "->", "handle", ",", "0", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failed to truncate file {$this->path}.\"", ")...
Writes the new number. @param string $number
[ "Writes", "the", "new", "number", "." ]
train
https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Generator/NumberGenerator.php#L77-L101
o2system/html
src/Dom/Lists/Nodes.php
Nodes.replace
public function replace($source) { foreach ($this as $node) { if ($node instanceof Element) { $node->replace($source); } } }
php
public function replace($source) { foreach ($this as $node) { if ($node instanceof Element) { $node->replace($source); } } }
[ "public", "function", "replace", "(", "$", "source", ")", "{", "foreach", "(", "$", "this", "as", "$", "node", ")", "{", "if", "(", "$", "node", "instanceof", "Element", ")", "{", "$", "node", "->", "replace", "(", "$", "source", ")", ";", "}", "...
Nodes::replace @param mixed $source
[ "Nodes", "::", "replace" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Lists/Nodes.php#L107-L114
o2system/html
src/Dom/Lists/Nodes.php
Nodes.remove
public function remove() { foreach ($this as $node) { if ($node instanceof Element) { if ( ! empty($node->parentNode)) { $node->parentNode->removeChild($node); } } } }
php
public function remove() { foreach ($this as $node) { if ($node instanceof Element) { if ( ! empty($node->parentNode)) { $node->parentNode->removeChild($node); } } } }
[ "public", "function", "remove", "(", ")", "{", "foreach", "(", "$", "this", "as", "$", "node", ")", "{", "if", "(", "$", "node", "instanceof", "Element", ")", "{", "if", "(", "!", "empty", "(", "$", "node", "->", "parentNode", ")", ")", "{", "$",...
Nodes::remove
[ "Nodes", "::", "remove" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Lists/Nodes.php#L121-L130
o2system/html
src/Dom/Lists/Nodes.php
Nodes.append
public function append($source) { foreach ($this as $node) { if ($node instanceof Element) { $node->prepend($source); } } return $this; }
php
public function append($source) { foreach ($this as $node) { if ($node instanceof Element) { $node->prepend($source); } } return $this; }
[ "public", "function", "append", "(", "$", "source", ")", "{", "foreach", "(", "$", "this", "as", "$", "node", ")", "{", "if", "(", "$", "node", "instanceof", "Element", ")", "{", "$", "node", "->", "prepend", "(", "$", "source", ")", ";", "}", "}...
Nodes::append @param mixed $source @return static
[ "Nodes", "::", "append" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Lists/Nodes.php#L161-L170
o2system/html
src/Dom/Lists/Nodes.php
Nodes.before
public function before($source) { foreach ($this as $node) { if ($node instanceof Element) { $node->before($source); } } return $this; }
php
public function before($source) { foreach ($this as $node) { if ($node instanceof Element) { $node->before($source); } } return $this; }
[ "public", "function", "before", "(", "$", "source", ")", "{", "foreach", "(", "$", "this", "as", "$", "node", ")", "{", "if", "(", "$", "node", "instanceof", "Element", ")", "{", "$", "node", "->", "before", "(", "$", "source", ")", ";", "}", "}"...
Nodes::before @param mixed $source @return static
[ "Nodes", "::", "before" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Lists/Nodes.php#L181-L190
o2system/html
src/Dom/Lists/Nodes.php
Nodes.after
public function after($source) { foreach ($this as $node) { if ($node instanceof Element) { $node->after($source); } } return $this; }
php
public function after($source) { foreach ($this as $node) { if ($node instanceof Element) { $node->after($source); } } return $this; }
[ "public", "function", "after", "(", "$", "source", ")", "{", "foreach", "(", "$", "this", "as", "$", "node", ")", "{", "if", "(", "$", "node", "instanceof", "Element", ")", "{", "$", "node", "->", "after", "(", "$", "source", ")", ";", "}", "}", ...
Nodes::after @param mixed $source @return static
[ "Nodes", "::", "after" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Lists/Nodes.php#L201-L210
goblindegook/Syllables
src/Cache/Fragment.php
Fragment._output
private function _output() { $output = \wp_cache_get( $this->key, $this->group ); if ( $output !== false ) { echo $output; return true; } ob_start(); return false; }
php
private function _output() { $output = \wp_cache_get( $this->key, $this->group ); if ( $output !== false ) { echo $output; return true; } ob_start(); return false; }
[ "private", "function", "_output", "(", ")", "{", "$", "output", "=", "\\", "wp_cache_get", "(", "$", "this", "->", "key", ",", "$", "this", "->", "group", ")", ";", "if", "(", "$", "output", "!==", "false", ")", "{", "echo", "$", "output", ";", "...
Outputs cached content, if available, otherwise begins capturing output for caching. @return boolean Whether content was found in the cache. @uses \wp_cache_get() @codeCoverageIgnore
[ "Outputs", "cached", "content", "if", "available", "otherwise", "begins", "capturing", "output", "for", "caching", "." ]
train
https://github.com/goblindegook/Syllables/blob/1a98cd15e37595a85b242242f88fee38c4e36acc/src/Cache/Fragment.php#L108-L119
goblindegook/Syllables
src/Cache/Fragment.php
Fragment._store
private function _store() { // Flushes the buffers $output = ob_get_flush(); \wp_cache_add( $this->key, $output, $this->group, $this->expires ); }
php
private function _store() { // Flushes the buffers $output = ob_get_flush(); \wp_cache_add( $this->key, $output, $this->group, $this->expires ); }
[ "private", "function", "_store", "(", ")", "{", "// Flushes the buffers", "$", "output", "=", "ob_get_flush", "(", ")", ";", "\\", "wp_cache_add", "(", "$", "this", "->", "key", ",", "$", "output", ",", "$", "this", "->", "group", ",", "$", "this", "->...
Stores the rendered snippet in the object cache. @uses \wp_cache_add() @codeCoverageIgnore
[ "Stores", "the", "rendered", "snippet", "in", "the", "object", "cache", "." ]
train
https://github.com/goblindegook/Syllables/blob/1a98cd15e37595a85b242242f88fee38c4e36acc/src/Cache/Fragment.php#L128-L133
axelitus/php-base
src/Int.php
Int.extIs
public static function extIs($value) { return static::is($value) || (is_string($value) && (strval(intval($value)) === strval($value))); }
php
public static function extIs($value) { return static::is($value) || (is_string($value) && (strval(intval($value)) === strval($value))); }
[ "public", "static", "function", "extIs", "(", "$", "value", ")", "{", "return", "static", "::", "is", "(", "$", "value", ")", "||", "(", "is_string", "(", "$", "value", ")", "&&", "(", "strval", "(", "intval", "(", "$", "value", ")", ")", "===", ...
Tests if the given value is an int or a string representation of an int. @param mixed $value The value to test. @return bool Returns true if the given value is an int or a representation of an int, false otherwise.
[ "Tests", "if", "the", "given", "value", "is", "an", "int", "or", "a", "string", "representation", "of", "an", "int", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Int.php#L59-L62
axelitus/php-base
src/Int.php
Int.compare
public static function compare($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } return ($int1 - $int2); }
php
public static function compare($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } return ($int1 - $int2); }
[ "public", "static", "function", "compare", "(", "$", "int1", ",", "$", "int2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int1", ")", "||", "!", "static", "::", "is", "(", "$", "int2", ")", ")", "{", "throw", "new", "\\", "Inval...
Compares two int values. The returning value contains the actual value difference. @param int $int1 The left operand. @param int $int2 The right operand. @return int Returns <0 if $int1<$int2, =0 if $int1 == $int2, >0 if $int1>$int2 @throws \InvalidArgumentException
[ "Compares", "two", "int", "values", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Int.php#L150-L157
axelitus/php-base
src/Int.php
Int.random
public static function random($min = 0, $max = 1, $seed = null) { if (!static::is($min) || !static::is($max)) { throw new \InvalidArgumentException("The \$min and \$max parameters must be of type int."); } if ($min > $max) { trigger_error("The \$min value cannot be g...
php
public static function random($min = 0, $max = 1, $seed = null) { if (!static::is($min) || !static::is($max)) { throw new \InvalidArgumentException("The \$min and \$max parameters must be of type int."); } if ($min > $max) { trigger_error("The \$min value cannot be g...
[ "public", "static", "function", "random", "(", "$", "min", "=", "0", ",", "$", "max", "=", "1", ",", "$", "seed", "=", "null", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "min", ")", "||", "!", "static", "::", "is", "(", "$", ...
Generates a random integer number between min and max. @param int $min Lower bound (inclusive) @param int $max Upper bound(inclusive) @param null|int $seed Random generator seed @return int|false A random integer value between min (or 0) and max (or 1, inclusive), or FALSE if max is less than min. @throws...
[ "Generates", "a", "random", "integer", "number", "between", "min", "and", "max", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Int.php#L258-L280
axelitus/php-base
src/Int.php
Int.add
public static function add($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } return ($int1 + $int2); }
php
public static function add($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } return ($int1 + $int2); }
[ "public", "static", "function", "add", "(", "$", "int1", ",", "$", "int2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int1", ")", "||", "!", "static", "::", "is", "(", "$", "int2", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Adds a number to another number. @param int $int1 The left operand. @param int $int2 The right operand. @return int The result of the operation. @throws \InvalidArgumentException
[ "Adds", "a", "number", "to", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Int.php#L311-L318
axelitus/php-base
src/Int.php
Int.sub
public static function sub($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } return ($int1 - $int2); }
php
public static function sub($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } return ($int1 - $int2); }
[ "public", "static", "function", "sub", "(", "$", "int1", ",", "$", "int2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int1", ")", "||", "!", "static", "::", "is", "(", "$", "int2", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Subtracts a number from another number. @param int $int1 The left operand. @param int $int2 The right operand. @return int The result of the operation. @throws \InvalidArgumentException
[ "Subtracts", "a", "number", "from", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Int.php#L329-L336
axelitus/php-base
src/Int.php
Int.mul
public static function mul($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } return ($int1 * $int2); }
php
public static function mul($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } return ($int1 * $int2); }
[ "public", "static", "function", "mul", "(", "$", "int1", ",", "$", "int2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int1", ")", "||", "!", "static", "::", "is", "(", "$", "int2", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Multiplies a number by another number. @param int $int1 The left operand. @param int $int2 The right operand. @return int The result of the operation. @throws \InvalidArgumentException
[ "Multiplies", "a", "number", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Int.php#L347-L354
axelitus/php-base
src/Int.php
Int.div
public static function div($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } if ($int2 == 0) { throw new \InvalidArgumentException("Cannot divide by zero. Th...
php
public static function div($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int."); } if ($int2 == 0) { throw new \InvalidArgumentException("Cannot divide by zero. Th...
[ "public", "static", "function", "div", "(", "$", "int1", ",", "$", "int2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int1", ")", "||", "!", "static", "::", "is", "(", "$", "int2", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Divides a number by another number. @param int $int1 The left operand. @param int $int2 The right operand. @return int|float The result of the operation. @throws \InvalidArgumentException
[ "Divides", "a", "number", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Int.php#L365-L376
axelitus/php-base
src/Int.php
Int.pow
public static function pow($base, $exponent) { if (!static::is($base) || !static::is($exponent)) { throw new \InvalidArgumentException("The \$base and \$exponent parameters must be of type int."); } return pow($base, $exponent); }
php
public static function pow($base, $exponent) { if (!static::is($base) || !static::is($exponent)) { throw new \InvalidArgumentException("The \$base and \$exponent parameters must be of type int."); } return pow($base, $exponent); }
[ "public", "static", "function", "pow", "(", "$", "base", ",", "$", "exponent", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "base", ")", "||", "!", "static", "::", "is", "(", "$", "exponent", ")", ")", "{", "throw", "new", "\\", "I...
Raises a number to the power of another number. @param int $base The base number. @param int $exponent The power exponent. @return int The result of the operation. @throws \InvalidArgumentException
[ "Raises", "a", "number", "to", "the", "power", "of", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Int.php#L387-L394
axelitus/php-base
src/Int.php
Int.mod
public static function mod($base, $modulus) { if (!static::is($base) || !static::is($modulus)) { throw new \InvalidArgumentException("The \$base and \$modulus parameters must be of type int."); } if ($modulus == 0) { throw new \InvalidArgumentException("Cannot divide...
php
public static function mod($base, $modulus) { if (!static::is($base) || !static::is($modulus)) { throw new \InvalidArgumentException("The \$base and \$modulus parameters must be of type int."); } if ($modulus == 0) { throw new \InvalidArgumentException("Cannot divide...
[ "public", "static", "function", "mod", "(", "$", "base", ",", "$", "modulus", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "base", ")", "||", "!", "static", "::", "is", "(", "$", "modulus", ")", ")", "{", "throw", "new", "\\", "Inv...
Gets the remainder of a number divided by another number. @param int $base The left operand. @param int $modulus The right operand. @return int The result of the operation. @throws \InvalidArgumentException
[ "Gets", "the", "remainder", "of", "a", "number", "divided", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Int.php#L405-L416
jenky/laravel-api-helper
src/ApiServiceProvider.php
ApiServiceProvider.setupConfig
protected function setupConfig() { $configPath = __DIR__.'/../config/apihelper.php'; $this->publishes([$configPath => config_path('apihelper.php')], 'config'); $this->mergeConfigFrom($configPath, 'apihelper'); }
php
protected function setupConfig() { $configPath = __DIR__.'/../config/apihelper.php'; $this->publishes([$configPath => config_path('apihelper.php')], 'config'); $this->mergeConfigFrom($configPath, 'apihelper'); }
[ "protected", "function", "setupConfig", "(", ")", "{", "$", "configPath", "=", "__DIR__", ".", "'/../config/apihelper.php'", ";", "$", "this", "->", "publishes", "(", "[", "$", "configPath", "=>", "config_path", "(", "'apihelper.php'", ")", "]", ",", "'config'...
Setup the config. @return void
[ "Setup", "the", "config", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/ApiServiceProvider.php#L35-L40
jenky/laravel-api-helper
src/ApiServiceProvider.php
ApiServiceProvider.registerApiHelper
protected function registerApiHelper(Application $app) { $app->singleton(Factory::class, function ($app) { $request = $app['request']; $config = $app['config']; return new Factory($request, $config); }); $app->alias(Factory::class, 'apihelper'); }
php
protected function registerApiHelper(Application $app) { $app->singleton(Factory::class, function ($app) { $request = $app['request']; $config = $app['config']; return new Factory($request, $config); }); $app->alias(Factory::class, 'apihelper'); }
[ "protected", "function", "registerApiHelper", "(", "Application", "$", "app", ")", "{", "$", "app", "->", "singleton", "(", "Factory", "::", "class", ",", "function", "(", "$", "app", ")", "{", "$", "request", "=", "$", "app", "[", "'request'", "]", ";...
Register the helper class. @param \Illuminate\Contracts\Foundation\Application $app @return void
[ "Register", "the", "helper", "class", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/ApiServiceProvider.php#L49-L59
someline/someline-image
src/Someline/Image/SomelineImageService.php
SomelineImageService.autoCreateDirectory
public static function autoCreateDirectory($path_name) { // check directory if (!File::exists(dirname($path_name))) { $isMadeDir = mkdir(dirname($path_name), 0777, true); if (!$isMadeDir) { return false; } } return true; }
php
public static function autoCreateDirectory($path_name) { // check directory if (!File::exists(dirname($path_name))) { $isMadeDir = mkdir(dirname($path_name), 0777, true); if (!$isMadeDir) { return false; } } return true; }
[ "public", "static", "function", "autoCreateDirectory", "(", "$", "path_name", ")", "{", "// check directory", "if", "(", "!", "File", "::", "exists", "(", "dirname", "(", "$", "path_name", ")", ")", ")", "{", "$", "isMadeDir", "=", "mkdir", "(", "dirname",...
auto create directory if not exists @param $path_name @return bool
[ "auto", "create", "directory", "if", "not", "exists" ]
train
https://github.com/someline/someline-image/blob/a48d760c5292ad24859ff6f4b14b7735fe6f4d42/src/Someline/Image/SomelineImageService.php#L638-L648
phramework/jsonapi
src/Controller/Relationships.php
Relationships.handleByIdRelationships
protected static function handleByIdRelationships( $parameters, $method, $headers, $id, $relationship, $modelClass, $allowedMethods, $primaryDataParameters = [], $relationshipParameters = [] ) { $relationship = Filter::string($relations...
php
protected static function handleByIdRelationships( $parameters, $method, $headers, $id, $relationship, $modelClass, $allowedMethods, $primaryDataParameters = [], $relationshipParameters = [] ) { $relationship = Filter::string($relations...
[ "protected", "static", "function", "handleByIdRelationships", "(", "$", "parameters", ",", "$", "method", ",", "$", "headers", ",", "$", "id", ",", "$", "relationship", ",", "$", "modelClass", ",", "$", "allowedMethods", ",", "$", "primaryDataParameters", "=",...
Handle handleByIdRelationships requests @param object $parameters Request parameters @param string $method Request method @param array $headers Request headers @param integer|string $id Resource's id @param string $relations...
[ "Handle", "handleByIdRelationships", "requests" ]
train
https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Controller/Relationships.php#L55-L113
phramework/jsonapi
src/Controller/Relationships.php
Relationships.handleByIdRelationshipsRelated
protected static function handleByIdRelationshipsRelated( $parameters, $method, $headers, $id, $relationship, $modelClass, $allowedMethods, $primaryDataParameters = [], $relationshipParameters = [] ) { $relationship = Filter::string($re...
php
protected static function handleByIdRelationshipsRelated( $parameters, $method, $headers, $id, $relationship, $modelClass, $allowedMethods, $primaryDataParameters = [], $relationshipParameters = [] ) { $relationship = Filter::string($re...
[ "protected", "static", "function", "handleByIdRelationshipsRelated", "(", "$", "parameters", ",", "$", "method", ",", "$", "headers", ",", "$", "id", ",", "$", "relationship", ",", "$", "modelClass", ",", "$", "allowedMethods", ",", "$", "primaryDataParameters",...
Handle handleByIdRelationships requests @param object $parameters Request parameters @param string $method Request method @param array $headers Request headers @param integer|string $id Resource's id @param string $relations...
[ "Handle", "handleByIdRelationships", "requests" ]
train
https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Controller/Relationships.php#L136-L219
blast-project/CoreBundle
src/Generator/ServicesManipulator.php
ServicesManipulator.addResource
public function addResource($serviceId, $modelClass, $adminClass, $controllerName, $managerType) { $rc = new \ReflectionClass($modelClass); $modelClassShortName = $rc->getShortName(); $code = "services:\n"; if (is_file($this->file)) { $code = rtrim(file_get_contents($th...
php
public function addResource($serviceId, $modelClass, $adminClass, $controllerName, $managerType) { $rc = new \ReflectionClass($modelClass); $modelClassShortName = $rc->getShortName(); $code = "services:\n"; if (is_file($this->file)) { $code = rtrim(file_get_contents($th...
[ "public", "function", "addResource", "(", "$", "serviceId", ",", "$", "modelClass", ",", "$", "adminClass", ",", "$", "controllerName", ",", "$", "managerType", ")", "{", "$", "rc", "=", "new", "\\", "ReflectionClass", "(", "$", "modelClass", ")", ";", "...
@param string $serviceId @param string $modelClass @param string $adminClass @param string $controllerName @param string $managerType @throws \RuntimeException
[ "@param", "string", "$serviceId", "@param", "string", "$modelClass", "@param", "string", "$adminClass", "@param", "string", "$controllerName", "@param", "string", "$managerType" ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Generator/ServicesManipulator.php#L54-L105
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.ensureConsistency
public function ensureConsistency() { if ($this->aUser !== null && $this->user_id !== $this->aUser->getId()) { $this->aUser = null; } if ($this->aRole !== null && $this->role_id !== $this->aRole->getId()) { $this->aRole = null; } }
php
public function ensureConsistency() { if ($this->aUser !== null && $this->user_id !== $this->aUser->getId()) { $this->aUser = null; } if ($this->aRole !== null && $this->role_id !== $this->aRole->getId()) { $this->aRole = null; } }
[ "public", "function", "ensureConsistency", "(", ")", "{", "if", "(", "$", "this", "->", "aUser", "!==", "null", "&&", "$", "this", "->", "user_id", "!==", "$", "this", "->", "aUser", "->", "getId", "(", ")", ")", "{", "$", "this", "->", "aUser", "=...
Checks and repairs the internal consistency of the object. This method is executed after an already-instantiated object is re-hydrated from the database. It exists to check any foreign keys to make sure that the objects related to the current object are correct based on foreign key. You can override this method in t...
[ "Checks", "and", "repairs", "the", "internal", "consistency", "of", "the", "object", "." ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L395-L403
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.setUserId
public function setUserId($v) { if ($v !== null) { $v = (int) $v; } if ($this->user_id !== $v) { $this->user_id = $v; $this->modifiedColumns[UserRoleTableMap::COL_USER_ID] = true; } if ($this->aUser !== null && $this->aUser->getId() !== $...
php
public function setUserId($v) { if ($v !== null) { $v = (int) $v; } if ($this->user_id !== $v) { $this->user_id = $v; $this->modifiedColumns[UserRoleTableMap::COL_USER_ID] = true; } if ($this->aUser !== null && $this->aUser->getId() !== $...
[ "public", "function", "setUserId", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "int", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "user_id", "!==", "$", "v", ")", "{", "$", "this", ...
Set the value of [user_id] column. @param int $v new value @return $this|\Alchemy\Component\Cerberus\Model\UserRole The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "user_id", "]", "column", "." ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L411-L427
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.fromArray
public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { $keys = UserRoleTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setUserId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setRoleId($arr[$...
php
public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { $keys = UserRoleTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setUserId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setRoleId($arr[$...
[ "public", "function", "fromArray", "(", "$", "arr", ",", "$", "keyType", "=", "TableMap", "::", "TYPE_PHPNAME", ")", "{", "$", "keys", "=", "UserRoleTableMap", "::", "getFieldNames", "(", "$", "keyType", ")", ";", "if", "(", "array_key_exists", "(", "$", ...
Populates the object using an array. This is particularly useful when populating an object from one of the request arrays (e.g. $_POST). This method goes through the column names, checking to see whether a matching key exists in populated array. If so the setByName() method is called for that column. You can specify...
[ "Populates", "the", "object", "using", "an", "array", "." ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L833-L843
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.buildCriteria
public function buildCriteria() { $criteria = new Criteria(UserRoleTableMap::DATABASE_NAME); if ($this->isColumnModified(UserRoleTableMap::COL_USER_ID)) { $criteria->add(UserRoleTableMap::COL_USER_ID, $this->user_id); } if ($this->isColumnModified(UserRoleTableMap::COL_R...
php
public function buildCriteria() { $criteria = new Criteria(UserRoleTableMap::DATABASE_NAME); if ($this->isColumnModified(UserRoleTableMap::COL_USER_ID)) { $criteria->add(UserRoleTableMap::COL_USER_ID, $this->user_id); } if ($this->isColumnModified(UserRoleTableMap::COL_R...
[ "public", "function", "buildCriteria", "(", ")", "{", "$", "criteria", "=", "new", "Criteria", "(", "UserRoleTableMap", "::", "DATABASE_NAME", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "UserRoleTableMap", "::", "COL_USER_ID", ")", ")", ...
Build a Criteria object containing the values of all modified columns in this object. @return Criteria The Criteria object containing all modified values.
[ "Build", "a", "Criteria", "object", "containing", "the", "values", "of", "all", "modified", "columns", "in", "this", "object", "." ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L874-L886
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.buildPkeyCriteria
public function buildPkeyCriteria() { $criteria = new Criteria(UserRoleTableMap::DATABASE_NAME); $criteria->add(UserRoleTableMap::COL_USER_ID, $this->user_id); $criteria->add(UserRoleTableMap::COL_ROLE_ID, $this->role_id); return $criteria; }
php
public function buildPkeyCriteria() { $criteria = new Criteria(UserRoleTableMap::DATABASE_NAME); $criteria->add(UserRoleTableMap::COL_USER_ID, $this->user_id); $criteria->add(UserRoleTableMap::COL_ROLE_ID, $this->role_id); return $criteria; }
[ "public", "function", "buildPkeyCriteria", "(", ")", "{", "$", "criteria", "=", "new", "Criteria", "(", "UserRoleTableMap", "::", "DATABASE_NAME", ")", ";", "$", "criteria", "->", "add", "(", "UserRoleTableMap", "::", "COL_USER_ID", ",", "$", "this", "->", "...
Builds a Criteria object containing the primary key for this object. Unlike buildCriteria() this method includes the primary key values regardless of whether or not they have been modified. @throws LogicException if no primary key is defined @return Criteria The Criteria object containing value(s) for primary key(s)...
[ "Builds", "a", "Criteria", "object", "containing", "the", "primary", "key", "for", "this", "object", "." ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L898-L905
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.hashCode
public function hashCode() { $validPk = null !== $this->getUserId() && null !== $this->getRoleId(); $validPrimaryKeyFKs = 2; $primaryKeyFKs = []; //relation user_role_fk_29554a to table user if ($this->aUser && $hash = spl_object_hash($this->aUser)) { ...
php
public function hashCode() { $validPk = null !== $this->getUserId() && null !== $this->getRoleId(); $validPrimaryKeyFKs = 2; $primaryKeyFKs = []; //relation user_role_fk_29554a to table user if ($this->aUser && $hash = spl_object_hash($this->aUser)) { ...
[ "public", "function", "hashCode", "(", ")", "{", "$", "validPk", "=", "null", "!==", "$", "this", "->", "getUserId", "(", ")", "&&", "null", "!==", "$", "this", "->", "getRoleId", "(", ")", ";", "$", "validPrimaryKeyFKs", "=", "2", ";", "$", "primary...
If the primary key is not null, return the hashcode of the primary key. Otherwise, return the hash code of the object. @return int Hashcode
[ "If", "the", "primary", "key", "is", "not", "null", "return", "the", "hashcode", "of", "the", "primary", "key", ".", "Otherwise", "return", "the", "hash", "code", "of", "the", "object", "." ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L913-L942
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.copyInto
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setUserId($this->getUserId()); $copyObj->setRoleId($this->getRoleId()); if ($makeNew) { $copyObj->setNew(true); } }
php
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setUserId($this->getUserId()); $copyObj->setRoleId($this->getRoleId()); if ($makeNew) { $copyObj->setNew(true); } }
[ "public", "function", "copyInto", "(", "$", "copyObj", ",", "$", "deepCopy", "=", "false", ",", "$", "makeNew", "=", "true", ")", "{", "$", "copyObj", "->", "setUserId", "(", "$", "this", "->", "getUserId", "(", ")", ")", ";", "$", "copyObj", "->", ...
Sets contents of passed object to values from current object. If desired, this method can also make copies of all associated (fkey referrers) objects. @param object $copyObj An object of \Alchemy\Component\Cerberus\Model\UserRole (or compatible) type. @param boolean $deepCopy Whether to also copy all rows t...
[ "Sets", "contents", "of", "passed", "object", "to", "values", "from", "current", "object", "." ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L990-L997
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.getUser
public function getUser(ConnectionInterface $con = null) { if ($this->aUser === null && ($this->user_id !== null)) { $this->aUser = ChildUserQuery::create()->findPk($this->user_id, $con); /* The following can be used additionally to guarantee the related object contai...
php
public function getUser(ConnectionInterface $con = null) { if ($this->aUser === null && ($this->user_id !== null)) { $this->aUser = ChildUserQuery::create()->findPk($this->user_id, $con); /* The following can be used additionally to guarantee the related object contai...
[ "public", "function", "getUser", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "$", "this", "->", "aUser", "===", "null", "&&", "(", "$", "this", "->", "user_id", "!==", "null", ")", ")", "{", "$", "this", "->", "aUser", ...
Get the associated ChildUser object @param ConnectionInterface $con Optional Connection object. @return ChildUser The associated ChildUser object. @throws PropelException
[ "Get", "the", "associated", "ChildUser", "object" ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L1056-L1070
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.getRole
public function getRole(ConnectionInterface $con = null) { if ($this->aRole === null && ($this->role_id !== null)) { $this->aRole = ChildRoleQuery::create()->findPk($this->role_id, $con); /* The following can be used additionally to guarantee the related object contai...
php
public function getRole(ConnectionInterface $con = null) { if ($this->aRole === null && ($this->role_id !== null)) { $this->aRole = ChildRoleQuery::create()->findPk($this->role_id, $con); /* The following can be used additionally to guarantee the related object contai...
[ "public", "function", "getRole", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "$", "this", "->", "aRole", "===", "null", "&&", "(", "$", "this", "->", "role_id", "!==", "null", ")", ")", "{", "$", "this", "->", "aRole", ...
Get the associated ChildRole object @param ConnectionInterface $con Optional Connection object. @return ChildRole The associated ChildRole object. @throws PropelException
[ "Get", "the", "associated", "ChildRole", "object" ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L1107-L1121
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.clear
public function clear() { if (null !== $this->aUser) { $this->aUser->removeUserRole($this); } if (null !== $this->aRole) { $this->aRole->removeUserRole($this); } $this->user_id = null; $this->role_id = null; $this->alreadyInSave = false...
php
public function clear() { if (null !== $this->aUser) { $this->aUser->removeUserRole($this); } if (null !== $this->aRole) { $this->aRole->removeUserRole($this); } $this->user_id = null; $this->role_id = null; $this->alreadyInSave = false...
[ "public", "function", "clear", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "aUser", ")", "{", "$", "this", "->", "aUser", "->", "removeUserRole", "(", "$", "this", ")", ";", "}", "if", "(", "null", "!==", "$", "this", "->", "aRole...
Clears the current object, sets all attributes to their default values and removes outgoing references as well as back-references (from other objects to this one. Results probably in a database change of those foreign objects when you call `save` there).
[ "Clears", "the", "current", "object", "sets", "all", "attributes", "to", "their", "default", "values", "and", "removes", "outgoing", "references", "as", "well", "as", "back", "-", "references", "(", "from", "other", "objects", "to", "this", "one", ".", "Resu...
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L1128-L1143
phpalchemy/cerberus
src/Alchemy/Component/Cerberus/Model/Base/UserRole.php
UserRole.clearAllReferences
public function clearAllReferences($deep = false) { if ($deep) { } // if ($deep) $this->aUser = null; $this->aRole = null; }
php
public function clearAllReferences($deep = false) { if ($deep) { } // if ($deep) $this->aUser = null; $this->aRole = null; }
[ "public", "function", "clearAllReferences", "(", "$", "deep", "=", "false", ")", "{", "if", "(", "$", "deep", ")", "{", "}", "// if ($deep)", "$", "this", "->", "aUser", "=", "null", ";", "$", "this", "->", "aRole", "=", "null", ";", "}" ]
Resets all references and back-references to other model objects or collections of model objects. This method is used to reset all php object references (not the actual reference in the database). Necessary for object serialisation. @param boolean $deep Whether to also clear the references on all referrer object...
[ "Resets", "all", "references", "and", "back", "-", "references", "to", "other", "model", "objects", "or", "collections", "of", "model", "objects", "." ]
train
https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/UserRole.php#L1153-L1160
aboutcoders/enum-serializer-bundle
DependencyInjection/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $treeBuilder->root('abc_enum_serializer') ->children() ->arrayNode('serializer') ->addDefaultsIfNotSet() ->children() ->arrayNode('ty...
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $treeBuilder->root('abc_enum_serializer') ->children() ->arrayNode('serializer') ->addDefaultsIfNotSet() ->children() ->arrayNode('ty...
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", ")", ";", "$", "treeBuilder", "->", "root", "(", "'abc_enum_serializer'", ")", "->", "children", "(", ")", "->", "arrayNode", "(", "'serializer'", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/aboutcoders/enum-serializer-bundle/blob/e8a48e8d6d52b2f8fc896e9789fbb9fbbc38164f/DependencyInjection/Configuration.php#L24-L42
jan-dolata/crude-crud
src/Engine/CrudeSetupTrait/OrderParameters.php
OrderParameters.setOrderParameters
public function setOrderParameters($idAttr, $orderAttr, $labelAttr) { $this->orderParameters = [ 'idAttr' => $idAttr, 'orderAttr' => $orderAttr, 'labelAttr' => $labelAttr ]; return $this; }
php
public function setOrderParameters($idAttr, $orderAttr, $labelAttr) { $this->orderParameters = [ 'idAttr' => $idAttr, 'orderAttr' => $orderAttr, 'labelAttr' => $labelAttr ]; return $this; }
[ "public", "function", "setOrderParameters", "(", "$", "idAttr", ",", "$", "orderAttr", ",", "$", "labelAttr", ")", "{", "$", "this", "->", "orderParameters", "=", "[", "'idAttr'", "=>", "$", "idAttr", ",", "'orderAttr'", "=>", "$", "orderAttr", ",", "'labe...
Sets the Ordered list param. @param array $orderedList the ordered list @return self
[ "Sets", "the", "Ordered", "list", "param", "." ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/OrderParameters.php#L35-L44
jan-dolata/crude-crud
src/Engine/CrudeSetupTrait/Actions.php
Actions.setMapAction
private function setMapAction() { array_push($this->actions, 'map'); $this->addForm = array_diff($this->addForm, ['map_lat', 'map_lng', 'map_address', 'map_province', 'map_locality', 'map_postal_code']); $this->editForm = array_diff($this->addForm, ['map_lat', 'map_lng', 'map_address', 'map...
php
private function setMapAction() { array_push($this->actions, 'map'); $this->addForm = array_diff($this->addForm, ['map_lat', 'map_lng', 'map_address', 'map_province', 'map_locality', 'map_postal_code']); $this->editForm = array_diff($this->addForm, ['map_lat', 'map_lng', 'map_address', 'map...
[ "private", "function", "setMapAction", "(", ")", "{", "array_push", "(", "$", "this", "->", "actions", ",", "'map'", ")", ";", "$", "this", "->", "addForm", "=", "array_diff", "(", "$", "this", "->", "addForm", ",", "[", "'map_lat'", ",", "'map_lng'", ...
Set 'map' action
[ "Set", "map", "action" ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/Actions.php#L51-L59