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
ddrv-test/firmapi-core
src/Object/Build.php
Build.actionAdd
protected function actionAdd($params=array()) { $response = array( 'errors' => array(), 'data' => array(), ); $values = $this->build->prepareParams($params); if (empty($values['street'])) { $response['errors'][] = 'bld01'; } ...
php
protected function actionAdd($params=array()) { $response = array( 'errors' => array(), 'data' => array(), ); $values = $this->build->prepareParams($params); if (empty($values['street'])) { $response['errors'][] = 'bld01'; } ...
[ "protected", "function", "actionAdd", "(", "$", "params", "=", "array", "(", ")", ")", "{", "$", "response", "=", "array", "(", "'errors'", "=>", "array", "(", ")", ",", "'data'", "=>", "array", "(", ")", ",", ")", ";", "$", "values", "=", "$", "...
Add build @param array $params @return array
[ "Add", "build" ]
train
https://github.com/ddrv-test/firmapi-core/blob/8f8843f0fb134568e7764cabd5039e15c579976d/src/Object/Build.php#L35-L70
ddrv-test/firmapi-core
src/Object/Build.php
Build.actionGet
protected function actionGet($params=array()) { $response = array( 'errors'=>array(), 'data' => array( 'count' => 0, 'items' => array(), ), ); $offset = isset($params['offset'])?(int)$params['offset']:0; if...
php
protected function actionGet($params=array()) { $response = array( 'errors'=>array(), 'data' => array( 'count' => 0, 'items' => array(), ), ); $offset = isset($params['offset'])?(int)$params['offset']:0; if...
[ "protected", "function", "actionGet", "(", "$", "params", "=", "array", "(", ")", ")", "{", "$", "response", "=", "array", "(", "'errors'", "=>", "array", "(", ")", ",", "'data'", "=>", "array", "(", "'count'", "=>", "0", ",", "'items'", "=>", "array...
Get build @param array $params @return array
[ "Get", "build" ]
train
https://github.com/ddrv-test/firmapi-core/blob/8f8843f0fb134568e7764cabd5039e15c579976d/src/Object/Build.php#L78-L145
Xsaven/laravel-intelect-admin
src/Admin.php
Admin.registerAuthRoutes
public function registerAuthRoutes() { Route::group(['prefix' => config('lia.route.prefix'), 'namespace' => 'Lia\Controllers', 'middleware' => 'api'], function($router){ /* @var \Illuminate\Routing\Router $router */ $router->get('auth/jwt', 'AuthController@jwt'); }); ...
php
public function registerAuthRoutes() { Route::group(['prefix' => config('lia.route.prefix'), 'namespace' => 'Lia\Controllers', 'middleware' => 'api'], function($router){ /* @var \Illuminate\Routing\Router $router */ $router->get('auth/jwt', 'AuthController@jwt'); }); ...
[ "public", "function", "registerAuthRoutes", "(", ")", "{", "Route", "::", "group", "(", "[", "'prefix'", "=>", "config", "(", "'lia.route.prefix'", ")", ",", "'namespace'", "=>", "'Lia\\Controllers'", ",", "'middleware'", "=>", "'api'", "]", ",", "function", "...
Register the auth routes. @return void
[ "Register", "the", "auth", "routes", "." ]
train
https://github.com/Xsaven/laravel-intelect-admin/blob/592574633d12c74cf25b43dd6694fee496abefcb/src/Admin.php#L251-L283
Sapistudio/SapiRestApi
src/AbstractHttpClient.php
AbstractHttpClient.setInContainer
protected function setInContainer($objectName = null){ if(is_null($objectName)) return false; if(!isset($this->apiContainer[md5($objectName)])) $this->apiContainer[md5($objectName)] = new $objectName($this); return $this->apiContainer[md5($objectName)]; }
php
protected function setInContainer($objectName = null){ if(is_null($objectName)) return false; if(!isset($this->apiContainer[md5($objectName)])) $this->apiContainer[md5($objectName)] = new $objectName($this); return $this->apiContainer[md5($objectName)]; }
[ "protected", "function", "setInContainer", "(", "$", "objectName", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "objectName", ")", ")", "return", "false", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "apiContainer", "[", "md5", "(", ...
AbstractHttpClient::setInContainer() @return
[ "AbstractHttpClient", "::", "setInContainer", "()" ]
train
https://github.com/Sapistudio/SapiRestApi/blob/0c67fb658884b63d471276b16f06f13da626e7a0/src/AbstractHttpClient.php#L90-L96
Sapistudio/SapiRestApi
src/AbstractHttpClient.php
AbstractHttpClient.get
public function get($path=null,$parameters=null) { if($parameters){ foreach($parameters as $key=>$parameter) $this->addQuery($key,$parameter); } return $this->startRequest('GET',$path); }
php
public function get($path=null,$parameters=null) { if($parameters){ foreach($parameters as $key=>$parameter) $this->addQuery($key,$parameter); } return $this->startRequest('GET',$path); }
[ "public", "function", "get", "(", "$", "path", "=", "null", ",", "$", "parameters", "=", "null", ")", "{", "if", "(", "$", "parameters", ")", "{", "foreach", "(", "$", "parameters", "as", "$", "key", "=>", "$", "parameter", ")", "$", "this", "->", ...
AbstractHttpClient::get() @return
[ "AbstractHttpClient", "::", "get", "()" ]
train
https://github.com/Sapistudio/SapiRestApi/blob/0c67fb658884b63d471276b16f06f13da626e7a0/src/AbstractHttpClient.php#L115-L122
Sapistudio/SapiRestApi
src/AbstractHttpClient.php
AbstractHttpClient.post
public function post($path=null,$parameters=null) { if($parameters){ foreach($parameters as $key=>$parameter) $this->addFormParameter($key,$parameter); } return $this->startRequest('POST', $path); }
php
public function post($path=null,$parameters=null) { if($parameters){ foreach($parameters as $key=>$parameter) $this->addFormParameter($key,$parameter); } return $this->startRequest('POST', $path); }
[ "public", "function", "post", "(", "$", "path", "=", "null", ",", "$", "parameters", "=", "null", ")", "{", "if", "(", "$", "parameters", ")", "{", "foreach", "(", "$", "parameters", "as", "$", "key", "=>", "$", "parameter", ")", "$", "this", "->",...
AbstractHttpClient::post() @return
[ "AbstractHttpClient", "::", "post", "()" ]
train
https://github.com/Sapistudio/SapiRestApi/blob/0c67fb658884b63d471276b16f06f13da626e7a0/src/AbstractHttpClient.php#L169-L176
Sapistudio/SapiRestApi
src/AbstractHttpClient.php
AbstractHttpClient.getHttpClient
public function getHttpClient() { $this->options['headers'] = $this->getHeaders(); return \SapiStudio\Http\Browser\StreamClient::make($this->options); }
php
public function getHttpClient() { $this->options['headers'] = $this->getHeaders(); return \SapiStudio\Http\Browser\StreamClient::make($this->options); }
[ "public", "function", "getHttpClient", "(", ")", "{", "$", "this", "->", "options", "[", "'headers'", "]", "=", "$", "this", "->", "getHeaders", "(", ")", ";", "return", "\\", "SapiStudio", "\\", "Http", "\\", "Browser", "\\", "StreamClient", "::", "make...
AbstractHttpClient::getHttpClient() @return
[ "AbstractHttpClient", "::", "getHttpClient", "()" ]
train
https://github.com/Sapistudio/SapiRestApi/blob/0c67fb658884b63d471276b16f06f13da626e7a0/src/AbstractHttpClient.php#L193-L197
Sapistudio/SapiRestApi
src/AbstractHttpClient.php
AbstractHttpClient.applyModifiers
private function applyModifiers($arguments) { $modifiers = $this->getRequestModifier(); $modifiedClient = $this; if($modifiers){ foreach ($modifiers as $modifier) { $modifier = new $modifier($modifiedClient, $arguments); $modifiedClient = $mod...
php
private function applyModifiers($arguments) { $modifiers = $this->getRequestModifier(); $modifiedClient = $this; if($modifiers){ foreach ($modifiers as $modifier) { $modifier = new $modifier($modifiedClient, $arguments); $modifiedClient = $mod...
[ "private", "function", "applyModifiers", "(", "$", "arguments", ")", "{", "$", "modifiers", "=", "$", "this", "->", "getRequestModifier", "(", ")", ";", "$", "modifiedClient", "=", "$", "this", ";", "if", "(", "$", "modifiers", ")", "{", "foreach", "(", ...
AbstractHttpClient::applyModifiers() @return
[ "AbstractHttpClient", "::", "applyModifiers", "()" ]
train
https://github.com/Sapistudio/SapiRestApi/blob/0c67fb658884b63d471276b16f06f13da626e7a0/src/AbstractHttpClient.php#L263-L274
lasallecms/lasallecms-l5-usermanagement-pkg
src/Validation/ForbiddenTLD.php
ForbiddenTLD.validateForbiddenTLD
public function validateForbiddenTLD($email, $specifiedTLDs = array()) { $forbiddenTLDs = $this->getTheForbiddenTLDs($specifiedTLDs); // if no TLD's specified in the parameters; and, no TLD's specified in the config, // then deem the validation as kosher if (empty($forbiddenTLDs)) retu...
php
public function validateForbiddenTLD($email, $specifiedTLDs = array()) { $forbiddenTLDs = $this->getTheForbiddenTLDs($specifiedTLDs); // if no TLD's specified in the parameters; and, no TLD's specified in the config, // then deem the validation as kosher if (empty($forbiddenTLDs)) retu...
[ "public", "function", "validateForbiddenTLD", "(", "$", "email", ",", "$", "specifiedTLDs", "=", "array", "(", ")", ")", "{", "$", "forbiddenTLDs", "=", "$", "this", "->", "getTheForbiddenTLDs", "(", "$", "specifiedTLDs", ")", ";", "// if no TLD's specified in t...
Validate Top Level Domains @param string $email @param array $specifiedTLDs So unit test can specify its own array of forbidden TLDs @return bool
[ "Validate", "Top", "Level", "Domains" ]
train
https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Validation/ForbiddenTLD.php#L53-L77
maxvu/skeletal
src/Service/Service.php
Service.onNotFound
public function onNotFound ( $callback ) { $callback = $this->vetHandler( $callback ); if ( $callback === NULL ) throw new \InvalidArgumentException( "Invalid callback for onNotFound." ); $this->onNotFound = $callback; }
php
public function onNotFound ( $callback ) { $callback = $this->vetHandler( $callback ); if ( $callback === NULL ) throw new \InvalidArgumentException( "Invalid callback for onNotFound." ); $this->onNotFound = $callback; }
[ "public", "function", "onNotFound", "(", "$", "callback", ")", "{", "$", "callback", "=", "$", "this", "->", "vetHandler", "(", "$", "callback", ")", ";", "if", "(", "$", "callback", "===", "NULL", ")", "throw", "new", "\\", "InvalidArgumentException", "...
/* Register these two events.
[ "/", "*", "Register", "these", "two", "events", "." ]
train
https://github.com/maxvu/skeletal/blob/fd403dc685dfb7e23b4a318a2d3e196be75cd270/src/Service/Service.php#L36-L41
maxvu/skeletal
src/Service/Service.php
Service.vetHandler
private function vetHandler ( $handler ) { if ( is_callable( $handler ) ) return $handler; else if ( is_string( $handler ) && preg_match( "/^.+\#.+$/", $handler ) == 1 ) return function ( $service, $request ) use ( $handler ) { list($controller, $method) = explode( '#', $handler );...
php
private function vetHandler ( $handler ) { if ( is_callable( $handler ) ) return $handler; else if ( is_string( $handler ) && preg_match( "/^.+\#.+$/", $handler ) == 1 ) return function ( $service, $request ) use ( $handler ) { list($controller, $method) = explode( '#', $handler );...
[ "private", "function", "vetHandler", "(", "$", "handler", ")", "{", "if", "(", "is_callable", "(", "$", "handler", ")", ")", "return", "$", "handler", ";", "else", "if", "(", "is_string", "(", "$", "handler", ")", "&&", "preg_match", "(", "\"/^.+\\#.+$/\...
/* Accept as a handler either a closure with argument ( $service, $request ) or a string in the form 'ControllerClass#ControllerMethod'.
[ "/", "*", "Accept", "as", "a", "handler", "either", "a", "closure", "with", "argument", "(", "$service", "$request", ")", "or", "a", "string", "in", "the", "form", "ControllerClass#ControllerMethod", "." ]
train
https://github.com/maxvu/skeletal/blob/fd403dc685dfb7e23b4a318a2d3e196be75cd270/src/Service/Service.php#L115-L125
maxvu/skeletal
src/Service/Service.php
Service.route
public function route ( Request $request ) { $route = $this->router->findRoute( $request->path(), $request->method() ); // Found the right path if ( $route !== NULL ) { $request->queryString = array_merge( $route->apply( $request->requestPath ), $request->queryString...
php
public function route ( Request $request ) { $route = $this->router->findRoute( $request->path(), $request->method() ); // Found the right path if ( $route !== NULL ) { $request->queryString = array_merge( $route->apply( $request->requestPath ), $request->queryString...
[ "public", "function", "route", "(", "Request", "$", "request", ")", "{", "$", "route", "=", "$", "this", "->", "router", "->", "findRoute", "(", "$", "request", "->", "path", "(", ")", ",", "$", "request", "->", "method", "(", ")", ")", ";", "// Fo...
/* Turn a Request into a Response. Merge path variables (e.g. "/item/{id}") into _GET. Treat HEAD requests as GETs, but stripping the body. Call $this->onNotFound on no match.
[ "/", "*", "Turn", "a", "Request", "into", "a", "Response", ".", "Merge", "path", "variables", "(", "e", ".", "g", ".", "/", "item", "/", "{", "id", "}", ")", "into", "_GET", ".", "Treat", "HEAD", "requests", "as", "GETs", "but", "stripping", "the",...
train
https://github.com/maxvu/skeletal/blob/fd403dc685dfb7e23b4a318a2d3e196be75cd270/src/Service/Service.php#L134-L160
maxvu/skeletal
src/Service/Service.php
Service.invokeCallback
private function invokeCallback ( Request $request, $handler ) { try { return call_user_func_array( $handler, array( $this, $request ) ); } catch ( \Exception $ex ) { $this->exception = $ex; return call_user_func_array( $this->onException, array( $this, $request ) ); } }
php
private function invokeCallback ( Request $request, $handler ) { try { return call_user_func_array( $handler, array( $this, $request ) ); } catch ( \Exception $ex ) { $this->exception = $ex; return call_user_func_array( $this->onException, array( $this, $request ) ); } }
[ "private", "function", "invokeCallback", "(", "Request", "$", "request", ",", "$", "handler", ")", "{", "try", "{", "return", "call_user_func_array", "(", "$", "handler", ",", "array", "(", "$", "this", ",", "$", "request", ")", ")", ";", "}", "catch", ...
/* Execute the handler in $this scope. Intercept exceptions and give to $this->onException.
[ "/", "*", "Execute", "the", "handler", "in", "$this", "scope", ".", "Intercept", "exceptions", "and", "give", "to", "$this", "-", ">", "onException", "." ]
train
https://github.com/maxvu/skeletal/blob/fd403dc685dfb7e23b4a318a2d3e196be75cd270/src/Service/Service.php#L171-L178
palmtreephp/nameconverter
SnakeCaseToCamelCaseNameConverter.php
SnakeCaseToCamelCaseNameConverter.denormalize
public function denormalize($input) { $lcPropertyName = lcfirst($input); $snakeCasedName = ''; $len = strlen($lcPropertyName); for ($i = 0; $i < $len; ++$i) { if (ctype_upper($lcPropertyName[$i])) { $snakeCasedName .= '_' . strtolower($lcPropertyName[$i])...
php
public function denormalize($input) { $lcPropertyName = lcfirst($input); $snakeCasedName = ''; $len = strlen($lcPropertyName); for ($i = 0; $i < $len; ++$i) { if (ctype_upper($lcPropertyName[$i])) { $snakeCasedName .= '_' . strtolower($lcPropertyName[$i])...
[ "public", "function", "denormalize", "(", "$", "input", ")", "{", "$", "lcPropertyName", "=", "lcfirst", "(", "$", "input", ")", ";", "$", "snakeCasedName", "=", "''", ";", "$", "len", "=", "strlen", "(", "$", "lcPropertyName", ")", ";", "for", "(", ...
Converts a string like 'myInput' to 'my_input' @param $input @return string
[ "Converts", "a", "string", "like", "myInput", "to", "my_input" ]
train
https://github.com/palmtreephp/nameconverter/blob/ccec2ac6134cd8941ea9a83fa0a8588615443c9b/SnakeCaseToCamelCaseNameConverter.php#L41-L56
siriusSupreme/sirius-queue
src/CallQueuedHandler.php
CallQueuedHandler.handleModelNotFound
protected function handleModelNotFound(Job $job, $e) { $class = $job->resolveName(); try { $shouldDelete = (new ReflectionClass($class)) ->getDefaultProperties()['deleteWhenMissingModels'] ?? false; } catch (Exception $e) { $shouldDelete = false; ...
php
protected function handleModelNotFound(Job $job, $e) { $class = $job->resolveName(); try { $shouldDelete = (new ReflectionClass($class)) ->getDefaultProperties()['deleteWhenMissingModels'] ?? false; } catch (Exception $e) { $shouldDelete = false; ...
[ "protected", "function", "handleModelNotFound", "(", "Job", "$", "job", ",", "$", "e", ")", "{", "$", "class", "=", "$", "job", "->", "resolveName", "(", ")", ";", "try", "{", "$", "shouldDelete", "=", "(", "new", "ReflectionClass", "(", "$", "class", ...
Handle a model not found exception. @param \Sirius\Queue\Jobs\Job $job @param \Exception $e
[ "Handle", "a", "model", "not", "found", "exception", "." ]
train
https://github.com/siriusSupreme/sirius-queue/blob/11c9ca563e6142b1bf0c788418f87948b0d4dc50/src/CallQueuedHandler.php#L118-L136
CraryPrimitiveMan/php-resque
src/core/Worker.php
Worker.work
public function work($interval = 5) { $this->updateProcLine('Starting'); $this->startup(); while(true) { if($this->shutdown) { break; } // Attempt to find and reserve a job $job = false; if(!$this->paused) { ...
php
public function work($interval = 5) { $this->updateProcLine('Starting'); $this->startup(); while(true) { if($this->shutdown) { break; } // Attempt to find and reserve a job $job = false; if(!$this->paused) { ...
[ "public", "function", "work", "(", "$", "interval", "=", "5", ")", "{", "$", "this", "->", "updateProcLine", "(", "'Starting'", ")", ";", "$", "this", "->", "startup", "(", ")", ";", "while", "(", "true", ")", "{", "if", "(", "$", "this", "->", "...
The primary loop for a worker which when called on an instance starts the worker's life cycle. Queues are checked every $interval (seconds) for new jobs. @param int $interval How often to check for new jobs across the queues.
[ "The", "primary", "loop", "for", "a", "worker", "which", "when", "called", "on", "an", "instance", "starts", "the", "worker", "s", "life", "cycle", "." ]
train
https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/core/Worker.php#L154-L225
CraryPrimitiveMan/php-resque
src/core/Worker.php
Worker.perform
public function perform(Job $job) { try { Event::trigger('afterFork', $job); $job->perform(); } catch(Exception $e) { $this->log($job . ' failed: ' . $e->getMessage()); $job->fail($e); return; } $job->updateStatus(Status::S...
php
public function perform(Job $job) { try { Event::trigger('afterFork', $job); $job->perform(); } catch(Exception $e) { $this->log($job . ' failed: ' . $e->getMessage()); $job->fail($e); return; } $job->updateStatus(Status::S...
[ "public", "function", "perform", "(", "Job", "$", "job", ")", "{", "try", "{", "Event", "::", "trigger", "(", "'afterFork'", ",", "$", "job", ")", ";", "$", "job", "->", "perform", "(", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{"...
Process a single job. @param Job $job The job to be processed.
[ "Process", "a", "single", "job", "." ]
train
https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/core/Worker.php#L232-L245
CraryPrimitiveMan/php-resque
src/core/Worker.php
Worker.reserve
public function reserve() { $queues = $this->queues(); if(!is_array($queues)) { return; } foreach($queues as $queue) { $this->log('Checking ' . $queue, self::LOG_VERBOSE); $job = Job::reserve($queue); if($job) { $this->...
php
public function reserve() { $queues = $this->queues(); if(!is_array($queues)) { return; } foreach($queues as $queue) { $this->log('Checking ' . $queue, self::LOG_VERBOSE); $job = Job::reserve($queue); if($job) { $this->...
[ "public", "function", "reserve", "(", ")", "{", "$", "queues", "=", "$", "this", "->", "queues", "(", ")", ";", "if", "(", "!", "is_array", "(", "$", "queues", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "queues", "as", "$", "queue", ...
Attempt to find a job from the top of one of the queues for this worker. @return object|boolean Instance of Job if a job is found, false if not.
[ "Attempt", "to", "find", "a", "job", "from", "the", "top", "of", "one", "of", "the", "queues", "for", "this", "worker", "." ]
train
https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/core/Worker.php#L252-L269
CraryPrimitiveMan/php-resque
src/core/Worker.php
Worker.startup
private function startup() { $this->registerSigHandlers(); $this->pruneDeadWorkers(); Event::trigger('beforeFirstFork', $this); $this->registerWorker(); }
php
private function startup() { $this->registerSigHandlers(); $this->pruneDeadWorkers(); Event::trigger('beforeFirstFork', $this); $this->registerWorker(); }
[ "private", "function", "startup", "(", ")", "{", "$", "this", "->", "registerSigHandlers", "(", ")", ";", "$", "this", "->", "pruneDeadWorkers", "(", ")", ";", "Event", "::", "trigger", "(", "'beforeFirstFork'", ",", "$", "this", ")", ";", "$", "this", ...
Perform necessary actions to start a worker.
[ "Perform", "necessary", "actions", "to", "start", "a", "worker", "." ]
train
https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/core/Worker.php#L316-L322
CraryPrimitiveMan/php-resque
src/core/Worker.php
Worker.registerSigHandlers
private function registerSigHandlers() { if(!function_exists('pcntl_signal')) { return; } declare(ticks = 1); pcntl_signal(SIGTERM, array($this, 'shutDownNow')); pcntl_signal(SIGINT, array($this, 'shutDownNow')); pcntl_signal(SIGQUIT, array($this, 'shutdow...
php
private function registerSigHandlers() { if(!function_exists('pcntl_signal')) { return; } declare(ticks = 1); pcntl_signal(SIGTERM, array($this, 'shutDownNow')); pcntl_signal(SIGINT, array($this, 'shutDownNow')); pcntl_signal(SIGQUIT, array($this, 'shutdow...
[ "private", "function", "registerSigHandlers", "(", ")", "{", "if", "(", "!", "function_exists", "(", "'pcntl_signal'", ")", ")", "{", "return", ";", "}", "declare", "(", "ticks", "=", "1", ")", ";", "pcntl_signal", "(", "SIGTERM", ",", "array", "(", "$",...
Register signal handlers that a worker should respond to. TERM: Shutdown immediately and stop processing jobs. INT: Shutdown immediately and stop processing jobs. QUIT: Shutdown after the current job finishes processing. USR1: Kill the forked child immediately and continue processing jobs.
[ "Register", "signal", "handlers", "that", "a", "worker", "should", "respond", "to", "." ]
train
https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/core/Worker.php#L346-L360
CraryPrimitiveMan/php-resque
src/core/Worker.php
Worker.registerWorker
public function registerWorker() { Resque::redis()->sadd('workers', $this); Resque::redis()->set('worker:' . (string)$this . ':started', strftime('%a %b %d %H:%M:%S %Z %Y')); }
php
public function registerWorker() { Resque::redis()->sadd('workers', $this); Resque::redis()->set('worker:' . (string)$this . ':started', strftime('%a %b %d %H:%M:%S %Z %Y')); }
[ "public", "function", "registerWorker", "(", ")", "{", "Resque", "::", "redis", "(", ")", "->", "sadd", "(", "'workers'", ",", "$", "this", ")", ";", "Resque", "::", "redis", "(", ")", "->", "set", "(", "'worker:'", ".", "(", "string", ")", "$", "t...
Register this worker in Redis.
[ "Register", "this", "worker", "in", "Redis", "." ]
train
https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/core/Worker.php#L477-L481
CraryPrimitiveMan/php-resque
src/core/Worker.php
Worker.unregisterWorker
public function unregisterWorker() { if(is_object($this->currentJob)) { $this->currentJob->fail(new DirtyExitException); } $id = (string)$this; Resque::redis()->srem('workers', $id); Resque::redis()->del('worker:' . $id); Resque::redis()->del('worker:' . ...
php
public function unregisterWorker() { if(is_object($this->currentJob)) { $this->currentJob->fail(new DirtyExitException); } $id = (string)$this; Resque::redis()->srem('workers', $id); Resque::redis()->del('worker:' . $id); Resque::redis()->del('worker:' . ...
[ "public", "function", "unregisterWorker", "(", ")", "{", "if", "(", "is_object", "(", "$", "this", "->", "currentJob", ")", ")", "{", "$", "this", "->", "currentJob", "->", "fail", "(", "new", "DirtyExitException", ")", ";", "}", "$", "id", "=", "(", ...
Unregister this worker in Redis. (shutdown etc)
[ "Unregister", "this", "worker", "in", "Redis", ".", "(", "shutdown", "etc", ")" ]
train
https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/core/Worker.php#L486-L498
CraryPrimitiveMan/php-resque
src/core/Worker.php
Worker.workingOn
public function workingOn(Job $job) { $job->worker = $this; $this->currentJob = $job; $job->updateStatus(Status::STATUS_RUNNING); $data = json_encode(array( 'queue' => $job->queue, 'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'), 'payload' => $job-...
php
public function workingOn(Job $job) { $job->worker = $this; $this->currentJob = $job; $job->updateStatus(Status::STATUS_RUNNING); $data = json_encode(array( 'queue' => $job->queue, 'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'), 'payload' => $job-...
[ "public", "function", "workingOn", "(", "Job", "$", "job", ")", "{", "$", "job", "->", "worker", "=", "$", "this", ";", "$", "this", "->", "currentJob", "=", "$", "job", ";", "$", "job", "->", "updateStatus", "(", "Status", "::", "STATUS_RUNNING", ")...
Tell Redis which job we're currently working on. @param object $job Job instance containing the job we're working on.
[ "Tell", "Redis", "which", "job", "we", "re", "currently", "working", "on", "." ]
train
https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/core/Worker.php#L505-L516
modulusphp/utility
RouteQuery.php
RouteQuery.persist
public function persist($eloquent, $field, $value, $name) { return $this->handle($eloquent, $field, $value, $name); }
php
public function persist($eloquent, $field, $value, $name) { return $this->handle($eloquent, $field, $value, $name); }
[ "public", "function", "persist", "(", "$", "eloquent", ",", "$", "field", ",", "$", "value", ",", "$", "name", ")", "{", "return", "$", "this", "->", "handle", "(", "$", "eloquent", ",", "$", "field", ",", "$", "value", ",", "$", "name", ")", ";"...
Persist route query @param mixed $eloquent @param mixed $field @param mixed $value @return mixed
[ "Persist", "route", "query" ]
train
https://github.com/modulusphp/utility/blob/c1e127539b13d3ec8381e41c64b881e0701807f5/RouteQuery.php#L15-L18
bheisig/cli
src/Command/Version.php
Version.execute
public function execute() { $this->log ->printAsOutput() ->info( '%s %s', $this->config['composer']['extra']['name'], $this->config['composer']['extra']['version'] ); return $this; }
php
public function execute() { $this->log ->printAsOutput() ->info( '%s %s', $this->config['composer']['extra']['name'], $this->config['composer']['extra']['version'] ); return $this; }
[ "public", "function", "execute", "(", ")", "{", "$", "this", "->", "log", "->", "printAsOutput", "(", ")", "->", "info", "(", "'%s %s'", ",", "$", "this", "->", "config", "[", "'composer'", "]", "[", "'extra'", "]", "[", "'name'", "]", ",", "$", "t...
Execute command @return self Returns itself @throws Exception on error
[ "Execute", "command" ]
train
https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/Command/Version.php#L41-L51
rollerworks-graveyard/metadata
src/CacheableMetadataFactory.php
CacheableMetadataFactory.getClassMetadata
public function getClassMetadata($className) { // Allow reflection as parameter for internal usage. if ($className instanceof ReflectionClass) { $className = $className->getName(); } $cacheKey = str_replace('\\', '.', $className).'.single'; if (null !== $classMe...
php
public function getClassMetadata($className) { // Allow reflection as parameter for internal usage. if ($className instanceof ReflectionClass) { $className = $className->getName(); } $cacheKey = str_replace('\\', '.', $className).'.single'; if (null !== $classMe...
[ "public", "function", "getClassMetadata", "(", "$", "className", ")", "{", "// Allow reflection as parameter for internal usage.", "if", "(", "$", "className", "instanceof", "ReflectionClass", ")", "{", "$", "className", "=", "$", "className", "->", "getName", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks-graveyard/metadata/blob/5b07f564aad87709ca0d0b3e140e4dc4edf9d375/src/CacheableMetadataFactory.php#L86-L106
rollerworks-graveyard/metadata
src/CacheableMetadataFactory.php
CacheableMetadataFactory.getMergedClassMetadata
public function getMergedClassMetadata($className, $flags = 0) { $cacheKey = str_replace('\\', '.', $className).'.merged.'.$flags; if (null !== $classMetadata = $this->freshOrNull($this->cache->fetch($cacheKey))) { return $classMetadata; } return $this->filterAndStore( ...
php
public function getMergedClassMetadata($className, $flags = 0) { $cacheKey = str_replace('\\', '.', $className).'.merged.'.$flags; if (null !== $classMetadata = $this->freshOrNull($this->cache->fetch($cacheKey))) { return $classMetadata; } return $this->filterAndStore( ...
[ "public", "function", "getMergedClassMetadata", "(", "$", "className", ",", "$", "flags", "=", "0", ")", "{", "$", "cacheKey", "=", "str_replace", "(", "'\\\\'", ",", "'.'", ",", "$", "className", ")", ".", "'.merged.'", ".", "$", "flags", ";", "if", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/rollerworks-graveyard/metadata/blob/5b07f564aad87709ca0d0b3e140e4dc4edf9d375/src/CacheableMetadataFactory.php#L111-L124
rollerworks-graveyard/metadata
src/CacheableMetadataFactory.php
CacheableMetadataFactory.freshOrNull
private function freshOrNull(ClassMetadata $classMetadata = null) { if (null === $classMetadata) { return; } return $this->freshnessValidator->isFresh($classMetadata) ? $classMetadata : null; }
php
private function freshOrNull(ClassMetadata $classMetadata = null) { if (null === $classMetadata) { return; } return $this->freshnessValidator->isFresh($classMetadata) ? $classMetadata : null; }
[ "private", "function", "freshOrNull", "(", "ClassMetadata", "$", "classMetadata", "=", "null", ")", "{", "if", "(", "null", "===", "$", "classMetadata", ")", "{", "return", ";", "}", "return", "$", "this", "->", "freshnessValidator", "->", "isFresh", "(", ...
Internal method for handling refreshing of metadata. @param ClassMetadata|null $classMetadata @return ClassMetadata|null
[ "Internal", "method", "for", "handling", "refreshing", "of", "metadata", "." ]
train
https://github.com/rollerworks-graveyard/metadata/blob/5b07f564aad87709ca0d0b3e140e4dc4edf9d375/src/CacheableMetadataFactory.php#L133-L140
danielgp/common-lib
source/CommonLibLocale.php
CommonLibLocale.handleLanguageIntoSession
public function handleLanguageIntoSession() { $this->settingsCommonLib(); $this->initializeSprGlbAndSession(); if (is_null($this->tCmnSuperGlobals->get('lang')) && is_null($this->tCmnSession->get('lang'))) { $this->tCmnSession->set('lang', $this->commonLibFlags['default_language'...
php
public function handleLanguageIntoSession() { $this->settingsCommonLib(); $this->initializeSprGlbAndSession(); if (is_null($this->tCmnSuperGlobals->get('lang')) && is_null($this->tCmnSession->get('lang'))) { $this->tCmnSession->set('lang', $this->commonLibFlags['default_language'...
[ "public", "function", "handleLanguageIntoSession", "(", ")", "{", "$", "this", "->", "settingsCommonLib", "(", ")", ";", "$", "this", "->", "initializeSprGlbAndSession", "(", ")", ";", "if", "(", "is_null", "(", "$", "this", "->", "tCmnSuperGlobals", "->", "...
Stores given language or default one into global session variable (In order to avoid potential language injections from other applications session will revert to the default language if application one is not among the one are not supported here)
[ "Stores", "given", "language", "or", "default", "one", "into", "global", "session", "variable", "(", "In", "order", "to", "avoid", "potential", "language", "injections", "from", "other", "applications", "session", "will", "revert", "to", "the", "default", "langu...
train
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonLibLocale.php#L89-L99
danielgp/common-lib
source/CommonLibLocale.php
CommonLibLocale.handleLocalizationCommon
private function handleLocalizationCommon() { $this->handleLanguageIntoSession(); $localizationFile = $this->getCommonLocaleFolder() . '/locale/' . $this->tCmnSession->get('lang') . '/LC_MESSAGES/' . $this->commonLibFlags['localization_domain'] . '.mo'; $translations ...
php
private function handleLocalizationCommon() { $this->handleLanguageIntoSession(); $localizationFile = $this->getCommonLocaleFolder() . '/locale/' . $this->tCmnSession->get('lang') . '/LC_MESSAGES/' . $this->commonLibFlags['localization_domain'] . '.mo'; $translations ...
[ "private", "function", "handleLocalizationCommon", "(", ")", "{", "$", "this", "->", "handleLanguageIntoSession", "(", ")", ";", "$", "localizationFile", "=", "$", "this", "->", "getCommonLocaleFolder", "(", ")", ".", "'/locale/'", ".", "$", "this", "->", "tCm...
Takes care of instantiation of localization libraries used within current module for multi-languages support
[ "Takes", "care", "of", "instantiation", "of", "localization", "libraries", "used", "within", "current", "module", "for", "multi", "-", "languages", "support" ]
train
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonLibLocale.php#L106-L116
danielgp/common-lib
source/CommonLibLocale.php
CommonLibLocale.setDividedResult
public function setDividedResult($fAbove, $fBelow, $mArguments = null) { if (($fAbove == 0) || ($fBelow == 0)) { // prevent infinite result AND division by 0 return 0; } $numberToFormat = ($fAbove / $fBelow); if (is_numeric($mArguments)) { $frMinMax = [ ...
php
public function setDividedResult($fAbove, $fBelow, $mArguments = null) { if (($fAbove == 0) || ($fBelow == 0)) { // prevent infinite result AND division by 0 return 0; } $numberToFormat = ($fAbove / $fBelow); if (is_numeric($mArguments)) { $frMinMax = [ ...
[ "public", "function", "setDividedResult", "(", "$", "fAbove", ",", "$", "fBelow", ",", "$", "mArguments", "=", "null", ")", "{", "if", "(", "(", "$", "fAbove", "==", "0", ")", "||", "(", "$", "fBelow", "==", "0", ")", ")", "{", "// prevent infinite r...
Returns proper result from a mathematical division in order to avoid Zero division error or Infinite results @param float $fAbove @param float $fBelow @param mixed $mArguments @return string
[ "Returns", "proper", "result", "from", "a", "mathematical", "division", "in", "order", "to", "avoid", "Zero", "division", "error", "or", "Infinite", "results" ]
train
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/CommonLibLocale.php#L173-L187
mpf-soft/admin-widgets
menu/items/Label.php
Label.display
public function display() { if (!$this->isVisible()) return ""; $content = \mpf\web\helpers\Html::get()->tag('span', $this->getIcon() . $this->translate($this->label), $this->labelHtmlOptions); $submenu = ""; if (count($this->items)) { $this->htmlOptions['cla...
php
public function display() { if (!$this->isVisible()) return ""; $content = \mpf\web\helpers\Html::get()->tag('span', $this->getIcon() . $this->translate($this->label), $this->labelHtmlOptions); $submenu = ""; if (count($this->items)) { $this->htmlOptions['cla...
[ "public", "function", "display", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isVisible", "(", ")", ")", "return", "\"\"", ";", "$", "content", "=", "\\", "mpf", "\\", "web", "\\", "helpers", "\\", "Html", "::", "get", "(", ")", "->", "tag"...
Returns current item as HTML Code @return string
[ "Returns", "current", "item", "as", "HTML", "Code" ]
train
https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/menu/items/Label.php#L85-L115
tw88/sso
src/Server.php
Server.startBrokerSession
public function startBrokerSession() { if (isset($this->brokerId)) { return; } $sid = $this->getBrokerSessionID(); if ($sid === false) { return $this->fail("Broker didn't send a session key", 400); } $linkedId = $this->cache->get($sid); ...
php
public function startBrokerSession() { if (isset($this->brokerId)) { return; } $sid = $this->getBrokerSessionID(); if ($sid === false) { return $this->fail("Broker didn't send a session key", 400); } $linkedId = $this->cache->get($sid); ...
[ "public", "function", "startBrokerSession", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "brokerId", ")", ")", "{", "return", ";", "}", "$", "sid", "=", "$", "this", "->", "getBrokerSessionID", "(", ")", ";", "if", "(", "$", "sid", "=...
Start the session for broker requests to the SSO server
[ "Start", "the", "session", "for", "broker", "requests", "to", "the", "SSO", "server" ]
train
https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Server.php#L68-L97
tw88/sso
src/Server.php
Server.generateSessionId
protected function generateSessionId($brokerId, $token) { $broker = $this->getBrokerInfo($brokerId); if (!isset($broker)) { return null; } return "SSO-{$brokerId}-{$token}-" . hash('sha256', 'session' . $token . $broker['secret']); }
php
protected function generateSessionId($brokerId, $token) { $broker = $this->getBrokerInfo($brokerId); if (!isset($broker)) { return null; } return "SSO-{$brokerId}-{$token}-" . hash('sha256', 'session' . $token . $broker['secret']); }
[ "protected", "function", "generateSessionId", "(", "$", "brokerId", ",", "$", "token", ")", "{", "$", "broker", "=", "$", "this", "->", "getBrokerInfo", "(", "$", "brokerId", ")", ";", "if", "(", "!", "isset", "(", "$", "broker", ")", ")", "{", "retu...
Generate session id from session token @param string $brokerId @param string $token @return string
[ "Generate", "session", "id", "from", "session", "token" ]
train
https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Server.php#L164-L173
tw88/sso
src/Server.php
Server.detectReturnType
protected function detectReturnType() { if (isset($_GET['cookie'])) { $this->returnType = 'none'; return; } elseif (!empty($_GET['return_url'])) { $this->returnType = 'redirect'; } elseif (!empty($_GET['callback'])) { $this->returnType = 'jsonp...
php
protected function detectReturnType() { if (isset($_GET['cookie'])) { $this->returnType = 'none'; return; } elseif (!empty($_GET['return_url'])) { $this->returnType = 'redirect'; } elseif (!empty($_GET['callback'])) { $this->returnType = 'jsonp...
[ "protected", "function", "detectReturnType", "(", ")", "{", "if", "(", "isset", "(", "$", "_GET", "[", "'cookie'", "]", ")", ")", "{", "$", "this", "->", "returnType", "=", "'none'", ";", "return", ";", "}", "elseif", "(", "!", "empty", "(", "$", "...
Detect the type for the HTTP response. Should only be done for an `attach` request.
[ "Detect", "the", "type", "for", "the", "HTTP", "response", ".", "Should", "only", "be", "done", "for", "an", "attach", "request", "." ]
train
https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Server.php#L198-L212
tw88/sso
src/Server.php
Server.attach
public function attach() { $this->detectReturnType(); if (empty($_REQUEST['broker'])) { return $this->fail("No broker specified", 400); } if (empty($_REQUEST['token'])) { return $this->fail("No token specified", 400); } if (!$this->returnTyp...
php
public function attach() { $this->detectReturnType(); if (empty($_REQUEST['broker'])) { return $this->fail("No broker specified", 400); } if (empty($_REQUEST['token'])) { return $this->fail("No token specified", 400); } if (!$this->returnTyp...
[ "public", "function", "attach", "(", ")", "{", "$", "this", "->", "detectReturnType", "(", ")", ";", "if", "(", "empty", "(", "$", "_REQUEST", "[", "'broker'", "]", ")", ")", "{", "return", "$", "this", "->", "fail", "(", "\"No broker specified\"", ","...
Attach a user session to a broker session
[ "Attach", "a", "user", "session", "to", "a", "broker", "session" ]
train
https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Server.php#L217-L244
tw88/sso
src/Server.php
Server.outputAttachSuccess
protected function outputAttachSuccess() { if ($this->returnType === 'image') { $this->outputImage(); } if ($this->returnType === 'json' || $this->returnType === 'none') { header('Content-type: application/json; charset=UTF-8'); echo json_encode(['success...
php
protected function outputAttachSuccess() { if ($this->returnType === 'image') { $this->outputImage(); } if ($this->returnType === 'json' || $this->returnType === 'none') { header('Content-type: application/json; charset=UTF-8'); echo json_encode(['success...
[ "protected", "function", "outputAttachSuccess", "(", ")", "{", "if", "(", "$", "this", "->", "returnType", "===", "'image'", ")", "{", "$", "this", "->", "outputImage", "(", ")", ";", "}", "if", "(", "$", "this", "->", "returnType", "===", "'json'", "|...
Output on a successful attach
[ "Output", "on", "a", "successful", "attach" ]
train
https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Server.php#L249-L270
tw88/sso
src/Server.php
Server.getSessionData
protected function getSessionData($key) { if ($key === 'id') { return session_id(); } return isset($_SESSION[$key]) ? $_SESSION[$key] : null; }
php
protected function getSessionData($key) { if ($key === 'id') { return session_id(); } return isset($_SESSION[$key]) ? $_SESSION[$key] : null; }
[ "protected", "function", "getSessionData", "(", "$", "key", ")", "{", "if", "(", "$", "key", "===", "'id'", ")", "{", "return", "session_id", "(", ")", ";", "}", "return", "isset", "(", "$", "_SESSION", "[", "$", "key", "]", ")", "?", "$", "_SESSIO...
Get session data @param type $key
[ "Get", "session", "data" ]
train
https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Server.php#L363-L370
tw88/sso
src/Server.php
Server.fail
protected function fail($message, $http_status = 500) { if (!empty($this->options['fail_exception'])) { throw new Exception($message, $http_status); } if ($http_status === 500) { trigger_error($message, E_USER_WARNING); } if ($this->returnType === 'j...
php
protected function fail($message, $http_status = 500) { if (!empty($this->options['fail_exception'])) { throw new Exception($message, $http_status); } if ($http_status === 500) { trigger_error($message, E_USER_WARNING); } if ($this->returnType === 'j...
[ "protected", "function", "fail", "(", "$", "message", ",", "$", "http_status", "=", "500", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "options", "[", "'fail_exception'", "]", ")", ")", "{", "throw", "new", "Exception", "(", "$", "mess...
An error occured. @param string $message @param int $http_status
[ "An", "error", "occured", "." ]
train
https://github.com/tw88/sso/blob/746323f3087af5a06769f7c207ab4ed5124a14bb/src/Server.php#L379-L406
itsmikej/Filter
src/Filter.php
Filter.string
public static function string(&$value, $options = ['length'=>null, 'regex'=>null, 'default'=>null]) { $value = htmlspecialchars(trim($value)); self::processString($value, $options); return $value; }
php
public static function string(&$value, $options = ['length'=>null, 'regex'=>null, 'default'=>null]) { $value = htmlspecialchars(trim($value)); self::processString($value, $options); return $value; }
[ "public", "static", "function", "string", "(", "&", "$", "value", ",", "$", "options", "=", "[", "'length'", "=>", "null", ",", "'regex'", "=>", "null", ",", "'default'", "=>", "null", "]", ")", "{", "$", "value", "=", "htmlspecialchars", "(", "trim", ...
filter string @param $value @param $options @return string
[ "filter", "string" ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L71-L76
itsmikej/Filter
src/Filter.php
Filter.int
public static function int(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null]) { $value = (int)$value; self::processNum($value, $options); return $value; }
php
public static function int(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null]) { $value = (int)$value; self::processNum($value, $options); return $value; }
[ "public", "static", "function", "int", "(", "&", "$", "value", ",", "$", "options", "=", "[", "'max'", "=>", "null", ",", "'min'", "=>", "null", ",", "'default'", "=>", "null", "]", ")", "{", "$", "value", "=", "(", "int", ")", "$", "value", ";",...
filter int @param $value @param array $options @return int
[ "filter", "int" ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L84-L89
itsmikej/Filter
src/Filter.php
Filter.uInt
public static function uInt(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null]) { $value = (int)$value; self::processUNum($value, $options); return $value; }
php
public static function uInt(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null]) { $value = (int)$value; self::processUNum($value, $options); return $value; }
[ "public", "static", "function", "uInt", "(", "&", "$", "value", ",", "$", "options", "=", "[", "'max'", "=>", "null", ",", "'min'", "=>", "null", ",", "'default'", "=>", "null", "]", ")", "{", "$", "value", "=", "(", "int", ")", "$", "value", ";"...
filter positive int @param $value @param array $options @return int
[ "filter", "positive", "int" ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L97-L102
itsmikej/Filter
src/Filter.php
Filter.float
public static function float(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null]) { $value = (float)$value; self::processNum($value, $options); return $value; }
php
public static function float(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null]) { $value = (float)$value; self::processNum($value, $options); return $value; }
[ "public", "static", "function", "float", "(", "&", "$", "value", ",", "$", "options", "=", "[", "'max'", "=>", "null", ",", "'min'", "=>", "null", ",", "'default'", "=>", "null", "]", ")", "{", "$", "value", "=", "(", "float", ")", "$", "value", ...
filter float @param $value @param array $options @return float
[ "filter", "float" ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L110-L115
itsmikej/Filter
src/Filter.php
Filter.ufloat
public static function ufloat(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null]) { $value = (float)$value; self::processUNum($value, $options); return $value; }
php
public static function ufloat(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null]) { $value = (float)$value; self::processUNum($value, $options); return $value; }
[ "public", "static", "function", "ufloat", "(", "&", "$", "value", ",", "$", "options", "=", "[", "'max'", "=>", "null", ",", "'min'", "=>", "null", ",", "'default'", "=>", "null", "]", ")", "{", "$", "value", "=", "(", "float", ")", "$", "value", ...
filter positive float @param $value @param array $options @return float
[ "filter", "positive", "float" ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L123-L128
itsmikej/Filter
src/Filter.php
Filter.enum
public static function enum(&$value, $options = ['enum'=>[], 'strict'=>false, 'default'=>null]) { if (isset($options['enum']) && is_array($options['enum']) && $options['enum'] != []) { $value = in_array($value, $options['enum'], isset($options['strict']) && $options['strict']) ? ...
php
public static function enum(&$value, $options = ['enum'=>[], 'strict'=>false, 'default'=>null]) { if (isset($options['enum']) && is_array($options['enum']) && $options['enum'] != []) { $value = in_array($value, $options['enum'], isset($options['strict']) && $options['strict']) ? ...
[ "public", "static", "function", "enum", "(", "&", "$", "value", ",", "$", "options", "=", "[", "'enum'", "=>", "[", "]", ",", "'strict'", "=>", "false", ",", "'default'", "=>", "null", "]", ")", "{", "if", "(", "isset", "(", "$", "options", "[", ...
enum If $value is in an array of enum, then return value. otherwise, according to the enum array and default parameters, select the appropriate value to return. @param $value @param array $options @return mixed|null
[ "enum", "If", "$value", "is", "in", "an", "array", "of", "enum", "then", "return", "value", ".", "otherwise", "according", "to", "the", "enum", "array", "and", "default", "parameters", "select", "the", "appropriate", "value", "to", "return", "." ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L138-L148
itsmikej/Filter
src/Filter.php
Filter.enumByKey
public static function enumByKey(&$value, $options = ['enum'=>[], 'default_key'=>null, 'enum_key'=>false, 'default'=>null]) { if (isset($options['enum']) && is_array($options['enum']) && $options['enum'] != []) { $key = null; if (isset($options['enum'][$value])) { //...
php
public static function enumByKey(&$value, $options = ['enum'=>[], 'default_key'=>null, 'enum_key'=>false, 'default'=>null]) { if (isset($options['enum']) && is_array($options['enum']) && $options['enum'] != []) { $key = null; if (isset($options['enum'][$value])) { //...
[ "public", "static", "function", "enumByKey", "(", "&", "$", "value", ",", "$", "options", "=", "[", "'enum'", "=>", "[", "]", ",", "'default_key'", "=>", "null", ",", "'enum_key'", "=>", "false", ",", "'default'", "=>", "null", "]", ")", "{", "if", "...
enum by key If array_key_exists($value), then returns the corresponding value otherwise, according to the array and default_key, default parameters submitted, select the appropriate value to return. @param $value @param array $options @return mixed|null
[ "enum", "by", "key", "If", "array_key_exists", "(", "$value", ")", "then", "returns", "the", "corresponding", "value", "otherwise", "according", "to", "the", "array", "and", "default_key", "default", "parameters", "submitted", "select", "the", "appropriate", "valu...
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L158-L190
itsmikej/Filter
src/Filter.php
Filter.json
public static function json(&$value, $options = ['json_assoc'=>true, 'json_schema'=>[], 'default'=>null]) { $json_assoc = isset($options['json_assoc']) && $options['json_assoc'] ? true : false; $value = @json_decode(trim($value), $json_assoc); if ($value !== null && $json_assoc && isset($op...
php
public static function json(&$value, $options = ['json_assoc'=>true, 'json_schema'=>[], 'default'=>null]) { $json_assoc = isset($options['json_assoc']) && $options['json_assoc'] ? true : false; $value = @json_decode(trim($value), $json_assoc); if ($value !== null && $json_assoc && isset($op...
[ "public", "static", "function", "json", "(", "&", "$", "value", ",", "$", "options", "=", "[", "'json_assoc'", "=>", "true", ",", "'json_schema'", "=>", "[", "]", ",", "'default'", "=>", "null", "]", ")", "{", "$", "json_assoc", "=", "isset", "(", "$...
filter json @param $value @param array $options @return mixed
[ "filter", "json" ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L198-L216
itsmikej/Filter
src/Filter.php
Filter.processString
protected static function processString(&$value, $options) { $value = str_replace(chr(0), '', $value); if (isset($options['length']) && $options['length']) { $value = substr($value, 0, $options['length']); } if (isset($options['regex']) && $options['regex']) { ...
php
protected static function processString(&$value, $options) { $value = str_replace(chr(0), '', $value); if (isset($options['length']) && $options['length']) { $value = substr($value, 0, $options['length']); } if (isset($options['regex']) && $options['regex']) { ...
[ "protected", "static", "function", "processString", "(", "&", "$", "value", ",", "$", "options", ")", "{", "$", "value", "=", "str_replace", "(", "chr", "(", "0", ")", ",", "''", ",", "$", "value", ")", ";", "if", "(", "isset", "(", "$", "options",...
process string @param $value @param $options
[ "process", "string" ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L223-L235
itsmikej/Filter
src/Filter.php
Filter.processNum
protected static function processNum(&$value, $options) { if (isset($options['min']) && $options['min'] >= 0) { $ic = $value < $options['min'] ? 0 : 1; } else { $ic = 1; } if (isset($options['max']) && $options['max']) { if (isset($options['min'])...
php
protected static function processNum(&$value, $options) { if (isset($options['min']) && $options['min'] >= 0) { $ic = $value < $options['min'] ? 0 : 1; } else { $ic = 1; } if (isset($options['max']) && $options['max']) { if (isset($options['min'])...
[ "protected", "static", "function", "processNum", "(", "&", "$", "value", ",", "$", "options", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'min'", "]", ")", "&&", "$", "options", "[", "'min'", "]", ">=", "0", ")", "{", "$", "ic", "=",...
process number @param $value @param $options
[ "process", "number" ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L242-L311
itsmikej/Filter
src/Filter.php
Filter.processUNum
protected static function processUNum(&$value, $options) { if (!isset($options['min']) || empty($options['min']) || $options['min'] < 0) { $options['min'] = 0; } self::processNum($value, $options); }
php
protected static function processUNum(&$value, $options) { if (!isset($options['min']) || empty($options['min']) || $options['min'] < 0) { $options['min'] = 0; } self::processNum($value, $options); }
[ "protected", "static", "function", "processUNum", "(", "&", "$", "value", ",", "$", "options", ")", "{", "if", "(", "!", "isset", "(", "$", "options", "[", "'min'", "]", ")", "||", "empty", "(", "$", "options", "[", "'min'", "]", ")", "||", "$", ...
process positive number @param $value @param $options
[ "process", "positive", "number" ]
train
https://github.com/itsmikej/Filter/blob/77132fd7c2e12d353323273220af841e39b77193/src/Filter.php#L318-L324
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.csrfMetaTags
public static function csrfMetaTags() { $request = Yii::$app->getRequest(); if ($request instanceof Request && $request->enableCsrfValidation) { return static::tag('meta', '', ['name' => 'csrf-param', 'content' => $request->csrfParam]) . "\n " . static::tag('meta', '',...
php
public static function csrfMetaTags() { $request = Yii::$app->getRequest(); if ($request instanceof Request && $request->enableCsrfValidation) { return static::tag('meta', '', ['name' => 'csrf-param', 'content' => $request->csrfParam]) . "\n " . static::tag('meta', '',...
[ "public", "static", "function", "csrfMetaTags", "(", ")", "{", "$", "request", "=", "Yii", "::", "$", "app", "->", "getRequest", "(", ")", ";", "if", "(", "$", "request", "instanceof", "Request", "&&", "$", "request", "->", "enableCsrfValidation", ")", "...
Generates the meta tags containing CSRF token information. @return string the generated meta tags @see Request::enableCsrfValidation
[ "Generates", "the", "meta", "tags", "containing", "CSRF", "token", "information", "." ]
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L281-L290
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.img
public static function img($src, $options = []) { $options['src'] = Url::to($src); if (!isset($options['alt'])) { $options['alt'] = ''; } return static::tag('img', '', $options); }
php
public static function img($src, $options = []) { $options['src'] = Url::to($src); if (!isset($options['alt'])) { $options['alt'] = ''; } return static::tag('img', '', $options); }
[ "public", "static", "function", "img", "(", "$", "src", ",", "$", "options", "=", "[", "]", ")", "{", "$", "options", "[", "'src'", "]", "=", "Url", "::", "to", "(", "$", "src", ")", ";", "if", "(", "!", "isset", "(", "$", "options", "[", "'a...
Generates an image tag. @param array|string $src the image URL. This parameter will be processed by [[Url::to()]]. @param array $options the tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, th...
[ "Generates", "an", "image", "tag", "." ]
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L411-L418
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.textarea
public static function textarea($name, $value = '', $options = []) { $options['name'] = $name; return static::tag('textarea', static::encode($value), $options); }
php
public static function textarea($name, $value = '', $options = []) { $options['name'] = $name; return static::tag('textarea', static::encode($value), $options); }
[ "public", "static", "function", "textarea", "(", "$", "name", ",", "$", "value", "=", "''", ",", "$", "options", "=", "[", "]", ")", "{", "$", "options", "[", "'name'", "]", "=", "$", "name", ";", "return", "static", "::", "tag", "(", "'textarea'",...
Generates a text area input. @param string $name the input name @param string $value the input value. Note that it will be encoded using [[encode()]]. @param array $options the tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using ...
[ "Generates", "a", "text", "area", "input", "." ]
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L641-L645
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.checkboxList
public static function checkboxList($name, $selection = null, $items = [], $options = []) { if (substr($name, -2) !== '[]') { $name .= '[]'; } $formatter = isset($options['item']) ? $options['item'] : null; $itemOptions = isset($options['itemOptions']) ? $options['itemOp...
php
public static function checkboxList($name, $selection = null, $items = [], $options = []) { if (substr($name, -2) !== '[]') { $name .= '[]'; } $formatter = isset($options['item']) ? $options['item'] : null; $itemOptions = isset($options['itemOptions']) ? $options['itemOp...
[ "public", "static", "function", "checkboxList", "(", "$", "name", ",", "$", "selection", "=", "null", ",", "$", "items", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "substr", "(", "$", "name", ",", "-", "2", ")", "!=...
Generates a list of checkboxes. A checkbox list allows multiple selection, like [[listBox()]]. As a result, the corresponding submitted value is an array. @param string $name the name attribute of each checkbox. @param string|array $selection the selected value(s). @param array $items the data item used to generate the...
[ "Generates", "a", "list", "of", "checkboxes", ".", "A", "checkbox", "list", "allows", "multiple", "selection", "like", "[[", "listBox", "()", "]]", ".", "As", "a", "result", "the", "corresponding", "submitted", "value", "is", "an", "array", ".", "@param", ...
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L877-L916
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.ul
public static function ul($items, $options = []) { $tag = isset($options['tag']) ? $options['tag'] : 'ul'; $encode = !isset($options['encode']) || $options['encode']; $formatter = isset($options['item']) ? $options['item'] : null; $itemOptions = isset($options['itemOptions']) ? $opti...
php
public static function ul($items, $options = []) { $tag = isset($options['tag']) ? $options['tag'] : 'ul'; $encode = !isset($options['encode']) || $options['encode']; $formatter = isset($options['item']) ? $options['item'] : null; $itemOptions = isset($options['itemOptions']) ? $opti...
[ "public", "static", "function", "ul", "(", "$", "items", ",", "$", "options", "=", "[", "]", ")", "{", "$", "tag", "=", "isset", "(", "$", "options", "[", "'tag'", "]", ")", "?", "$", "options", "[", "'tag'", "]", ":", "'ul'", ";", "$", "encode...
Generates an unordered list. @param array|\Traversable $items the items for generating the list. Each item generates a single list item. Note that items will be automatically HTML encoded if `$options['encode']` is not set or true. @param array $options options (name => config) for the radio button list. The following ...
[ "Generates", "an", "unordered", "list", ".", "@param", "array|", "\\", "Traversable", "$items", "the", "items", "for", "generating", "the", "list", ".", "Each", "item", "generates", "a", "single", "list", "item", ".", "Note", "that", "items", "will", "be", ...
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L1009-L1030
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.activeLabel
public static function activeLabel($model, $attribute, $options = []) { $for = array_key_exists('for', $options) ? $options['for'] : static::getInputId($model, $attribute); $attribute = static::getAttributeName($attribute); $label = isset($options['label']) ? $options['label'] : static::enco...
php
public static function activeLabel($model, $attribute, $options = []) { $for = array_key_exists('for', $options) ? $options['for'] : static::getInputId($model, $attribute); $attribute = static::getAttributeName($attribute); $label = isset($options['label']) ? $options['label'] : static::enco...
[ "public", "static", "function", "activeLabel", "(", "$", "model", ",", "$", "attribute", ",", "$", "options", "=", "[", "]", ")", "{", "$", "for", "=", "array_key_exists", "(", "'for'", ",", "$", "options", ")", "?", "$", "options", "[", "'for'", "]"...
Generates a label tag for the given model attribute. The label text is the label associated with the attribute, obtained via [[Model::getAttributeLabel()]]. @param Model $model the model object @param string $attribute the attribute name or expression. See [[getAttributeName()]] for the format about attribute expressio...
[ "Generates", "a", "label", "tag", "for", "the", "given", "model", "attribute", ".", "The", "label", "text", "is", "the", "label", "associated", "with", "the", "attribute", "obtained", "via", "[[", "Model", "::", "getAttributeLabel", "()", "]]", ".", "@param"...
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L1080-L1087
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.errorSummary
public static function errorSummary($models, $options = []) { $header = isset($options['header']) ? $options['header'] : '<p>' . Yii::t('yii', 'Please fix the following errors:') . '</p>'; $footer = isset($options['footer']) ? $options['footer'] : ''; $encode = !isset($options['encode']) || ...
php
public static function errorSummary($models, $options = []) { $header = isset($options['header']) ? $options['header'] : '<p>' . Yii::t('yii', 'Please fix the following errors:') . '</p>'; $footer = isset($options['footer']) ? $options['footer'] : ''; $encode = !isset($options['encode']) || ...
[ "public", "static", "function", "errorSummary", "(", "$", "models", ",", "$", "options", "=", "[", "]", ")", "{", "$", "header", "=", "isset", "(", "$", "options", "[", "'header'", "]", ")", "?", "$", "options", "[", "'header'", "]", ":", "'<p>'", ...
Generates a summary of the validation errors. If there is no validation error, an empty error summary markup will still be generated, but it will be hidden. @param Model|Model[] $models the model(s) whose validation errors are to be displayed @param array $options the tag options in terms of name-value pairs. The follo...
[ "Generates", "a", "summary", "of", "the", "validation", "errors", ".", "If", "there", "is", "no", "validation", "error", "an", "empty", "error", "summary", "markup", "will", "still", "be", "generated", "but", "it", "will", "be", "hidden", ".", "@param", "M...
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L1136-L1162
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.error
public static function error($model, $attribute, $options = []) { $attribute = static::getAttributeName($attribute); $error = $model->getFirstError($attribute); $tag = isset($options['tag']) ? $options['tag'] : 'div'; $encode = !isset($options['encode']) || $options['encode'] !== fal...
php
public static function error($model, $attribute, $options = []) { $attribute = static::getAttributeName($attribute); $error = $model->getFirstError($attribute); $tag = isset($options['tag']) ? $options['tag'] : 'div'; $encode = !isset($options['encode']) || $options['encode'] !== fal...
[ "public", "static", "function", "error", "(", "$", "model", ",", "$", "attribute", ",", "$", "options", "=", "[", "]", ")", "{", "$", "attribute", "=", "static", "::", "getAttributeName", "(", "$", "attribute", ")", ";", "$", "error", "=", "$", "mode...
Generates a tag that contains the first validation error of the specified model attribute. Note that even if there is no validation error, this method will still return an empty error tag. @param Model $model the model object @param string $attribute the attribute name or expression. See [[getAttributeName()]] for the ...
[ "Generates", "a", "tag", "that", "contains", "the", "first", "validation", "error", "of", "the", "specified", "model", "attribute", ".", "Note", "that", "even", "if", "there", "is", "no", "validation", "error", "this", "method", "will", "still", "return", "a...
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L1182-L1190
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.activeFileInput
public static function activeFileInput($model, $attribute, $options = []) { // add a hidden field so that if a model only has a file field, we can // still use isset($_POST[$modelClass]) to detect if the input is submitted return static::activeHiddenInput($model, $attribute, ['id' => null, '...
php
public static function activeFileInput($model, $attribute, $options = []) { // add a hidden field so that if a model only has a file field, we can // still use isset($_POST[$modelClass]) to detect if the input is submitted return static::activeHiddenInput($model, $attribute, ['id' => null, '...
[ "public", "static", "function", "activeFileInput", "(", "$", "model", ",", "$", "attribute", ",", "$", "options", "=", "[", "]", ")", "{", "// add a hidden field so that if a model only has a file field, we can", "// still use isset($_POST[$modelClass]) to detect if the input i...
Generates a file input tag for the given model attribute. This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in `$options`. @param Model $model the model object @param string $attribute the attribute name or expression. See [[getAtt...
[ "Generates", "a", "file", "input", "tag", "for", "the", "given", "model", "attribute", ".", "This", "method", "will", "generate", "the", "name", "and", "value", "tag", "attributes", "automatically", "for", "the", "model", "attribute", "unless", "they", "are", ...
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L1313-L1319
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.activeRadio
public static function activeRadio($model, $attribute, $options = []) { $name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute); $value = static::getAttributeValue($model, $attribute); if (!array_key_exists('value', $options)) { $options['va...
php
public static function activeRadio($model, $attribute, $options = []) { $name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute); $value = static::getAttributeValue($model, $attribute); if (!array_key_exists('value', $options)) { $options['va...
[ "public", "static", "function", "activeRadio", "(", "$", "model", ",", "$", "attribute", ",", "$", "options", "=", "[", "]", ")", "{", "$", "name", "=", "isset", "(", "$", "options", "[", "'name'", "]", ")", "?", "$", "options", "[", "'name'", "]",...
Generates a radio button tag together with a label for the given model attribute. This method will generate the "checked" tag attribute according to the model attribute value. @param Model $model the model object @param string $attribute the attribute name or expression. See [[getAttributeName()]] for the format about ...
[ "Generates", "a", "radio", "button", "tag", "together", "with", "a", "label", "for", "the", "given", "model", "attribute", ".", "This", "method", "will", "generate", "the", "checked", "tag", "attribute", "according", "to", "the", "model", "attribute", "value",...
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L1379-L1401
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.activeCheckbox
public static function activeCheckbox($model, $attribute, $options = []) { $name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute); $value = static::getAttributeValue($model, $attribute); if (!array_key_exists('value', $options)) { $options[...
php
public static function activeCheckbox($model, $attribute, $options = []) { $name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute); $value = static::getAttributeValue($model, $attribute); if (!array_key_exists('value', $options)) { $options[...
[ "public", "static", "function", "activeCheckbox", "(", "$", "model", ",", "$", "attribute", ",", "$", "options", "=", "[", "]", ")", "{", "$", "name", "=", "isset", "(", "$", "options", "[", "'name'", "]", ")", "?", "$", "options", "[", "'name'", "...
Generates a checkbox tag together with a label for the given model attribute. This method will generate the "checked" tag attribute according to the model attribute value. @param Model $model the model object @param string $attribute the attribute name or expression. See [[getAttributeName()]] for the format about attr...
[ "Generates", "a", "checkbox", "tag", "together", "with", "a", "label", "for", "the", "given", "model", "attribute", ".", "This", "method", "will", "generate", "the", "checked", "tag", "attribute", "according", "to", "the", "model", "attribute", "value", ".", ...
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L1428-L1450
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.activeListInput
protected static function activeListInput($type, $model, $attribute, $items, $options = []) { $name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute); $selection = static::getAttributeValue($model, $attribute); if (!array_key_exists('unselect', $options)...
php
protected static function activeListInput($type, $model, $attribute, $items, $options = []) { $name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute); $selection = static::getAttributeValue($model, $attribute); if (!array_key_exists('unselect', $options)...
[ "protected", "static", "function", "activeListInput", "(", "$", "type", ",", "$", "model", ",", "$", "attribute", ",", "$", "items", ",", "$", "options", "=", "[", "]", ")", "{", "$", "name", "=", "isset", "(", "$", "options", "[", "'name'", "]", "...
Generates a list of input fields. This method is mainly called by [[activeListBox()]], [[activeRadioList()]] and [[activeCheckBoxList()]]. @param string $type the input type. This can be 'listBox', 'radioList', or 'checkBoxList'. @param Model $model the model object @param string $attribute the attribute name or expres...
[ "Generates", "a", "list", "of", "input", "fields", ".", "This", "method", "is", "mainly", "called", "by", "[[", "activeListBox", "()", "]]", "[[", "activeRadioList", "()", "]]", "and", "[[", "activeCheckBoxList", "()", "]]", "." ]
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L1646-L1657
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.renderSelectOptions
public static function renderSelectOptions($selection, $items, &$tagOptions = []) { $lines = []; $encodeSpaces = ArrayHelper::remove($tagOptions, 'encodeSpaces', false); $encode = ArrayHelper::remove($tagOptions, 'encode', true); if (isset($tagOptions['prompt'])) { $promp...
php
public static function renderSelectOptions($selection, $items, &$tagOptions = []) { $lines = []; $encodeSpaces = ArrayHelper::remove($tagOptions, 'encodeSpaces', false); $encode = ArrayHelper::remove($tagOptions, 'encode', true); if (isset($tagOptions['prompt'])) { $promp...
[ "public", "static", "function", "renderSelectOptions", "(", "$", "selection", ",", "$", "items", ",", "&", "$", "tagOptions", "=", "[", "]", ")", "{", "$", "lines", "=", "[", "]", ";", "$", "encodeSpaces", "=", "ArrayHelper", "::", "remove", "(", "$", ...
Renders the option tags that can be used by [[dropDownList()]] and [[listBox()]]. @param string|array $selection the selected value(s). This can be either a string for single selection or an array for multiple selections. @param array $items the option data items. The array keys are option values, and the array values ...
[ "Renders", "the", "option", "tags", "that", "can", "be", "used", "by", "[[", "dropDownList", "()", "]]", "and", "[[", "listBox", "()", "]]", ".", "@param", "string|array", "$selection", "the", "selected", "value", "(", "s", ")", ".", "This", "can", "be",...
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L1677-L1720
hiqdev/minii-helpers
src/BaseHtml.php
BaseHtml.getInputName
public static function getInputName($model, $attribute) { $formName = $model->formName(); if (!preg_match('/(^|.*\])([\w\.]+)(\[.*|$)/', $attribute, $matches)) { throw new InvalidParamException('Attribute name must contain word characters only.'); } $prefix = $matches[1];...
php
public static function getInputName($model, $attribute) { $formName = $model->formName(); if (!preg_match('/(^|.*\])([\w\.]+)(\[.*|$)/', $attribute, $matches)) { throw new InvalidParamException('Attribute name must contain word characters only.'); } $prefix = $matches[1];...
[ "public", "static", "function", "getInputName", "(", "$", "model", ",", "$", "attribute", ")", "{", "$", "formName", "=", "$", "model", "->", "formName", "(", ")", ";", "if", "(", "!", "preg_match", "(", "'/(^|.*\\])([\\w\\.]+)(\\[.*|$)/'", ",", "$", "attr...
Generates an appropriate input name for the specified attribute name or expression. This method generates a name that can be used as the input name to collect user input for the specified attribute. The name is generated according to the [[Model::formName|form name]] of the model and the given attribute name. For exam...
[ "Generates", "an", "appropriate", "input", "name", "for", "the", "specified", "attribute", "name", "or", "expression", "." ]
train
https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseHtml.php#L2072-L2088
stubbles/stubbles-reflect
src/main/php/annotation/AnnotationCache.php
AnnotationCache.start
public static function start(callable $readCache, callable $storeCache) { self::$annotations = $readCache(); if (!is_array(self::$annotations)) { self::flush(); throw new \RuntimeException('Cached annotation data is not an array'); } self::$unserialized = [];...
php
public static function start(callable $readCache, callable $storeCache) { self::$annotations = $readCache(); if (!is_array(self::$annotations)) { self::flush(); throw new \RuntimeException('Cached annotation data is not an array'); } self::$unserialized = [];...
[ "public", "static", "function", "start", "(", "callable", "$", "readCache", ",", "callable", "$", "storeCache", ")", "{", "self", "::", "$", "annotations", "=", "$", "readCache", "(", ")", ";", "if", "(", "!", "is_array", "(", "self", "::", "$", "annot...
start annotation cache with given cache storage logic Calling this method will also flush the cache. If this method is never called the annotation cache will not be persistent but only last as long as the current request is running. The $readCache closure must return the stored annotation data. If no such data is pre...
[ "start", "annotation", "cache", "with", "given", "cache", "storage", "logic" ]
train
https://github.com/stubbles/stubbles-reflect/blob/ab48f9b8692293ef0d276b52619625dbb8869c97/src/main/php/annotation/AnnotationCache.php#L83-L95
stubbles/stubbles-reflect
src/main/php/annotation/AnnotationCache.php
AnnotationCache.startFromFileCache
public static function startFromFileCache(string $cacheFile) { self::start( function() use($cacheFile) { if (file_exists($cacheFile)) { return unserialize(file_get_contents($cacheFile)); } re...
php
public static function startFromFileCache(string $cacheFile) { self::start( function() use($cacheFile) { if (file_exists($cacheFile)) { return unserialize(file_get_contents($cacheFile)); } re...
[ "public", "static", "function", "startFromFileCache", "(", "string", "$", "cacheFile", ")", "{", "self", "::", "start", "(", "function", "(", ")", "use", "(", "$", "cacheFile", ")", "{", "if", "(", "file_exists", "(", "$", "cacheFile", ")", ")", "{", "...
starts annotation cache with given cache file @param string $cacheFile path to file wherein cached annotation data is stored @since 3.0.0
[ "starts", "annotation", "cache", "with", "given", "cache", "file" ]
train
https://github.com/stubbles/stubbles-reflect/blob/ab48f9b8692293ef0d276b52619625dbb8869c97/src/main/php/annotation/AnnotationCache.php#L103-L119
stubbles/stubbles-reflect
src/main/php/annotation/AnnotationCache.php
AnnotationCache.__shutdown
public static function __shutdown() { if (self::$cacheChanged && null !== self::$storeCache) { $storeCache = self::$storeCache; $storeCache(self::$annotations); } }
php
public static function __shutdown() { if (self::$cacheChanged && null !== self::$storeCache) { $storeCache = self::$storeCache; $storeCache(self::$annotations); } }
[ "public", "static", "function", "__shutdown", "(", ")", "{", "if", "(", "self", "::", "$", "cacheChanged", "&&", "null", "!==", "self", "::", "$", "storeCache", ")", "{", "$", "storeCache", "=", "self", "::", "$", "storeCache", ";", "$", "storeCache", ...
static shutdown
[ "static", "shutdown" ]
train
https://github.com/stubbles/stubbles-reflect/blob/ab48f9b8692293ef0d276b52619625dbb8869c97/src/main/php/annotation/AnnotationCache.php#L134-L140
stubbles/stubbles-reflect
src/main/php/annotation/AnnotationCache.php
AnnotationCache.put
public static function put(Annotations $annotations) { self::$annotations[$annotations->target()] = serialize($annotations); self::$unserialized[$annotations->target()] = $annotations; self::$cacheChanged = true; }
php
public static function put(Annotations $annotations) { self::$annotations[$annotations->target()] = serialize($annotations); self::$unserialized[$annotations->target()] = $annotations; self::$cacheChanged = true; }
[ "public", "static", "function", "put", "(", "Annotations", "$", "annotations", ")", "{", "self", "::", "$", "annotations", "[", "$", "annotations", "->", "target", "(", ")", "]", "=", "serialize", "(", "$", "annotations", ")", ";", "self", "::", "$", "...
store annotations in the cache @param \stubbles\reflect\annotation\Annotations $annotations
[ "store", "annotations", "in", "the", "cache" ]
train
https://github.com/stubbles/stubbles-reflect/blob/ab48f9b8692293ef0d276b52619625dbb8869c97/src/main/php/annotation/AnnotationCache.php#L157-L162
stubbles/stubbles-reflect
src/main/php/annotation/AnnotationCache.php
AnnotationCache.get
public static function get(string $target) { if (!self::has($target)) { return null; } if (!isset(self::$unserialized[$target])) { self::$unserialized[$target] = unserialize(self::$annotations[$target]); } return self::$unserialized[$target]; }
php
public static function get(string $target) { if (!self::has($target)) { return null; } if (!isset(self::$unserialized[$target])) { self::$unserialized[$target] = unserialize(self::$annotations[$target]); } return self::$unserialized[$target]; }
[ "public", "static", "function", "get", "(", "string", "$", "target", ")", "{", "if", "(", "!", "self", "::", "has", "(", "$", "target", ")", ")", "{", "return", "null", ";", "}", "if", "(", "!", "isset", "(", "self", "::", "$", "unserialized", "[...
returns list of all annotations for given target @param string $target @return \stubbles\reflect\annotation\Annotations
[ "returns", "list", "of", "all", "annotations", "for", "given", "target" ]
train
https://github.com/stubbles/stubbles-reflect/blob/ab48f9b8692293ef0d276b52619625dbb8869c97/src/main/php/annotation/AnnotationCache.php#L181-L192
JoeBengalen/Config
src/Config.php
Config.load
public function load($file) { if (!is_string($file) || !file_exists($file)) { throw new InvalidArgumentException('File must be a valid file.'); } $data = include $file; if (!is_array($data)) { throw new RuntimeException('File did not return an array.'); ...
php
public function load($file) { if (!is_string($file) || !file_exists($file)) { throw new InvalidArgumentException('File must be a valid file.'); } $data = include $file; if (!is_array($data)) { throw new RuntimeException('File did not return an array.'); ...
[ "public", "function", "load", "(", "$", "file", ")", "{", "if", "(", "!", "is_string", "(", "$", "file", ")", "||", "!", "file_exists", "(", "$", "file", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'File must be a valid file.'", ")", ...
Load a configuration file. @param string $file Path to php file which returns an array. @return self. @throws \InvalidArgumentException If $file is not a valid file. @throws \RunTimeException If $file does not return an array.
[ "Load", "a", "configuration", "file", "." ]
train
https://github.com/JoeBengalen/Config/blob/1a13f3153374224aad52da4669bd69655f037546/src/Config.php#L33-L46
tonis-io-legacy/web
src/Console.php
Console.add
public function add(Command $command) { if ($command instanceof ContainerAwareInterface) { $command->setServiceContainer($this->app->getServiceContainer()); } return parent::add($command); }
php
public function add(Command $command) { if ($command instanceof ContainerAwareInterface) { $command->setServiceContainer($this->app->getServiceContainer()); } return parent::add($command); }
[ "public", "function", "add", "(", "Command", "$", "command", ")", "{", "if", "(", "$", "command", "instanceof", "ContainerAwareInterface", ")", "{", "$", "command", "->", "setServiceContainer", "(", "$", "this", "->", "app", "->", "getServiceContainer", "(", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/tonis-io-legacy/web/blob/730bec77457afeb91ce4ca9fbbf85c469c2fb8bc/src/Console.php#L33-L39
SlaxWeb/Slaxer
src/Service/Provider.php
Provider.register
public function register(Container $app) { $app["slaxer.service"] = function (Container $app) { $cliApp = new CLIApp("Slaxer", "0.4.*-dev"); if (isset($app["slaxerCommands"]) === false) { return $cliApp; } foreach ($app["slaxerCommands"] as $...
php
public function register(Container $app) { $app["slaxer.service"] = function (Container $app) { $cliApp = new CLIApp("Slaxer", "0.4.*-dev"); if (isset($app["slaxerCommands"]) === false) { return $cliApp; } foreach ($app["slaxerCommands"] as $...
[ "public", "function", "register", "(", "Container", "$", "app", ")", "{", "$", "app", "[", "\"slaxer.service\"", "]", "=", "function", "(", "Container", "$", "app", ")", "{", "$", "cliApp", "=", "new", "CLIApp", "(", "\"Slaxer\"", ",", "\"0.4.*-dev\"", "...
Register provider Register is called by the container, when the provider gets registered. @param \Pimple\Container $app Dependency Injection Container @return void
[ "Register", "provider" ]
train
https://github.com/SlaxWeb/Slaxer/blob/69cb5ddb086b644a5577a758f8d4e323baa59184/src/Service/Provider.php#L31-L63
bseddon/XPath20
Value/NMTOKENValue.php
NMTOKENValue.Equals
public function Equals($obj) { if ( ! $obj instanceof NMTOKENValue ) { return false; } /** * @var TokenValue $other */ $other = $obj; return strcmp( $this->Value, $other->Value ) == 0; }
php
public function Equals($obj) { if ( ! $obj instanceof NMTOKENValue ) { return false; } /** * @var TokenValue $other */ $other = $obj; return strcmp( $this->Value, $other->Value ) == 0; }
[ "public", "function", "Equals", "(", "$", "obj", ")", "{", "if", "(", "!", "$", "obj", "instanceof", "NMTOKENValue", ")", "{", "return", "false", ";", "}", "/**\r\n\t\t * @var TokenValue $other\r\n\t\t */", "$", "other", "=", "$", "obj", ";", "return", "strc...
Equals @param object $obj @return bool
[ "Equals" ]
train
https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/NMTOKENValue.php#L92-L104
zhaoxianfang/tools
src/Symfony/Component/DependencyInjection/ServiceLocator.php
ServiceLocator.get
public function get($id) { if (!isset($this->factories[$id])) { throw new ServiceNotFoundException($id, end($this->loading) ?: null, null, array(), $this->createServiceNotFoundMessage($id)); } if (isset($this->loading[$id])) { $ids = array_values($this->loading); ...
php
public function get($id) { if (!isset($this->factories[$id])) { throw new ServiceNotFoundException($id, end($this->loading) ?: null, null, array(), $this->createServiceNotFoundMessage($id)); } if (isset($this->loading[$id])) { $ids = array_values($this->loading); ...
[ "public", "function", "get", "(", "$", "id", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "factories", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "ServiceNotFoundException", "(", "$", "id", ",", "end", "(", "$", "this", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/ServiceLocator.php#L48-L68
spryker/multi-cart-data-import
src/Spryker/Zed/MultiCartDataImport/Business/CartImportStep/StoreToIdStoreStep.php
StoreToIdStoreStep.execute
public function execute(DataSetInterface $dataSet): void { $storeName = $dataSet[CartDataSetInterface::KEY_STORE]; if (!isset($this->idStoreCache[$storeName])) { $storeQuery = new SpyStoreQuery(); $idStore = $storeQuery ->select(SpyStoreTableMap::COL_ID_STORE)...
php
public function execute(DataSetInterface $dataSet): void { $storeName = $dataSet[CartDataSetInterface::KEY_STORE]; if (!isset($this->idStoreCache[$storeName])) { $storeQuery = new SpyStoreQuery(); $idStore = $storeQuery ->select(SpyStoreTableMap::COL_ID_STORE)...
[ "public", "function", "execute", "(", "DataSetInterface", "$", "dataSet", ")", ":", "void", "{", "$", "storeName", "=", "$", "dataSet", "[", "CartDataSetInterface", "::", "KEY_STORE", "]", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "idStoreCache...
@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @throws \Spryker\Zed\DataImport\Business\Exception\EntityNotFoundException @return void
[ "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ]
train
https://github.com/spryker/multi-cart-data-import/blob/3c699df39e87c44c3f4a47f2ccf0f5791330a729/src/Spryker/Zed/MultiCartDataImport/Business/CartImportStep/StoreToIdStoreStep.php#L31-L48
Polosa/shade-framework-core
app/View/Replace.php
Replace.render
public function render($templates, array $data = array()) { $templates = (array) $templates; foreach ($templates as $template) { if (!is_readable($template) || !is_file($template)) { throw new \Shade\Exception('Template file "'.$template.'" does not exists'); ...
php
public function render($templates, array $data = array()) { $templates = (array) $templates; foreach ($templates as $template) { if (!is_readable($template) || !is_file($template)) { throw new \Shade\Exception('Template file "'.$template.'" does not exists'); ...
[ "public", "function", "render", "(", "$", "templates", ",", "array", "$", "data", "=", "array", "(", ")", ")", "{", "$", "templates", "=", "(", "array", ")", "$", "templates", ";", "foreach", "(", "$", "templates", "as", "$", "template", ")", "{", ...
Render template @param string|array $templates Path to template or array of paths to template and layouts @param array $data Data for templates @throws \Shade\Exception @return string
[ "Render", "template" ]
train
https://github.com/Polosa/shade-framework-core/blob/d735d3e8e0616fb9cf4ffc25b8425762ed07940f/app/View/Replace.php#L53-L66
hiqdev/minii-widgets
src/FragmentCache.php
FragmentCache.init
public function init() { parent::init(); $this->cache = $this->enabled ? Instance::ensure($this->cache, Cache::className()) : null; if ($this->cache instanceof Cache && $this->getCachedContent() === false) { $this->getView()->cacheStack[] = $this; ob_start(); ...
php
public function init() { parent::init(); $this->cache = $this->enabled ? Instance::ensure($this->cache, Cache::className()) : null; if ($this->cache instanceof Cache && $this->getCachedContent() === false) { $this->getView()->cacheStack[] = $this; ob_start(); ...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "$", "this", "->", "cache", "=", "$", "this", "->", "enabled", "?", "Instance", "::", "ensure", "(", "$", "this", "->", "cache", ",", "Cache", "::", "className", "(...
Initializes the FragmentCache object.
[ "Initializes", "the", "FragmentCache", "object", "." ]
train
https://github.com/hiqdev/minii-widgets/blob/b8bc54a3645e9e45c228e3ec81b11ff4775385c3/src/FragmentCache.php#L83-L94
hiqdev/minii-widgets
src/FragmentCache.php
FragmentCache.run
public function run() { if (($content = $this->getCachedContent()) !== false) { echo $content; } elseif ($this->cache instanceof Cache) { $content = ob_get_clean(); if ($content === false || $content === '') { return; } arra...
php
public function run() { if (($content = $this->getCachedContent()) !== false) { echo $content; } elseif ($this->cache instanceof Cache) { $content = ob_get_clean(); if ($content === false || $content === '') { return; } arra...
[ "public", "function", "run", "(", ")", "{", "if", "(", "(", "$", "content", "=", "$", "this", "->", "getCachedContent", "(", ")", ")", "!==", "false", ")", "{", "echo", "$", "content", ";", "}", "elseif", "(", "$", "this", "->", "cache", "instanceo...
Marks the end of content to be cached. Content displayed before this method call and after [[init()]] will be captured and saved in cache. This method does nothing if valid content is already found in cache.
[ "Marks", "the", "end", "of", "content", "to", "be", "cached", ".", "Content", "displayed", "before", "this", "method", "call", "and", "after", "[[", "init", "()", "]]", "will", "be", "captured", "and", "saved", "in", "cache", ".", "This", "method", "does...
train
https://github.com/hiqdev/minii-widgets/blob/b8bc54a3645e9e45c228e3ec81b11ff4775385c3/src/FragmentCache.php#L102-L123
hiqdev/minii-widgets
src/FragmentCache.php
FragmentCache.getCachedContent
public function getCachedContent() { if ($this->_content === null) { $this->_content = false; if ($this->cache instanceof Cache) { $key = $this->calculateKey(); $data = $this->cache->get($key); if (is_array($data) && count($data) === 2)...
php
public function getCachedContent() { if ($this->_content === null) { $this->_content = false; if ($this->cache instanceof Cache) { $key = $this->calculateKey(); $data = $this->cache->get($key); if (is_array($data) && count($data) === 2)...
[ "public", "function", "getCachedContent", "(", ")", "{", "if", "(", "$", "this", "->", "_content", "===", "null", ")", "{", "$", "this", "->", "_content", "=", "false", ";", "if", "(", "$", "this", "->", "cache", "instanceof", "Cache", ")", "{", "$",...
Returns the cached content if available. @return string|boolean the cached content. False is returned if valid content is not found in the cache.
[ "Returns", "the", "cached", "content", "if", "available", "." ]
train
https://github.com/hiqdev/minii-widgets/blob/b8bc54a3645e9e45c228e3ec81b11ff4775385c3/src/FragmentCache.php#L134-L158
hiqdev/minii-widgets
src/FragmentCache.php
FragmentCache.updateDynamicContent
protected function updateDynamicContent($content, $placeholders) { foreach ($placeholders as $name => $statements) { $placeholders[$name] = $this->getView()->evaluateDynamicContent($statements); } return strtr($content, $placeholders); }
php
protected function updateDynamicContent($content, $placeholders) { foreach ($placeholders as $name => $statements) { $placeholders[$name] = $this->getView()->evaluateDynamicContent($statements); } return strtr($content, $placeholders); }
[ "protected", "function", "updateDynamicContent", "(", "$", "content", ",", "$", "placeholders", ")", "{", "foreach", "(", "$", "placeholders", "as", "$", "name", "=>", "$", "statements", ")", "{", "$", "placeholders", "[", "$", "name", "]", "=", "$", "th...
Replaces placeholders in content by results of evaluated dynamic statements. @param string $content @param array $placeholders @return string final content
[ "Replaces", "placeholders", "in", "content", "by", "results", "of", "evaluated", "dynamic", "statements", "." ]
train
https://github.com/hiqdev/minii-widgets/blob/b8bc54a3645e9e45c228e3ec81b11ff4775385c3/src/FragmentCache.php#L167-L174
hiqdev/minii-widgets
src/FragmentCache.php
FragmentCache.calculateKey
protected function calculateKey() { $factors = [__CLASS__, $this->getId()]; if (is_array($this->variations)) { foreach ($this->variations as $factor) { $factors[] = $factor; } } return $factors; }
php
protected function calculateKey() { $factors = [__CLASS__, $this->getId()]; if (is_array($this->variations)) { foreach ($this->variations as $factor) { $factors[] = $factor; } } return $factors; }
[ "protected", "function", "calculateKey", "(", ")", "{", "$", "factors", "=", "[", "__CLASS__", ",", "$", "this", "->", "getId", "(", ")", "]", ";", "if", "(", "is_array", "(", "$", "this", "->", "variations", ")", ")", "{", "foreach", "(", "$", "th...
Generates a unique key used for storing the content in cache. The key generated depends on both [[id]] and [[variations]]. @return mixed a valid cache key
[ "Generates", "a", "unique", "key", "used", "for", "storing", "the", "content", "in", "cache", ".", "The", "key", "generated", "depends", "on", "both", "[[", "id", "]]", "and", "[[", "variations", "]]", "." ]
train
https://github.com/hiqdev/minii-widgets/blob/b8bc54a3645e9e45c228e3ec81b11ff4775385c3/src/FragmentCache.php#L181-L191
praxigento/mobi_mod_downline
Ui/DataProvider/Grid/Customer/Group/Changes/Query.php
Query.getQueryItems
protected function getQueryItems() { $result = $this->conn->select(); /* define tables aliases for internal usage (in this method) */ $asCust = self::AS_CUST; $asDwnl = self::AS_DWNL; $asGrpCur = self::AS_GRP_CUR; $asGrpNew = self::AS_GRP_NEW; $asGrpOld = sel...
php
protected function getQueryItems() { $result = $this->conn->select(); /* define tables aliases for internal usage (in this method) */ $asCust = self::AS_CUST; $asDwnl = self::AS_DWNL; $asGrpCur = self::AS_GRP_CUR; $asGrpNew = self::AS_GRP_NEW; $asGrpOld = sel...
[ "protected", "function", "getQueryItems", "(", ")", "{", "$", "result", "=", "$", "this", "->", "conn", "->", "select", "(", ")", ";", "/* define tables aliases for internal usage (in this method) */", "$", "asCust", "=", "self", "::", "AS_CUST", ";", "$", "asDw...
SELECT `r`.`id`, `r`.`date_changed` AS `dateChanged`, (CONCAT(c.firstname, " ", c.lastname)) AS `custName`, `d`.`mlm_id` AS `custMlmId`, `gc`.`customer_group_code` AS `groupCur`, `go`.`customer_group_code` AS `groupOld`, `gn`.`customer_group_code` AS `groupNew` FROM `prxgt_dwnl_change_group` AS `r` LEFT JOIN `customer_...
[ "SELECT", "r", ".", "id", "r", ".", "date_changed", "AS", "dateChanged", "(", "CONCAT", "(", "c", ".", "firstname", "c", ".", "lastname", "))", "AS", "custName", "d", ".", "mlm_id", "AS", "custMlmId", "gc", ".", "customer_group_code", "AS", "groupCur", "...
train
https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Ui/DataProvider/Grid/Customer/Group/Changes/Query.php#L95-L165
comodojo/foundation
src/Comodojo/Foundation/Validation/DataFilter.php
DataFilter.filterInteger
public static function filterInteger($int, $min=~PHP_INT_MAX, $max=PHP_INT_MAX, $default=0) { return filter_var($int, FILTER_VALIDATE_INT, array( 'options' => array( 'default' => $default, 'min_range' => $min, 'max_range' => $max ) ...
php
public static function filterInteger($int, $min=~PHP_INT_MAX, $max=PHP_INT_MAX, $default=0) { return filter_var($int, FILTER_VALIDATE_INT, array( 'options' => array( 'default' => $default, 'min_range' => $min, 'max_range' => $max ) ...
[ "public", "static", "function", "filterInteger", "(", "$", "int", ",", "$", "min", "=", "~", "PHP_INT_MAX", ",", "$", "max", "=", "PHP_INT_MAX", ",", "$", "default", "=", "0", ")", "{", "return", "filter_var", "(", "$", "int", ",", "FILTER_VALIDATE_INT",...
Filter an integer. This method is a shortcut to filter_var using FILTER_VALIDATE_INT @param int $int Int to filter @param int $min Min value (default to ~PHP_INT_MAX) @param int $max Max value (default to PHP_INT_MAX) @param int $default Default value @return int
[ "Filter", "an", "integer", "." ]
train
https://github.com/comodojo/foundation/blob/21ed690e81763ed9e1ef7721a7eb4fcc0fcefc1a/src/Comodojo/Foundation/Validation/DataFilter.php#L32-L42
KDF5000/EasyThink
src/ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_config.php
Smarty_Internal_Config.buildCompiledFilepath
public function buildCompiledFilepath() { $_compile_id = isset($this->smarty->compile_id) ? preg_replace('![^\w\|]+!', '_', $this->smarty->compile_id) : null; $_flag = (int) $this->smarty->config_read_hidden + (int) $this->smarty->config_booleanize * 2 + (int) $this->smarty->config_o...
php
public function buildCompiledFilepath() { $_compile_id = isset($this->smarty->compile_id) ? preg_replace('![^\w\|]+!', '_', $this->smarty->compile_id) : null; $_flag = (int) $this->smarty->config_read_hidden + (int) $this->smarty->config_booleanize * 2 + (int) $this->smarty->config_o...
[ "public", "function", "buildCompiledFilepath", "(", ")", "{", "$", "_compile_id", "=", "isset", "(", "$", "this", "->", "smarty", "->", "compile_id", ")", "?", "preg_replace", "(", "'![^\\w\\|]+!'", ",", "'_'", ",", "$", "this", "->", "smarty", "->", "comp...
Get file path. @return string
[ "Get", "file", "path", "." ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_config.php#L102-L121
ikkentim/WikiClone
src/Ikkentim/WikiClone/Http/Middleware/GollumWebhook.php
GollumWebhook.handle
public function handle($request, Closure $next) { $event = $request->header('X-GitHub-Event'); if ($event !== 'gollum' && $event != 'push' && $event != 'create' && $event != 'delete') { return response('Page not found', 404); } return $next($request); ...
php
public function handle($request, Closure $next) { $event = $request->header('X-GitHub-Event'); if ($event !== 'gollum' && $event != 'push' && $event != 'create' && $event != 'delete') { return response('Page not found', 404); } return $next($request); ...
[ "public", "function", "handle", "(", "$", "request", ",", "Closure", "$", "next", ")", "{", "$", "event", "=", "$", "request", "->", "header", "(", "'X-GitHub-Event'", ")", ";", "if", "(", "$", "event", "!==", "'gollum'", "&&", "$", "event", "!=", "'...
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @return mixed
[ "Handle", "an", "incoming", "request", "." ]
train
https://github.com/ikkentim/WikiClone/blob/848b8090e3e632aa5b392d50f39c960ce23ede07/src/Ikkentim/WikiClone/Http/Middleware/GollumWebhook.php#L13-L22
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.whereNot
public function whereNot(\Closure $callback, string $appendRule = 'AND'): self { $groupQuery = $this->resolveCriteriaGroupClosure($callback); $this->where[] = new CriteriaCriterion($groupQuery->where, true, $appendRule); return $this; }
php
public function whereNot(\Closure $callback, string $appendRule = 'AND'): self { $groupQuery = $this->resolveCriteriaGroupClosure($callback); $this->where[] = new CriteriaCriterion($groupQuery->where, true, $appendRule); return $this; }
[ "public", "function", "whereNot", "(", "\\", "Closure", "$", "callback", ",", "string", "$", "appendRule", "=", "'AND'", ")", ":", "self", "{", "$", "groupQuery", "=", "$", "this", "->", "resolveCriteriaGroupClosure", "(", "$", "callback", ")", ";", "$", ...
Adds a group of criteria wrapped by NOT. @param \Closure $callback Makes a group of criteria @param string $appendRule How the criterion should be appended to the others (SQL boolean operator name) @return $this @throws InvalidReturnValueException
[ "Adds", "a", "group", "of", "criteria", "wrapped", "by", "NOT", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L77-L82
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.whereRaw
public function whereRaw(string $query, array $bindings = [], string $appendRule = 'AND'): self { $this->where[] = new RawCriterion(new Raw($query, $bindings), $appendRule); return $this; }
php
public function whereRaw(string $query, array $bindings = [], string $appendRule = 'AND'): self { $this->where[] = new RawCriterion(new Raw($query, $bindings), $appendRule); return $this; }
[ "public", "function", "whereRaw", "(", "string", "$", "query", ",", "array", "$", "bindings", "=", "[", "]", ",", "string", "$", "appendRule", "=", "'AND'", ")", ":", "self", "{", "$", "this", "->", "where", "[", "]", "=", "new", "RawCriterion", "(",...
Adds a raw SQL criterion to the WHERE section. @param string $query SQL statement @param array $bindings Values to bind to the statement @param string $appendRule How the criterion should be appended to the others (SQL boolean operator name) @return $this
[ "Adds", "a", "raw", "SQL", "criterion", "to", "the", "WHERE", "section", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L104-L108
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.whereBetween
public function whereBetween($column, $min, $max, bool $not = false, string $appendRule = 'AND'): self { $column = $this->checkStringValue('Argument $column', $column); $min = $this->checkScalarOrNullValue('The left between value', $min); $max = $this->checkScalarOrNullValue('The right betwe...
php
public function whereBetween($column, $min, $max, bool $not = false, string $appendRule = 'AND'): self { $column = $this->checkStringValue('Argument $column', $column); $min = $this->checkScalarOrNullValue('The left between value', $min); $max = $this->checkScalarOrNullValue('The right betwe...
[ "public", "function", "whereBetween", "(", "$", "column", ",", "$", "min", ",", "$", "max", ",", "bool", "$", "not", "=", "false", ",", "string", "$", "appendRule", "=", "'AND'", ")", ":", "self", "{", "$", "column", "=", "$", "this", "->", "checkS...
Adds a BETWEEN criterion to the WHERE section. @param string|\Closure|Query|StatementInterface $column Target column @param mixed|\Closure|Query|StatementInterface $min Left value @param mixed|\Closure|Query|StatementInterface $max Right value @param bool $not Whether the rule should be NOT BETWEEN @param string $appe...
[ "Adds", "a", "BETWEEN", "criterion", "to", "the", "WHERE", "section", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L135-L143
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.orWhereBetween
public function orWhereBetween($column, $min, $max): self { return $this->whereBetween($column, $min, $max, false, 'OR'); }
php
public function orWhereBetween($column, $min, $max): self { return $this->whereBetween($column, $min, $max, false, 'OR'); }
[ "public", "function", "orWhereBetween", "(", "$", "column", ",", "$", "min", ",", "$", "max", ")", ":", "self", "{", "return", "$", "this", "->", "whereBetween", "(", "$", "column", ",", "$", "min", ",", "$", "max", ",", "false", ",", "'OR'", ")", ...
Adds a BETWEEN criterion to the WHERE section with the OR append rule. See the readme for more info about append rules. @param string|\Closure|Query|StatementInterface $column Target column @param mixed|\Closure|Query|StatementInterface $min Left value @param mixed|\Closure|Query|StatementInterface $max Right value @r...
[ "Adds", "a", "BETWEEN", "criterion", "to", "the", "WHERE", "section", "with", "the", "OR", "append", "rule", ".", "See", "the", "readme", "for", "more", "info", "about", "append", "rules", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L156-L159
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.whereNotBetween
public function whereNotBetween($column, $min, $max): self { return $this->whereBetween($column, $min, $max, true); }
php
public function whereNotBetween($column, $min, $max): self { return $this->whereBetween($column, $min, $max, true); }
[ "public", "function", "whereNotBetween", "(", "$", "column", ",", "$", "min", ",", "$", "max", ")", ":", "self", "{", "return", "$", "this", "->", "whereBetween", "(", "$", "column", ",", "$", "min", ",", "$", "max", ",", "true", ")", ";", "}" ]
Adds a NOT BETWEEN criterion to the WHERE section. @param string|\Closure|Query|StatementInterface $column Target column @param mixed|\Closure|Query|StatementInterface $min Left value @param mixed|\Closure|Query|StatementInterface $max Right value @return $this @throws InvalidArgumentException @throws InvalidReturnVal...
[ "Adds", "a", "NOT", "BETWEEN", "criterion", "to", "the", "WHERE", "section", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L171-L174
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.orWhereNotBetween
public function orWhereNotBetween($column, $min, $max): self { return $this->whereBetween($column, $min, $max, true, 'OR'); }
php
public function orWhereNotBetween($column, $min, $max): self { return $this->whereBetween($column, $min, $max, true, 'OR'); }
[ "public", "function", "orWhereNotBetween", "(", "$", "column", ",", "$", "min", ",", "$", "max", ")", ":", "self", "{", "return", "$", "this", "->", "whereBetween", "(", "$", "column", ",", "$", "min", ",", "$", "max", ",", "true", ",", "'OR'", ")"...
Adds a NOT BETWEEN criterion to the WHERE section with the OR append rule. See the readme for more info about append rules. @param string|\Closure|Query|StatementInterface $column Target column @param mixed|\Closure|Query|StatementInterface $min Left value @param mixed|\Closure|Query|StatementInterface $max Right valu...
[ "Adds", "a", "NOT", "BETWEEN", "criterion", "to", "the", "WHERE", "section", "with", "the", "OR", "append", "rule", ".", "See", "the", "readme", "for", "more", "info", "about", "append", "rules", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L187-L190
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.whereIn
public function whereIn($column, $values, bool $not = false, string $appendRule = 'AND'): self { $column = $this->checkStringValue('Argument $column', $column); if ( !is_array($values) && !($values instanceof \Closure) && !($values instanceof Query) && ...
php
public function whereIn($column, $values, bool $not = false, string $appendRule = 'AND'): self { $column = $this->checkStringValue('Argument $column', $column); if ( !is_array($values) && !($values instanceof \Closure) && !($values instanceof Query) && ...
[ "public", "function", "whereIn", "(", "$", "column", ",", "$", "values", ",", "bool", "$", "not", "=", "false", ",", "string", "$", "appendRule", "=", "'AND'", ")", ":", "self", "{", "$", "column", "=", "$", "this", "->", "checkStringValue", "(", "'A...
Adds a IN criterion to the WHERE section. @param string|\Closure|Query|StatementInterface $column Target column @param mixed[]|\Closure[]|Query[]|StatementInterface[]|\Closure|Query|StatementInterface Haystack values @param bool $not Whether the rule should be NOT IN @param string $appendRule How the criterion should ...
[ "Adds", "a", "IN", "criterion", "to", "the", "WHERE", "section", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L203-L230
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.whereNull
public function whereNull($column, bool $not = false, string $appendRule = 'AND'): self { $column = $this->checkStringValue('Argument $column', $column); $this->where[] = new NullCriterion($column, !$not, $appendRule); return $this; }
php
public function whereNull($column, bool $not = false, string $appendRule = 'AND'): self { $column = $this->checkStringValue('Argument $column', $column); $this->where[] = new NullCriterion($column, !$not, $appendRule); return $this; }
[ "public", "function", "whereNull", "(", "$", "column", ",", "bool", "$", "not", "=", "false", ",", "string", "$", "appendRule", "=", "'AND'", ")", ":", "self", "{", "$", "column", "=", "$", "this", "->", "checkStringValue", "(", "'Argument $column'", ","...
Adds a IS NULL criterion to the WHERE section. @param string|\Closure|Query|StatementInterface $column Target column @param bool $not Whether the rule should be NOT NULL @param string $appendRule How the criterion should be appended to the others (SQL boolean operator name) @return $this @throws InvalidArgumentExcepti...
[ "Adds", "a", "IS", "NULL", "criterion", "to", "the", "WHERE", "section", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L286-L292
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.whereColumn
public function whereColumn(...$arguments): self { $this->where[] = $this->whereArgumentsToCriterion($arguments, 'AND', true); return $this; }
php
public function whereColumn(...$arguments): self { $this->where[] = $this->whereArgumentsToCriterion($arguments, 'AND', true); return $this; }
[ "public", "function", "whereColumn", "(", "...", "$", "arguments", ")", ":", "self", "{", "$", "this", "->", "where", "[", "]", "=", "$", "this", "->", "whereArgumentsToCriterion", "(", "$", "arguments", ",", "'AND'", ",", "true", ")", ";", "return", "...
Adds a columns comparing rule to the WHERE section. You may either pass two columns and rule or only two columns: `whereColumn($column1, $column2)`, in this case the rule is `=`. Or you may pass an array of compares as the first argument (they are appended with the AND rule). @param string|\Closure|Query|StatementInte...
[ "Adds", "a", "columns", "comparing", "rule", "to", "the", "WHERE", "section", ".", "You", "may", "either", "pass", "two", "columns", "and", "rule", "or", "only", "two", "columns", ":", "whereColumn", "(", "$column1", "$column2", ")", "in", "this", "case", ...
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L347-L351
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.orWhereColumn
public function orWhereColumn(...$arguments): self { $this->where[] = $this->whereArgumentsToCriterion($arguments, 'OR', true); return $this; }
php
public function orWhereColumn(...$arguments): self { $this->where[] = $this->whereArgumentsToCriterion($arguments, 'OR', true); return $this; }
[ "public", "function", "orWhereColumn", "(", "...", "$", "arguments", ")", ":", "self", "{", "$", "this", "->", "where", "[", "]", "=", "$", "this", "->", "whereArgumentsToCriterion", "(", "$", "arguments", ",", "'OR'", ",", "true", ")", ";", "return", ...
The same as `whereColumn` but the result criterion is appended to the "where" group with the OR append rule. @see whereColumn @param string|\Closure|Query|StatementInterface|array[] $column Target column 1 @param string|\Closure|Query|StatementInterface $rule Rule or target column 2 @param string|\Closure|Query|Statem...
[ "The", "same", "as", "whereColumn", "but", "the", "result", "criterion", "is", "appended", "to", "the", "where", "group", "with", "the", "OR", "append", "rule", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L364-L368
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.whereExists
public function whereExists($subQuery, bool $not = false, string $appendRule = 'AND'): self { $subQuery = $this->checkSubQueryValue('Argument $subQuery', $subQuery); $this->where[] = new ExistsCriterion($subQuery, $not, $appendRule); return $this; }
php
public function whereExists($subQuery, bool $not = false, string $appendRule = 'AND'): self { $subQuery = $this->checkSubQueryValue('Argument $subQuery', $subQuery); $this->where[] = new ExistsCriterion($subQuery, $not, $appendRule); return $this; }
[ "public", "function", "whereExists", "(", "$", "subQuery", ",", "bool", "$", "not", "=", "false", ",", "string", "$", "appendRule", "=", "'AND'", ")", ":", "self", "{", "$", "subQuery", "=", "$", "this", "->", "checkSubQueryValue", "(", "'Argument $subQuer...
Adds a EXISTS criterion to the WHERE section. @param $subQuery \Closure|Query|StatementInterface Query to place inside the EXISTS clause. If closure, it should create the query. @param bool $not Whether the rule should be NOT EXISTS @param string $appendRule How the criterion should be appended to the others (SQL bool...
[ "Adds", "a", "EXISTS", "criterion", "to", "the", "WHERE", "section", "." ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L381-L387
Finesse/QueryScribe
src/QueryBricks/WhereTrait.php
WhereTrait.whereArgumentsToCriterion
protected function whereArgumentsToCriterion( array $arguments, string $appendRule = 'AND', bool $valueIsColumn = false ): Criterion { switch ($argumentsCount = count($arguments)) { case 0: return $this->handleException(new InvalidArgumentException('Too fe...
php
protected function whereArgumentsToCriterion( array $arguments, string $appendRule = 'AND', bool $valueIsColumn = false ): Criterion { switch ($argumentsCount = count($arguments)) { case 0: return $this->handleException(new InvalidArgumentException('Too fe...
[ "protected", "function", "whereArgumentsToCriterion", "(", "array", "$", "arguments", ",", "string", "$", "appendRule", "=", "'AND'", ",", "bool", "$", "valueIsColumn", "=", "false", ")", ":", "Criterion", "{", "switch", "(", "$", "argumentsCount", "=", "count...
Converts `where` method arguments to a criterion object @see where @see whereColumn @param array $arguments The original method arguments @param string $appendRule How the criterion should be appended to the others (SQL boolean operator name) @param bool $valueIsColumn Treat the second or the third argument as a colum...
[ "Converts", "where", "method", "arguments", "to", "a", "criterion", "object" ]
train
https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/WhereTrait.php#L445-L502
spryker/multi-cart-data-import
src/Spryker/Zed/MultiCartDataImport/Business/CartImportStep/CartWriterStep.php
CartWriterStep.execute
public function execute(DataSetInterface $dataSet) { $quoteEntity = SpyQuoteQuery::create() ->filterByKey($dataSet[CartDataSetInterface::KEY_CART]) ->findOneOrCreate(); $quoteEntity->fromArray($dataSet->getArrayCopy()); $quoteEntity ->setFkStore($dataSet[...
php
public function execute(DataSetInterface $dataSet) { $quoteEntity = SpyQuoteQuery::create() ->filterByKey($dataSet[CartDataSetInterface::KEY_CART]) ->findOneOrCreate(); $quoteEntity->fromArray($dataSet->getArrayCopy()); $quoteEntity ->setFkStore($dataSet[...
[ "public", "function", "execute", "(", "DataSetInterface", "$", "dataSet", ")", "{", "$", "quoteEntity", "=", "SpyQuoteQuery", "::", "create", "(", ")", "->", "filterByKey", "(", "$", "dataSet", "[", "CartDataSetInterface", "::", "KEY_CART", "]", ")", "->", "...
@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @return void
[ "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ]
train
https://github.com/spryker/multi-cart-data-import/blob/3c699df39e87c44c3f4a47f2ccf0f5791330a729/src/Spryker/Zed/MultiCartDataImport/Business/CartImportStep/CartWriterStep.php#L22-L33
libreworks/caridea-acl
src/Rule.php
Rule.match
public function match(Subject $subject, string $verb): bool { return $this->subject->getType() == $subject->getType() && $this->subject->getId() === $subject->getId() && ($this->verbs === null || in_array($verb, $this->verbs, true)); }
php
public function match(Subject $subject, string $verb): bool { return $this->subject->getType() == $subject->getType() && $this->subject->getId() === $subject->getId() && ($this->verbs === null || in_array($verb, $this->verbs, true)); }
[ "public", "function", "match", "(", "Subject", "$", "subject", ",", "string", "$", "verb", ")", ":", "bool", "{", "return", "$", "this", "->", "subject", "->", "getType", "(", ")", "==", "$", "subject", "->", "getType", "(", ")", "&&", "$", "this", ...
Gets whether this Rule matches the `Subject` and verb provided. @param \Caridea\Acl\Subject $subject The subject to check @param string $verb The verb to check @return bool Whether this Rule matches the arguments provided
[ "Gets", "whether", "this", "Rule", "matches", "the", "Subject", "and", "verb", "provided", "." ]
train
https://github.com/libreworks/caridea-acl/blob/64ff8f2e29926acc67b9fc4a8a9ea7bcc50e4916/src/Rule.php#L75-L80
libreworks/caridea-acl
src/Rule.php
Rule.allow
public static function allow(Subject $subject, array $verbs = null): Rule { return new self($subject, true, $verbs); }
php
public static function allow(Subject $subject, array $verbs = null): Rule { return new self($subject, true, $verbs); }
[ "public", "static", "function", "allow", "(", "Subject", "$", "subject", ",", "array", "$", "verbs", "=", "null", ")", ":", "Rule", "{", "return", "new", "self", "(", "$", "subject", ",", "true", ",", "$", "verbs", ")", ";", "}" ]
Creates an allowing Rule. @param \Caridea\Acl\Subject $subject The subject to allow access @param array<string>|null $verbs Optional list of allowed verbs. Empty or `null` means *all*. @return Rule The allowing Rule
[ "Creates", "an", "allowing", "Rule", "." ]
train
https://github.com/libreworks/caridea-acl/blob/64ff8f2e29926acc67b9fc4a8a9ea7bcc50e4916/src/Rule.php#L90-L93