id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
193,100
battis/mysql-schema-loader
src/Loader.php
Loader.strposArray
private function strposArray($haystack, $needles) { if (is_array($needles)) { foreach ($needles as $needle) { if (($strpos = strpos($haystack, $needle)) !== false) { return $strpos; } } } return false; }
php
private function strposArray($haystack, $needles) { if (is_array($needles)) { foreach ($needles as $needle) { if (($strpos = strpos($haystack, $needle)) !== false) { return $strpos; } } } return false; }
[ "private", "function", "strposArray", "(", "$", "haystack", ",", "$", "needles", ")", "{", "if", "(", "is_array", "(", "$", "needles", ")", ")", "{", "foreach", "(", "$", "needles", "as", "$", "needle", ")", "{", "if", "(", "(", "$", "strpos", "=",...
Find the position of the first occurrence of any of several substrings in a string @param string $haystack The string to search in. @param mixed $needles Array of strings to search for. If a needle is not a string, it is converted to an integer and applied as the ordinal value of a character. @return int|boolean Retur...
[ "Find", "the", "position", "of", "the", "first", "occurrence", "of", "any", "of", "several", "substrings", "in", "a", "string" ]
9a499470b9799bab8eee3deb21113826d882afbd
https://github.com/battis/mysql-schema-loader/blob/9a499470b9799bab8eee3deb21113826d882afbd/src/Loader.php#L85-L95
193,101
battis/mysql-schema-loader
src/Loader.php
Loader.load
public function load($test = true) { $missingTables = false; if ($test) { $missingTables = $this->test(); } if (!$test || ($test && $missingTables !== false)) { foreach (explode(';', $this->schema) as $query) { if (!empty(trim($query))) { ...
php
public function load($test = true) { $missingTables = false; if ($test) { $missingTables = $this->test(); } if (!$test || ($test && $missingTables !== false)) { foreach (explode(';', $this->schema) as $query) { if (!empty(trim($query))) { ...
[ "public", "function", "load", "(", "$", "test", "=", "true", ")", "{", "$", "missingTables", "=", "false", ";", "if", "(", "$", "test", ")", "{", "$", "missingTables", "=", "$", "this", "->", "test", "(", ")", ";", "}", "if", "(", "!", "$", "te...
Load the schema into the database If `$test` is set to `true`, this method will test to see if any tables created by the schema are missing. If any tables are missing, then only the queries affecting those tables will be run. Otherwise, if `$test` is `false`, all queries in the schema will be run blindly, potentially ...
[ "Load", "the", "schema", "into", "the", "database" ]
9a499470b9799bab8eee3deb21113826d882afbd
https://github.com/battis/mysql-schema-loader/blob/9a499470b9799bab8eee3deb21113826d882afbd/src/Loader.php#L112-L135
193,102
cogentParadigm/behat-starbug-extension
src/Context/MailContext.php
MailContext.assertEmail
public function assertEmail($subject, $address) { $message = $this->getMailCatcherClient()->searchOne([ Message::SUBJECT_CRITERIA => $subject, Message::TO_CRITERIA => $address ]); if (is_null($message)) { throw new Exception("Message not found."); } }
php
public function assertEmail($subject, $address) { $message = $this->getMailCatcherClient()->searchOne([ Message::SUBJECT_CRITERIA => $subject, Message::TO_CRITERIA => $address ]); if (is_null($message)) { throw new Exception("Message not found."); } }
[ "public", "function", "assertEmail", "(", "$", "subject", ",", "$", "address", ")", "{", "$", "message", "=", "$", "this", "->", "getMailCatcherClient", "(", ")", "->", "searchOne", "(", "[", "Message", "::", "SUBJECT_CRITERIA", "=>", "$", "subject", ",", ...
Check for email. @Then :subject should be emailed to :address @throws Exception When no matching message is found.
[ "Check", "for", "email", "." ]
76da5d943773857ad2388a7cccb6632176b452a9
https://github.com/cogentParadigm/behat-starbug-extension/blob/76da5d943773857ad2388a7cccb6632176b452a9/src/Context/MailContext.php#L17-L25
193,103
ekyna/Resource
Doctrine/ORM/Util/TranslatableResourceRepositoryTrait.php
TranslatableResourceRepositoryTrait.getQueryBuilder
protected function getQueryBuilder($alias = null, $indexBy = null) { $qb = $this->traitGetQueryBuilder($alias, $indexBy); $alias = $alias ?: $this->getAlias(); return $qb ->addSelect('translation') ->leftJoin($alias . '.translations', 'translation'); }
php
protected function getQueryBuilder($alias = null, $indexBy = null) { $qb = $this->traitGetQueryBuilder($alias, $indexBy); $alias = $alias ?: $this->getAlias(); return $qb ->addSelect('translation') ->leftJoin($alias . '.translations', 'translation'); }
[ "protected", "function", "getQueryBuilder", "(", "$", "alias", "=", "null", ",", "$", "indexBy", "=", "null", ")", "{", "$", "qb", "=", "$", "this", "->", "traitGetQueryBuilder", "(", "$", "alias", ",", "$", "indexBy", ")", ";", "$", "alias", "=", "$...
Returns the singe result query builder. @param string $alias @param string $indexBy @return \Doctrine\ORM\QueryBuilder
[ "Returns", "the", "singe", "result", "query", "builder", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/TranslatableResourceRepositoryTrait.php#L43-L52
193,104
ekyna/Resource
Doctrine/ORM/Util/TranslatableResourceRepositoryTrait.php
TranslatableResourceRepositoryTrait.getCollectionQueryBuilder
protected function getCollectionQueryBuilder($alias = null, $indexBy = null) { $qb = $this->traitGetCollectionQueryBuilder($alias, $indexBy); $alias = $alias ?: $this->getAlias(); return $qb ->addSelect('translation') ->leftJoin($alias . '.translations', 'translatio...
php
protected function getCollectionQueryBuilder($alias = null, $indexBy = null) { $qb = $this->traitGetCollectionQueryBuilder($alias, $indexBy); $alias = $alias ?: $this->getAlias(); return $qb ->addSelect('translation') ->leftJoin($alias . '.translations', 'translatio...
[ "protected", "function", "getCollectionQueryBuilder", "(", "$", "alias", "=", "null", ",", "$", "indexBy", "=", "null", ")", "{", "$", "qb", "=", "$", "this", "->", "traitGetCollectionQueryBuilder", "(", "$", "alias", ",", "$", "indexBy", ")", ";", "$", ...
Returns the collection query builder. @param string $alias @param string $indexBy @return \Doctrine\ORM\QueryBuilder
[ "Returns", "the", "collection", "query", "builder", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/TranslatableResourceRepositoryTrait.php#L62-L71
193,105
ekyna/Resource
Doctrine/ORM/Util/TranslatableResourceRepositoryTrait.php
TranslatableResourceRepositoryTrait.createNew
public function createNew() { $resource = $this->traitCreateNew(); if (!$resource instanceof TranslatableInterface) { throw new \InvalidArgumentException('Resource must implement TranslatableInterface.'); } $resource->setCurrentLocale($this->localeProvider->getCurrentLo...
php
public function createNew() { $resource = $this->traitCreateNew(); if (!$resource instanceof TranslatableInterface) { throw new \InvalidArgumentException('Resource must implement TranslatableInterface.'); } $resource->setCurrentLocale($this->localeProvider->getCurrentLo...
[ "public", "function", "createNew", "(", ")", "{", "$", "resource", "=", "$", "this", "->", "traitCreateNew", "(", ")", ";", "if", "(", "!", "$", "resource", "instanceof", "TranslatableInterface", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(...
Returns a new resource instance. @throws \InvalidArgumentException @return object
[ "Returns", "a", "new", "resource", "instance", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Util/TranslatableResourceRepositoryTrait.php#L80-L92
193,106
devlabmtl/haven-cms
Entity/Comment.php
Comment.getUserEndorsement
public function getUserEndorsement($user) { return $this->endorsements->filter(function($e) use ($user) { return $e->getUser() == $user; })->first(); }
php
public function getUserEndorsement($user) { return $this->endorsements->filter(function($e) use ($user) { return $e->getUser() == $user; })->first(); }
[ "public", "function", "getUserEndorsement", "(", "$", "user", ")", "{", "return", "$", "this", "->", "endorsements", "->", "filter", "(", "function", "(", "$", "e", ")", "use", "(", "$", "user", ")", "{", "return", "$", "e", "->", "getUser", "(", ")"...
Get the current endorsement for a specific user_id @return \Doctrine\Common\Collections\Collection
[ "Get", "the", "current", "endorsement", "for", "a", "specific", "user_id" ]
c20761a07c201a966dbda1f3eae33617f80e1ece
https://github.com/devlabmtl/haven-cms/blob/c20761a07c201a966dbda1f3eae33617f80e1ece/Entity/Comment.php#L249-L253
193,107
PenoaksDev/Milky-Framework
src/Milky/Account/Guards/TokenGuard.php
TokenGuard.validate
public function validate( array $credentials = [] ) { $credentials = [$this->storageKey => $credentials[$this->inputKey]]; if ( $this->auth->retrieveByCredentials( $credentials ) ) return true; return false; }
php
public function validate( array $credentials = [] ) { $credentials = [$this->storageKey => $credentials[$this->inputKey]]; if ( $this->auth->retrieveByCredentials( $credentials ) ) return true; return false; }
[ "public", "function", "validate", "(", "array", "$", "credentials", "=", "[", "]", ")", "{", "$", "credentials", "=", "[", "$", "this", "->", "storageKey", "=>", "$", "credentials", "[", "$", "this", "->", "inputKey", "]", "]", ";", "if", "(", "$", ...
Validate a acct's credentials. @param array $credentials @return bool
[ "Validate", "a", "acct", "s", "credentials", "." ]
8afd7156610a70371aa5b1df50b8a212bf7b142c
https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Account/Guards/TokenGuard.php#L93-L101
193,108
Dhii/exception-helper-base
src/CreateInternalExceptionCapableTrait.php
CreateInternalExceptionCapableTrait._createInternalException
protected function _createInternalException($message = null, $code = null, $previous = null) { return new InternalException($message, $code, $previous); }
php
protected function _createInternalException($message = null, $code = null, $previous = null) { return new InternalException($message, $code, $previous); }
[ "protected", "function", "_createInternalException", "(", "$", "message", "=", "null", ",", "$", "code", "=", "null", ",", "$", "previous", "=", "null", ")", "{", "return", "new", "InternalException", "(", "$", "message", ",", "$", "code", ",", "$", "pre...
Creates a new Internal exception. @since [*next-version*] @param string|Stringable|int|float|bool|null $message The message, if any. @param int|float|string|Stringable|null $code The numeric error code, if any. @param RootException|null $previous The inner exception, if any. @return Inte...
[ "Creates", "a", "new", "Internal", "exception", "." ]
e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5
https://github.com/Dhii/exception-helper-base/blob/e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5/src/CreateInternalExceptionCapableTrait.php#L26-L29
193,109
dms-org/common.structure
src/DateTime/DateTimeRange.php
DateTimeRange.encompasses
public function encompasses(DateTimeRange $otherRange) : bool { return $this->start->comesBeforeOrEqual($otherRange->start) && $this->end->comesAfterOrEqual($otherRange->end); }
php
public function encompasses(DateTimeRange $otherRange) : bool { return $this->start->comesBeforeOrEqual($otherRange->start) && $this->end->comesAfterOrEqual($otherRange->end); }
[ "public", "function", "encompasses", "(", "DateTimeRange", "$", "otherRange", ")", ":", "bool", "{", "return", "$", "this", "->", "start", "->", "comesBeforeOrEqual", "(", "$", "otherRange", "->", "start", ")", "&&", "$", "this", "->", "end", "->", "comesA...
Returns whether the supplied date time range is encompassed by this date time range. @param DateTimeRange $otherRange @return bool
[ "Returns", "whether", "the", "supplied", "date", "time", "range", "is", "encompassed", "by", "this", "date", "time", "range", "." ]
23f122182f60df5ec847047a81a39c8aab019ff1
https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/DateTimeRange.php#L93-L96
193,110
nicodevs/laito
src/Laito/Http/Request.php
Request.method
public function method() { // Return the emulated method from GET $emulated = filter_input(INPUT_GET, '_method', FILTER_SANITIZE_STRING); // Return the emulated method from POST if (!$emulated) { $emulated = filter_input(INPUT_POST, '_method', FILTER_SANITIZE_STRING); ...
php
public function method() { // Return the emulated method from GET $emulated = filter_input(INPUT_GET, '_method', FILTER_SANITIZE_STRING); // Return the emulated method from POST if (!$emulated) { $emulated = filter_input(INPUT_POST, '_method', FILTER_SANITIZE_STRING); ...
[ "public", "function", "method", "(", ")", "{", "// Return the emulated method from GET", "$", "emulated", "=", "filter_input", "(", "INPUT_GET", ",", "'_method'", ",", "FILTER_SANITIZE_STRING", ")", ";", "// Return the emulated method from POST", "if", "(", "!", "$", ...
Retrieves the request method @return string Method
[ "Retrieves", "the", "request", "method" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Http/Request.php#L32-L49
193,111
nicodevs/laito
src/Laito/Http/Request.php
Request.token
public function token() { $inputs = $this->getInputs(); $headers = $this->headers(); // Read token from request custom header if (isset($headers['X-Auth-Token'])) { return $headers['X-Auth-Token']; } // Read token from request input if (isset($in...
php
public function token() { $inputs = $this->getInputs(); $headers = $this->headers(); // Read token from request custom header if (isset($headers['X-Auth-Token'])) { return $headers['X-Auth-Token']; } // Read token from request input if (isset($in...
[ "public", "function", "token", "(", ")", "{", "$", "inputs", "=", "$", "this", "->", "getInputs", "(", ")", ";", "$", "headers", "=", "$", "this", "->", "headers", "(", ")", ";", "// Read token from request custom header", "if", "(", "isset", "(", "$", ...
Retrieves the token @return mixed Token or false
[ "Retrieves", "the", "token" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Http/Request.php#L67-L84
193,112
nicodevs/laito
src/Laito/Http/Request.php
Request.input
public function input($input = null, $default = null) { // Get all inputs $inputs = array_merge($this->getInputs(), $this->additionalInputs); // Exclude reserved inputs foreach ($inputs as $key => $value) { if (in_array($key, $this->reserved)) { unset($in...
php
public function input($input = null, $default = null) { // Get all inputs $inputs = array_merge($this->getInputs(), $this->additionalInputs); // Exclude reserved inputs foreach ($inputs as $key => $value) { if (in_array($key, $this->reserved)) { unset($in...
[ "public", "function", "input", "(", "$", "input", "=", "null", ",", "$", "default", "=", "null", ")", "{", "// Get all inputs", "$", "inputs", "=", "array_merge", "(", "$", "this", "->", "getInputs", "(", ")", ",", "$", "this", "->", "additionalInputs", ...
Returns a request input @param string $input Input key @param string $default Default value to return @return mixed Array of inputs, or single input if a key is specified
[ "Returns", "a", "request", "input" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Http/Request.php#L120-L139
193,113
nicodevs/laito
src/Laito/Http/Request.php
Request.file
public function file($input = null) { // The input name must be defined if (!isset($input) || !isset($_FILES[$input])) { throw new \InvalidArgumentException('Invalid file', 400); } // Return the file info return $_FILES[$input]; }
php
public function file($input = null) { // The input name must be defined if (!isset($input) || !isset($_FILES[$input])) { throw new \InvalidArgumentException('Invalid file', 400); } // Return the file info return $_FILES[$input]; }
[ "public", "function", "file", "(", "$", "input", "=", "null", ")", "{", "// The input name must be defined", "if", "(", "!", "isset", "(", "$", "input", ")", "||", "!", "isset", "(", "$", "_FILES", "[", "$", "input", "]", ")", ")", "{", "throw", "new...
Gets a request file @param string $input Input key @return mixed File info, or false
[ "Gets", "a", "request", "file" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Http/Request.php#L184-L193
193,114
nicodevs/laito
src/Laito/Http/Request.php
Request.storeFile
public function storeFile($input = null, $target) { // The input name and target path must be defined if (!isset($input) || !isset($target)) { throw new \InvalidArgumentException('Undefined input name or target', 400); } // Move the uploaded file $result = move_u...
php
public function storeFile($input = null, $target) { // The input name and target path must be defined if (!isset($input) || !isset($target)) { throw new \InvalidArgumentException('Undefined input name or target', 400); } // Move the uploaded file $result = move_u...
[ "public", "function", "storeFile", "(", "$", "input", "=", "null", ",", "$", "target", ")", "{", "// The input name and target path must be defined", "if", "(", "!", "isset", "(", "$", "input", ")", "||", "!", "isset", "(", "$", "target", ")", ")", "{", ...
Stores a request file @param string $input Input key @param string $target Target path @return boolean Success or fail of the store operation
[ "Stores", "a", "request", "file" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Http/Request.php#L220-L237
193,115
nicodevs/laito
src/Laito/Http/Request.php
Request.getInputs
private function getInputs() { // If defined, return the inputs array if ($this->inputs) { return $this->inputs; } // Check for JSON data if (isset($_SERVER['CONTENT_TYPE']) && strpos($_SERVER['CONTENT_TYPE'], 'application/json') === 0) { $input = fil...
php
private function getInputs() { // If defined, return the inputs array if ($this->inputs) { return $this->inputs; } // Check for JSON data if (isset($_SERVER['CONTENT_TYPE']) && strpos($_SERVER['CONTENT_TYPE'], 'application/json') === 0) { $input = fil...
[ "private", "function", "getInputs", "(", ")", "{", "// If defined, return the inputs array", "if", "(", "$", "this", "->", "inputs", ")", "{", "return", "$", "this", "->", "inputs", ";", "}", "// Check for JSON data", "if", "(", "isset", "(", "$", "_SERVER", ...
Stores the parameters from the request in the inputs array @return array Array of inputs
[ "Stores", "the", "parameters", "from", "the", "request", "in", "the", "inputs", "array" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Http/Request.php#L244-L282
193,116
cloudtek/dynamodm
lib/Cloudtek/DynamoDM/Client/Command.php
Command.getSdkCommand
public function getSdkCommand($parameters = []) { return $this->injectMiddleware( $this->dm->getClient()->getCommand( static::$sdkName, array_merge($this->parameters, $parameters) ) ); }
php
public function getSdkCommand($parameters = []) { return $this->injectMiddleware( $this->dm->getClient()->getCommand( static::$sdkName, array_merge($this->parameters, $parameters) ) ); }
[ "public", "function", "getSdkCommand", "(", "$", "parameters", "=", "[", "]", ")", "{", "return", "$", "this", "->", "injectMiddleware", "(", "$", "this", "->", "dm", "->", "getClient", "(", ")", "->", "getCommand", "(", "static", "::", "$", "sdkName", ...
Return the prepared AWS SDK Command object to be executed. @param array $parameters Additional parameters to add to the Command object before returning. Any existing parameters with the same name will be overridden. @return \Aws\CommandInterface
[ "Return", "the", "prepared", "AWS", "SDK", "Command", "object", "to", "be", "executed", "." ]
119d355e2c5cbaef1f867970349b4432f5704fcd
https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Client/Command.php#L124-L132
193,117
praxigento/mobi_mod_downline
Service/Customer/Add.php
Add.getReferredParentId
private function getReferredParentId($customerId) { /* use customer ID as parent ID if parent ID cannot be defined */ $result = $customerId; $area = $this->state->getAreaCode(); if ($area == \Magento\Framework\App\Area::AREA_ADMINHTML) { /* use default MLM ID from config ...
php
private function getReferredParentId($customerId) { /* use customer ID as parent ID if parent ID cannot be defined */ $result = $customerId; $area = $this->state->getAreaCode(); if ($area == \Magento\Framework\App\Area::AREA_ADMINHTML) { /* use default MLM ID from config ...
[ "private", "function", "getReferredParentId", "(", "$", "customerId", ")", "{", "/* use customer ID as parent ID if parent ID cannot be defined */", "$", "result", "=", "$", "customerId", ";", "$", "area", "=", "$", "this", "->", "state", "->", "getAreaCode", "(", "...
Analyze referral code and get parent for the customer if parent ID was missed in request. @param int $customerId @return int @throws \Magento\Framework\Exception\LocalizedException
[ "Analyze", "referral", "code", "and", "get", "parent", "for", "the", "customer", "if", "parent", "ID", "was", "missed", "in", "request", "." ]
0f3c276dfff1aa029f9fd205ccfc56f207a2e75b
https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Service/Customer/Add.php#L123-L157
193,118
koolkode/context
src/Bind/ContainerBuilder.php
ContainerBuilder.getParameter
public function getParameter($name) { if(array_key_exists($name, $this->parameters)) { return $this->parameters[$name]; } if(func_num_args() > 1) { return func_get_arg(1); } throw new ContextParamNotFoundException(sprintf('Container parameter "%s" was not found', $name)); }
php
public function getParameter($name) { if(array_key_exists($name, $this->parameters)) { return $this->parameters[$name]; } if(func_num_args() > 1) { return func_get_arg(1); } throw new ContextParamNotFoundException(sprintf('Container parameter "%s" was not found', $name)); }
[ "public", "function", "getParameter", "(", "$", "name", ")", "{", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "parameters", ")", ")", "{", "return", "$", "this", "->", "parameters", "[", "$", "name", "]", ";", "}", "if", ...
Get the value of the given parameter. @param string $name @param mixed $default @return mixed @throws ContextParamNotFoundException When the parameter has not been registered and no default value is given.
[ "Get", "the", "value", "of", "the", "given", "parameter", "." ]
f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36
https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/ContainerBuilder.php#L93-L106
193,119
koolkode/context
src/Bind/ContainerBuilder.php
ContainerBuilder.bind
public function bind($typeName) { if($this->proxyTypes !== NULL) { $this->proxyTypes = NULL; } $key = strtolower($typeName); switch($key) { case 'koolkode\config\configuration': case 'koolkode\context\containerinterface': case 'koolkode\context\exposedcontainerinterface': case 'koolkod...
php
public function bind($typeName) { if($this->proxyTypes !== NULL) { $this->proxyTypes = NULL; } $key = strtolower($typeName); switch($key) { case 'koolkode\config\configuration': case 'koolkode\context\containerinterface': case 'koolkode\context\exposedcontainerinterface': case 'koolkod...
[ "public", "function", "bind", "(", "$", "typeName", ")", "{", "if", "(", "$", "this", "->", "proxyTypes", "!==", "NULL", ")", "{", "$", "this", "->", "proxyTypes", "=", "NULL", ";", "}", "$", "key", "=", "strtolower", "(", "$", "typeName", ")", ";"...
Create a binding for the given type, the binding is registered in the builder and will be bound by the created DI container, binding multiple times to the same type will modify the existing binding instead of creating a new binding! @return Binding
[ "Create", "a", "binding", "for", "the", "given", "type", "the", "binding", "is", "registered", "in", "the", "builder", "and", "will", "be", "bound", "by", "the", "created", "DI", "container", "binding", "multiple", "times", "to", "the", "same", "type", "wi...
f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36
https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/ContainerBuilder.php#L163-L187
193,120
koolkode/context
src/Bind/ContainerBuilder.php
ContainerBuilder.getProxyBindings
public function getProxyBindings() { if($this->proxyTypes === NULL) { $this->proxyTypes = []; foreach($this->bindings as $binding) { $scope = $binding->getScope(); if($scope === NULL) { continue; } if(Singleton::class == $scope) { continue; } $this->p...
php
public function getProxyBindings() { if($this->proxyTypes === NULL) { $this->proxyTypes = []; foreach($this->bindings as $binding) { $scope = $binding->getScope(); if($scope === NULL) { continue; } if(Singleton::class == $scope) { continue; } $this->p...
[ "public", "function", "getProxyBindings", "(", ")", "{", "if", "(", "$", "this", "->", "proxyTypes", "===", "NULL", ")", "{", "$", "this", "->", "proxyTypes", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "bindings", "as", "$", "binding", ")...
Get all bindings that require a scope proxy. @return \array<string, BindingInterface>
[ "Get", "all", "bindings", "that", "require", "a", "scope", "proxy", "." ]
f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36
https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Bind/ContainerBuilder.php#L215-L240
193,121
asaokamei/ScoreSql
src/Sql/Sql.php
Sql.subQuery
public function subQuery( $table, $alias=null ) { $sub = new self(); if( !$alias ) $alias = 'sub_' . $this->subQueryCount ++; $sub->table( $table, $alias ); $sub->setParentTable( $this->getAliasOrTable() ); return $sub; }
php
public function subQuery( $table, $alias=null ) { $sub = new self(); if( !$alias ) $alias = 'sub_' . $this->subQueryCount ++; $sub->table( $table, $alias ); $sub->setParentTable( $this->getAliasOrTable() ); return $sub; }
[ "public", "function", "subQuery", "(", "$", "table", ",", "$", "alias", "=", "null", ")", "{", "$", "sub", "=", "new", "self", "(", ")", ";", "if", "(", "!", "$", "alias", ")", "$", "alias", "=", "'sub_'", ".", "$", "this", "->", "subQueryCount",...
return a new Sql|Query object as sub-query. @param string $table @param string $alias @return $this
[ "return", "a", "new", "Sql|Query", "object", "as", "sub", "-", "query", "." ]
f1fce28476629e98b3c4c1216859c7f5309de7a1
https://github.com/asaokamei/ScoreSql/blob/f1fce28476629e98b3c4c1216859c7f5309de7a1/src/Sql/Sql.php#L160-L167
193,122
asaokamei/ScoreSql
src/Sql/Sql.php
Sql.value
public function value( $name, $value = null ) { if ( is_array( $name ) ) { $this->values += $name; } elseif ( func_num_args() > 1 ) { $this->values[ $name ] = $value; } return $this; }
php
public function value( $name, $value = null ) { if ( is_array( $name ) ) { $this->values += $name; } elseif ( func_num_args() > 1 ) { $this->values[ $name ] = $value; } return $this; }
[ "public", "function", "value", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "name", ")", ")", "{", "$", "this", "->", "values", "+=", "$", "name", ";", "}", "elseif", "(", "func_num_args", "(", ")",...
set values for insert or update. @param string|array $name @param string|null $value @return $this
[ "set", "values", "for", "insert", "or", "update", "." ]
f1fce28476629e98b3c4c1216859c7f5309de7a1
https://github.com/asaokamei/ScoreSql/blob/f1fce28476629e98b3c4c1216859c7f5309de7a1/src/Sql/Sql.php#L348-L356
193,123
geniv/nette-identity-authorizator
src/AuthorizatorTrait.php
AuthorizatorTrait.handleAddAcl
public function handleAddAcl(string $role, string $resource = null, string $privilege = null) { $idRole = $this->identityAuthorizator->getIdRoleByName($role); $idResource = null; if ($resource) { $idResource = $this->identityAuthorizator->getIdResourceByName($resource); ...
php
public function handleAddAcl(string $role, string $resource = null, string $privilege = null) { $idRole = $this->identityAuthorizator->getIdRoleByName($role); $idResource = null; if ($resource) { $idResource = $this->identityAuthorizator->getIdResourceByName($resource); ...
[ "public", "function", "handleAddAcl", "(", "string", "$", "role", ",", "string", "$", "resource", "=", "null", ",", "string", "$", "privilege", "=", "null", ")", "{", "$", "idRole", "=", "$", "this", "->", "identityAuthorizator", "->", "getIdRoleByName", "...
Handle add acl. @param string $role @param string|null $resource @param string|null $privilege
[ "Handle", "add", "acl", "." ]
f7db1cd589d022b6443f24a59432098a343d4639
https://github.com/geniv/nette-identity-authorizator/blob/f7db1cd589d022b6443f24a59432098a343d4639/src/AuthorizatorTrait.php#L25-L52
193,124
ARCANESOFT/Blog
src/Entities/PostStatus.php
PostStatus.all
public static function all($locale = null) { return static::keys()->mapWithKeys(function ($key) use ($locale) { return [$key => trans("blog::posts.statuses.{$key}", [], $locale)]; }); }
php
public static function all($locale = null) { return static::keys()->mapWithKeys(function ($key) use ($locale) { return [$key => trans("blog::posts.statuses.{$key}", [], $locale)]; }); }
[ "public", "static", "function", "all", "(", "$", "locale", "=", "null", ")", "{", "return", "static", "::", "keys", "(", ")", "->", "mapWithKeys", "(", "function", "(", "$", "key", ")", "use", "(", "$", "locale", ")", "{", "return", "[", "$", "key"...
Get all posts status @param string|null $locale @return \Illuminate\Support\Collection
[ "Get", "all", "posts", "status" ]
2078fdfdcbccda161c02899b9e1f344f011b2859
https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Entities/PostStatus.php#L46-L51
193,125
ARCANESOFT/Blog
src/Entities/PostStatus.php
PostStatus.get
public static function get($key, $default = null, $locale = null) { return self::all($locale)->get($key, $default); }
php
public static function get($key, $default = null, $locale = null) { return self::all($locale)->get($key, $default); }
[ "public", "static", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ",", "$", "locale", "=", "null", ")", "{", "return", "self", "::", "all", "(", "$", "locale", ")", "->", "get", "(", "$", "key", ",", "$", "default", ")", ...
Get a post status. @param string $key @param mixed $default @param string|null $locale @return string|null
[ "Get", "a", "post", "status", "." ]
2078fdfdcbccda161c02899b9e1f344f011b2859
https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Entities/PostStatus.php#L62-L65
193,126
ekyna/MediaBundle
Twig/PlayerExtension.php
PlayerExtension.renderMedia
public function renderMedia(MediaInterface $media, array $params = []) { switch ($media->getType()) { case MediaTypes::VIDEO : return $this->renderVideo($media, $params); case MediaTypes::FLASH : return $this->renderFlash($media, $params); ...
php
public function renderMedia(MediaInterface $media, array $params = []) { switch ($media->getType()) { case MediaTypes::VIDEO : return $this->renderVideo($media, $params); case MediaTypes::FLASH : return $this->renderFlash($media, $params); ...
[ "public", "function", "renderMedia", "(", "MediaInterface", "$", "media", ",", "array", "$", "params", "=", "[", "]", ")", "{", "switch", "(", "$", "media", "->", "getType", "(", ")", ")", "{", "case", "MediaTypes", "::", "VIDEO", ":", "return", "$", ...
Renders the media. @param MediaInterface $media @param array $params @return string @throws \InvalidArgumentException
[ "Renders", "the", "media", "." ]
512cf86c801a130a9f17eba8b48d646d23acdbab
https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Twig/PlayerExtension.php#L87-L101
193,127
ekyna/MediaBundle
Twig/PlayerExtension.php
PlayerExtension.renderVideo
public function renderVideo(MediaInterface $video, array $params = []) { if ($video->getType() !== MediaTypes::VIDEO) { throw new \InvalidArgumentException('Expected media with "video" type.'); } $params = array_merge([ 'responsive' => false, 'aspect_ra...
php
public function renderVideo(MediaInterface $video, array $params = []) { if ($video->getType() !== MediaTypes::VIDEO) { throw new \InvalidArgumentException('Expected media with "video" type.'); } $params = array_merge([ 'responsive' => false, 'aspect_ra...
[ "public", "function", "renderVideo", "(", "MediaInterface", "$", "video", ",", "array", "$", "params", "=", "[", "]", ")", "{", "if", "(", "$", "video", "->", "getType", "(", ")", "!==", "MediaTypes", "::", "VIDEO", ")", "{", "throw", "new", "\\", "I...
Renders the video. @param MediaInterface $video @param array $params @return string @throws \InvalidArgumentException
[ "Renders", "the", "video", "." ]
512cf86c801a130a9f17eba8b48d646d23acdbab
https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Twig/PlayerExtension.php#L111-L135
193,128
ekyna/MediaBundle
Twig/PlayerExtension.php
PlayerExtension.renderFlash
public function renderFlash(MediaInterface $flash, array $params = []) { if ($flash->getType() !== MediaTypes::FLASH) { throw new \InvalidArgumentException('Expected media with "flash" type.'); } $params = array_merge([ //'responsive' => false, 'attr' ...
php
public function renderFlash(MediaInterface $flash, array $params = []) { if ($flash->getType() !== MediaTypes::FLASH) { throw new \InvalidArgumentException('Expected media with "flash" type.'); } $params = array_merge([ //'responsive' => false, 'attr' ...
[ "public", "function", "renderFlash", "(", "MediaInterface", "$", "flash", ",", "array", "$", "params", "=", "[", "]", ")", "{", "if", "(", "$", "flash", "->", "getType", "(", ")", "!==", "MediaTypes", "::", "FLASH", ")", "{", "throw", "new", "\\", "I...
Renders the flash swf. @param MediaInterface $flash @param array $params @return string @throws \InvalidArgumentException
[ "Renders", "the", "flash", "swf", "." ]
512cf86c801a130a9f17eba8b48d646d23acdbab
https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Twig/PlayerExtension.php#L145-L166
193,129
ekyna/MediaBundle
Twig/PlayerExtension.php
PlayerExtension.renderAudio
public function renderAudio(MediaInterface $audio, array $params = []) { if ($audio->getType() !== MediaTypes::AUDIO) { throw new \InvalidArgumentException('Expected media with "audio" type.'); } $params = array_merge([ 'attr' => [ 'id' => 'media-audi...
php
public function renderAudio(MediaInterface $audio, array $params = []) { if ($audio->getType() !== MediaTypes::AUDIO) { throw new \InvalidArgumentException('Expected media with "audio" type.'); } $params = array_merge([ 'attr' => [ 'id' => 'media-audi...
[ "public", "function", "renderAudio", "(", "MediaInterface", "$", "audio", ",", "array", "$", "params", "=", "[", "]", ")", "{", "if", "(", "$", "audio", "->", "getType", "(", ")", "!==", "MediaTypes", "::", "AUDIO", ")", "{", "throw", "new", "\\", "I...
Renders the audio. @param MediaInterface $audio @param array $params @return string @throws \InvalidArgumentException
[ "Renders", "the", "audio", "." ]
512cf86c801a130a9f17eba8b48d646d23acdbab
https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Twig/PlayerExtension.php#L176-L192
193,130
bseddon/XPath20
XPath2NodeIterator.php
XPath2NodeIterator.getIsSingleIterator
public function getIsSingleIterator() { /** * @var XPath2NodeIterator $iter */ $iter = $this->CloneInstance(); // $iter->named = "Original"; $part1 = $iter->MoveNext(); if ( $part1 ) { $part2 = ! $iter->MoveNext(); if ( $part2 ) return true; } return false; }
php
public function getIsSingleIterator() { /** * @var XPath2NodeIterator $iter */ $iter = $this->CloneInstance(); // $iter->named = "Original"; $part1 = $iter->MoveNext(); if ( $part1 ) { $part2 = ! $iter->MoveNext(); if ( $part2 ) return true; } return false; }
[ "public", "function", "getIsSingleIterator", "(", ")", "{", "/**\r\n\t\t * @var XPath2NodeIterator $iter\r\n\t\t */", "$", "iter", "=", "$", "this", "->", "CloneInstance", "(", ")", ";", "// $iter->named = \"Original\";\r", "$", "part1", "=", "$", "iter", "->", "MoveN...
Check to see if the iterator has just one item @return bool
[ "Check", "to", "see", "if", "the", "iterator", "has", "just", "one", "item" ]
69882b6efffaa5470a819d5fdd2f6473ddeb046d
https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/XPath2NodeIterator.php#L160-L175
193,131
Polosa/shade-framework-core
app/App.php
App.init
public function init() { if ( !$this->serviceContainer->isRegistered(ServiceContainer::SERVICE_LOGGER) || !($this->getLogger() instanceof LoggerInterface) ) { $this->setService(ServiceContainer::SERVICE_LOGGER, new NullLogger()); } $this->getContro...
php
public function init() { if ( !$this->serviceContainer->isRegistered(ServiceContainer::SERVICE_LOGGER) || !($this->getLogger() instanceof LoggerInterface) ) { $this->setService(ServiceContainer::SERVICE_LOGGER, new NullLogger()); } $this->getContro...
[ "public", "function", "init", "(", ")", "{", "if", "(", "!", "$", "this", "->", "serviceContainer", "->", "isRegistered", "(", "ServiceContainer", "::", "SERVICE_LOGGER", ")", "||", "!", "(", "$", "this", "->", "getLogger", "(", ")", "instanceof", "LoggerI...
Initialize application before execution
[ "Initialize", "application", "before", "execution" ]
d735d3e8e0616fb9cf4ffc25b8425762ed07940f
https://github.com/Polosa/shade-framework-core/blob/d735d3e8e0616fb9cf4ffc25b8425762ed07940f/app/App.php#L111-L120
193,132
Polosa/shade-framework-core
app/App.php
App.run
public function run(Request $request = null) { $this->init(); $this->getLogger()->debug('Application launched'); if (!($request instanceof Request)) { $appMode = $this->detectRunMode(); if ($appMode == self::MODE_WEB) { $request = Request\Web::makeFrom...
php
public function run(Request $request = null) { $this->init(); $this->getLogger()->debug('Application launched'); if (!($request instanceof Request)) { $appMode = $this->detectRunMode(); if ($appMode == self::MODE_WEB) { $request = Request\Web::makeFrom...
[ "public", "function", "run", "(", "Request", "$", "request", "=", "null", ")", "{", "$", "this", "->", "init", "(", ")", ";", "$", "this", "->", "getLogger", "(", ")", "->", "debug", "(", "'Application launched'", ")", ";", "if", "(", "!", "(", "$"...
Run Application and output content @param \Shade\Request|null $request Request @throws \Shade\Exception
[ "Run", "Application", "and", "output", "content" ]
d735d3e8e0616fb9cf4ffc25b8425762ed07940f
https://github.com/Polosa/shade-framework-core/blob/d735d3e8e0616fb9cf4ffc25b8425762ed07940f/app/App.php#L129-L145
193,133
irfantoor/database
src/Database/Model.php
Model.getSchema
function getSchema() { # Database structure $schema = 'CREATE TABLE IF NOT EXISTS ' . $this->table . ' ('; $sep = PHP_EOL; foreach($this->schema as $fld) { $schema .= $sep . $fld; $sep = ', ' . PHP_EOL; } $schema .= PHP_EOL . ');' . PHP_EOL; ...
php
function getSchema() { # Database structure $schema = 'CREATE TABLE IF NOT EXISTS ' . $this->table . ' ('; $sep = PHP_EOL; foreach($this->schema as $fld) { $schema .= $sep . $fld; $sep = ', ' . PHP_EOL; } $schema .= PHP_EOL . ');' . PHP_EOL; ...
[ "function", "getSchema", "(", ")", "{", "# Database structure", "$", "schema", "=", "'CREATE TABLE IF NOT EXISTS '", ".", "$", "this", "->", "table", ".", "' ('", ";", "$", "sep", "=", "PHP_EOL", ";", "foreach", "(", "$", "this", "->", "schema", "as", "$",...
Creates the schema of the DB according to the defined
[ "Creates", "the", "schema", "of", "the", "DB", "according", "to", "the", "defined" ]
0e01e2f265b95f17b1a888137c4364714c367128
https://github.com/irfantoor/database/blob/0e01e2f265b95f17b1a888137c4364714c367128/src/Database/Model.php#L95-L129
193,134
irfantoor/database
src/Database/Model.php
Model.getFirst
public function getFirst($q = [], $data = []) { $q['limit'] = 1; $list = $this->get($q, $data); return (count($list)) ? $list[0] : null; }
php
public function getFirst($q = [], $data = []) { $q['limit'] = 1; $list = $this->get($q, $data); return (count($list)) ? $list[0] : null; }
[ "public", "function", "getFirst", "(", "$", "q", "=", "[", "]", ",", "$", "data", "=", "[", "]", ")", "{", "$", "q", "[", "'limit'", "]", "=", "1", ";", "$", "list", "=", "$", "this", "->", "get", "(", "$", "q", ",", "$", "data", ")", ";"...
Gets the first item as predfined by any previous functional operators @param array $q different elements of sql @param array $data elements used for binding @return array|null the first matching record as associated array or null
[ "Gets", "the", "first", "item", "as", "predfined", "by", "any", "previous", "functional", "operators" ]
0e01e2f265b95f17b1a888137c4364714c367128
https://github.com/irfantoor/database/blob/0e01e2f265b95f17b1a888137c4364714c367128/src/Database/Model.php#L193-L199
193,135
nicodevs/laito
src/Laito/Model.php
Model.where
public function where($column, $value, $operator = '=', $table = null) { $table = $table? $table : $this->table; $this->db()->where($column, $value, $operator, $table); return $this; }
php
public function where($column, $value, $operator = '=', $table = null) { $table = $table? $table : $this->table; $this->db()->where($column, $value, $operator, $table); return $this; }
[ "public", "function", "where", "(", "$", "column", ",", "$", "value", ",", "$", "operator", "=", "'='", ",", "$", "table", "=", "null", ")", "{", "$", "table", "=", "$", "table", "?", "$", "table", ":", "$", "this", "->", "table", ";", "$", "th...
Sets a where condition @param string $column Column name @param string $value Value to match @param string $operator Operator to compare with @return object Database instance
[ "Sets", "a", "where", "condition" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L189-L194
193,136
nicodevs/laito
src/Laito/Model.php
Model.whereIn
public function whereIn($column, $values, $table = null) { $this->db()->whereIn($column, $values, $table); return $this; }
php
public function whereIn($column, $values, $table = null) { $this->db()->whereIn($column, $values, $table); return $this; }
[ "public", "function", "whereIn", "(", "$", "column", ",", "$", "values", ",", "$", "table", "=", "null", ")", "{", "$", "this", "->", "db", "(", ")", "->", "whereIn", "(", "$", "column", ",", "$", "values", ",", "$", "table", ")", ";", "return", ...
Sets a where in condition @param string $column Column name @param string $values Values to match @return object Database instance
[ "Sets", "a", "where", "in", "condition" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L203-L207
193,137
nicodevs/laito
src/Laito/Model.php
Model.search
public function search($filters = []) { // Set resolved $resolved = []; // Check the filters if (!isset($filters) || !is_array($filters)) { throw new \InvalidArgumentException('Undefined search filters', 400); } // Set limit, offset and order if ...
php
public function search($filters = []) { // Set resolved $resolved = []; // Check the filters if (!isset($filters) || !is_array($filters)) { throw new \InvalidArgumentException('Undefined search filters', 400); } // Set limit, offset and order if ...
[ "public", "function", "search", "(", "$", "filters", "=", "[", "]", ")", "{", "// Set resolved", "$", "resolved", "=", "[", "]", ";", "// Check the filters", "if", "(", "!", "isset", "(", "$", "filters", ")", "||", "!", "is_array", "(", "$", "filters",...
Sets an array of filters as where conditions @param array $params Search parameters @return bool|array Array of results, or false
[ "Sets", "an", "array", "of", "filters", "as", "where", "conditions" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L235-L301
193,138
nicodevs/laito
src/Laito/Model.php
Model.get
public function get() { // Perform before hook $this->beforeGet(); // Set basic query $this->db()->table($this->table)->select($this->columns)->limit($this->limit)->offset($this->offset)->orderBy($this->orderBy); // Resolve relationships $this->hasOne()->belongsToMa...
php
public function get() { // Perform before hook $this->beforeGet(); // Set basic query $this->db()->table($this->table)->select($this->columns)->limit($this->limit)->offset($this->offset)->orderBy($this->orderBy); // Resolve relationships $this->hasOne()->belongsToMa...
[ "public", "function", "get", "(", ")", "{", "// Perform before hook", "$", "this", "->", "beforeGet", "(", ")", ";", "// Set basic query", "$", "this", "->", "db", "(", ")", "->", "table", "(", "$", "this", "->", "table", ")", "->", "select", "(", "$",...
Returns an array of models @return bool|array Array of models, or false
[ "Returns", "an", "array", "of", "models" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L308-L333
193,139
nicodevs/laito
src/Laito/Model.php
Model.count
public function count() { $this->db()->table($this->table)->groupBy($this->table . '.' . $this->primaryKey); $this->hasOne()->belongsToMany(); $count = $this->db()->count($this->primaryKey); return $count; }
php
public function count() { $this->db()->table($this->table)->groupBy($this->table . '.' . $this->primaryKey); $this->hasOne()->belongsToMany(); $count = $this->db()->count($this->primaryKey); return $count; }
[ "public", "function", "count", "(", ")", "{", "$", "this", "->", "db", "(", ")", "->", "table", "(", "$", "this", "->", "table", ")", "->", "groupBy", "(", "$", "this", "->", "table", ".", "'.'", ".", "$", "this", "->", "primaryKey", ")", ";", ...
Returns the total number of models @param string $column Column to count by @return int Total number of models
[ "Returns", "the", "total", "number", "of", "models" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L341-L347
193,140
nicodevs/laito
src/Laito/Model.php
Model.find
public function find($id = null) { // ID has to be defined if (!isset($id)) { throw new \InvalidArgumentException('Undefined ID to find', 400); } // Return the first found record using the primary key for the where $result = $this->where($this->primaryKey, $id, '...
php
public function find($id = null) { // ID has to be defined if (!isset($id)) { throw new \InvalidArgumentException('Undefined ID to find', 400); } // Return the first found record using the primary key for the where $result = $this->where($this->primaryKey, $id, '...
[ "public", "function", "find", "(", "$", "id", "=", "null", ")", "{", "// ID has to be defined", "if", "(", "!", "isset", "(", "$", "id", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Undefined ID to find'", ",", "400", ")", ";", ...
Returns a single model by primary key @param string $id Primary key value @return bool|array Model attributes, or false
[ "Returns", "a", "single", "model", "by", "primary", "key" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L355-L367
193,141
nicodevs/laito
src/Laito/Model.php
Model.first
public function first() { // Perform query $result = $this->get(); // Abort if no models where found if (!$result || !is_array($result) || empty($result)) { return false; } // Return the first matching model return reset($result); }
php
public function first() { // Perform query $result = $this->get(); // Abort if no models where found if (!$result || !is_array($result) || empty($result)) { return false; } // Return the first matching model return reset($result); }
[ "public", "function", "first", "(", ")", "{", "// Perform query", "$", "result", "=", "$", "this", "->", "get", "(", ")", ";", "// Abort if no models where found", "if", "(", "!", "$", "result", "||", "!", "is_array", "(", "$", "result", ")", "||", "empt...
Returns the first model found @return bool|array Model attributes, or false
[ "Returns", "the", "first", "model", "found" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L374-L386
193,142
nicodevs/laito
src/Laito/Model.php
Model.create
public function create($attributes = []) { // Attributes have to be array if (!(isset($attributes)) || !is_array($attributes)) { throw new \InvalidArgumentException('Undefined attributes', 400); } // Perform before hook $attributes = $this->beforeCreate($attribut...
php
public function create($attributes = []) { // Attributes have to be array if (!(isset($attributes)) || !is_array($attributes)) { throw new \InvalidArgumentException('Undefined attributes', 400); } // Perform before hook $attributes = $this->beforeCreate($attribut...
[ "public", "function", "create", "(", "$", "attributes", "=", "[", "]", ")", "{", "// Attributes have to be array", "if", "(", "!", "(", "isset", "(", "$", "attributes", ")", ")", "||", "!", "is_array", "(", "$", "attributes", ")", ")", "{", "throw", "n...
Creates a new model @param $attributes Model attributes @return bool|array Created model ID, or false
[ "Creates", "a", "new", "model" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L394-L436
193,143
nicodevs/laito
src/Laito/Model.php
Model.update
public function update($id = null, $attributes = []) { // ID has to be defined if (!isset($id)) { throw new \InvalidArgumentException('Undefined ID to update', 400); } // Attributes have to be array if (!(isset($attributes)) || !is_array($attributes)) { ...
php
public function update($id = null, $attributes = []) { // ID has to be defined if (!isset($id)) { throw new \InvalidArgumentException('Undefined ID to update', 400); } // Attributes have to be array if (!(isset($attributes)) || !is_array($attributes)) { ...
[ "public", "function", "update", "(", "$", "id", "=", "null", ",", "$", "attributes", "=", "[", "]", ")", "{", "// ID has to be defined", "if", "(", "!", "isset", "(", "$", "id", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Un...
Updates a model @param $id Model primary key @param $attributes Model attributes @return bool|array Updated model, or false
[ "Updates", "a", "model" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L445-L494
193,144
nicodevs/laito
src/Laito/Model.php
Model.destroy
public function destroy($id = null) { // ID has to be defined if (!isset($id)) { throw new \InvalidArgumentException('Undefined ID to destroy', 400); } // Perform before hook $this->beforeDestroy($id); // Update the model $result = $this->db()->t...
php
public function destroy($id = null) { // ID has to be defined if (!isset($id)) { throw new \InvalidArgumentException('Undefined ID to destroy', 400); } // Perform before hook $this->beforeDestroy($id); // Update the model $result = $this->db()->t...
[ "public", "function", "destroy", "(", "$", "id", "=", "null", ")", "{", "// ID has to be defined", "if", "(", "!", "isset", "(", "$", "id", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Undefined ID to destroy'", ",", "400", ")", ...
Destroys a model @return bool|array Deleted model ID, or false
[ "Destroys", "a", "model" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L501-L524
193,145
nicodevs/laito
src/Laito/Model.php
Model.hasOne
private function hasOne() { // Return if there are no relationships of that type if (!isset($this->relationships['hasOne']) || empty($this->relationships['hasOne'])) { return $this; } // Iterate relationships foreach ($this->relationships['hasOne'] as $join) { ...
php
private function hasOne() { // Return if there are no relationships of that type if (!isset($this->relationships['hasOne']) || empty($this->relationships['hasOne'])) { return $this; } // Iterate relationships foreach ($this->relationships['hasOne'] as $join) { ...
[ "private", "function", "hasOne", "(", ")", "{", "// Return if there are no relationships of that type", "if", "(", "!", "isset", "(", "$", "this", "->", "relationships", "[", "'hasOne'", "]", ")", "||", "empty", "(", "$", "this", "->", "relationships", "[", "'...
Resolves one to one relationships @return object Model instance
[ "Resolves", "one", "to", "one", "relationships" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L632-L654
193,146
nicodevs/laito
src/Laito/Model.php
Model.hasMany
private function hasMany() { // Return if there are no relationships of that type if (!isset($this->relationships['hasMany']) || empty($this->relationships['hasMany'])) { return $this; } // Get current records IDs $ids = array_column($this->records, 'id'); ...
php
private function hasMany() { // Return if there are no relationships of that type if (!isset($this->relationships['hasMany']) || empty($this->relationships['hasMany'])) { return $this; } // Get current records IDs $ids = array_column($this->records, 'id'); ...
[ "private", "function", "hasMany", "(", ")", "{", "// Return if there are no relationships of that type", "if", "(", "!", "isset", "(", "$", "this", "->", "relationships", "[", "'hasMany'", "]", ")", "||", "empty", "(", "$", "this", "->", "relationships", "[", ...
Resolves one to many relationships @return object Model instance
[ "Resolves", "one", "to", "many", "relationships" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L661-L726
193,147
nicodevs/laito
src/Laito/Model.php
Model.belongsToMany
private function belongsToMany() { // Return if there are no relationships of that type if (!isset($this->relationships['belongsToMany']) || empty($this->relationships['belongsToMany'])) { return $this; } // Group by primary key $this->db()->groupBy($this->table ...
php
private function belongsToMany() { // Return if there are no relationships of that type if (!isset($this->relationships['belongsToMany']) || empty($this->relationships['belongsToMany'])) { return $this; } // Group by primary key $this->db()->groupBy($this->table ...
[ "private", "function", "belongsToMany", "(", ")", "{", "// Return if there are no relationships of that type", "if", "(", "!", "isset", "(", "$", "this", "->", "relationships", "[", "'belongsToMany'", "]", ")", "||", "empty", "(", "$", "this", "->", "relationships...
Resolves many to many relationships @return object Model instance
[ "Resolves", "many", "to", "many", "relationships" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L733-L756
193,148
nicodevs/laito
src/Laito/Model.php
Model.sync
private function sync($id, $attributes) { // Return if the ID is invalid, or attributes is not an array if (!isset($id) || !isset($attributes) || empty($attributes)) { return $this; } // Return if there are no relationships of that type if (!isset($this->relation...
php
private function sync($id, $attributes) { // Return if the ID is invalid, or attributes is not an array if (!isset($id) || !isset($attributes) || empty($attributes)) { return $this; } // Return if there are no relationships of that type if (!isset($this->relation...
[ "private", "function", "sync", "(", "$", "id", ",", "$", "attributes", ")", "{", "// Return if the ID is invalid, or attributes is not an array", "if", "(", "!", "isset", "(", "$", "id", ")", "||", "!", "isset", "(", "$", "attributes", ")", "||", "empty", "(...
Syncs many to many relationships @param $attributes Model attributes @return object Model instance
[ "Syncs", "many", "to", "many", "relationships" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L764-L794
193,149
nicodevs/laito
src/Laito/Model.php
Model.formatBelongsToMany
private function formatBelongsToMany() { // Return if there are no relationships of that type if (!isset($this->relationships['belongsToMany']) || empty($this->relationships['belongsToMany'])) { return $this; } // Iterate relationships foreach ($this->relationshi...
php
private function formatBelongsToMany() { // Return if there are no relationships of that type if (!isset($this->relationships['belongsToMany']) || empty($this->relationships['belongsToMany'])) { return $this; } // Iterate relationships foreach ($this->relationshi...
[ "private", "function", "formatBelongsToMany", "(", ")", "{", "// Return if there are no relationships of that type", "if", "(", "!", "isset", "(", "$", "this", "->", "relationships", "[", "'belongsToMany'", "]", ")", "||", "empty", "(", "$", "this", "->", "relatio...
Format many to many relationships results @return object Model instance
[ "Format", "many", "to", "many", "relationships", "results" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L915-L937
193,150
nicodevs/laito
src/Laito/Model.php
Model.formatHasOne
private function formatHasOne() { // Return if there are no relationships of that type if (!isset($this->relationships['hasOne']) || empty($this->relationships['hasOne'])) { return $this; } // Iterate relationships foreach ($this->relationships['hasOne'] as $join...
php
private function formatHasOne() { // Return if there are no relationships of that type if (!isset($this->relationships['hasOne']) || empty($this->relationships['hasOne'])) { return $this; } // Iterate relationships foreach ($this->relationships['hasOne'] as $join...
[ "private", "function", "formatHasOne", "(", ")", "{", "// Return if there are no relationships of that type", "if", "(", "!", "isset", "(", "$", "this", "->", "relationships", "[", "'hasOne'", "]", ")", "||", "empty", "(", "$", "this", "->", "relationships", "["...
Format has many relationships results @return object Model instance
[ "Format", "has", "many", "relationships", "results" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L944-L967
193,151
nicodevs/laito
src/Laito/Model.php
Model.validationErrors
public function validationErrors($attributes, $rules = null) { // Rules container $this->rules = $this->setValidationRules(); // Ruleset $ruleSet = isset($rules)? $rules : $this->validate; // Errors collector $errors = []; // Leave only the validable attri...
php
public function validationErrors($attributes, $rules = null) { // Rules container $this->rules = $this->setValidationRules(); // Ruleset $ruleSet = isset($rules)? $rules : $this->validate; // Errors collector $errors = []; // Leave only the validable attri...
[ "public", "function", "validationErrors", "(", "$", "attributes", ",", "$", "rules", "=", "null", ")", "{", "// Rules container", "$", "this", "->", "rules", "=", "$", "this", "->", "setValidationRules", "(", ")", ";", "// Ruleset", "$", "ruleSet", "=", "i...
Validates a model @param $attributes Attributes to validate @param $rules Rules to validate @return array|bool Array of errors, or false if the model is valid
[ "Validates", "a", "model" ]
d2d28abfcbf981c4decfec28ce94f8849600e9fe
https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Model.php#L986-L1020
193,152
XetaIO/Xetaravel-IpTraceable
src/Listeners/Subscribers/IpTraceableSubscriber.php
IpTraceableSubscriber.onLogin
public function onLogin(Login $event) { $ip = $this->request->getClientIp(); $this->updateFields($this->auth, $ip); }
php
public function onLogin(Login $event) { $ip = $this->request->getClientIp(); $this->updateFields($this->auth, $ip); }
[ "public", "function", "onLogin", "(", "Login", "$", "event", ")", "{", "$", "ip", "=", "$", "this", "->", "request", "->", "getClientIp", "(", ")", ";", "$", "this", "->", "updateFields", "(", "$", "this", "->", "auth", ",", "$", "ip", ")", ";", ...
Listener for the login event. @param \Illuminate\Auth\Events\Login $event The event that was fired. @return bool
[ "Listener", "for", "the", "login", "event", "." ]
e1c57592d45f240c55e827fd6b756e5143c892b5
https://github.com/XetaIO/Xetaravel-IpTraceable/blob/e1c57592d45f240c55e827fd6b756e5143c892b5/src/Listeners/Subscribers/IpTraceableSubscriber.php#L58-L63
193,153
romm/configuration_object
Classes/Core/Core.php
Core.classExists
public function classExists($className) { if (!$className) { return false; } if (false === isset($this->existingClassList[$className])) { $this->existingClassList[$className] = class_exists($className) || interface_exists($className); } return $this-...
php
public function classExists($className) { if (!$className) { return false; } if (false === isset($this->existingClassList[$className])) { $this->existingClassList[$className] = class_exists($className) || interface_exists($className); } return $this-...
[ "public", "function", "classExists", "(", "$", "className", ")", "{", "if", "(", "!", "$", "className", ")", "{", "return", "false", ";", "}", "if", "(", "false", "===", "isset", "(", "$", "this", "->", "existingClassList", "[", "$", "className", "]", ...
Internal function which will check if the given class exists. This is useful because of the calls to undefined class, which can lead to a lack of performance due to the auto-loader called if the name of the class is not registered yet. This function will store the already checked class name in local cache. @param str...
[ "Internal", "function", "which", "will", "check", "if", "the", "given", "class", "exists", ".", "This", "is", "useful", "because", "of", "the", "calls", "to", "undefined", "class", "which", "can", "lead", "to", "a", "lack", "of", "performance", "due", "to"...
d3a40903386c2e0766bd8279337fe6da45cf5ce3
https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Core/Core.php#L114-L125
193,154
romm/configuration_object
Classes/Core/Core.php
Core.getGettablePropertiesOfObject
public function getGettablePropertiesOfObject($object) { $className = get_class($object); if (false === isset($this->gettablePropertiesOfObjects[$className])) { $this->gettablePropertiesOfObjects[$className] = []; $properties = $this->getReflectionService()->getClassProperty...
php
public function getGettablePropertiesOfObject($object) { $className = get_class($object); if (false === isset($this->gettablePropertiesOfObjects[$className])) { $this->gettablePropertiesOfObjects[$className] = []; $properties = $this->getReflectionService()->getClassProperty...
[ "public", "function", "getGettablePropertiesOfObject", "(", "$", "object", ")", "{", "$", "className", "=", "get_class", "(", "$", "object", ")", ";", "if", "(", "false", "===", "isset", "(", "$", "this", "->", "gettablePropertiesOfObjects", "[", "$", "class...
Returns the list of properties which are accessible for this given object. Properties are stored in local cache to improve performance. @param object $object @return array
[ "Returns", "the", "list", "of", "properties", "which", "are", "accessible", "for", "this", "given", "object", "." ]
d3a40903386c2e0766bd8279337fe6da45cf5ce3
https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Core/Core.php#L136-L152
193,155
carno-php/rpc
src/Chips/DInstances.php
DInstances.preparing
public function preparing(Promised $started, Promised $stopping) : Promised { $starts = []; foreach ($this->dr()->servers() as $api) { foreach ($this->dr()->services($api) as $service => $route) { // set global instance of service DI::set($class = $route[...
php
public function preparing(Promised $started, Promised $stopping) : Promised { $starts = []; foreach ($this->dr()->servers() as $api) { foreach ($this->dr()->services($api) as $service => $route) { // set global instance of service DI::set($class = $route[...
[ "public", "function", "preparing", "(", "Promised", "$", "started", ",", "Promised", "$", "stopping", ")", ":", "Promised", "{", "$", "starts", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "dr", "(", ")", "->", "servers", "(", ")", "as", ...
bind service implementer @param Promised $started @param Promised $stopping @return Promised
[ "bind", "service", "implementer" ]
0f1b310ac44a7f61271ba2a95ca265ed98f322ce
https://github.com/carno-php/rpc/blob/0f1b310ac44a7f61271ba2a95ca265ed98f322ce/src/Chips/DInstances.php#L33-L50
193,156
Wedeto/HTTP
src/Nonce.php
Nonce.getNonce
public static function getNonce(string $action, Session $session, array $context = [], int $timestamp = null) { // When nonce are not allowed to be stored, the nonce is not actually // used only once since it needs to be reproducable to be verifiable. // Therefore, it sent timestamped to th...
php
public static function getNonce(string $action, Session $session, array $context = [], int $timestamp = null) { // When nonce are not allowed to be stored, the nonce is not actually // used only once since it needs to be reproducable to be verifiable. // Therefore, it sent timestamped to th...
[ "public", "static", "function", "getNonce", "(", "string", "$", "action", ",", "Session", "$", "session", ",", "array", "$", "context", "=", "[", "]", ",", "int", "$", "timestamp", "=", "null", ")", "{", "// When nonce are not allowed to be stored, the nonce is ...
Get a nonce for the specified action optionally including context @param string $action The action to tie the nonce to @param Session $session The session to get the session salt from @param array $context The context required for the nonce to be validated @return string The nonce that should be submitted as parameter ...
[ "Get", "a", "nonce", "for", "the", "specified", "action", "optionally", "including", "context" ]
7318eff1b81a3c103c4263466d09b7f3593b70b9
https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Nonce.php#L79-L97
193,157
Wedeto/HTTP
src/Nonce.php
Nonce.validateNonce
public static function validateNonce(string $action, Session $session, Dictionary $arguments, array $context = []) { // Check if a nonce was posted at all if (!$arguments->has(self::$nonce_parameter, Type::STRING)) { // No nonce submitted, indeterminate outcome return...
php
public static function validateNonce(string $action, Session $session, Dictionary $arguments, array $context = []) { // Check if a nonce was posted at all if (!$arguments->has(self::$nonce_parameter, Type::STRING)) { // No nonce submitted, indeterminate outcome return...
[ "public", "static", "function", "validateNonce", "(", "string", "$", "action", ",", "Session", "$", "session", ",", "Dictionary", "$", "arguments", ",", "array", "$", "context", "=", "[", "]", ")", "{", "// Check if a nonce was posted at all", "if", "(", "!", ...
Check if a nonce was posted and if it matches the data @param Dictionary $arguments The POST arguments. @param Session $session The session where the nonce data was stored @return bool True when a nonce was posted and validated, false if a nonce was posted and rejected, null when no nonce was posted.
[ "Check", "if", "a", "nonce", "was", "posted", "and", "if", "it", "matches", "the", "data" ]
7318eff1b81a3c103c4263466d09b7f3593b70b9
https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Nonce.php#L106-L144
193,158
BapCat/Remodel
src/EntityDefinition.php
EntityDefinition.required
public function required(string $alias, string $type): EntityDefinitionOptions { return $this->required[$alias] = new EntityDefinitionOptions($alias, $type); }
php
public function required(string $alias, string $type): EntityDefinitionOptions { return $this->required[$alias] = new EntityDefinitionOptions($alias, $type); }
[ "public", "function", "required", "(", "string", "$", "alias", ",", "string", "$", "type", ")", ":", "EntityDefinitionOptions", "{", "return", "$", "this", "->", "required", "[", "$", "alias", "]", "=", "new", "EntityDefinitionOptions", "(", "$", "alias", ...
Adds a required column @param string $alias The name of the column (does not have to match the database) @param string $type A value object class name @return EntityDefinitionOptions Options for the column
[ "Adds", "a", "required", "column" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/EntityDefinition.php#L112-L114
193,159
BapCat/Remodel
src/EntityDefinition.php
EntityDefinition.optional
public function optional(string $alias, string $type): EntityDefinitionOptions { return $this->optional[$alias] = new EntityDefinitionOptions($alias, $type); }
php
public function optional(string $alias, string $type): EntityDefinitionOptions { return $this->optional[$alias] = new EntityDefinitionOptions($alias, $type); }
[ "public", "function", "optional", "(", "string", "$", "alias", ",", "string", "$", "type", ")", ":", "EntityDefinitionOptions", "{", "return", "$", "this", "->", "optional", "[", "$", "alias", "]", "=", "new", "EntityDefinitionOptions", "(", "$", "alias", ...
Adds an optional column @param string $alias The name of the column (does not have to match the database) @param string $type A value object class name @return EntityDefinitionOptions Options for the column
[ "Adds", "an", "optional", "column" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/EntityDefinition.php#L124-L126
193,160
BapCat/Remodel
src/EntityDefinition.php
EntityDefinition.timestamps
public function timestamps(): void { $this->optional('created_at', Timestamp::class)->readOnly(); $this->optional('updated_at', Timestamp::class)->readOnly(); }
php
public function timestamps(): void { $this->optional('created_at', Timestamp::class)->readOnly(); $this->optional('updated_at', Timestamp::class)->readOnly(); }
[ "public", "function", "timestamps", "(", ")", ":", "void", "{", "$", "this", "->", "optional", "(", "'created_at'", ",", "Timestamp", "::", "class", ")", "->", "readOnly", "(", ")", ";", "$", "this", "->", "optional", "(", "'updated_at'", ",", "Timestamp...
Adds `created_at` and `updated_at` timestamps @return void
[ "Adds", "created_at", "and", "updated_at", "timestamps" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/EntityDefinition.php#L133-L136
193,161
BapCat/Remodel
src/EntityDefinition.php
EntityDefinition.hasMany
public function hasMany(string $alias, string $entity): Relation { return $this->has_many[$entity] = new Relation($alias, $this->full_name, $entity); }
php
public function hasMany(string $alias, string $entity): Relation { return $this->has_many[$entity] = new Relation($alias, $this->full_name, $entity); }
[ "public", "function", "hasMany", "(", "string", "$", "alias", ",", "string", "$", "entity", ")", ":", "Relation", "{", "return", "$", "this", "->", "has_many", "[", "$", "entity", "]", "=", "new", "Relation", "(", "$", "alias", ",", "$", "this", "->"...
Add a `has many` relationship @param string $alias The name of the local column @param string $entity The fully-qualified class name of the related `Entity` @return Relation Options for the relation
[ "Add", "a", "has", "many", "relationship" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/EntityDefinition.php#L146-L148
193,162
BapCat/Remodel
src/EntityDefinition.php
EntityDefinition.hasManyThrough
public function hasManyThrough(string $alias, string $entity_join, string $entity_foreign): HasManyThrough { return $this->has_many_through[] = new HasManyThrough($alias, $entity_join, $entity_foreign); }
php
public function hasManyThrough(string $alias, string $entity_join, string $entity_foreign): HasManyThrough { return $this->has_many_through[] = new HasManyThrough($alias, $entity_join, $entity_foreign); }
[ "public", "function", "hasManyThrough", "(", "string", "$", "alias", ",", "string", "$", "entity_join", ",", "string", "$", "entity_foreign", ")", ":", "HasManyThrough", "{", "return", "$", "this", "->", "has_many_through", "[", "]", "=", "new", "HasManyThroug...
Add a `has many through` relationship @param string $alias The name of the local column @param string $entity_join The fully-qualified class name of the intermediate `Entity` @param string $entity_foreign The fully-qualified class name of the foreign `Entity` @return HasManyThrough Options for ...
[ "Add", "a", "has", "many", "through", "relationship" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/EntityDefinition.php#L159-L161
193,163
BapCat/Remodel
src/EntityDefinition.php
EntityDefinition.belongsTo
public function belongsTo(string $alias, string $entity): Relation { return $this->belongs_to[$entity] = new Relation($alias, $this->full_name, $entity); }
php
public function belongsTo(string $alias, string $entity): Relation { return $this->belongs_to[$entity] = new Relation($alias, $this->full_name, $entity); }
[ "public", "function", "belongsTo", "(", "string", "$", "alias", ",", "string", "$", "entity", ")", ":", "Relation", "{", "return", "$", "this", "->", "belongs_to", "[", "$", "entity", "]", "=", "new", "Relation", "(", "$", "alias", ",", "$", "this", ...
Add a `belongs to` relationship @param string $alias The name of the local column @param string $entity The fully-qualified class name of the related `Entity` @return Relation Options for the relation
[ "Add", "a", "belongs", "to", "relationship" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/EntityDefinition.php#L171-L173
193,164
BapCat/Remodel
src/EntityDefinition.php
EntityDefinition.associates
public function associates(string $alias_join, string $alias_left, string $entity_left, string $alias_right, string $entity_right): ManyToMany { return $this->many_to_many[] = new ManyToMany($alias_join, $alias_left, $this->full_name, $entity_left, $alias_right, $entity_right); }
php
public function associates(string $alias_join, string $alias_left, string $entity_left, string $alias_right, string $entity_right): ManyToMany { return $this->many_to_many[] = new ManyToMany($alias_join, $alias_left, $this->full_name, $entity_left, $alias_right, $entity_right); }
[ "public", "function", "associates", "(", "string", "$", "alias_join", ",", "string", "$", "alias_left", ",", "string", "$", "entity_left", ",", "string", "$", "alias_right", ",", "string", "$", "entity_right", ")", ":", "ManyToMany", "{", "return", "$", "thi...
Adds a `has many through` relationship to the left and right `Entity`s through this `Entity` @param string $alias_join The name of the join column @param string $alias_left The name of the left column @param string $entity_left The fully-qualified class name of the left `Entity` @param string $alias_ri...
[ "Adds", "a", "has", "many", "through", "relationship", "to", "the", "left", "and", "right", "Entity", "s", "through", "this", "Entity" ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/EntityDefinition.php#L186-L188
193,165
BapCat/Remodel
src/EntityDefinition.php
EntityDefinition.virtual
public function virtual(string $name, string $type, callable $callback): void { $this->virtuals[$name] = new VirtualField($name, $type, $callback); }
php
public function virtual(string $name, string $type, callable $callback): void { $this->virtuals[$name] = new VirtualField($name, $type, $callback); }
[ "public", "function", "virtual", "(", "string", "$", "name", ",", "string", "$", "type", ",", "callable", "$", "callback", ")", ":", "void", "{", "$", "this", "->", "virtuals", "[", "$", "name", "]", "=", "new", "VirtualField", "(", "$", "name", ",",...
Adds a virtual field to the `Entity`. The `callable` will be executed whenever the virtual field is accessed, and passed the `Entity`. @param string $name @param string $type @param callable $callback
[ "Adds", "a", "virtual", "field", "to", "the", "Entity", ".", "The", "callable", "will", "be", "executed", "whenever", "the", "virtual", "field", "is", "accessed", "and", "passed", "the", "Entity", "." ]
80fcdec8bca22b88c5af9a0a93622c796cf3e7b1
https://github.com/BapCat/Remodel/blob/80fcdec8bca22b88c5af9a0a93622c796cf3e7b1/src/EntityDefinition.php#L212-L214
193,166
flipbox/spark
src/models/traits/UserAttribute.php
UserTrait.setUserId
public function setUserId(int $id) { // Has the id changed? if ($id !== $this->userId) { // Invalidate existing user if ($this->user !== null && $this->user->getId() !== $id) { $this->user = null; }; $this->userId = $id; } ...
php
public function setUserId(int $id) { // Has the id changed? if ($id !== $this->userId) { // Invalidate existing user if ($this->user !== null && $this->user->getId() !== $id) { $this->user = null; }; $this->userId = $id; } ...
[ "public", "function", "setUserId", "(", "int", "$", "id", ")", "{", "// Has the id changed?", "if", "(", "$", "id", "!==", "$", "this", "->", "userId", ")", "{", "// Invalidate existing user", "if", "(", "$", "this", "->", "user", "!==", "null", "&&", "$...
Set associated userId @param $id @return $this
[ "Set", "associated", "userId" ]
9d75fd3d95744b9c9187921c4f3b9eea42c035d4
https://github.com/flipbox/spark/blob/9d75fd3d95744b9c9187921c4f3b9eea42c035d4/src/models/traits/UserAttribute.php#L38-L52
193,167
Dhii/placeholder-template-abstract
src/ReplaceTokensCapableTrait.php
ReplaceTokensCapableTrait._replaceTokens
protected function _replaceTokens($input, $source, $tokenStart, $tokenEnd, $default = null) { $input = $this->_normalizeString($input); $default = $default === null ? '' : $this->_normalizeString($default); $regexDelimiter = '/'; $tokenStart = $this->_quoteRegex($tokenStart, $...
php
protected function _replaceTokens($input, $source, $tokenStart, $tokenEnd, $default = null) { $input = $this->_normalizeString($input); $default = $default === null ? '' : $this->_normalizeString($default); $regexDelimiter = '/'; $tokenStart = $this->_quoteRegex($tokenStart, $...
[ "protected", "function", "_replaceTokens", "(", "$", "input", ",", "$", "source", ",", "$", "tokenStart", ",", "$", "tokenEnd", ",", "$", "default", "=", "null", ")", "{", "$", "input", "=", "$", "this", "->", "_normalizeString", "(", "$", "input", ")"...
Replaces all tokens in a string with corresponding values. Use {@see _normalizeTokenKey()} to convert token keys into a format used in the container. @since [*next-version*] @param string|Stringable $input The string that may contain tokens. @param BaseContainerInterface|array|Ar...
[ "Replaces", "all", "tokens", "in", "a", "string", "with", "corresponding", "values", "." ]
bfa7cea3b1e078b19bcf59d9a3da63b8c12ed03b
https://github.com/Dhii/placeholder-template-abstract/blob/bfa7cea3b1e078b19bcf59d9a3da63b8c12ed03b/src/ReplaceTokensCapableTrait.php#L40-L72
193,168
Tom-Millard/php-class-gen
src/Generator.php
Generator.createClass
public function createClass(string $name, string $location, string $extends = "") : bool { $namespace = trim($this->getNameSpace($name)); $name = trim($this->getClassName($name)); $className = $name; if ($extends !== "") { $className .= " extends {$extends}"; } ...
php
public function createClass(string $name, string $location, string $extends = "") : bool { $namespace = trim($this->getNameSpace($name)); $name = trim($this->getClassName($name)); $className = $name; if ($extends !== "") { $className .= " extends {$extends}"; } ...
[ "public", "function", "createClass", "(", "string", "$", "name", ",", "string", "$", "location", ",", "string", "$", "extends", "=", "\"\"", ")", ":", "bool", "{", "$", "namespace", "=", "trim", "(", "$", "this", "->", "getNameSpace", "(", "$", "name",...
Create a class @param string $name @param string $location @param string $extends @return boolean
[ "Create", "a", "class" ]
a4c06620589a63a98b3b64c9f64b9a85d754810e
https://github.com/Tom-Millard/php-class-gen/blob/a4c06620589a63a98b3b64c9f64b9a85d754810e/src/Generator.php#L32-L55
193,169
Tom-Millard/php-class-gen
src/Generator.php
Generator.getNameSpace
public function getNameSpace(string $name) : string { $segs = []; $name = str_replace("/", "\\", $name); $namespace = explode("\\", $name); array_pop($namespace); array_walk($namespace, function (&$value) { $value = $this->removeNoneAlpherNumeric($value); ...
php
public function getNameSpace(string $name) : string { $segs = []; $name = str_replace("/", "\\", $name); $namespace = explode("\\", $name); array_pop($namespace); array_walk($namespace, function (&$value) { $value = $this->removeNoneAlpherNumeric($value); ...
[ "public", "function", "getNameSpace", "(", "string", "$", "name", ")", ":", "string", "{", "$", "segs", "=", "[", "]", ";", "$", "name", "=", "str_replace", "(", "\"/\"", ",", "\"\\\\\"", ",", "$", "name", ")", ";", "$", "namespace", "=", "explode", ...
Work out name space of the class @param string $name @return string
[ "Work", "out", "name", "space", "of", "the", "class" ]
a4c06620589a63a98b3b64c9f64b9a85d754810e
https://github.com/Tom-Millard/php-class-gen/blob/a4c06620589a63a98b3b64c9f64b9a85d754810e/src/Generator.php#L121-L133
193,170
Tom-Millard/php-class-gen
src/Generator.php
Generator.getClassName
public function getClassName(string $name) : string { $name = str_replace("/", "\\", $name); $name = explode("\\", $name); $name = array_pop($name); $name = $this->removeNoneAlpherNumeric($name); return $name; }
php
public function getClassName(string $name) : string { $name = str_replace("/", "\\", $name); $name = explode("\\", $name); $name = array_pop($name); $name = $this->removeNoneAlpherNumeric($name); return $name; }
[ "public", "function", "getClassName", "(", "string", "$", "name", ")", ":", "string", "{", "$", "name", "=", "str_replace", "(", "\"/\"", ",", "\"\\\\\"", ",", "$", "name", ")", ";", "$", "name", "=", "explode", "(", "\"\\\\\"", ",", "$", "name", ")"...
Work out the class name from a namespace string @param string $name @return string
[ "Work", "out", "the", "class", "name", "from", "a", "namespace", "string" ]
a4c06620589a63a98b3b64c9f64b9a85d754810e
https://github.com/Tom-Millard/php-class-gen/blob/a4c06620589a63a98b3b64c9f64b9a85d754810e/src/Generator.php#L141-L148
193,171
agentmedia/phine-builtin
src/BuiltIn/Logic/Tree/NavigationTreeProvider.php
NavigationTreeProvider.Equals
public function Equals($item1, $item2) { if ($item1 === null && $item2 !== null) { return false; } else if ($item1 !== null && $item2 === null) { return false; } else if ($item1 === null && $item2 === null) { return ...
php
public function Equals($item1, $item2) { if ($item1 === null && $item2 !== null) { return false; } else if ($item1 !== null && $item2 === null) { return false; } else if ($item1 === null && $item2 === null) { return ...
[ "public", "function", "Equals", "(", "$", "item1", ",", "$", "item2", ")", "{", "if", "(", "$", "item1", "===", "null", "&&", "$", "item2", "!==", "null", ")", "{", "return", "false", ";", "}", "else", "if", "(", "$", "item1", "!==", "null", "&&"...
Compares the items @param NavigationItem $item1 @param NavigationItem $item2
[ "Compares", "the", "items" ]
4dd05bc406a71e997bd4eaa16b12e23dbe62a456
https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Logic/Tree/NavigationTreeProvider.php#L40-L55
193,172
praxigento/mobi_mod_downline
Service/Customer/Get/ById.php
ById.convertDbToApi
private function convertDbToApi($db) { $result = new AResponse(); if ($db) { /* extract DB data */ $custId = $db[QBGetCustomer::A_ID]; $email = $db[QBGetCustomer::A_EMAIL]; $nameFirst = $db[QBGetCustomer::A_NAME_FIRST]; $nameLast = $db[QBGe...
php
private function convertDbToApi($db) { $result = new AResponse(); if ($db) { /* extract DB data */ $custId = $db[QBGetCustomer::A_ID]; $email = $db[QBGetCustomer::A_EMAIL]; $nameFirst = $db[QBGetCustomer::A_NAME_FIRST]; $nameLast = $db[QBGe...
[ "private", "function", "convertDbToApi", "(", "$", "db", ")", "{", "$", "result", "=", "new", "AResponse", "(", ")", ";", "if", "(", "$", "db", ")", "{", "/* extract DB data */", "$", "custId", "=", "$", "db", "[", "QBGetCustomer", "::", "A_ID", "]", ...
Convert database query result set to response object. @param array $db @return \Praxigento\Downline\Api\Service\Customer\Get\ById\Response @throws \Exception
[ "Convert", "database", "query", "result", "set", "to", "response", "object", "." ]
0f3c276dfff1aa029f9fd205ccfc56f207a2e75b
https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Service/Customer/Get/ById.php#L42-L68
193,173
juliangut/mapping
src/Driver/Locator/FileLocator.php
FileLocator.getMappingFiles
public function getMappingFiles(): array { $mappingPaths = []; foreach ($this->paths as $mappingPath) { if (\is_dir($mappingPath)) { $mappingPaths[] = $this->getFilesFromDirectory($mappingPath); } elseif (\is_file($mappingPath)) { $mappingPath...
php
public function getMappingFiles(): array { $mappingPaths = []; foreach ($this->paths as $mappingPath) { if (\is_dir($mappingPath)) { $mappingPaths[] = $this->getFilesFromDirectory($mappingPath); } elseif (\is_file($mappingPath)) { $mappingPath...
[ "public", "function", "getMappingFiles", "(", ")", ":", "array", "{", "$", "mappingPaths", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "paths", "as", "$", "mappingPath", ")", "{", "if", "(", "\\", "is_dir", "(", "$", "mappingPath", ")", ")...
Get mapping files. @throws DriverException
[ "Get", "mapping", "files", "." ]
1830ff84c054d8e3759df170a5664a97f7070be9
https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/Locator/FileLocator.php#L74-L89
193,174
juliangut/mapping
src/Driver/Locator/FileLocator.php
FileLocator.getFilesFromDirectory
protected function getFilesFromDirectory(string $mappingDirectory): array { $mappingPaths = []; $filePattern = \sprintf('/^.+\.(%s)$/i', \implode('|', $this->extensions)); $recursiveIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($mappingDirectory)); $regex...
php
protected function getFilesFromDirectory(string $mappingDirectory): array { $mappingPaths = []; $filePattern = \sprintf('/^.+\.(%s)$/i', \implode('|', $this->extensions)); $recursiveIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($mappingDirectory)); $regex...
[ "protected", "function", "getFilesFromDirectory", "(", "string", "$", "mappingDirectory", ")", ":", "array", "{", "$", "mappingPaths", "=", "[", "]", ";", "$", "filePattern", "=", "\\", "sprintf", "(", "'/^.+\\.(%s)$/i'", ",", "\\", "implode", "(", "'|'", ",...
Get mapping files from directory. @param string $mappingDirectory @return array
[ "Get", "mapping", "files", "from", "directory", "." ]
1830ff84c054d8e3759df170a5664a97f7070be9
https://github.com/juliangut/mapping/blob/1830ff84c054d8e3759df170a5664a97f7070be9/src/Driver/Locator/FileLocator.php#L98-L113
193,175
g4code/storage
src/StorageFactory.php
StorageFactory.createInstance
public static function createInstance($driver, $options) { if(!in_array($driver, self::$_validDrivers)) { throw new \Exception("Driver '{$driver}' not implemented"); } $class = __NAMESPACE__ . '\\Driver\\' . $driver; $driver = new $class; $driver->setOptions($op...
php
public static function createInstance($driver, $options) { if(!in_array($driver, self::$_validDrivers)) { throw new \Exception("Driver '{$driver}' not implemented"); } $class = __NAMESPACE__ . '\\Driver\\' . $driver; $driver = new $class; $driver->setOptions($op...
[ "public", "static", "function", "createInstance", "(", "$", "driver", ",", "$", "options", ")", "{", "if", "(", "!", "in_array", "(", "$", "driver", ",", "self", "::", "$", "_validDrivers", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Driv...
Create new instance of G4\Storage\Storage @param string $driver @param array $options @throws \Exception @return \G4\Storage\Storage
[ "Create", "new", "instance", "of", "G4", "\\", "Storage", "\\", "Storage" ]
05b3976d5b855c2855979ff9fd9db1090473541d
https://github.com/g4code/storage/blob/05b3976d5b855c2855979ff9fd9db1090473541d/src/StorageFactory.php#L24-L36
193,176
rollerworks-graveyard/metadata
src/DefaultClassMetadata.php
DefaultClassMetadata.merge
public function merge(ClassMetadata $object) { $properties = $this->properties; $methods = $this->methods; foreach ($object->getProperties() as $property) { $properties[$property->getName()] = $property; } foreach ($object->getMethods() as $method) { ...
php
public function merge(ClassMetadata $object) { $properties = $this->properties; $methods = $this->methods; foreach ($object->getProperties() as $property) { $properties[$property->getName()] = $property; } foreach ($object->getMethods() as $method) { ...
[ "public", "function", "merge", "(", "ClassMetadata", "$", "object", ")", "{", "$", "properties", "=", "$", "this", "->", "properties", ";", "$", "methods", "=", "$", "this", "->", "methods", ";", "foreach", "(", "$", "object", "->", "getProperties", "(",...
Merge the ClassMetadata of the object with the current ClassMetadata into a new object. Note: instead of modifying the current ClassMetadata you should instead return a new object. @param ClassMetadata $object Another MergeableClassMetadata object. @return self New ClassMetadata instance with the merged class metada...
[ "Merge", "the", "ClassMetadata", "of", "the", "object", "with", "the", "current", "ClassMetadata", "into", "a", "new", "object", "." ]
5b07f564aad87709ca0d0b3e140e4dc4edf9d375
https://github.com/rollerworks-graveyard/metadata/blob/5b07f564aad87709ca0d0b3e140e4dc4edf9d375/src/DefaultClassMetadata.php#L180-L200
193,177
theopera/framework
src/Component/WebApplication/WebApplication.php
WebApplication.mapQueryToActionParameters
private function mapQueryToActionParameters(RouteEndpoint $route, RequestInterface $request) : array { $reflection = new ReflectionClass($route->getFullyQualifiedName()); $method = $reflection->getMethod($route->getAction(true)); $query = $request->getQuery(); $mapper = []; ...
php
private function mapQueryToActionParameters(RouteEndpoint $route, RequestInterface $request) : array { $reflection = new ReflectionClass($route->getFullyQualifiedName()); $method = $reflection->getMethod($route->getAction(true)); $query = $request->getQuery(); $mapper = []; ...
[ "private", "function", "mapQueryToActionParameters", "(", "RouteEndpoint", "$", "route", ",", "RequestInterface", "$", "request", ")", ":", "array", "{", "$", "reflection", "=", "new", "ReflectionClass", "(", "$", "route", "->", "getFullyQualifiedName", "(", ")", ...
Maps all the query parameters to the controller action parameters @param RouteEndpoint $route @return string[] @throws HttpException @throws ReflectionException
[ "Maps", "all", "the", "query", "parameters", "to", "the", "controller", "action", "parameters" ]
fa6165d3891a310faa580c81dee49a63c150c711
https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/WebApplication/WebApplication.php#L160-L184
193,178
kaiohken1982/Cropper
src/Cropper/Filter/File/ImageCrop.php
ImageCrop.setThumbnailer
protected function setThumbnailer(Thumbnailer $thumbnailer) { if(!$thumbnailer instanceof Thumbnailer) { throw new \Exception('The thumbnailer service given is not instance of Thumbnailer\Thumbnailer\Thumbnailer'); } $this->options['thumbnailer'] = $thumbnailer; return $this...
php
protected function setThumbnailer(Thumbnailer $thumbnailer) { if(!$thumbnailer instanceof Thumbnailer) { throw new \Exception('The thumbnailer service given is not instance of Thumbnailer\Thumbnailer\Thumbnailer'); } $this->options['thumbnailer'] = $thumbnailer; return $this...
[ "protected", "function", "setThumbnailer", "(", "Thumbnailer", "$", "thumbnailer", ")", "{", "if", "(", "!", "$", "thumbnailer", "instanceof", "Thumbnailer", ")", "{", "throw", "new", "\\", "Exception", "(", "'The thumbnailer service given is not instance of Thumbnailer...
Set the thumbnailer given with the options @throws \Exception @return Cropper\Filter\File\ImageCrop
[ "Set", "the", "thumbnailer", "given", "with", "the", "options" ]
5ec42136d085fdd4162ecca82c467fe9f7e6bdb0
https://github.com/kaiohken1982/Cropper/blob/5ec42136d085fdd4162ecca82c467fe9f7e6bdb0/src/Cropper/Filter/File/ImageCrop.php#L27-L35
193,179
native5/native5-sdk-client-php
src/Native5/Sessions/WebContext.php
WebContext.get
public function get($key) { if (array_key_exists($key, $this->_map)) { return $this->_map[$key]; } return null; }
php
public function get($key) { if (array_key_exists($key, $this->_map)) { return $this->_map[$key]; } return null; }
[ "public", "function", "get", "(", "$", "key", ")", "{", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "_map", ")", ")", "{", "return", "$", "this", "->", "_map", "[", "$", "key", "]", ";", "}", "return", "null", ";", "...
Get attribute from web context. @param mixed $key The key to search for in the map. @access public @return void
[ "Get", "attribute", "from", "web", "context", "." ]
e1f598cf27654d81bb5facace1990b737242a2f9
https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Sessions/WebContext.php#L83-L91
193,180
jabernardo/lollipop-php
Library/HTTP/Request.php
Request.query
public function query($name, $val = null) { return isset($this->_queries[$name]) ? $this->_queries[$name] : $val; }
php
public function query($name, $val = null) { return isset($this->_queries[$name]) ? $this->_queries[$name] : $val; }
[ "public", "function", "query", "(", "$", "name", ",", "$", "val", "=", "null", ")", "{", "return", "isset", "(", "$", "this", "->", "_queries", "[", "$", "name", "]", ")", "?", "$", "this", "->", "_queries", "[", "$", "name", "]", ":", "$", "va...
Get query string from url @access public @param string $name Input name @param string $val Default value if query doesn't exists @return mixed
[ "Get", "query", "string", "from", "url" ]
004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5
https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/HTTP/Request.php#L126-L130
193,181
jabernardo/lollipop-php
Library/HTTP/Request.php
Request.queries
public function queries(array $names, $default = null) { $var = []; foreach ($names as $in) { $var[$in] = isset($this->_queries[$in]) ? $this->_queries[$in] : $default; } return $var; }
php
public function queries(array $names, $default = null) { $var = []; foreach ($names as $in) { $var[$in] = isset($this->_queries[$in]) ? $this->_queries[$in] : $default; } return $var; }
[ "public", "function", "queries", "(", "array", "$", "names", ",", "$", "default", "=", "null", ")", "{", "$", "var", "=", "[", "]", ";", "foreach", "(", "$", "names", "as", "$", "in", ")", "{", "$", "var", "[", "$", "in", "]", "=", "isset", "...
Getting querie from url parameters @access public @param array $name Query names @param mixed $default Default value @return array
[ "Getting", "querie", "from", "url", "parameters" ]
004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5
https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/HTTP/Request.php#L141-L151
193,182
jabernardo/lollipop-php
Library/HTTP/Request.php
Request.only
public function only(array $names, $default = null) { $var = []; foreach ($names as $in) { $var[$in] = isset($this->_requests[$in]) ? $this->_requests[$in] : $default; } return $var; }
php
public function only(array $names, $default = null) { $var = []; foreach ($names as $in) { $var[$in] = isset($this->_requests[$in]) ? $this->_requests[$in] : $default; } return $var; }
[ "public", "function", "only", "(", "array", "$", "names", ",", "$", "default", "=", "null", ")", "{", "$", "var", "=", "[", "]", ";", "foreach", "(", "$", "names", "as", "$", "in", ")", "{", "$", "var", "[", "$", "in", "]", "=", "isset", "(",...
Getting segments of inputs @access public @param array $names Input names @param mixed $default Default value (null) @return array
[ "Getting", "segments", "of", "inputs" ]
004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5
https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/HTTP/Request.php#L162-L172
193,183
jabernardo/lollipop-php
Library/HTTP/Request.php
Request.except
public function except(array $name) { $var = []; foreach ($this->_requests as $k => $v) { if (!in_array($k, $name)) { $var[$k] = $v; } } return $var; }
php
public function except(array $name) { $var = []; foreach ($this->_requests as $k => $v) { if (!in_array($k, $name)) { $var[$k] = $v; } } return $var; }
[ "public", "function", "except", "(", "array", "$", "name", ")", "{", "$", "var", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "_requests", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "!", "in_array", "(", "$", "k", ",", "$"...
Get data input except some @access public @param array $name Input names @return array
[ "Get", "data", "input", "except", "some" ]
004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5
https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/HTTP/Request.php#L182-L192
193,184
jabernardo/lollipop-php
Library/HTTP/Request.php
Request.hasInputs
public function hasInputs(array $names) { foreach ($names as $name) { if (!$this->has($name)) return false; } return true; }
php
public function hasInputs(array $names) { foreach ($names as $name) { if (!$this->has($name)) return false; } return true; }
[ "public", "function", "hasInputs", "(", "array", "$", "names", ")", "{", "foreach", "(", "$", "names", "as", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "has", "(", "$", "name", ")", ")", "return", "false", ";", "}", "return", "true...
Check if inputs are received @access public @param array $names Input names @return bool
[ "Check", "if", "inputs", "are", "received" ]
004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5
https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/HTTP/Request.php#L226-L233
193,185
jabernardo/lollipop-php
Library/HTTP/Request.php
Request.hasQueries
public function hasQueries(array $names) { foreach ($names as $name) { if (!$this->hasQuery($name)) return false; } return true; }
php
public function hasQueries(array $names) { foreach ($names as $name) { if (!$this->hasQuery($name)) return false; } return true; }
[ "public", "function", "hasQueries", "(", "array", "$", "names", ")", "{", "foreach", "(", "$", "names", "as", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "hasQuery", "(", "$", "name", ")", ")", "return", "false", ";", "}", "return", ...
Check if queries exists @access public @param array $names Query names @return bool
[ "Check", "if", "queries", "exists" ]
004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5
https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/HTTP/Request.php#L255-L262
193,186
jabernardo/lollipop-php
Library/HTTP/Request.php
Request.url
public function url($component = -1) { $active_url = URL::here(); if ($component > -1) { return parse_url($active_url, $component); } return $active_url; }
php
public function url($component = -1) { $active_url = URL::here(); if ($component > -1) { return parse_url($active_url, $component); } return $active_url; }
[ "public", "function", "url", "(", "$", "component", "=", "-", "1", ")", "{", "$", "active_url", "=", "URL", "::", "here", "(", ")", ";", "if", "(", "$", "component", ">", "-", "1", ")", "{", "return", "parse_url", "(", "$", "active_url", ",", "$"...
Get request URL @access public @param int $component URL parse_url component @return string
[ "Get", "request", "URL" ]
004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5
https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/HTTP/Request.php#L294-L301
193,187
jabernardo/lollipop-php
Library/HTTP/Request.php
Request.header
public function header($header) { foreach($this->_headers as $k => $v) { if (!strcasecmp($k, $header)) { return $v; } } return null; }
php
public function header($header) { foreach($this->_headers as $k => $v) { if (!strcasecmp($k, $header)) { return $v; } } return null; }
[ "public", "function", "header", "(", "$", "header", ")", "{", "foreach", "(", "$", "this", "->", "_headers", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "!", "strcasecmp", "(", "$", "k", ",", "$", "header", ")", ")", "{", "return", "$"...
Get request header value @access public @param string $header Request header @return mixed `null` if header is not set
[ "Get", "request", "header", "value" ]
004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5
https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/HTTP/Request.php#L322-L330
193,188
AmaraLiving/php-onehydra
src/Amara/OneHydra/Api.php
Api.getPageResult
public function getPageResult($url, $attributes = []) { $request = new Request(); $request->setService(self::SERVICE_PAGE); $request->setParam('url', $url); $request->setAttributes($attributes); return $this->execute($request); }
php
public function getPageResult($url, $attributes = []) { $request = new Request(); $request->setService(self::SERVICE_PAGE); $request->setParam('url', $url); $request->setAttributes($attributes); return $this->execute($request); }
[ "public", "function", "getPageResult", "(", "$", "url", ",", "$", "attributes", "=", "[", "]", ")", "{", "$", "request", "=", "new", "Request", "(", ")", ";", "$", "request", "->", "setService", "(", "self", "::", "SERVICE_PAGE", ")", ";", "$", "requ...
Get details for a page @param string $url @param array $attributes @return PageResult
[ "Get", "details", "for", "a", "page" ]
f2c3155c42c8c0bec8c0246feb2a5959a15b2406
https://github.com/AmaraLiving/php-onehydra/blob/f2c3155c42c8c0bec8c0246feb2a5959a15b2406/src/Amara/OneHydra/Api.php#L103-L112
193,189
AmaraLiving/php-onehydra
src/Amara/OneHydra/Api.php
Api.execute
public function execute(RequestInterface $request) { $httpRequest = $this->httpRequestBuilder->build($request); $httpResponse = $this->transport->execute($httpRequest); return $this->resultBuilderEngine->build($request, $httpResponse); }
php
public function execute(RequestInterface $request) { $httpRequest = $this->httpRequestBuilder->build($request); $httpResponse = $this->transport->execute($httpRequest); return $this->resultBuilderEngine->build($request, $httpResponse); }
[ "public", "function", "execute", "(", "RequestInterface", "$", "request", ")", "{", "$", "httpRequest", "=", "$", "this", "->", "httpRequestBuilder", "->", "build", "(", "$", "request", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "transport", "-...
Execute a OneHydra request and return the result @param RequestInterface $request @return ResultInterface @throws HttpTransportException
[ "Execute", "a", "OneHydra", "request", "and", "return", "the", "result" ]
f2c3155c42c8c0bec8c0246feb2a5959a15b2406
https://github.com/AmaraLiving/php-onehydra/blob/f2c3155c42c8c0bec8c0246feb2a5959a15b2406/src/Amara/OneHydra/Api.php#L121-L128
193,190
Aviogram/Common
src/ArrayUtils.php
ArrayUtils.targetGet
public static function targetGet($needle, array $haystack, $default = null) { if ($needle === null) { return $haystack; } $parts = preg_split('/(?<!\\\\)\./', $needle); foreach ($parts as $part) { $key = str_replace('\\.', '.', $part); ...
php
public static function targetGet($needle, array $haystack, $default = null) { if ($needle === null) { return $haystack; } $parts = preg_split('/(?<!\\\\)\./', $needle); foreach ($parts as $part) { $key = str_replace('\\.', '.', $part); ...
[ "public", "static", "function", "targetGet", "(", "$", "needle", ",", "array", "$", "haystack", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "needle", "===", "null", ")", "{", "return", "$", "haystack", ";", "}", "$", "parts", "=", "...
Get an value from an array via a dotted notation @param string $needle (my.scope.notation) Use \. to escape . characters @param array $haystack @param mixed $default @return mixed
[ "Get", "an", "value", "from", "an", "array", "via", "a", "dotted", "notation" ]
bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5
https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/ArrayUtils.php#L15-L37
193,191
Aviogram/Common
src/ArrayUtils.php
ArrayUtils.targetSet
public static function targetSet($needle, $value, array $haystack = array()) { $keys = explode('.', $needle); $loop = &$haystack; foreach ($keys as $key) { if (is_array($loop) === false) { $loop = array(); } if (array_key_exists...
php
public static function targetSet($needle, $value, array $haystack = array()) { $keys = explode('.', $needle); $loop = &$haystack; foreach ($keys as $key) { if (is_array($loop) === false) { $loop = array(); } if (array_key_exists...
[ "public", "static", "function", "targetSet", "(", "$", "needle", ",", "$", "value", ",", "array", "$", "haystack", "=", "array", "(", ")", ")", "{", "$", "keys", "=", "explode", "(", "'.'", ",", "$", "needle", ")", ";", "$", "loop", "=", "&", "$"...
Set an value on a multi dimensional array via a dotted string notation @param string $needle @param string $value @param array $haystack @return array
[ "Set", "an", "value", "on", "a", "multi", "dimensional", "array", "via", "a", "dotted", "string", "notation" ]
bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5
https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/ArrayUtils.php#L48-L68
193,192
covex-nn/JooS
src/JooS/Helper/Broker.php
Broker.__isset
public function __isset($helper) { if (isset($this->_helpers[$helper])) { $isset = true; } else { $isset = !is_null($this->_getHelper($helper)); } return $isset; }
php
public function __isset($helper) { if (isset($this->_helpers[$helper])) { $isset = true; } else { $isset = !is_null($this->_getHelper($helper)); } return $isset; }
[ "public", "function", "__isset", "(", "$", "helper", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_helpers", "[", "$", "helper", "]", ")", ")", "{", "$", "isset", "=", "true", ";", "}", "else", "{", "$", "isset", "=", "!", "is_null", ...
Is helper presents ? @param string $helper Name @return boolean
[ "Is", "helper", "presents", "?" ]
8dfb94edccecaf307787d4091ba7f20a674b7792
https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Helper/Broker.php#L87-L95
193,193
covex-nn/JooS
src/JooS/Helper/Broker.php
Broker._getHelper
private function _getHelper($helper) { $instance = null; foreach ($this->_prefixes as $prefix) { $className = $prefix . "\\" . $helper; if (Loader::loadClass($className)) { if (is_subclass_of($className, __NAMESPACE__ . "\\Helper_Interface")) { $instance = new $className(); ...
php
private function _getHelper($helper) { $instance = null; foreach ($this->_prefixes as $prefix) { $className = $prefix . "\\" . $helper; if (Loader::loadClass($className)) { if (is_subclass_of($className, __NAMESPACE__ . "\\Helper_Interface")) { $instance = new $className(); ...
[ "private", "function", "_getHelper", "(", "$", "helper", ")", "{", "$", "instance", "=", "null", ";", "foreach", "(", "$", "this", "->", "_prefixes", "as", "$", "prefix", ")", "{", "$", "className", "=", "$", "prefix", ".", "\"\\\\\"", ".", "$", "hel...
Creates a new helper's instance @param string $helper Name @return Helper_Interface
[ "Creates", "a", "new", "helper", "s", "instance" ]
8dfb94edccecaf307787d4091ba7f20a674b7792
https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Helper/Broker.php#L104-L119
193,194
covex-nn/JooS
src/JooS/Helper/Broker.php
Broker.prependPrefix
public function prependPrefix($prefix) { $this->deletePrefix($prefix); $prepend = array($prefix => $prefix); $this->_prefixes = array_merge($prepend, $this->_prefixes); }
php
public function prependPrefix($prefix) { $this->deletePrefix($prefix); $prepend = array($prefix => $prefix); $this->_prefixes = array_merge($prepend, $this->_prefixes); }
[ "public", "function", "prependPrefix", "(", "$", "prefix", ")", "{", "$", "this", "->", "deletePrefix", "(", "$", "prefix", ")", ";", "$", "prepend", "=", "array", "(", "$", "prefix", "=>", "$", "prefix", ")", ";", "$", "this", "->", "_prefixes", "="...
Prepend namespace-prefix @param string $prefix Prefix @return null
[ "Prepend", "namespace", "-", "prefix" ]
8dfb94edccecaf307787d4091ba7f20a674b7792
https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Helper/Broker.php#L156-L162
193,195
bseddon/XPath20
Value/HexBinaryValue.php
HexBinaryValue.fromString
public static function fromString( $string ) { // Make sure the string does not contain non-hex characters $matched = preg_match( "/[^0-9a-fA-F]+/", $string, $matches ); if ( $matched || strlen( $string ) % 2 != 0 ) { throw XPath2Exception::withErrorCodeAndParams( "FORG0001", Resources::InvalidFormat,...
php
public static function fromString( $string ) { // Make sure the string does not contain non-hex characters $matched = preg_match( "/[^0-9a-fA-F]+/", $string, $matches ); if ( $matched || strlen( $string ) % 2 != 0 ) { throw XPath2Exception::withErrorCodeAndParams( "FORG0001", Resources::InvalidFormat,...
[ "public", "static", "function", "fromString", "(", "$", "string", ")", "{", "// Make sure the string does not contain non-hex characters\r", "$", "matched", "=", "preg_match", "(", "\"/[^0-9a-fA-F]+/\"", ",", "$", "string", ",", "$", "matches", ")", ";", "if", "(", ...
Convert a string representation of a hex value to is binary version and create a HexBinaryValue instance @param unknown $string
[ "Convert", "a", "string", "representation", "of", "a", "hex", "value", "to", "is", "binary", "version", "and", "create", "a", "HexBinaryValue", "instance" ]
69882b6efffaa5470a819d5fdd2f6473ddeb046d
https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/HexBinaryValue.php#L65-L76
193,196
romm/configuration_object
Classes/Service/Items/Parents/ParentsUtility.php
ParentsUtility.classUsesParentsTrait
public function classUsesParentsTrait($className) { if (is_object($className)) { $className = get_class($className); } if (false === isset($this->classUsingParentsTrait[$className])) { $this->classUsingParentsTrait[$className] = $this->checkClassUsesParentsTrait($cla...
php
public function classUsesParentsTrait($className) { if (is_object($className)) { $className = get_class($className); } if (false === isset($this->classUsingParentsTrait[$className])) { $this->classUsingParentsTrait[$className] = $this->checkClassUsesParentsTrait($cla...
[ "public", "function", "classUsesParentsTrait", "(", "$", "className", ")", "{", "if", "(", "is_object", "(", "$", "className", ")", ")", "{", "$", "className", "=", "get_class", "(", "$", "className", ")", ";", "}", "if", "(", "false", "===", "isset", ...
Will check and store the class names which use the trait `ParentsTrait`. @param string|object $className @return bool
[ "Will", "check", "and", "store", "the", "class", "names", "which", "use", "the", "trait", "ParentsTrait", "." ]
d3a40903386c2e0766bd8279337fe6da45cf5ce3
https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/Items/Parents/ParentsUtility.php#L35-L46
193,197
romm/configuration_object
Classes/Service/Items/Parents/ParentsUtility.php
ParentsUtility.checkClassUsesParentsTrait
protected function checkClassUsesParentsTrait($className) { $flag = false; $classes = array_merge([$className], class_parents($className)); foreach ($classes as $class) { $traits = class_uses($class); $flag = $flag || (true === isset($traits[ParentsTrait::class])); ...
php
protected function checkClassUsesParentsTrait($className) { $flag = false; $classes = array_merge([$className], class_parents($className)); foreach ($classes as $class) { $traits = class_uses($class); $flag = $flag || (true === isset($traits[ParentsTrait::class])); ...
[ "protected", "function", "checkClassUsesParentsTrait", "(", "$", "className", ")", "{", "$", "flag", "=", "false", ";", "$", "classes", "=", "array_merge", "(", "[", "$", "className", "]", ",", "class_parents", "(", "$", "className", ")", ")", ";", "foreac...
Will check if the given class name uses the trait `ParentsTrait`. @param string $className @return bool
[ "Will", "check", "if", "the", "given", "class", "name", "uses", "the", "trait", "ParentsTrait", "." ]
d3a40903386c2e0766bd8279337fe6da45cf5ce3
https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/Items/Parents/ParentsUtility.php#L54-L65
193,198
freialib/hlin.archetype
src/Trait/CLI.php
CLITrait.ask
function ask($question, array $answers) { // question loop $optstr = implode("|", $answers); do { $this->printf("$question [$optstr] "); $answer = $this->fgets(); } while ( ! in_array($answer, $answers)); return $answer; }
php
function ask($question, array $answers) { // question loop $optstr = implode("|", $answers); do { $this->printf("$question [$optstr] "); $answer = $this->fgets(); } while ( ! in_array($answer, $answers)); return $answer; }
[ "function", "ask", "(", "$", "question", ",", "array", "$", "answers", ")", "{", "// question loop", "$", "optstr", "=", "implode", "(", "\"|\"", ",", "$", "answers", ")", ";", "do", "{", "$", "this", "->", "printf", "(", "\"$question [$optstr] \"", ")",...
Shorthand for retrieving confirmation from console. Common console task for input. @return string answer
[ "Shorthand", "for", "retrieving", "confirmation", "from", "console", ".", "Common", "console", "task", "for", "input", "." ]
d8750a9bf4b7efb8063899969e3f39c1915c423a
https://github.com/freialib/hlin.archetype/blob/d8750a9bf4b7efb8063899969e3f39c1915c423a/src/Trait/CLI.php#L85-L95
193,199
AlexyaFramework/Tools
Alexya/Tools/Inflector.php
Inflector.plural
public static function plural(string $word) : string { // Check that `$word` is countable. if(in_array($word, Inflector::$_uncontable)) { return $word; } // Now check that `$word` is regular. if(isset(Inflector::$_plural["irregular"][$word])) { return...
php
public static function plural(string $word) : string { // Check that `$word` is countable. if(in_array($word, Inflector::$_uncontable)) { return $word; } // Now check that `$word` is regular. if(isset(Inflector::$_plural["irregular"][$word])) { return...
[ "public", "static", "function", "plural", "(", "string", "$", "word", ")", ":", "string", "{", "// Check that `$word` is countable.", "if", "(", "in_array", "(", "$", "word", ",", "Inflector", "::", "$", "_uncontable", ")", ")", "{", "return", "$", "word", ...
Returns the plural form of the word. @param string $word Word to pluralize. @return string The plural form of `$word`.
[ "Returns", "the", "plural", "form", "of", "the", "word", "." ]
2ae7c91cde0517579b926dd872eaf7ea324fd1e4
https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Inflector.php#L307-L336