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
20,000
Chill-project/Main
Export/Formatter/CSVListFormatter.php
CSVListFormatter.buildForm
public function buildForm( FormBuilderInterface $builder, $exportAlias, array $aggregatorAliases ){ $builder->add('numerotation', ChoiceType::class, array( 'choices' => array( 'yes' => true, 'no' => false ), 'expa...
php
public function buildForm( FormBuilderInterface $builder, $exportAlias, array $aggregatorAliases ){ $builder->add('numerotation', ChoiceType::class, array( 'choices' => array( 'yes' => true, 'no' => false ), 'expa...
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "$", "exportAlias", ",", "array", "$", "aggregatorAliases", ")", "{", "$", "builder", "->", "add", "(", "'numerotation'", ",", "ChoiceType", "::", "class", ",", "array", "(", ...
build a form, which will be used to collect data required for the execution of this formatter. @uses appendAggregatorForm @param FormBuilderInterface $builder @param type $exportAlias @param array $aggregatorAliases
[ "build", "a", "form", "which", "will", "be", "used", "to", "collect", "data", "required", "for", "the", "execution", "of", "this", "formatter", "." ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L93-L109
20,001
Chill-project/Main
Export/Formatter/CSVListFormatter.php
CSVListFormatter.getResponse
public function getResponse( $result, $formatterData, $exportAlias, array $exportData, array $filtersData, array $aggregatorsData ) { $this->result = $result; $this->exportAlias = $exportAlias; $this->exportData = $exportData; $thi...
php
public function getResponse( $result, $formatterData, $exportAlias, array $exportData, array $filtersData, array $aggregatorsData ) { $this->result = $result; $this->exportAlias = $exportAlias; $this->exportData = $exportData; $thi...
[ "public", "function", "getResponse", "(", "$", "result", ",", "$", "formatterData", ",", "$", "exportAlias", ",", "array", "$", "exportData", ",", "array", "$", "filtersData", ",", "array", "$", "aggregatorsData", ")", "{", "$", "this", "->", "result", "="...
Generate a response from the data collected on differents ExportElementInterface @param mixed[] $result The result, as given by the ExportInterface @param mixed[] $formatterData collected from the current form @param string $exportAlias the id of the current export @param array $filtersData an array containing the fil...
[ "Generate", "a", "response", "from", "the", "data", "collected", "on", "differents", "ExportElementInterface" ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L121-L166
20,002
Chill-project/Main
Export/Formatter/CSVListFormatter.php
CSVListFormatter.prepareHeaders
protected function prepareHeaders($output) { $keys = $this->exportManager->getExport($this->exportAlias)->getQueryKeys($this->exportData); // we want to keep the order of the first row. So we will iterate on the first row of the results $first_row = count($this->result) > 0 ? $this->result[0...
php
protected function prepareHeaders($output) { $keys = $this->exportManager->getExport($this->exportAlias)->getQueryKeys($this->exportData); // we want to keep the order of the first row. So we will iterate on the first row of the results $first_row = count($this->result) > 0 ? $this->result[0...
[ "protected", "function", "prepareHeaders", "(", "$", "output", ")", "{", "$", "keys", "=", "$", "this", "->", "exportManager", "->", "getExport", "(", "$", "this", "->", "exportAlias", ")", "->", "getQueryKeys", "(", "$", "this", "->", "exportData", ")", ...
add the headers to the csv file @param resource $output
[ "add", "the", "headers", "to", "the", "csv", "file" ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L173-L191
20,003
Chill-project/Main
Export/Formatter/CSVListFormatter.php
CSVListFormatter.getLabel
protected function getLabel($key, $value) { if ($this->labelsCache === null) { $this->prepareCacheLabels(); } return $this->labelsCache[$key]($value); }
php
protected function getLabel($key, $value) { if ($this->labelsCache === null) { $this->prepareCacheLabels(); } return $this->labelsCache[$key]($value); }
[ "protected", "function", "getLabel", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "this", "->", "labelsCache", "===", "null", ")", "{", "$", "this", "->", "prepareCacheLabels", "(", ")", ";", "}", "return", "$", "this", "->", "labels...
Give the label corresponding to the given key and value. @param string $key @param string $value @return string @throws \LogicException if the label is not found
[ "Give", "the", "label", "corresponding", "to", "the", "given", "key", "and", "value", "." ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L201-L209
20,004
Chill-project/Main
Export/Formatter/CSVListFormatter.php
CSVListFormatter.prepareCacheLabels
protected function prepareCacheLabels() { $export = $this->exportManager->getExport($this->exportAlias); $keys = $export->getQueryKeys($this->exportData); foreach($keys as $key) { // get an array with all values for this key if possible $values = \array_map(f...
php
protected function prepareCacheLabels() { $export = $this->exportManager->getExport($this->exportAlias); $keys = $export->getQueryKeys($this->exportData); foreach($keys as $key) { // get an array with all values for this key if possible $values = \array_map(f...
[ "protected", "function", "prepareCacheLabels", "(", ")", "{", "$", "export", "=", "$", "this", "->", "exportManager", "->", "getExport", "(", "$", "this", "->", "exportAlias", ")", ";", "$", "keys", "=", "$", "export", "->", "getQueryKeys", "(", "$", "th...
Prepare the label cache which will be used by getLabel. This function should be called only once in the generation lifecycle.
[ "Prepare", "the", "label", "cache", "which", "will", "be", "used", "by", "getLabel", ".", "This", "function", "should", "be", "called", "only", "once", "in", "the", "generation", "lifecycle", "." ]
384cb6c793072a4f1047dc5cafc2157ee2419f60
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVListFormatter.php#L215-L226
20,005
hackzilla/ticket-message
Component/TicketFeatures.php
TicketFeatures.hasFeature
public function hasFeature($feature) { $feature = strtoupper($feature); if (!isset($this->features[$feature])) { return null; } return $this->features[$feature]; }
php
public function hasFeature($feature) { $feature = strtoupper($feature); if (!isset($this->features[$feature])) { return null; } return $this->features[$feature]; }
[ "public", "function", "hasFeature", "(", "$", "feature", ")", "{", "$", "feature", "=", "strtoupper", "(", "$", "feature", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "features", "[", "$", "feature", "]", ")", ")", "{", "return", "nu...
Check if feature exists and enabled. @param string $feature @return bool|null
[ "Check", "if", "feature", "exists", "and", "enabled", "." ]
043950aa95f322cfaae145ce3c7781a4b0618a18
https://github.com/hackzilla/ticket-message/blob/043950aa95f322cfaae145ce3c7781a4b0618a18/Component/TicketFeatures.php#L32-L41
20,006
redaigbaria/oauth2
src/AbstractServer.php
AbstractServer.setEventEmitter
public function setEventEmitter($emitter = null) { if ($emitter === null) { $this->eventEmitter = new Emitter(); } else { $this->eventEmitter = $emitter; } }
php
public function setEventEmitter($emitter = null) { if ($emitter === null) { $this->eventEmitter = new Emitter(); } else { $this->eventEmitter = $emitter; } }
[ "public", "function", "setEventEmitter", "(", "$", "emitter", "=", "null", ")", "{", "if", "(", "$", "emitter", "===", "null", ")", "{", "$", "this", "->", "eventEmitter", "=", "new", "Emitter", "(", ")", ";", "}", "else", "{", "$", "this", "->", "...
Set an event emitter @param object $emitter Event emitter object
[ "Set", "an", "event", "emitter" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L111-L118
20,007
redaigbaria/oauth2
src/AbstractServer.php
AbstractServer.addEventListener
public function addEventListener($eventName, callable $listener, $priority = Emitter::P_NORMAL) { $this->eventEmitter->addListener($eventName, $listener, $priority); }
php
public function addEventListener($eventName, callable $listener, $priority = Emitter::P_NORMAL) { $this->eventEmitter->addListener($eventName, $listener, $priority); }
[ "public", "function", "addEventListener", "(", "$", "eventName", ",", "callable", "$", "listener", ",", "$", "priority", "=", "Emitter", "::", "P_NORMAL", ")", "{", "$", "this", "->", "eventEmitter", "->", "addListener", "(", "$", "eventName", ",", "$", "l...
Add an event listener to the event emitter @param string $eventName Event name @param callable $listener Callable function or method @param int $priority Priority of event listener
[ "Add", "an", "event", "listener", "to", "the", "event", "emitter" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L127-L130
20,008
redaigbaria/oauth2
src/AbstractServer.php
AbstractServer.setClientStorage
public function setClientStorage(ClientInterface $storage) { $storage->setServer($this); $this->clientStorage = $storage; return $this; }
php
public function setClientStorage(ClientInterface $storage) { $storage->setServer($this); $this->clientStorage = $storage; return $this; }
[ "public", "function", "setClientStorage", "(", "ClientInterface", "$", "storage", ")", "{", "$", "storage", "->", "setServer", "(", "$", "this", ")", ";", "$", "this", "->", "clientStorage", "=", "$", "storage", ";", "return", "$", "this", ";", "}" ]
Set the client storage @param \League\OAuth2\Server\Storage\ClientInterface $storage @return self
[ "Set", "the", "client", "storage" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L177-L183
20,009
redaigbaria/oauth2
src/AbstractServer.php
AbstractServer.setSessionStorage
public function setSessionStorage(SessionInterface $storage) { $storage->setServer($this); $this->sessionStorage = $storage; return $this; }
php
public function setSessionStorage(SessionInterface $storage) { $storage->setServer($this); $this->sessionStorage = $storage; return $this; }
[ "public", "function", "setSessionStorage", "(", "SessionInterface", "$", "storage", ")", "{", "$", "storage", "->", "setServer", "(", "$", "this", ")", ";", "$", "this", "->", "sessionStorage", "=", "$", "storage", ";", "return", "$", "this", ";", "}" ]
Set the session storage @param \League\OAuth2\Server\Storage\SessionInterface $storage @return self
[ "Set", "the", "session", "storage" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L192-L198
20,010
redaigbaria/oauth2
src/AbstractServer.php
AbstractServer.setAccessTokenStorage
public function setAccessTokenStorage(AccessTokenInterface $storage) { $storage->setServer($this); $this->accessTokenStorage = $storage; return $this; }
php
public function setAccessTokenStorage(AccessTokenInterface $storage) { $storage->setServer($this); $this->accessTokenStorage = $storage; return $this; }
[ "public", "function", "setAccessTokenStorage", "(", "AccessTokenInterface", "$", "storage", ")", "{", "$", "storage", "->", "setServer", "(", "$", "this", ")", ";", "$", "this", "->", "accessTokenStorage", "=", "$", "storage", ";", "return", "$", "this", ";"...
Set the access token storage @param \League\OAuth2\Server\Storage\AccessTokenInterface $storage @return self
[ "Set", "the", "access", "token", "storage" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L207-L213
20,011
redaigbaria/oauth2
src/AbstractServer.php
AbstractServer.setRefreshTokenStorage
public function setRefreshTokenStorage(RefreshTokenInterface $storage) { $storage->setServer($this); $this->refreshTokenStorage = $storage; return $this; }
php
public function setRefreshTokenStorage(RefreshTokenInterface $storage) { $storage->setServer($this); $this->refreshTokenStorage = $storage; return $this; }
[ "public", "function", "setRefreshTokenStorage", "(", "RefreshTokenInterface", "$", "storage", ")", "{", "$", "storage", "->", "setServer", "(", "$", "this", ")", ";", "$", "this", "->", "refreshTokenStorage", "=", "$", "storage", ";", "return", "$", "this", ...
Set the refresh token storage @param \League\OAuth2\Server\Storage\RefreshTokenInterface $storage @return self
[ "Set", "the", "refresh", "token", "storage" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L222-L228
20,012
redaigbaria/oauth2
src/AbstractServer.php
AbstractServer.setAuthCodeStorage
public function setAuthCodeStorage(AuthCodeInterface $storage) { $storage->setServer($this); $this->authCodeStorage = $storage; return $this; }
php
public function setAuthCodeStorage(AuthCodeInterface $storage) { $storage->setServer($this); $this->authCodeStorage = $storage; return $this; }
[ "public", "function", "setAuthCodeStorage", "(", "AuthCodeInterface", "$", "storage", ")", "{", "$", "storage", "->", "setServer", "(", "$", "this", ")", ";", "$", "this", "->", "authCodeStorage", "=", "$", "storage", ";", "return", "$", "this", ";", "}" ]
Set the auth code storage @param \League\OAuth2\Server\Storage\AuthCodeInterface $storage @return self
[ "Set", "the", "auth", "code", "storage" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L237-L243
20,013
redaigbaria/oauth2
src/AbstractServer.php
AbstractServer.setScopeStorage
public function setScopeStorage(ScopeInterface $storage) { $storage->setServer($this); $this->scopeStorage = $storage; return $this; }
php
public function setScopeStorage(ScopeInterface $storage) { $storage->setServer($this); $this->scopeStorage = $storage; return $this; }
[ "public", "function", "setScopeStorage", "(", "ScopeInterface", "$", "storage", ")", "{", "$", "storage", "->", "setServer", "(", "$", "this", ")", ";", "$", "this", "->", "scopeStorage", "=", "$", "storage", ";", "return", "$", "this", ";", "}" ]
Set the scope storage @param \League\OAuth2\Server\Storage\ScopeInterface $storage @return self
[ "Set", "the", "scope", "storage" ]
54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/AbstractServer.php#L252-L258
20,014
yuncms/framework
src/admin/controllers/AdminController.php
AdminController.actionDelete
public function actionDelete($id) { if (Admin::find()->count() == 1) { Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'This is the last administrator, delete can not manage the system, it can not be deleted!')); return $this->redirect(['index']); } $thi...
php
public function actionDelete($id) { if (Admin::find()->count() == 1) { Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'This is the last administrator, delete can not manage the system, it can not be deleted!')); return $this->redirect(['index']); } $thi...
[ "public", "function", "actionDelete", "(", "$", "id", ")", "{", "if", "(", "Admin", "::", "find", "(", ")", "->", "count", "(", ")", "==", "1", ")", "{", "Yii", "::", "$", "app", "->", "getSession", "(", ")", "->", "setFlash", "(", "'success'", "...
Deletes an existing Admin model. If deletion is successful, the browser will be redirected to the 'index' page. @param integer $id @return mixed @throws NotFoundHttpException @throws \Exception @throws \Throwable @throws \yii\db\StaleObjectException
[ "Deletes", "an", "existing", "Admin", "model", ".", "If", "deletion", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "index", "page", "." ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/controllers/AdminController.php#L102-L111
20,015
okitcom/ok-lib-php
src/Model/Attributes.php
Attributes.init
public static function init(array $attributes) { $obj = new Attributes; foreach ($attributes as $attribute) { $obj->{$attribute->key} = $attribute; } return $obj; }
php
public static function init(array $attributes) { $obj = new Attributes; foreach ($attributes as $attribute) { $obj->{$attribute->key} = $attribute; } return $obj; }
[ "public", "static", "function", "init", "(", "array", "$", "attributes", ")", "{", "$", "obj", "=", "new", "Attributes", ";", "foreach", "(", "$", "attributes", "as", "$", "attribute", ")", "{", "$", "obj", "->", "{", "$", "attribute", "->", "key", "...
Initialize from list of attributes. @param Attribute[] $attributes @return Attributes
[ "Initialize", "from", "list", "of", "attributes", "." ]
1f441f3d216af7c952788e864bfe66bc4f089467
https://github.com/okitcom/ok-lib-php/blob/1f441f3d216af7c952788e864bfe66bc4f089467/src/Model/Attributes.php#L62-L68
20,016
loadsys/CakePHP-CreatorModifier
src/Model/Behavior/CreatorModifierBehavior.php
CreatorModifierBehavior.sessionUserId
protected function sessionUserId() { $userId = null; $request = $this->newRequest(); if ($request->session()->started()) { $userId = $request->session()->read($this->_config['sessionUserIdKey']); } else { $this->log('The Session is not started. This typically means a User is not logged in. In this case t...
php
protected function sessionUserId() { $userId = null; $request = $this->newRequest(); if ($request->session()->started()) { $userId = $request->session()->read($this->_config['sessionUserIdKey']); } else { $this->log('The Session is not started. This typically means a User is not logged in. In this case t...
[ "protected", "function", "sessionUserId", "(", ")", "{", "$", "userId", "=", "null", ";", "$", "request", "=", "$", "this", "->", "newRequest", "(", ")", ";", "if", "(", "$", "request", "->", "session", "(", ")", "->", "started", "(", ")", ")", "{"...
Return the User.id grabbed from the Session information. @return string The string representing the current logged in user.
[ "Return", "the", "User", ".", "id", "grabbed", "from", "the", "Session", "information", "." ]
42a87eda9413beff82b4eb9cab77d2d5bd5536a0
https://github.com/loadsys/CakePHP-CreatorModifier/blob/42a87eda9413beff82b4eb9cab77d2d5bd5536a0/src/Model/Behavior/CreatorModifierBehavior.php#L169-L185
20,017
nyeholt/silverstripe-external-content
thirdparty/Zend/Feed.php
Zend_Feed.importArray
public static function importArray(array $data, $format = 'atom') { $obj = 'Zend_Feed_' . ucfirst(strtolower($format)); /** * @see Zend_Loader */ require_once 'Zend/Loader.php'; Zend_Loader::loadClass($obj); /** * @see Zend_Feed_Builder */ ...
php
public static function importArray(array $data, $format = 'atom') { $obj = 'Zend_Feed_' . ucfirst(strtolower($format)); /** * @see Zend_Loader */ require_once 'Zend/Loader.php'; Zend_Loader::loadClass($obj); /** * @see Zend_Feed_Builder */ ...
[ "public", "static", "function", "importArray", "(", "array", "$", "data", ",", "$", "format", "=", "'atom'", ")", "{", "$", "obj", "=", "'Zend_Feed_'", ".", "ucfirst", "(", "strtolower", "(", "$", "format", ")", ")", ";", "/**\n * @see Zend_Loader\n ...
Construct a new Zend_Feed_Abstract object from a custom array @param array $data @param string $format (rss|atom) the requested output format @return Zend_Feed_Abstract
[ "Construct", "a", "new", "Zend_Feed_Abstract", "object", "from", "a", "custom", "array" ]
1c6da8c56ef717225ff904e1522aff94ed051601
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed.php#L373-L386
20,018
nyeholt/silverstripe-external-content
thirdparty/Zend/Feed.php
Zend_Feed.importBuilder
public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom') { $obj = 'Zend_Feed_' . ucfirst(strtolower($format)); /** * @see Zend_Loader */ require_once 'Zend/Loader.php'; Zend_Loader::loadClass($obj); return new $obj(null, ...
php
public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom') { $obj = 'Zend_Feed_' . ucfirst(strtolower($format)); /** * @see Zend_Loader */ require_once 'Zend/Loader.php'; Zend_Loader::loadClass($obj); return new $obj(null, ...
[ "public", "static", "function", "importBuilder", "(", "Zend_Feed_Builder_Interface", "$", "builder", ",", "$", "format", "=", "'atom'", ")", "{", "$", "obj", "=", "'Zend_Feed_'", ".", "ucfirst", "(", "strtolower", "(", "$", "format", ")", ")", ";", "/**\n ...
Construct a new Zend_Feed_Abstract object from a Zend_Feed_Builder_Interface data source @param Zend_Feed_Builder_Interface $builder this object will be used to extract the data of the feed @param string $format (rss|atom) the requested output format @return Zend_Feed_Abstract
[ "Construct", "a", "new", "Zend_Feed_Abstract", "object", "from", "a", "Zend_Feed_Builder_Interface", "data", "source" ]
1c6da8c56ef717225ff904e1522aff94ed051601
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed.php#L395-L405
20,019
yuncms/framework
src/web/Controller.php
Controller.asJsonP
public function asJsonP($data): YiiResponse { $response = Yii::$app->getResponse(); $response->data = $data; $response->format = YiiResponse::FORMAT_JSONP; return $response; }
php
public function asJsonP($data): YiiResponse { $response = Yii::$app->getResponse(); $response->data = $data; $response->format = YiiResponse::FORMAT_JSONP; return $response; }
[ "public", "function", "asJsonP", "(", "$", "data", ")", ":", "YiiResponse", "{", "$", "response", "=", "Yii", "::", "$", "app", "->", "getResponse", "(", ")", ";", "$", "response", "->", "data", "=", "$", "data", ";", "$", "response", "->", "format",...
Sets the response format of the given data as JSONP. @param mixed $data The data that should be formatted. @return Response A response that is configured to send `$data` formatted as JSON. @see YiiResponse::$format @see YiiResponse::FORMAT_JSONP @see JsonResponseFormatter
[ "Sets", "the", "response", "format", "of", "the", "given", "data", "as", "JSONP", "." ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/web/Controller.php#L33-L39
20,020
yuncms/framework
src/web/Controller.php
Controller.asRaw
public function asRaw($data): YiiResponse { $response = Yii::$app->getResponse(); $response->data = $data; $response->format = YiiResponse::FORMAT_RAW; return $response; }
php
public function asRaw($data): YiiResponse { $response = Yii::$app->getResponse(); $response->data = $data; $response->format = YiiResponse::FORMAT_RAW; return $response; }
[ "public", "function", "asRaw", "(", "$", "data", ")", ":", "YiiResponse", "{", "$", "response", "=", "Yii", "::", "$", "app", "->", "getResponse", "(", ")", ";", "$", "response", "->", "data", "=", "$", "data", ";", "$", "response", "->", "format", ...
Sets the response format of the given data as RAW. @param mixed $data The data that should *not* be formatted. @return YiiResponse A response that is configured to send `$data` without formatting. @see YiiResponse::$format @see YiiResponse::FORMAT_RAW
[ "Sets", "the", "response", "format", "of", "the", "given", "data", "as", "RAW", "." ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/web/Controller.php#L49-L55
20,021
magnus-eriksson/entity
src/Entity.php
Entity.setParam
protected function setParam($key, $value) { if (!array_key_exists($key, $this->_params)) { if ($this->_ignoreExisting || $this->arrayGet($this->_setup, 'suppress_errors') === true) { return; } throw new UnknownPropertyException("Unknown property: '{$key}'...
php
protected function setParam($key, $value) { if (!array_key_exists($key, $this->_params)) { if ($this->_ignoreExisting || $this->arrayGet($this->_setup, 'suppress_errors') === true) { return; } throw new UnknownPropertyException("Unknown property: '{$key}'...
[ "protected", "function", "setParam", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "_params", ")", ")", "{", "if", "(", "$", "this", "->", "_ignoreExisting", "||", "$", "t...
Set a value in the parameter pool and cast it to the same type as the default value @param string $key @param mixed $value @throws UnknownPropertyException
[ "Set", "a", "value", "in", "the", "parameter", "pool", "and", "cast", "it", "to", "the", "same", "type", "as", "the", "default", "value" ]
e6b1df5bd7b65c0c2513895afa533d441fc6d43b
https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L159-L189
20,022
magnus-eriksson/entity
src/Entity.php
Entity.setDefaultDataTypes
protected function setDefaultDataTypes() { foreach ($this->_params as $key => $value) { switch (gettype($value)) { case "boolean": $this->_types[$key] = 'boolean'; break; case "integer": $this->_types[$ke...
php
protected function setDefaultDataTypes() { foreach ($this->_params as $key => $value) { switch (gettype($value)) { case "boolean": $this->_types[$key] = 'boolean'; break; case "integer": $this->_types[$ke...
[ "protected", "function", "setDefaultDataTypes", "(", ")", "{", "foreach", "(", "$", "this", "->", "_params", "as", "$", "key", "=>", "$", "value", ")", "{", "switch", "(", "gettype", "(", "$", "value", ")", ")", "{", "case", "\"boolean\"", ":", "$", ...
Get the default data types
[ "Get", "the", "default", "data", "types" ]
e6b1df5bd7b65c0c2513895afa533d441fc6d43b
https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L195-L219
20,023
magnus-eriksson/entity
src/Entity.php
Entity.toArray
public function toArray($protect = null) { $protect = is_array($protect) ? $protect : $this->_protect; if ($protect) { $new = $this->_params; foreach ($protect as $key) { unset($new[$key]); } // Do json encod...
php
public function toArray($protect = null) { $protect = is_array($protect) ? $protect : $this->_protect; if ($protect) { $new = $this->_params; foreach ($protect as $key) { unset($new[$key]); } // Do json encod...
[ "public", "function", "toArray", "(", "$", "protect", "=", "null", ")", "{", "$", "protect", "=", "is_array", "(", "$", "protect", ")", "?", "$", "protect", ":", "$", "this", "->", "_protect", ";", "if", "(", "$", "protect", ")", "{", "$", "new", ...
Return the params as array and remove the protected keys @param array|null $protect @return array
[ "Return", "the", "params", "as", "array", "and", "remove", "the", "protected", "keys" ]
e6b1df5bd7b65c0c2513895afa533d441fc6d43b
https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L258-L278
20,024
magnus-eriksson/entity
src/Entity.php
Entity.date
public function date($key, $format = "F j, Y") { if (is_numeric($this->_params[$key])) { return date($format, $this->_params[$key]); } return date($format, strtotime($this->_params[$key])); }
php
public function date($key, $format = "F j, Y") { if (is_numeric($this->_params[$key])) { return date($format, $this->_params[$key]); } return date($format, strtotime($this->_params[$key])); }
[ "public", "function", "date", "(", "$", "key", ",", "$", "format", "=", "\"F j, Y\"", ")", "{", "if", "(", "is_numeric", "(", "$", "this", "->", "_params", "[", "$", "key", "]", ")", ")", "{", "return", "date", "(", "$", "format", ",", "$", "this...
Return a parameter as a formatted date string @param string $key @param string $format @return string
[ "Return", "a", "parameter", "as", "a", "formatted", "date", "string" ]
e6b1df5bd7b65c0c2513895afa533d441fc6d43b
https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L300-L307
20,025
magnus-eriksson/entity
src/Entity.php
Entity.make
public static function make($data = null, $index = null, Closure $modifier = null) { if ($data instanceof Traversable) { $data = iterator_to_array($data); } if (!is_array($data)) { return null; } if (count($data) < 1) { return []; ...
php
public static function make($data = null, $index = null, Closure $modifier = null) { if ($data instanceof Traversable) { $data = iterator_to_array($data); } if (!is_array($data)) { return null; } if (count($data) < 1) { return []; ...
[ "public", "static", "function", "make", "(", "$", "data", "=", "null", ",", "$", "index", "=", "null", ",", "Closure", "$", "modifier", "=", "null", ")", "{", "if", "(", "$", "data", "instanceof", "Traversable", ")", "{", "$", "data", "=", "iterator_...
Convert array to entities @param array $data @param string $index Set the value in this key as index @param Closure $modifier Executed before the entity gets populated @return Entity|array
[ "Convert", "array", "to", "entities" ]
e6b1df5bd7b65c0c2513895afa533d441fc6d43b
https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L332-L366
20,026
magnus-eriksson/entity
src/Entity.php
Entity.arrayGet
protected function arrayGet(&$source, $key, $default = null) { if (!$key) { return $default; } if (array_key_exists($key, $source)) { return $source[$key]; } $current =& $source; foreach (explode('.', $key) as $segment) { if (!arr...
php
protected function arrayGet(&$source, $key, $default = null) { if (!$key) { return $default; } if (array_key_exists($key, $source)) { return $source[$key]; } $current =& $source; foreach (explode('.', $key) as $segment) { if (!arr...
[ "protected", "function", "arrayGet", "(", "&", "$", "source", ",", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "!", "$", "key", ")", "{", "return", "$", "default", ";", "}", "if", "(", "array_key_exists", "(", "$", "key", "...
Get a key value, using dot notation @param array &$source @param string $key @param mixed $default @return mixed
[ "Get", "a", "key", "value", "using", "dot", "notation" ]
e6b1df5bd7b65c0c2513895afa533d441fc6d43b
https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L392-L411
20,027
magnus-eriksson/entity
src/Entity.php
Entity.arrayHasKey
protected function arrayHasKey(&$source, $key) { if (!$key || !is_array($source)) { return false; } if (array_key_exists($key, $source)) { return true; } $current =& $source; foreach (explode('.', $key) as $segment) { if (!array_k...
php
protected function arrayHasKey(&$source, $key) { if (!$key || !is_array($source)) { return false; } if (array_key_exists($key, $source)) { return true; } $current =& $source; foreach (explode('.', $key) as $segment) { if (!array_k...
[ "protected", "function", "arrayHasKey", "(", "&", "$", "source", ",", "$", "key", ")", "{", "if", "(", "!", "$", "key", "||", "!", "is_array", "(", "$", "source", ")", ")", "{", "return", "false", ";", "}", "if", "(", "array_key_exists", "(", "$", ...
Check if a key exists, using dot notation @param array &$source @param string $key @return boolean
[ "Check", "if", "a", "key", "exists", "using", "dot", "notation" ]
e6b1df5bd7b65c0c2513895afa533d441fc6d43b
https://github.com/magnus-eriksson/entity/blob/e6b1df5bd7b65c0c2513895afa533d441fc6d43b/src/Entity.php#L422-L441
20,028
haldayne/boost
src/MapOfStrings.php
MapOfStrings.join
public function join($separator) { return $this->reduce( function ($joined, $string) use ($separator) { return ('' === $joined ? '' : $joined . $separator) . $string; }, '' ); }
php
public function join($separator) { return $this->reduce( function ($joined, $string) use ($separator) { return ('' === $joined ? '' : $joined . $separator) . $string; }, '' ); }
[ "public", "function", "join", "(", "$", "separator", ")", "{", "return", "$", "this", "->", "reduce", "(", "function", "(", "$", "joined", ",", "$", "string", ")", "use", "(", "$", "separator", ")", "{", "return", "(", "''", "===", "$", "joined", "...
Join all the strings in this map with the separator between them. @param string $separator @return string @api
[ "Join", "all", "the", "strings", "in", "this", "map", "with", "the", "separator", "between", "them", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/MapOfStrings.php#L17-L25
20,029
haldayne/boost
src/MapOfStrings.php
MapOfStrings.letter_frequency
public function letter_frequency() { return $this->transform( function ($frequencies, $word) { foreach (count_chars($word, 1) as $byte => $frequency) { $letter = chr($byte); if ($frequencies->has($letter)) { $frequen...
php
public function letter_frequency() { return $this->transform( function ($frequencies, $word) { foreach (count_chars($word, 1) as $byte => $frequency) { $letter = chr($byte); if ($frequencies->has($letter)) { $frequen...
[ "public", "function", "letter_frequency", "(", ")", "{", "return", "$", "this", "->", "transform", "(", "function", "(", "$", "frequencies", ",", "$", "word", ")", "{", "foreach", "(", "count_chars", "(", "$", "word", ",", "1", ")", "as", "$", "byte", ...
Calculate frequency of letters in all strings. Counts how many times each letter occurs within every string in this map. Returns a new Map of letter to number of occurrences. Only letters that appear will be in the resulting map. @return \Haldayne\Boost\MapOfIntegers @api
[ "Calculate", "frequency", "of", "letters", "in", "all", "strings", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/MapOfStrings.php#L37-L52
20,030
AymDev/PPRR
src/PPRR.php
PPRR.buildRegex
private static function buildRegex(string $expression, bool $is_prefix = false) : string { $regex = self::REGEX_DELIMITER . '^'; $regex .= preg_replace(array_keys(self::$datatypes), self::$datatypes, $expression); $regex .= $is_prefix ? '(.*)' : ''; $regex .= '$' . self::REGEX_DELIM...
php
private static function buildRegex(string $expression, bool $is_prefix = false) : string { $regex = self::REGEX_DELIMITER . '^'; $regex .= preg_replace(array_keys(self::$datatypes), self::$datatypes, $expression); $regex .= $is_prefix ? '(.*)' : ''; $regex .= '$' . self::REGEX_DELIM...
[ "private", "static", "function", "buildRegex", "(", "string", "$", "expression", ",", "bool", "$", "is_prefix", "=", "false", ")", ":", "string", "{", "$", "regex", "=", "self", "::", "REGEX_DELIMITER", ".", "'^'", ";", "$", "regex", ".=", "preg_replace", ...
Build a complete regular expression @param string $expression the route to evaluate @param bool $is_prefix is the route a route prefix @return string the complete regular expression
[ "Build", "a", "complete", "regular", "expression" ]
f14fc0a79c68a7f90891aa4a74986bdac1f59335
https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L63-L70
20,031
AymDev/PPRR
src/PPRR.php
PPRR.getParsingMode
private function getParsingMode(string &$route) : int { // Explicit regex mode if (strpos($route, 'R>') === 0) { $route = str_replace('R>', '', $route); return self::MODE_REGEX; } // Explicit string mode if (strpos($route, 'S>') === 0) { $r...
php
private function getParsingMode(string &$route) : int { // Explicit regex mode if (strpos($route, 'R>') === 0) { $route = str_replace('R>', '', $route); return self::MODE_REGEX; } // Explicit string mode if (strpos($route, 'S>') === 0) { $r...
[ "private", "function", "getParsingMode", "(", "string", "&", "$", "route", ")", ":", "int", "{", "// Explicit regex mode", "if", "(", "strpos", "(", "$", "route", ",", "'R>'", ")", "===", "0", ")", "{", "$", "route", "=", "str_replace", "(", "'R>'", ",...
Detect route parsing mode for specific route @param string &$route route to check @return int class constant mode
[ "Detect", "route", "parsing", "mode", "for", "specific", "route" ]
f14fc0a79c68a7f90891aa4a74986bdac1f59335
https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L83-L98
20,032
AymDev/PPRR
src/PPRR.php
PPRR.matchRoute
private function matchRoute(string $route, string $url, &$matches, $value = null) { switch ($this->getParsingMode($route)) { case self::MODE_REGEX: // Evaluate & remove first match (full route) $matched = preg_match(self::buildRegex($route, !is_null($value)), $...
php
private function matchRoute(string $route, string $url, &$matches, $value = null) { switch ($this->getParsingMode($route)) { case self::MODE_REGEX: // Evaluate & remove first match (full route) $matched = preg_match(self::buildRegex($route, !is_null($value)), $...
[ "private", "function", "matchRoute", "(", "string", "$", "route", ",", "string", "$", "url", ",", "&", "$", "matches", ",", "$", "value", "=", "null", ")", "{", "switch", "(", "$", "this", "->", "getParsingMode", "(", "$", "route", ")", ")", "{", "...
Match url against route @param string $route route to match against @param string $url url to test @param mixed &$matches variable to fill with matches @param mixed $value route value (sub routes or callback)
[ "Match", "url", "against", "route" ]
f14fc0a79c68a7f90891aa4a74986bdac1f59335
https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L111-L142
20,033
AymDev/PPRR
src/PPRR.php
PPRR.route
private function route() : void { // Parse route $parsed = $this->parseRoute(); // Run error controller when no route matched if (!$parsed && isset($this->error_controller)) { call_user_func($this->error_controller); } }
php
private function route() : void { // Parse route $parsed = $this->parseRoute(); // Run error controller when no route matched if (!$parsed && isset($this->error_controller)) { call_user_func($this->error_controller); } }
[ "private", "function", "route", "(", ")", ":", "void", "{", "// Parse route", "$", "parsed", "=", "$", "this", "->", "parseRoute", "(", ")", ";", "// Run error controller when no route matched", "if", "(", "!", "$", "parsed", "&&", "isset", "(", "$", "this",...
Try to parse routes or call the error controller @return void
[ "Try", "to", "parse", "routes", "or", "call", "the", "error", "controller" ]
f14fc0a79c68a7f90891aa4a74986bdac1f59335
https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L153-L162
20,034
AymDev/PPRR
src/PPRR.php
PPRR.setDefaultMode
public static function setDefaultMode(int $mode) : void { if (in_array($mode, [self::MODE_REGEX, self::MODE_STRING])) { self::$mode = $mode; return; } // Unknown mode throw new \UnexpectedValueException('Invalid route mode'); }
php
public static function setDefaultMode(int $mode) : void { if (in_array($mode, [self::MODE_REGEX, self::MODE_STRING])) { self::$mode = $mode; return; } // Unknown mode throw new \UnexpectedValueException('Invalid route mode'); }
[ "public", "static", "function", "setDefaultMode", "(", "int", "$", "mode", ")", ":", "void", "{", "if", "(", "in_array", "(", "$", "mode", ",", "[", "self", "::", "MODE_REGEX", ",", "self", "::", "MODE_STRING", "]", ")", ")", "{", "self", "::", "$", ...
Set the route parsing mode @param int $mode a class MODE_* constant @return void @throws \UnexpectedValueException for unknown modes
[ "Set", "the", "route", "parsing", "mode" ]
f14fc0a79c68a7f90891aa4a74986bdac1f59335
https://github.com/AymDev/PPRR/blob/f14fc0a79c68a7f90891aa4a74986bdac1f59335/src/PPRR.php#L262-L271
20,035
cohesion/cohesion-core
src/Util/Autoloader.php
Autoloader.addClassPath
public function addClassPath($path) { if(!is_array($path)) { $path = array($path); } foreach($path as $item) { $this->classPaths[] = $item; } }
php
public function addClassPath($path) { if(!is_array($path)) { $path = array($path); } foreach($path as $item) { $this->classPaths[] = $item; } }
[ "public", "function", "addClassPath", "(", "$", "path", ")", "{", "if", "(", "!", "is_array", "(", "$", "path", ")", ")", "{", "$", "path", "=", "array", "(", "$", "path", ")", ";", "}", "foreach", "(", "$", "path", "as", "$", "item", ")", "{",...
Adds a path to search in when looking for a class. @param string $path @return void
[ "Adds", "a", "path", "to", "search", "in", "when", "looking", "for", "a", "class", "." ]
c6352aef7336e06285f0943da68235dc45523998
https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Util/Autoloader.php#L96-L103
20,036
cohesion/cohesion-core
src/Util/Autoloader.php
Autoloader.loadClass
public function loadClass($className) { $cache = $this->getCache(); $entries = $cache->load($this->cacheKey); if($entries == false) { $entries = array(); } $status = $this->tryAndLoadClass($className, $entries); if($status) { // class loaded ...
php
public function loadClass($className) { $cache = $this->getCache(); $entries = $cache->load($this->cacheKey); if($entries == false) { $entries = array(); } $status = $this->tryAndLoadClass($className, $entries); if($status) { // class loaded ...
[ "public", "function", "loadClass", "(", "$", "className", ")", "{", "$", "cache", "=", "$", "this", "->", "getCache", "(", ")", ";", "$", "entries", "=", "$", "cache", "->", "load", "(", "$", "this", "->", "cacheKey", ")", ";", "if", "(", "$", "e...
Returns true if the class file was found and included, false if not. @return boolean
[ "Returns", "true", "if", "the", "class", "file", "was", "found", "and", "included", "false", "if", "not", "." ]
c6352aef7336e06285f0943da68235dc45523998
https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Util/Autoloader.php#L179-L205
20,037
titon/db
src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php
AbstractPdoDialect.buildCreateIndex
public function buildCreateIndex(Query $query) { return $this->renderStatement(Query::CREATE_INDEX, [ 'index' => $this->formatTable($query->getAlias()), 'table' => $this->formatTable($query->getTable()), 'fields' => $this->formatFields($query) ] + $this->formatAttribu...
php
public function buildCreateIndex(Query $query) { return $this->renderStatement(Query::CREATE_INDEX, [ 'index' => $this->formatTable($query->getAlias()), 'table' => $this->formatTable($query->getTable()), 'fields' => $this->formatFields($query) ] + $this->formatAttribu...
[ "public", "function", "buildCreateIndex", "(", "Query", "$", "query", ")", "{", "return", "$", "this", "->", "renderStatement", "(", "Query", "::", "CREATE_INDEX", ",", "[", "'index'", "=>", "$", "this", "->", "formatTable", "(", "$", "query", "->", "getAl...
Build the CREATE INDEX query. @param \Titon\Db\Query $query @return string
[ "Build", "the", "CREATE", "INDEX", "query", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L26-L32
20,038
titon/db
src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php
AbstractPdoDialect.buildCreateTable
public function buildCreateTable(Query $query) { $schema = $query->getSchema(); if (!$schema) { throw new InvalidSchemaException('Table creation requires a valid schema object'); } return $this->renderStatement(Query::CREATE_TABLE, [ 'table' => $this->formatTabl...
php
public function buildCreateTable(Query $query) { $schema = $query->getSchema(); if (!$schema) { throw new InvalidSchemaException('Table creation requires a valid schema object'); } return $this->renderStatement(Query::CREATE_TABLE, [ 'table' => $this->formatTabl...
[ "public", "function", "buildCreateTable", "(", "Query", "$", "query", ")", "{", "$", "schema", "=", "$", "query", "->", "getSchema", "(", ")", ";", "if", "(", "!", "$", "schema", ")", "{", "throw", "new", "InvalidSchemaException", "(", "'Table creation req...
Build the CREATE TABLE query. Requires a table schema object. @param \Titon\Db\Query $query @return string @throws \Titon\Db\Exception\InvalidSchemaException
[ "Build", "the", "CREATE", "TABLE", "query", ".", "Requires", "a", "table", "schema", "object", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L41-L54
20,039
titon/db
src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php
AbstractPdoDialect.buildDelete
public function buildDelete(Query $query) { return $this->renderStatement(Query::DELETE, [ 'table' => $this->formatTable($query->getTable(), $query->getAlias()), 'joins' => $this->formatJoins($query->getJoins()), 'where' => $this->formatWhere($query->getWhere()), ...
php
public function buildDelete(Query $query) { return $this->renderStatement(Query::DELETE, [ 'table' => $this->formatTable($query->getTable(), $query->getAlias()), 'joins' => $this->formatJoins($query->getJoins()), 'where' => $this->formatWhere($query->getWhere()), ...
[ "public", "function", "buildDelete", "(", "Query", "$", "query", ")", "{", "return", "$", "this", "->", "renderStatement", "(", "Query", "::", "DELETE", ",", "[", "'table'", "=>", "$", "this", "->", "formatTable", "(", "$", "query", "->", "getTable", "("...
Build the DELETE query. @param \Titon\Db\Query $query @return string
[ "Build", "the", "DELETE", "query", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L62-L70
20,040
titon/db
src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php
AbstractPdoDialect.buildDropIndex
public function buildDropIndex(Query $query) { return $this->renderStatement(Query::DROP_INDEX, [ 'index' => $this->formatTable($query->getAlias()), 'table' => $this->formatTable($query->getTable()) ] + $this->formatAttributes($query->getAttributes())); }
php
public function buildDropIndex(Query $query) { return $this->renderStatement(Query::DROP_INDEX, [ 'index' => $this->formatTable($query->getAlias()), 'table' => $this->formatTable($query->getTable()) ] + $this->formatAttributes($query->getAttributes())); }
[ "public", "function", "buildDropIndex", "(", "Query", "$", "query", ")", "{", "return", "$", "this", "->", "renderStatement", "(", "Query", "::", "DROP_INDEX", ",", "[", "'index'", "=>", "$", "this", "->", "formatTable", "(", "$", "query", "->", "getAlias"...
Build the DROP INDEX query. @param \Titon\Db\Query $query @return string
[ "Build", "the", "DROP", "INDEX", "query", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L78-L83
20,041
titon/db
src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php
AbstractPdoDialect.buildDropTable
public function buildDropTable(Query $query) { return $this->renderStatement(Query::DROP_TABLE, [ 'table' => $this->formatTable($query->getTable()) ] + $this->formatAttributes($query->getAttributes())); }
php
public function buildDropTable(Query $query) { return $this->renderStatement(Query::DROP_TABLE, [ 'table' => $this->formatTable($query->getTable()) ] + $this->formatAttributes($query->getAttributes())); }
[ "public", "function", "buildDropTable", "(", "Query", "$", "query", ")", "{", "return", "$", "this", "->", "renderStatement", "(", "Query", "::", "DROP_TABLE", ",", "[", "'table'", "=>", "$", "this", "->", "formatTable", "(", "$", "query", "->", "getTable"...
Build the DROP TABLE query. @param \Titon\Db\Query $query @return string
[ "Build", "the", "DROP", "TABLE", "query", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L91-L95
20,042
titon/db
src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php
AbstractPdoDialect.buildMultiInsert
public function buildMultiInsert(Query $query) { return $this->renderStatement(Query::INSERT, [ 'table' => $this->formatTable($query->getTable()), 'fields' => $this->formatFields($query), 'values' => $this->formatValues($query) ] + $this->formatAttributes($query->getA...
php
public function buildMultiInsert(Query $query) { return $this->renderStatement(Query::INSERT, [ 'table' => $this->formatTable($query->getTable()), 'fields' => $this->formatFields($query), 'values' => $this->formatValues($query) ] + $this->formatAttributes($query->getA...
[ "public", "function", "buildMultiInsert", "(", "Query", "$", "query", ")", "{", "return", "$", "this", "->", "renderStatement", "(", "Query", "::", "INSERT", ",", "[", "'table'", "=>", "$", "this", "->", "formatTable", "(", "$", "query", "->", "getTable", ...
Build the INSERT query with multiple record support. @param \Titon\Db\Query $query @return string
[ "Build", "the", "INSERT", "query", "with", "multiple", "record", "support", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L117-L123
20,043
titon/db
src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php
AbstractPdoDialect.buildSelect
public function buildSelect(Query $query) { return $this->renderStatement(Query::SELECT, [ 'fields' => $this->formatFields($query), 'table' => $this->formatTable($query->getTable(), $query->getAlias()), 'joins' => $this->formatJoins($query->getJoins()), 'where' =>...
php
public function buildSelect(Query $query) { return $this->renderStatement(Query::SELECT, [ 'fields' => $this->formatFields($query), 'table' => $this->formatTable($query->getTable(), $query->getAlias()), 'joins' => $this->formatJoins($query->getJoins()), 'where' =>...
[ "public", "function", "buildSelect", "(", "Query", "$", "query", ")", "{", "return", "$", "this", "->", "renderStatement", "(", "Query", "::", "SELECT", ",", "[", "'fields'", "=>", "$", "this", "->", "formatFields", "(", "$", "query", ")", ",", "'table'"...
Build the SELECT query. @param \Titon\Db\Query $query @return string
[ "Build", "the", "SELECT", "query", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L131-L143
20,044
titon/db
src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php
AbstractPdoDialect.buildTruncate
public function buildTruncate(Query $query) { return $this->renderStatement(Query::TRUNCATE, [ 'table' => $this->formatTable($query->getTable()) ] + $this->formatAttributes($query->getAttributes())); }
php
public function buildTruncate(Query $query) { return $this->renderStatement(Query::TRUNCATE, [ 'table' => $this->formatTable($query->getTable()) ] + $this->formatAttributes($query->getAttributes())); }
[ "public", "function", "buildTruncate", "(", "Query", "$", "query", ")", "{", "return", "$", "this", "->", "renderStatement", "(", "Query", "::", "TRUNCATE", ",", "[", "'table'", "=>", "$", "this", "->", "formatTable", "(", "$", "query", "->", "getTable", ...
Build the TRUNCATE query. @param \Titon\Db\Query $query @return string
[ "Build", "the", "TRUNCATE", "query", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L151-L155
20,045
titon/db
src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php
AbstractPdoDialect.buildUpdate
public function buildUpdate(Query $query) { return $this->renderStatement(Query::UPDATE, [ 'fields' => $this->formatFields($query), 'table' => $this->formatTable($query->getTable(), $query->getAlias()), 'joins' => $this->formatJoins($query->getJoins()), 'where' =>...
php
public function buildUpdate(Query $query) { return $this->renderStatement(Query::UPDATE, [ 'fields' => $this->formatFields($query), 'table' => $this->formatTable($query->getTable(), $query->getAlias()), 'joins' => $this->formatJoins($query->getJoins()), 'where' =>...
[ "public", "function", "buildUpdate", "(", "Query", "$", "query", ")", "{", "return", "$", "this", "->", "renderStatement", "(", "Query", "::", "UPDATE", ",", "[", "'fields'", "=>", "$", "this", "->", "formatFields", "(", "$", "query", ")", ",", "'table'"...
Build the UPDATE query. @param \Titon\Db\Query $query @return string
[ "Build", "the", "UPDATE", "query", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/AbstractPdoDialect.php#L163-L172
20,046
php-rise/rise
src/Template/Blocks/Block.php
Block.extend
public function extend($template, $data = [], $paramName = 'body') { $this->extendedTemplate = $this->resolveTemplatePath($template); if (is_array($data)) { $this->extendedData = $data; } if (is_string($paramName) && $paramName) { $this->extendedParamName = $paramName; } }
php
public function extend($template, $data = [], $paramName = 'body') { $this->extendedTemplate = $this->resolveTemplatePath($template); if (is_array($data)) { $this->extendedData = $data; } if (is_string($paramName) && $paramName) { $this->extendedParamName = $paramName; } }
[ "public", "function", "extend", "(", "$", "template", ",", "$", "data", "=", "[", "]", ",", "$", "paramName", "=", "'body'", ")", "{", "$", "this", "->", "extendedTemplate", "=", "$", "this", "->", "resolveTemplatePath", "(", "$", "template", ")", ";",...
Set extended template and data. @param string $template @param array $data Optional. @param string $paramName Optional. Variable name of the variable storing the content of this block, default to "body".
[ "Set", "extended", "template", "and", "data", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L111-L119
20,047
php-rise/rise
src/Template/Blocks/Block.php
Block.translate
public function translate($key, $defaultValue = '', $locale = null) { return $this->translation->translate($key, $defaultValue, $locale); }
php
public function translate($key, $defaultValue = '', $locale = null) { return $this->translation->translate($key, $defaultValue, $locale); }
[ "public", "function", "translate", "(", "$", "key", ",", "$", "defaultValue", "=", "''", ",", "$", "locale", "=", "null", ")", "{", "return", "$", "this", "->", "translation", "->", "translate", "(", "$", "key", ",", "$", "defaultValue", ",", "$", "l...
Helper function for translation. @param string $key @param string $defaultValue @param string $locale @return string
[ "Helper", "function", "for", "translation", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L176-L178
20,048
php-rise/rise
src/Template/Blocks/Block.php
Block.resolveTemplatePath
protected function resolveTemplatePath($path) { switch ($path[0]) { case '/': break; case '.': $path = realpath(dirname($this->template) . '/' . $path . '.phtml'); break; default: $path = realpath($this->pathService->getTemplatesPath() . '/' . $path . '.phtml'); break; } if ($path === false)...
php
protected function resolveTemplatePath($path) { switch ($path[0]) { case '/': break; case '.': $path = realpath(dirname($this->template) . '/' . $path . '.phtml'); break; default: $path = realpath($this->pathService->getTemplatesPath() . '/' . $path . '.phtml'); break; } if ($path === false)...
[ "protected", "function", "resolveTemplatePath", "(", "$", "path", ")", "{", "switch", "(", "$", "path", "[", "0", "]", ")", "{", "case", "'/'", ":", "break", ";", "case", "'.'", ":", "$", "path", "=", "realpath", "(", "dirname", "(", "$", "this", "...
Resolve template path. @param string $path @return string
[ "Resolve", "template", "path", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L222-L239
20,049
php-rise/rise
src/Template/Blocks/Block.php
Block.renderToHtml
protected function renderToHtml() { extract($this->data, EXTR_SKIP); ob_start(); set_error_handler([$this, 'handleError']); include $this->template; restore_error_handler(); $html = ob_get_clean(); return $html; }
php
protected function renderToHtml() { extract($this->data, EXTR_SKIP); ob_start(); set_error_handler([$this, 'handleError']); include $this->template; restore_error_handler(); $html = ob_get_clean(); return $html; }
[ "protected", "function", "renderToHtml", "(", ")", "{", "extract", "(", "$", "this", "->", "data", ",", "EXTR_SKIP", ")", ";", "ob_start", "(", ")", ";", "set_error_handler", "(", "[", "$", "this", ",", "'handleError'", "]", ")", ";", "include", "$", "...
Render this block to HTML string. @return string
[ "Render", "this", "block", "to", "HTML", "string", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template/Blocks/Block.php#L246-L254
20,050
Ocramius/OcraDiCompiler
src/OcraDiCompiler/Generator/DiProxyGenerator.php
DiProxyGenerator.normalizeAlias
protected function normalizeAlias($alias) { $normalized = preg_replace('/[^a-zA-Z0-9]/', ' ', $alias); $normalized = 'new' . str_replace(' ', '', ucwords($normalized)); return $normalized; }
php
protected function normalizeAlias($alias) { $normalized = preg_replace('/[^a-zA-Z0-9]/', ' ', $alias); $normalized = 'new' . str_replace(' ', '', ucwords($normalized)); return $normalized; }
[ "protected", "function", "normalizeAlias", "(", "$", "alias", ")", "{", "$", "normalized", "=", "preg_replace", "(", "'/[^a-zA-Z0-9]/'", ",", "' '", ",", "$", "alias", ")", ";", "$", "normalized", "=", "'new'", ".", "str_replace", "(", "' '", ",", "''", ...
Normalize an alias to a new instance method name @param string $alias @return string
[ "Normalize", "an", "alias", "to", "a", "new", "instance", "method", "name" ]
667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a
https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Generator/DiProxyGenerator.php#L375-L380
20,051
steeffeen/FancyManiaLinks
FML/Stylesheet/Style.php
Style.addStyleId
public function addStyleId($styleId) { $styleId = (string)$styleId; if (!in_array($styleId, $this->styleIds)) { array_push($this->styleIds, $styleId); } return $this; }
php
public function addStyleId($styleId) { $styleId = (string)$styleId; if (!in_array($styleId, $this->styleIds)) { array_push($this->styleIds, $styleId); } return $this; }
[ "public", "function", "addStyleId", "(", "$", "styleId", ")", "{", "$", "styleId", "=", "(", "string", ")", "$", "styleId", ";", "if", "(", "!", "in_array", "(", "$", "styleId", ",", "$", "this", "->", "styleIds", ")", ")", "{", "array_push", "(", ...
Add style Id @api @param string $styleId Style Id @return static
[ "Add", "style", "Id" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Style.php#L114-L121
20,052
steeffeen/FancyManiaLinks
FML/Stylesheet/Style.php
Style.addStyleClass
public function addStyleClass($styleClass) { $styleClass = (string)$styleClass; if (!in_array($styleClass, $this->styleClasses)) { array_push($this->styleClasses, $styleClass); } return $this; }
php
public function addStyleClass($styleClass) { $styleClass = (string)$styleClass; if (!in_array($styleClass, $this->styleClasses)) { array_push($this->styleClasses, $styleClass); } return $this; }
[ "public", "function", "addStyleClass", "(", "$", "styleClass", ")", "{", "$", "styleClass", "=", "(", "string", ")", "$", "styleClass", ";", "if", "(", "!", "in_array", "(", "$", "styleClass", ",", "$", "this", "->", "styleClasses", ")", ")", "{", "arr...
Add style class @api @param string $styleClass Style class @return static
[ "Add", "style", "class" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Stylesheet/Style.php#L193-L200
20,053
webforge-labs/psc-cms
lib/Psc/Doctrine/CollectionSynchronizer.php
CollectionSynchronizer.init
public function init(Entity $entity, Closure $adder = NULL, Closure $remover = NULL) { parent::init($entity); list($add, $remove) = $this->getRelationInterface(); if (!$adder) { $adder = function ($entity, $toEntity, $repository) use ($add) { $repository->persist($toEntity); ...
php
public function init(Entity $entity, Closure $adder = NULL, Closure $remover = NULL) { parent::init($entity); list($add, $remove) = $this->getRelationInterface(); if (!$adder) { $adder = function ($entity, $toEntity, $repository) use ($add) { $repository->persist($toEntity); ...
[ "public", "function", "init", "(", "Entity", "$", "entity", ",", "Closure", "$", "adder", "=", "NULL", ",", "Closure", "$", "remover", "=", "NULL", ")", "{", "parent", "::", "init", "(", "$", "entity", ")", ";", "list", "(", "$", "add", ",", "$", ...
Kompiliert den Synchronizer und initialisiert wenn angegeben $add angegben wird, wird diese Closure mit $entity (der Parameter der init() Funktion) und $otherEntity aufgerufen bei $add ist $otherEntity ein Entity aus der $toCollection welches nicht in der $fromColleciton ist bei $remove ist $otherEntity ein Entity aus...
[ "Kompiliert", "den", "Synchronizer", "und", "initialisiert" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/CollectionSynchronizer.php#L51-L89
20,054
maniaplanet/maniaplanet-ws-sdk
libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php
ServerPublisher.postPublicNotification
function postPublicNotification($message, $link = null, $iconStyle = null, $iconSubstyle = null, $titleIdString = null, $mediaURL = null, $group = null) { $n = new Notification(); $n->senderName = (object) array('serverLogin' => $this->serverLogin); $n->message = $message; $n->link = $link; $n->iconStyle = $...
php
function postPublicNotification($message, $link = null, $iconStyle = null, $iconSubstyle = null, $titleIdString = null, $mediaURL = null, $group = null) { $n = new Notification(); $n->senderName = (object) array('serverLogin' => $this->serverLogin); $n->message = $message; $n->link = $link; $n->iconStyle = $...
[ "function", "postPublicNotification", "(", "$", "message", ",", "$", "link", "=", "null", ",", "$", "iconStyle", "=", "null", ",", "$", "iconSubstyle", "=", "null", ",", "$", "titleIdString", "=", "null", ",", "$", "mediaURL", "=", "null", ",", "$", "g...
Send a public notification to every player that bookmarked your server. @param string $message The message itself. If you send a public notification to a player, the message will be prepended with its nickname. Max length is 255 chars, you can use Maniaplanet special chars. @param string $link Link when the player cli...
[ "Send", "a", "public", "notification", "to", "every", "player", "that", "bookmarked", "your", "server", "." ]
027a458388035fe66f2f56ff3ea1f85eff2a5a4e
https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php#L48-L60
20,055
maniaplanet/maniaplanet-ws-sdk
libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php
ServerPublisher.postPrivateEvent
function postPrivateEvent($message, $eventDate, $receiverName, $link = null, $titleIdString = null, $mediaURL = null) { $e = new Event(); $n->senderName = (object) array('serverLogin' => $this->serverLogin); $e->message = $message; $e->link = $link; $e->receiverName = $receiverName; $e->eventDate = $eventD...
php
function postPrivateEvent($message, $eventDate, $receiverName, $link = null, $titleIdString = null, $mediaURL = null) { $e = new Event(); $n->senderName = (object) array('serverLogin' => $this->serverLogin); $e->message = $message; $e->link = $link; $e->receiverName = $receiverName; $e->eventDate = $eventD...
[ "function", "postPrivateEvent", "(", "$", "message", ",", "$", "eventDate", ",", "$", "receiverName", ",", "$", "link", "=", "null", ",", "$", "titleIdString", "=", "null", ",", "$", "mediaURL", "=", "null", ")", "{", "$", "e", "=", "new", "Event", "...
Create an event visible only by the receivers. To create an event for many players just give an array of login as receiverName. @param string $message The message itself. If you send a public notification to a player, the message will be prepended with its nickname. Max length is 255 chars, you can use Maniaplanet spe...
[ "Create", "an", "event", "visible", "only", "by", "the", "receivers", ".", "To", "create", "an", "event", "for", "many", "players", "just", "give", "an", "array", "of", "login", "as", "receiverName", "." ]
027a458388035fe66f2f56ff3ea1f85eff2a5a4e
https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php#L127-L139
20,056
maniaplanet/maniaplanet-ws-sdk
libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php
ServerPublisher.postPublicEvent
function postPublicEvent($message, $eventDate, $link = null, $titleIdString = null, $mediaURL = null) { $e = new Event(); $n->senderName = (object) array('serverLogin' => $this->serverLogin); $e->message = $message; $e->link = $link; $e->eventDate = $eventDate; $n->titleId = $titleIdString; $n->mediaURL ...
php
function postPublicEvent($message, $eventDate, $link = null, $titleIdString = null, $mediaURL = null) { $e = new Event(); $n->senderName = (object) array('serverLogin' => $this->serverLogin); $e->message = $message; $e->link = $link; $e->eventDate = $eventDate; $n->titleId = $titleIdString; $n->mediaURL ...
[ "function", "postPublicEvent", "(", "$", "message", ",", "$", "eventDate", ",", "$", "link", "=", "null", ",", "$", "titleIdString", "=", "null", ",", "$", "mediaURL", "=", "null", ")", "{", "$", "e", "=", "new", "Event", "(", ")", ";", "$", "n", ...
Create an event visible by all players who bookmarked your server @param string $message The message itself. If you send a public notification to a player, the @param string message will be prepended with its nickname. Max length is 255 chars, you can use Maniaplanet special chars. @param int $eventDate The UNIX Timest...
[ "Create", "an", "event", "visible", "by", "all", "players", "who", "bookmarked", "your", "server" ]
027a458388035fe66f2f56ff3ea1f85eff2a5a4e
https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome/ServerPublisher.php#L150-L160
20,057
devmobgroup/postcodes
src/Util/Uri.php
Uri.create
public static function create(string $baseUri, array $query = []): string { if (count($query) === 0) { return $baseUri; } return sprintf('%s/?%s', $baseUri, http_build_query($query)); }
php
public static function create(string $baseUri, array $query = []): string { if (count($query) === 0) { return $baseUri; } return sprintf('%s/?%s', $baseUri, http_build_query($query)); }
[ "public", "static", "function", "create", "(", "string", "$", "baseUri", ",", "array", "$", "query", "=", "[", "]", ")", ":", "string", "{", "if", "(", "count", "(", "$", "query", ")", "===", "0", ")", "{", "return", "$", "baseUri", ";", "}", "re...
Create request url based on base uri and request parameters. @param string $baseUri @param array $query @return string
[ "Create", "request", "url", "based", "on", "base", "uri", "and", "request", "parameters", "." ]
1a8438fd960a8f50ec28d61af94560892b529f12
https://github.com/devmobgroup/postcodes/blob/1a8438fd960a8f50ec28d61af94560892b529f12/src/Util/Uri.php#L14-L21
20,058
CakeCMS/Core
src/View/Helper/FormHelper.php
FormHelper.switcher
public function switcher($fieldName, array $options = []) { $input = parent::checkbox($fieldName, $options); if ($this->getConfig('materializeCss', false) === false) { return $input; } $options += [ 'before' => __d('backend', 'Off'), 'after' => ...
php
public function switcher($fieldName, array $options = []) { $input = parent::checkbox($fieldName, $options); if ($this->getConfig('materializeCss', false) === false) { return $input; } $options += [ 'before' => __d('backend', 'Off'), 'after' => ...
[ "public", "function", "switcher", "(", "$", "fieldName", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "input", "=", "parent", "::", "checkbox", "(", "$", "fieldName", ",", "$", "options", ")", ";", "if", "(", "$", "this", "->", "getC...
Form switcher. @param string $fieldName @param array $options @return string
[ "Form", "switcher", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L147-L175
20,059
CakeCMS/Core
src/View/Helper/FormHelper.php
FormHelper.create
public function create($model = null, array $options = []) { $options += ['process' => false, 'jsForm' => false]; $options = $this->addClass($options, $this->_class('form')); $isProcess = $options['process']; if ($isProcess !== false) { $_options = [ 'ur...
php
public function create($model = null, array $options = []) { $options += ['process' => false, 'jsForm' => false]; $options = $this->addClass($options, $this->_class('form')); $isProcess = $options['process']; if ($isProcess !== false) { $_options = [ 'ur...
[ "public", "function", "create", "(", "$", "model", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "[", "'process'", "=>", "false", ",", "'jsForm'", "=>", "false", "]", ";", "$", "options", "=", "$", "this"...
Create html form. @param mixed $model @param array $options @return string
[ "Create", "html", "form", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L212-L241
20,060
CakeCMS/Core
src/View/Helper/FormHelper.php
FormHelper.end
public function end(array $secureAttributes = []) { if ($this->_isJsForm) { return implode('', [ $this->hidden('action', ['value' => '', 'class' => 'jsFormAction']), parent::end($secureAttributes) ]); } return parent::end($secureAttrib...
php
public function end(array $secureAttributes = []) { if ($this->_isJsForm) { return implode('', [ $this->hidden('action', ['value' => '', 'class' => 'jsFormAction']), parent::end($secureAttributes) ]); } return parent::end($secureAttrib...
[ "public", "function", "end", "(", "array", "$", "secureAttributes", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "_isJsForm", ")", "{", "return", "implode", "(", "''", ",", "[", "$", "this", "->", "hidden", "(", "'action'", ",", "[", "'va...
End html form. @param array $secureAttributes @return string
[ "End", "html", "form", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L249-L259
20,061
CakeCMS/Core
src/View/Helper/FormHelper.php
FormHelper._addDefaultContextProviders
protected function _addDefaultContextProviders() { $this->addContextProvider('orm', function ($request, $data) { if (is_array($data['entity']) || $data['entity'] instanceof \Traversable) { $pass = (new Collection($data['entity']))->first() !== null; if ($pass) { ...
php
protected function _addDefaultContextProviders() { $this->addContextProvider('orm', function ($request, $data) { if (is_array($data['entity']) || $data['entity'] instanceof \Traversable) { $pass = (new Collection($data['entity']))->first() !== null; if ($pass) { ...
[ "protected", "function", "_addDefaultContextProviders", "(", ")", "{", "$", "this", "->", "addContextProvider", "(", "'orm'", ",", "function", "(", "$", "request", ",", "$", "data", ")", "{", "if", "(", "is_array", "(", "$", "data", "[", "'entity'", "]", ...
Add the default suite of context providers provided. @return void
[ "Add", "the", "default", "suite", "of", "context", "providers", "provided", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L278-L293
20,062
CakeCMS/Core
src/View/Helper/FormHelper.php
FormHelper._addEntityContent
protected function _addEntityContent($request, $data) { if ($data['entity'] instanceof EntityInterface) { return new EntityContext($request, $data); } if (is_array($data['entity']) && empty($data['entity']['schema'])) { return new EntityContext($request, $data); ...
php
protected function _addEntityContent($request, $data) { if ($data['entity'] instanceof EntityInterface) { return new EntityContext($request, $data); } if (is_array($data['entity']) && empty($data['entity']['schema'])) { return new EntityContext($request, $data); ...
[ "protected", "function", "_addEntityContent", "(", "$", "request", ",", "$", "data", ")", "{", "if", "(", "$", "data", "[", "'entity'", "]", "instanceof", "EntityInterface", ")", "{", "return", "new", "EntityContext", "(", "$", "request", ",", "$", "data",...
Add the entity suite of context providers provided. @param $request @param $data @return EntityContext
[ "Add", "the", "entity", "suite", "of", "context", "providers", "provided", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L330-L339
20,063
CakeCMS/Core
src/View/Helper/FormHelper.php
FormHelper._addFormArrayProvider
protected function _addFormArrayProvider() { $this->addContextProvider('array', function ($request, $data) { if (is_array($data['entity']) && isset($data['entity']['schema'])) { return new ArrayContext($request, $data['entity']); } }); }
php
protected function _addFormArrayProvider() { $this->addContextProvider('array', function ($request, $data) { if (is_array($data['entity']) && isset($data['entity']['schema'])) { return new ArrayContext($request, $data['entity']); } }); }
[ "protected", "function", "_addFormArrayProvider", "(", ")", "{", "$", "this", "->", "addContextProvider", "(", "'array'", ",", "function", "(", "$", "request", ",", "$", "data", ")", "{", "if", "(", "is_array", "(", "$", "data", "[", "'entity'", "]", ")"...
Add the array suite of context providers provided. @return void
[ "Add", "the", "array", "suite", "of", "context", "providers", "provided", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L346-L353
20,064
CakeCMS/Core
src/View/Helper/FormHelper.php
FormHelper._addFormContextProvider
protected function _addFormContextProvider() { $this->addContextProvider('form', function ($request, $data) { if ($data['entity'] instanceof Form) { return new FormContext($request, $data); } }); }
php
protected function _addFormContextProvider() { $this->addContextProvider('form', function ($request, $data) { if ($data['entity'] instanceof Form) { return new FormContext($request, $data); } }); }
[ "protected", "function", "_addFormContextProvider", "(", ")", "{", "$", "this", "->", "addContextProvider", "(", "'form'", ",", "function", "(", "$", "request", ",", "$", "data", ")", "{", "if", "(", "$", "data", "[", "'entity'", "]", "instanceof", "Form",...
Add the form suite of context providers provided. @return void
[ "Add", "the", "form", "suite", "of", "context", "providers", "provided", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FormHelper.php#L360-L367
20,065
basarevych/task-daemon
library/TaskDaemon/TaskDaemon.php
TaskDaemon.defineTask
public function defineTask($name, $object) { $options = static::getOptions(); $debug = @$options['debug'] === true; if ($this->started) throw new \Exception("Define tasks before start()ing the daemon not after"); if (! $object instanceof AbstractTask) throw ...
php
public function defineTask($name, $object) { $options = static::getOptions(); $debug = @$options['debug'] === true; if ($this->started) throw new \Exception("Define tasks before start()ing the daemon not after"); if (! $object instanceof AbstractTask) throw ...
[ "public", "function", "defineTask", "(", "$", "name", ",", "$", "object", ")", "{", "$", "options", "=", "static", "::", "getOptions", "(", ")", ";", "$", "debug", "=", "@", "$", "options", "[", "'debug'", "]", "===", "true", ";", "if", "(", "$", ...
Add task to the list of known tasks @param string $name @param AbstractTask $object @return TaskDaemon
[ "Add", "task", "to", "the", "list", "of", "known", "tasks" ]
d8084e414d87cabe3c3066902da625c6f0ba770b
https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L94-L112
20,066
basarevych/task-daemon
library/TaskDaemon/TaskDaemon.php
TaskDaemon.runTask
public function runTask($name, $data = null, $allowDuplicates = false) { $options = static::getOptions(); $debug = @$options['debug'] === true; if ($debug) echo "==> Trying to run task: $name" . PHP_EOL; $function = $options['namespace'] . '-' . $name; $data = j...
php
public function runTask($name, $data = null, $allowDuplicates = false) { $options = static::getOptions(); $debug = @$options['debug'] === true; if ($debug) echo "==> Trying to run task: $name" . PHP_EOL; $function = $options['namespace'] . '-' . $name; $data = j...
[ "public", "function", "runTask", "(", "$", "name", ",", "$", "data", "=", "null", ",", "$", "allowDuplicates", "=", "false", ")", "{", "$", "options", "=", "static", "::", "getOptions", "(", ")", ";", "$", "debug", "=", "@", "$", "options", "[", "'...
Add known task to the run queue @param string $name @param mixed $data @param boolean $allowDuplicates @return TaskDaemon
[ "Add", "known", "task", "to", "the", "run", "queue" ]
d8084e414d87cabe3c3066902da625c6f0ba770b
https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L122-L146
20,067
basarevych/task-daemon
library/TaskDaemon/TaskDaemon.php
TaskDaemon.ping
public function ping() { $options = static::getOptions(); $debug = @$options['debug'] === true; $gmClient = new GearmanClient(); $gmClient->addServer($options['gearman']['host'], $options['gearman']['port']); $ping = $gmClient->ping(self::generateUnique()); if ($de...
php
public function ping() { $options = static::getOptions(); $debug = @$options['debug'] === true; $gmClient = new GearmanClient(); $gmClient->addServer($options['gearman']['host'], $options['gearman']['port']); $ping = $gmClient->ping(self::generateUnique()); if ($de...
[ "public", "function", "ping", "(", ")", "{", "$", "options", "=", "static", "::", "getOptions", "(", ")", ";", "$", "debug", "=", "@", "$", "options", "[", "'debug'", "]", "===", "true", ";", "$", "gmClient", "=", "new", "GearmanClient", "(", ")", ...
Ping job servers @return TaskDaemon
[ "Ping", "job", "servers" ]
d8084e414d87cabe3c3066902da625c6f0ba770b
https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L153-L171
20,068
basarevych/task-daemon
library/TaskDaemon/TaskDaemon.php
TaskDaemon.getPid
public function getPid() { $options = static::getOptions(); $debug = @$options['debug'] === true; $pidFile = $options['pid_file']; if (!$pidFile) throw new \Exception("No pid_file in the config"); $fpPid = fopen($pidFile, "c"); if (!$fpPid) t...
php
public function getPid() { $options = static::getOptions(); $debug = @$options['debug'] === true; $pidFile = $options['pid_file']; if (!$pidFile) throw new \Exception("No pid_file in the config"); $fpPid = fopen($pidFile, "c"); if (!$fpPid) t...
[ "public", "function", "getPid", "(", ")", "{", "$", "options", "=", "static", "::", "getOptions", "(", ")", ";", "$", "debug", "=", "@", "$", "options", "[", "'debug'", "]", "===", "true", ";", "$", "pidFile", "=", "$", "options", "[", "'pid_file'", ...
Get daemon PID @return integer|false Returns false if there is no daemon running
[ "Get", "daemon", "PID" ]
d8084e414d87cabe3c3066902da625c6f0ba770b
https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L178-L200
20,069
basarevych/task-daemon
library/TaskDaemon/TaskDaemon.php
TaskDaemon.stop
public function stop() { $options = static::getOptions(); $debug = @$options['debug'] === true; $pidFile = $options['pid_file']; if (!$pidFile) throw new \Exception("No pid_file in the config"); $fpPid = fopen($pidFile, "c"); if (!$fpPid) thr...
php
public function stop() { $options = static::getOptions(); $debug = @$options['debug'] === true; $pidFile = $options['pid_file']; if (!$pidFile) throw new \Exception("No pid_file in the config"); $fpPid = fopen($pidFile, "c"); if (!$fpPid) thr...
[ "public", "function", "stop", "(", ")", "{", "$", "options", "=", "static", "::", "getOptions", "(", ")", ";", "$", "debug", "=", "@", "$", "options", "[", "'debug'", "]", "===", "true", ";", "$", "pidFile", "=", "$", "options", "[", "'pid_file'", ...
Stop the daemon @return TaskDaemon
[ "Stop", "the", "daemon" ]
d8084e414d87cabe3c3066902da625c6f0ba770b
https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L358-L386
20,070
basarevych/task-daemon
library/TaskDaemon/TaskDaemon.php
TaskDaemon.restart
public function restart() { if (count($this->tasks) == 0) throw new \Exception("There are no tasks defined - can not restart"); $this->stop(); do { sleep(1); } while ($this->getPid() !== false); $this->start(); }
php
public function restart() { if (count($this->tasks) == 0) throw new \Exception("There are no tasks defined - can not restart"); $this->stop(); do { sleep(1); } while ($this->getPid() !== false); $this->start(); }
[ "public", "function", "restart", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "tasks", ")", "==", "0", ")", "throw", "new", "\\", "Exception", "(", "\"There are no tasks defined - can not restart\"", ")", ";", "$", "this", "->", "stop", "(", ...
Restart the daemon @return TaskDaemon
[ "Restart", "the", "daemon" ]
d8084e414d87cabe3c3066902da625c6f0ba770b
https://github.com/basarevych/task-daemon/blob/d8084e414d87cabe3c3066902da625c6f0ba770b/library/TaskDaemon/TaskDaemon.php#L393-L405
20,071
PortaText/php-sdk
src/PortaText/Command/Api/Campaigns.php
Campaigns.setSetting
protected function setSetting($name, $value) { $args = $this->getArgument("settings"); if (is_null($args)) { $args = array(); } $args[$name] = $value; return $this->setArgument("settings", $args); }
php
protected function setSetting($name, $value) { $args = $this->getArgument("settings"); if (is_null($args)) { $args = array(); } $args[$name] = $value; return $this->setArgument("settings", $args); }
[ "protected", "function", "setSetting", "(", "$", "name", ",", "$", "value", ")", "{", "$", "args", "=", "$", "this", "->", "getArgument", "(", "\"settings\"", ")", ";", "if", "(", "is_null", "(", "$", "args", ")", ")", "{", "$", "args", "=", "array...
Set a campaign setting. @param string $name Setting name. @param mixed $value Setting value. @return PortaText\Command\ICommand
[ "Set", "a", "campaign", "setting", "." ]
dbe04ef043db5b251953f9de57aa4d0f1785dfcc
https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Campaigns.php#L222-L230
20,072
benmanu/silverstripe-knowledgebase
code/controller/KnowledgebasePage_Controller.php
KnowledgebasePage_Controller.getSearchQuery
protected function getSearchQuery($keywords) { $query = parent::getSearchQuery($keywords); // add hook to modify search query $this->extend('updateSearchQuery', $query); return $query; }
php
protected function getSearchQuery($keywords) { $query = parent::getSearchQuery($keywords); // add hook to modify search query $this->extend('updateSearchQuery', $query); return $query; }
[ "protected", "function", "getSearchQuery", "(", "$", "keywords", ")", "{", "$", "query", "=", "parent", "::", "getSearchQuery", "(", "$", "keywords", ")", ";", "// add hook to modify search query", "$", "this", "->", "extend", "(", "'updateSearchQuery'", ",", "$...
Builds a search query from a given search term. Also has an extension hook which allows you to modify the parameters of the query. @param string $keywords @return SearchQuery
[ "Builds", "a", "search", "query", "from", "a", "given", "search", "term", "." ]
db19bfd4836f43da17ab52e8b53e72a11be64210
https://github.com/benmanu/silverstripe-knowledgebase/blob/db19bfd4836f43da17ab52e8b53e72a11be64210/code/controller/KnowledgebasePage_Controller.php#L34-L42
20,073
benmanu/silverstripe-knowledgebase
code/controller/KnowledgebasePage_Controller.php
KnowledgebasePage_Controller.parseSearchResults
protected function parseSearchResults($results, $suggestion, $keywords) { $renderData = parent::parseSearchResults($results, $suggestion, $keywords); // adding hook to allow checks or additional data to be passed to the Search Results $this->extend('updateParseSearchResults', $renderData); ...
php
protected function parseSearchResults($results, $suggestion, $keywords) { $renderData = parent::parseSearchResults($results, $suggestion, $keywords); // adding hook to allow checks or additional data to be passed to the Search Results $this->extend('updateParseSearchResults', $renderData); ...
[ "protected", "function", "parseSearchResults", "(", "$", "results", ",", "$", "suggestion", ",", "$", "keywords", ")", "{", "$", "renderData", "=", "parent", "::", "parseSearchResults", "(", "$", "results", ",", "$", "suggestion", ",", "$", "keywords", ")", ...
Overloading view method purely to provide a hook for others to add extra checks or pass additional data to the Search Results. @param array $results @param array $suggestion @param string $keywords @return array
[ "Overloading", "view", "method", "purely", "to", "provide", "a", "hook", "for", "others", "to", "add", "extra", "checks", "or", "pass", "additional", "data", "to", "the", "Search", "Results", "." ]
db19bfd4836f43da17ab52e8b53e72a11be64210
https://github.com/benmanu/silverstripe-knowledgebase/blob/db19bfd4836f43da17ab52e8b53e72a11be64210/code/controller/KnowledgebasePage_Controller.php#L70-L78
20,074
phrest/sdk
src/PhrestSDK.php
PhrestSDK.setApp
public function setApp(PhrestAPI $app) { $this->app = $app; $this->app->isInternalRequest = true; return $this; }
php
public function setApp(PhrestAPI $app) { $this->app = $app; $this->app->isInternalRequest = true; return $this; }
[ "public", "function", "setApp", "(", "PhrestAPI", "$", "app", ")", "{", "$", "this", "->", "app", "=", "$", "app", ";", "$", "this", "->", "app", "->", "isInternalRequest", "=", "true", ";", "return", "$", "this", ";", "}" ]
Set the API instance @param PhrestAPI $app @return $this
[ "Set", "the", "API", "instance" ]
e9f2812ad517b07ca4d284512b530f615305eb47
https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/PhrestSDK.php#L87-L93
20,075
phrest/sdk
src/PhrestSDK.php
PhrestSDK.getHTTPResponse
private function getHTTPResponse( $method, $path, RequestOptions $options = null ) { $client = new Client(); // Build body $body = new PostBody(); if ($options) { foreach ($options->getPostParams() as $name => $value) { $body->setField($name, $value); } ...
php
private function getHTTPResponse( $method, $path, RequestOptions $options = null ) { $client = new Client(); // Build body $body = new PostBody(); if ($options) { foreach ($options->getPostParams() as $name => $value) { $body->setField($name, $value); } ...
[ "private", "function", "getHTTPResponse", "(", "$", "method", ",", "$", "path", ",", "RequestOptions", "$", "options", "=", "null", ")", "{", "$", "client", "=", "new", "Client", "(", ")", ";", "// Build body", "$", "body", "=", "new", "PostBody", "(", ...
Makes a cURL HTTP request to the API and returns the response todo this needs to also handle PUT, POST, DELETE @param string $method @param $path @param RequestOptions $options @throws \Exception @return string
[ "Makes", "a", "cURL", "HTTP", "request", "to", "the", "API", "and", "returns", "the", "response", "todo", "this", "needs", "to", "also", "handle", "PUT", "POST", "DELETE" ]
e9f2812ad517b07ca4d284512b530f615305eb47
https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/PhrestSDK.php#L314-L354
20,076
mle86/php-wq
src/WQ/WorkProcessor.php
WorkProcessor.processNextJob
public function processNextJob( $workQueue, callable $callback, int $timeout = WorkServerAdapter::DEFAULT_TIMEOUT ): void { $qe = $this->server->getNextQueueEntry($workQueue, $timeout); if (!$qe) { $this->onNoJobAvailable((array)$workQueue); return; ...
php
public function processNextJob( $workQueue, callable $callback, int $timeout = WorkServerAdapter::DEFAULT_TIMEOUT ): void { $qe = $this->server->getNextQueueEntry($workQueue, $timeout); if (!$qe) { $this->onNoJobAvailable((array)$workQueue); return; ...
[ "public", "function", "processNextJob", "(", "$", "workQueue", ",", "callable", "$", "callback", ",", "int", "$", "timeout", "=", "WorkServerAdapter", "::", "DEFAULT_TIMEOUT", ")", ":", "void", "{", "$", "qe", "=", "$", "this", "->", "server", "->", "getNe...
Executes the next job in the Work Queue by passing it to the callback function. If that results in a {@see \RuntimeException}, the method will try to re-queue the job and re-throw the exception. If the execution results in any other {@see \Throwable}, no re-queueing will be attempted; the job will be buried immediate...
[ "Executes", "the", "next", "job", "in", "the", "Work", "Queue", "by", "passing", "it", "to", "the", "callback", "function", "." ]
e1ca1dcfd3d40edb0085f6dfa83d90db74253de4
https://github.com/mle86/php-wq/blob/e1ca1dcfd3d40edb0085f6dfa83d90db74253de4/src/WQ/WorkProcessor.php#L78-L129
20,077
mle86/php-wq
src/WQ/WorkProcessor.php
WorkProcessor.setOption
public function setOption(int $option, $value): self { $this->options[$option] = $value; return $this; }
php
public function setOption(int $option, $value): self { $this->options[$option] = $value; return $this; }
[ "public", "function", "setOption", "(", "int", "$", "option", ",", "$", "value", ")", ":", "self", "{", "$", "this", "->", "options", "[", "$", "option", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
Sets one of the configuration options. @param int $option One of the <tt>WP_</tt> constants. @param mixed $value The option's new value. The required type depends on the option. @see setOptions() to change multiple options at once. @return self
[ "Sets", "one", "of", "the", "configuration", "options", "." ]
e1ca1dcfd3d40edb0085f6dfa83d90db74253de4
https://github.com/mle86/php-wq/blob/e1ca1dcfd3d40edb0085f6dfa83d90db74253de4/src/WQ/WorkProcessor.php#L286-L290
20,078
haldayne/boost
src/Map.php
Map.keys
public function keys() { $map = new Map; foreach (array_keys($this->array) as $hash) { $map[] = $this->hash_to_key($hash); } return $map; }
php
public function keys() { $map = new Map; foreach (array_keys($this->array) as $hash) { $map[] = $this->hash_to_key($hash); } return $map; }
[ "public", "function", "keys", "(", ")", "{", "$", "map", "=", "new", "Map", ";", "foreach", "(", "array_keys", "(", "$", "this", "->", "array", ")", "as", "$", "hash", ")", "{", "$", "map", "[", "]", "=", "$", "this", "->", "hash_to_key", "(", ...
Get the keys of this map as a new map. @return new Map @api @since 1.0.5
[ "Get", "the", "keys", "of", "this", "map", "as", "a", "new", "map", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L85-L92
20,079
haldayne/boost
src/Map.php
Map.filter
public function filter($expression) { $new = new static; $this->walk(function ($v, $k) use ($expression, $new) { $result = $this->call($expression, $v, $k); if ($this->passes($result)) { $new[$k] = $v; } }); return $new; }
php
public function filter($expression) { $new = new static; $this->walk(function ($v, $k) use ($expression, $new) { $result = $this->call($expression, $v, $k); if ($this->passes($result)) { $new[$k] = $v; } }); return $new; }
[ "public", "function", "filter", "(", "$", "expression", ")", "{", "$", "new", "=", "new", "static", ";", "$", "this", "->", "walk", "(", "function", "(", "$", "v", ",", "$", "k", ")", "use", "(", "$", "expression", ",", "$", "new", ")", "{", "$...
Apply the filter to every element, creating a new map with only those elements from the original map that do not fail this filter. The filter expressions receives two arguments: - The current value - The current key If the filter returns exactly boolean false, the element is not copied into the new map. Otherwise, i...
[ "Apply", "the", "filter", "to", "every", "element", "creating", "a", "new", "map", "with", "only", "those", "elements", "from", "the", "original", "map", "that", "do", "not", "fail", "this", "filter", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L133-L145
20,080
haldayne/boost
src/Map.php
Map.first
public function first($expression, $n = 1) { if (is_numeric($n) && intval($n) <= 0) { throw new \InvalidArgumentException('Argument $n must be whole number'); } return $this->grep($expression, intval($n)); }
php
public function first($expression, $n = 1) { if (is_numeric($n) && intval($n) <= 0) { throw new \InvalidArgumentException('Argument $n must be whole number'); } return $this->grep($expression, intval($n)); }
[ "public", "function", "first", "(", "$", "expression", ",", "$", "n", "=", "1", ")", "{", "if", "(", "is_numeric", "(", "$", "n", ")", "&&", "intval", "(", "$", "n", ")", "<=", "0", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", ...
Return a new map containing the first N elements passing the expression. Like `find`, but stop after finding N elements from the front. Defaults to N = 1. ``` $nums = new Map(range(0, 9)); $odd3 = $nums->first('1 == ($_0 % 2)', 3); // first three odds ``` @param callable|string $expression @param int $n @return new ...
[ "Return", "a", "new", "map", "containing", "the", "first", "N", "elements", "passing", "the", "expression", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L164-L170
20,081
haldayne/boost
src/Map.php
Map.last
public function last($expression, $n = 1) { if (is_numeric($n) && intval($n) <= 0) { throw new \InvalidArgumentException('Argument $n must be whole number'); } return $this->grep($expression, -intval($n)); }
php
public function last($expression, $n = 1) { if (is_numeric($n) && intval($n) <= 0) { throw new \InvalidArgumentException('Argument $n must be whole number'); } return $this->grep($expression, -intval($n)); }
[ "public", "function", "last", "(", "$", "expression", ",", "$", "n", "=", "1", ")", "{", "if", "(", "is_numeric", "(", "$", "n", ")", "&&", "intval", "(", "$", "n", ")", "<=", "0", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", ...
Return a new map containing the last N elements passing the expression. Like `first`, but stop after finding N elements from the *end*. Defaults to N = 1. ``` $nums = new Map(range(0, 9)); $odds = $nums->last('1 == ($_0 % 2)', 2); // last two odd numbers ``` @param callable|string $expression @param int $n @return n...
[ "Return", "a", "new", "map", "containing", "the", "last", "N", "elements", "passing", "the", "expression", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L188-L194
20,082
haldayne/boost
src/Map.php
Map.get
public function get($key, $default = null) { $hash = $this->key_to_hash($key); if (array_key_exists($hash, $this->array)) { return $this->array[$hash]; } else { return $default; } }
php
public function get($key, $default = null) { $hash = $this->key_to_hash($key); if (array_key_exists($hash, $this->array)) { return $this->array[$hash]; } else { return $default; } }
[ "public", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "$", "hash", "=", "$", "this", "->", "key_to_hash", "(", "$", "key", ")", ";", "if", "(", "array_key_exists", "(", "$", "hash", ",", "$", "this", "->", "arr...
Get the value corresponding to the given key. If the key does not exist in the map, return the default. This is the object method equivalent of the magic $map[$key]. @param mixed $key @param mixed $default @return mixed @api
[ "Get", "the", "value", "corresponding", "to", "the", "given", "key", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L259-L267
20,083
haldayne/boost
src/Map.php
Map.set
public function set($key, $value) { $hash = $this->key_to_hash($key); $this->array[$hash] = $value; return $this; }
php
public function set($key, $value) { $hash = $this->key_to_hash($key); $this->array[$hash] = $value; return $this; }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "$", "hash", "=", "$", "this", "->", "key_to_hash", "(", "$", "key", ")", ";", "$", "this", "->", "array", "[", "$", "hash", "]", "=", "$", "value", ";", "return", "$", ...
Set a key and its corresponding value into the map. This is the object method equivalent of the magic $map[$key] = 'foo'. @param mixed $key @param mixed $value @return $this @api
[ "Set", "a", "key", "and", "its", "corresponding", "value", "into", "the", "map", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L279-L284
20,084
haldayne/boost
src/Map.php
Map.diff
public function diff($collection, $comparison = Map::LOOSE) { $func = ($comparison === Map::LOOSE ? 'array_diff' : 'array_diff_assoc'); return new static( $func($this->toArray(), $this->collection_to_array($collection)) ); }
php
public function diff($collection, $comparison = Map::LOOSE) { $func = ($comparison === Map::LOOSE ? 'array_diff' : 'array_diff_assoc'); return new static( $func($this->toArray(), $this->collection_to_array($collection)) ); }
[ "public", "function", "diff", "(", "$", "collection", ",", "$", "comparison", "=", "Map", "::", "LOOSE", ")", "{", "$", "func", "=", "(", "$", "comparison", "===", "Map", "::", "LOOSE", "?", "'array_diff'", ":", "'array_diff_assoc'", ")", ";", "return", ...
Return a new map containing those keys and values that are not present in the given collection. If comparison is loose, then only those elements whose values match will be removed. Otherwise, comparison is strict, and elements whose keys and values match will be removed. @param Map|Arrayable|Jsonable|Traversable|obj...
[ "Return", "a", "new", "map", "containing", "those", "keys", "and", "values", "that", "are", "not", "present", "in", "the", "given", "collection", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L325-L331
20,085
haldayne/boost
src/Map.php
Map.partition
public function partition($expression) { $outer = new MapOfCollections; $proto = new static; $this->walk(function ($v, $k) use ($expression, $outer, $proto) { $partition = $this->call($expression, $v, $k); $inner = $outer->has($partition) ? $outer->get($partition) :...
php
public function partition($expression) { $outer = new MapOfCollections; $proto = new static; $this->walk(function ($v, $k) use ($expression, $outer, $proto) { $partition = $this->call($expression, $v, $k); $inner = $outer->has($partition) ? $outer->get($partition) :...
[ "public", "function", "partition", "(", "$", "expression", ")", "{", "$", "outer", "=", "new", "MapOfCollections", ";", "$", "proto", "=", "new", "static", ";", "$", "this", "->", "walk", "(", "function", "(", "$", "v", ",", "$", "k", ")", "use", "...
Groups elements of this map based on the result of an expression. Calls the expression for each element in this map. The expression receives the value and key, respectively. The expression may return any value: this value is the grouping key and the element is put into that group. ``` $nums = new Map(range(0, 9)); $...
[ "Groups", "elements", "of", "this", "map", "based", "on", "the", "result", "of", "an", "expression", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L377-L392
20,086
haldayne/boost
src/Map.php
Map.map
public function map($expression) { $new = new self; $this->walk(function ($v, $k) use ($expression, $new) { $new[$k] = $this->call($expression, $v, $k); }); return $new; }
php
public function map($expression) { $new = new self; $this->walk(function ($v, $k) use ($expression, $new) { $new[$k] = $this->call($expression, $v, $k); }); return $new; }
[ "public", "function", "map", "(", "$", "expression", ")", "{", "$", "new", "=", "new", "self", ";", "$", "this", "->", "walk", "(", "function", "(", "$", "v", ",", "$", "k", ")", "use", "(", "$", "expression", ",", "$", "new", ")", "{", "$", ...
Walk the map, applying the expression to every element, transforming them into a new map. ``` $nums = new Map(range(0, 9)); $doubled = $nums->map('$_0 * 2'); ``` The expression receives two arguments: - The current value in `$_0` - The current key in `$_1` The keys in the resulting map will be the same as the keys i...
[ "Walk", "the", "map", "applying", "the", "expression", "to", "every", "element", "transforming", "them", "into", "a", "new", "map", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L418-L427
20,087
haldayne/boost
src/Map.php
Map.reduce
public function reduce($reducer, $initial = null, $finisher = null) { $reduced = $initial; $this->walk(function ($value, $key) use ($reducer, &$reduced) { $reduced = $this->call($reducer, $reduced, $value, $key); }); if (null === $finisher) { return $reduced;...
php
public function reduce($reducer, $initial = null, $finisher = null) { $reduced = $initial; $this->walk(function ($value, $key) use ($reducer, &$reduced) { $reduced = $this->call($reducer, $reduced, $value, $key); }); if (null === $finisher) { return $reduced;...
[ "public", "function", "reduce", "(", "$", "reducer", ",", "$", "initial", "=", "null", ",", "$", "finisher", "=", "null", ")", "{", "$", "reduced", "=", "$", "initial", ";", "$", "this", "->", "walk", "(", "function", "(", "$", "value", ",", "$", ...
Walk the map, applying a reducing expression to every element, so as to reduce the map to a single value. The `$reducer` expression receives three arguments: - The current reduction (`$_0`) - The current value (`$_1`) - The current key (`$_2`) The initial value, if given or null if not, is passed as the current reduc...
[ "Walk", "the", "map", "applying", "a", "reducing", "expression", "to", "every", "element", "so", "as", "to", "reduce", "the", "map", "to", "a", "single", "value", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L460-L472
20,088
haldayne/boost
src/Map.php
Map.rekey
public function rekey($expression) { $new = new static; $this->walk(function ($v, $k) use ($expression, $new) { $new_key = $this->call($expression, $v, $k); $new[$new_key] = $v; }); return $new; }
php
public function rekey($expression) { $new = new static; $this->walk(function ($v, $k) use ($expression, $new) { $new_key = $this->call($expression, $v, $k); $new[$new_key] = $v; }); return $new; }
[ "public", "function", "rekey", "(", "$", "expression", ")", "{", "$", "new", "=", "new", "static", ";", "$", "this", "->", "walk", "(", "function", "(", "$", "v", ",", "$", "k", ")", "use", "(", "$", "expression", ",", "$", "new", ")", "{", "$"...
Change the key for every element in the map using an expression to calculate the new key. ``` $keyed_by_bytecode = new Map(count_chars('war of the worlds', 1)); $keyed_by_letter = $keyed_by_bytecode->rekey('chr($_1)'); ``` @param callable|string $expression @return new static @api
[ "Change", "the", "key", "for", "every", "element", "in", "the", "map", "using", "an", "expression", "to", "calculate", "the", "new", "key", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L487-L497
20,089
haldayne/boost
src/Map.php
Map.merge
public function merge($collection, callable $merger, $default = null) { $array = $this->collection_to_array($collection); foreach ($array as $key => $value) { $current = $this->get($key, $default); $this->set($key, $merger($current, $value)); } return $this; ...
php
public function merge($collection, callable $merger, $default = null) { $array = $this->collection_to_array($collection); foreach ($array as $key => $value) { $current = $this->get($key, $default); $this->set($key, $merger($current, $value)); } return $this; ...
[ "public", "function", "merge", "(", "$", "collection", ",", "callable", "$", "merger", ",", "$", "default", "=", "null", ")", "{", "$", "array", "=", "$", "this", "->", "collection_to_array", "(", "$", "collection", ")", ";", "foreach", "(", "$", "arra...
Merge the given collection into this map. The merger callable decides how to merge the current map's value with the given collection's value. The merger callable receives two arguments: - This map's value at the given key - The collection's value at the given key If the current map does not have a value for a key in...
[ "Merge", "the", "given", "collection", "into", "this", "map", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L517-L525
20,090
haldayne/boost
src/Map.php
Map.transform
public function transform(callable $transformer, callable $creator = null, callable $finisher = null) { // create the initial object, using as needed the default creator function if (null === $creator) { $creator = function (Map $original) { return new Map(); }; } $initia...
php
public function transform(callable $transformer, callable $creator = null, callable $finisher = null) { // create the initial object, using as needed the default creator function if (null === $creator) { $creator = function (Map $original) { return new Map(); }; } $initia...
[ "public", "function", "transform", "(", "callable", "$", "transformer", ",", "callable", "$", "creator", "=", "null", ",", "callable", "$", "finisher", "=", "null", ")", "{", "// create the initial object, using as needed the default creator function", "if", "(", "nul...
Flexibly and thoroughly change this map into another map. ``` // transform a word list into a map of word to frequency in the list use Haldayne\Boost\Map; $words = new Map([ 'bear', 'bee', 'goose', 'bee' ]); $lengths = $words->transform( function (Map $new, $word) { if ($new->has($word)) { $new->set($word, $new->get...
[ "Flexibly", "and", "thoroughly", "change", "this", "map", "into", "another", "map", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L597-L616
20,091
haldayne/boost
src/Map.php
Map.into
public function into(Map $target) { $this->walk(function ($value, $key) use ($target) { $target->set($key, $value); }); return $target; }
php
public function into(Map $target) { $this->walk(function ($value, $key) use ($target) { $target->set($key, $value); }); return $target; }
[ "public", "function", "into", "(", "Map", "$", "target", ")", "{", "$", "this", "->", "walk", "(", "function", "(", "$", "value", ",", "$", "key", ")", "use", "(", "$", "target", ")", "{", "$", "target", "->", "set", "(", "$", "key", ",", "$", ...
Put all of this map's elements into the target and return the target. ``` $words = new MapOfStrings([ 'foo', 'bar' ]); $words->map('strlen($_0)')->into(new MapOfInts)->sum(); // 6 ``` Use when you've mapped your elements into a different type, and you want to fluently perform operations on the new type. In the exampl...
[ "Put", "all", "of", "this", "map", "s", "elements", "into", "the", "target", "and", "return", "the", "target", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L633-L639
20,092
haldayne/boost
src/Map.php
Map.push
public function push($element) { // ask PHP to give me the next index // http://stackoverflow.com/q/3698743/2908724 $this->array[] = 'probe'; end($this->array); $next = key($this->array); unset($this->array[$next]); // hash that and store $this->set($...
php
public function push($element) { // ask PHP to give me the next index // http://stackoverflow.com/q/3698743/2908724 $this->array[] = 'probe'; end($this->array); $next = key($this->array); unset($this->array[$next]); // hash that and store $this->set($...
[ "public", "function", "push", "(", "$", "element", ")", "{", "// ask PHP to give me the next index", "// http://stackoverflow.com/q/3698743/2908724", "$", "this", "->", "array", "[", "]", "=", "'probe'", ";", "end", "(", "$", "this", "->", "array", ")", ";", "$"...
Treat the map as a stack and push an element onto its end. @return $this @api
[ "Treat", "the", "map", "as", "a", "stack", "and", "push", "an", "element", "onto", "its", "end", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L647-L660
20,093
haldayne/boost
src/Map.php
Map.pop
public function pop() { if (0 === count($this->array)) { return null; } // get the last hash of array end($this->array); $hash = key($this->array); // temporarily hold the element at that spot $element = $this->array[$hash]; // forget it...
php
public function pop() { if (0 === count($this->array)) { return null; } // get the last hash of array end($this->array); $hash = key($this->array); // temporarily hold the element at that spot $element = $this->array[$hash]; // forget it...
[ "public", "function", "pop", "(", ")", "{", "if", "(", "0", "===", "count", "(", "$", "this", "->", "array", ")", ")", "{", "return", "null", ";", "}", "// get the last hash of array", "end", "(", "$", "this", "->", "array", ")", ";", "$", "hash", ...
Treat the map as a stack and pop an element off its end. @return mixed|null @api
[ "Treat", "the", "map", "as", "a", "stack", "and", "pop", "an", "element", "off", "its", "end", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L668-L685
20,094
haldayne/boost
src/Map.php
Map.toArray
public function toArray() { $array = []; foreach ($this->array as $hash => $value) { $key = $this->hash_to_key($hash); if ($this->is_collection_like($value)) { $array[$key] = $this->collection_to_array($value); } else { $array[$key]...
php
public function toArray() { $array = []; foreach ($this->array as $hash => $value) { $key = $this->hash_to_key($hash); if ($this->is_collection_like($value)) { $array[$key] = $this->collection_to_array($value); } else { $array[$key]...
[ "public", "function", "toArray", "(", ")", "{", "$", "array", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "array", "as", "$", "hash", "=>", "$", "value", ")", "{", "$", "key", "=", "$", "this", "->", "hash_to_key", "(", "$", "hash", ...
Copy this map into an array, recursing as necessary to convert contained collections into arrays. @api
[ "Copy", "this", "map", "into", "an", "array", "recursing", "as", "necessary", "to", "convert", "contained", "collections", "into", "arrays", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L710-L722
20,095
haldayne/boost
src/Map.php
Map.offsetSet
public function offsetSet($key, $value) { if (null === $key) { $this->push($value); } else { $this->set($key, $value); } }
php
public function offsetSet($key, $value) { if (null === $key) { $this->push($value); } else { $this->set($key, $value); } }
[ "public", "function", "offsetSet", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "null", "===", "$", "key", ")", "{", "$", "this", "->", "push", "(", "$", "value", ")", ";", "}", "else", "{", "$", "this", "->", "set", "(", "$", "ke...
Set the value at a given key. If key is null, the value is appended to the array using numeric indexes, just like native PHP. Unlike native-PHP, $key can be of any type: boolean, int, float, string, array, object, closure, resource. @param mixed $key @param mixed $value @return void
[ "Set", "the", "value", "at", "a", "given", "key", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L773-L780
20,096
haldayne/boost
src/Map.php
Map.getIterator
public function getIterator() { $keys = $this->keys(); $count = count($keys); $index = 0; while ($index < $count) { $key = $keys[$index]; $value = $this->get($key); yield $key => $value; $index++; } }
php
public function getIterator() { $keys = $this->keys(); $count = count($keys); $index = 0; while ($index < $count) { $key = $keys[$index]; $value = $this->get($key); yield $key => $value; $index++; } }
[ "public", "function", "getIterator", "(", ")", "{", "$", "keys", "=", "$", "this", "->", "keys", "(", ")", ";", "$", "count", "=", "count", "(", "$", "keys", ")", ";", "$", "index", "=", "0", ";", "while", "(", "$", "index", "<", "$", "count", ...
Get an iterator for the map. @return \Generator @api
[ "Get", "an", "iterator", "for", "the", "map", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L802-L816
20,097
haldayne/boost
src/Map.php
Map.is_collection_like
protected function is_collection_like($value) { if ($value instanceof self) { return true; } else if ($value instanceof \Traversable) { return true; } else if ($value instanceof Arrayable) { return true; } else if ($value instanceof Jsonable) { ...
php
protected function is_collection_like($value) { if ($value instanceof self) { return true; } else if ($value instanceof \Traversable) { return true; } else if ($value instanceof Arrayable) { return true; } else if ($value instanceof Jsonable) { ...
[ "protected", "function", "is_collection_like", "(", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "self", ")", "{", "return", "true", ";", "}", "else", "if", "(", "$", "value", "instanceof", "\\", "Traversable", ")", "{", "return", "true...
Decide if the given value is considered collection-like. @param mixed $value @return bool
[ "Decide", "if", "the", "given", "value", "is", "considered", "collection", "-", "like", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L844-L864
20,098
haldayne/boost
src/Map.php
Map.collection_to_array
protected function collection_to_array($collection) { if ($collection instanceof self) { return $collection->toArray(); } else if ($collection instanceof \Traversable) { return iterator_to_array($collection); } else if ($collection instanceof Arrayable) { ...
php
protected function collection_to_array($collection) { if ($collection instanceof self) { return $collection->toArray(); } else if ($collection instanceof \Traversable) { return iterator_to_array($collection); } else if ($collection instanceof Arrayable) { ...
[ "protected", "function", "collection_to_array", "(", "$", "collection", ")", "{", "if", "(", "$", "collection", "instanceof", "self", ")", "{", "return", "$", "collection", "->", "toArray", "(", ")", ";", "}", "else", "if", "(", "$", "collection", "instanc...
Give me a native PHP array, regardless of what kind of collection-like structure is given. @param Map|Traversable|Arrayable|Jsonable|object|array $items @return array|boolean @throws \InvalidArgumentException
[ "Give", "me", "a", "native", "PHP", "array", "regardless", "of", "what", "kind", "of", "collection", "-", "like", "structure", "is", "given", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L874-L897
20,099
haldayne/boost
src/Map.php
Map.grep
protected function grep($expression, $limit = null) { // initialize our return map and book-keeping values $map = new static; $bnd = empty($limit) ? null : abs($limit); $cnt = 0; // define a helper to add matching values to our new map, stopping when // any designate...
php
protected function grep($expression, $limit = null) { // initialize our return map and book-keeping values $map = new static; $bnd = empty($limit) ? null : abs($limit); $cnt = 0; // define a helper to add matching values to our new map, stopping when // any designate...
[ "protected", "function", "grep", "(", "$", "expression", ",", "$", "limit", "=", "null", ")", "{", "// initialize our return map and book-keeping values", "$", "map", "=", "new", "static", ";", "$", "bnd", "=", "empty", "(", "$", "limit", ")", "?", "null", ...
Finds elements for which the given code passes, optionally limited to a maximum count. If limit is null, no limit on number of matches. If limit is positive, return that many from the front of the array. If limit is negative, return that many from the end of the array. @param callable|string $expression @param int|nu...
[ "Finds", "elements", "for", "which", "the", "given", "code", "passes", "optionally", "limited", "to", "a", "maximum", "count", "." ]
d18cc398557e23f9c316ea7fb40b90f84cc53650
https://github.com/haldayne/boost/blob/d18cc398557e23f9c316ea7fb40b90f84cc53650/src/Map.php#L911-L938