repo
stringclasses
21 values
path
stringlengths
10
100
func_name
stringlengths
6
71
original_string
stringlengths
115
97k
language
stringclasses
1 value
code
stringlengths
115
97k
code_tokens
listlengths
27
7.5k
docstring
stringlengths
6
1.88k
docstring_tokens
listlengths
1
177
sha
stringclasses
21 values
url
stringlengths
100
189
partition
stringclasses
1 value
summary
stringlengths
9
340
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
octobercms/october
modules/backend/behaviors/FormController.php
FormController.update_onSave
public function update_onSave($recordId = null, $context = null) { $this->context = strlen($context) ? $context : $this->getConfig('update[context]', self::CONTEXT_UPDATE); $model = $this->controller->formFindModelObject($recordId); $this->initForm($model); $this->controller->formBeforeSave($model); $this->controller->formBeforeUpdate($model); $modelsToSave = $this->prepareModelsToSave($model, $this->formWidget->getSaveData()); Db::transaction(function () use ($modelsToSave) { foreach ($modelsToSave as $modelToSave) { $modelToSave->save(null, $this->formWidget->getSessionKey()); } }); $this->controller->formAfterSave($model); $this->controller->formAfterUpdate($model); Flash::success($this->getLang("{$this->context}[flashSave]", 'backend::lang.form.update_success')); if ($redirect = $this->makeRedirect('update', $model)) { return $redirect; } }
php
public function update_onSave($recordId = null, $context = null) { $this->context = strlen($context) ? $context : $this->getConfig('update[context]', self::CONTEXT_UPDATE); $model = $this->controller->formFindModelObject($recordId); $this->initForm($model); $this->controller->formBeforeSave($model); $this->controller->formBeforeUpdate($model); $modelsToSave = $this->prepareModelsToSave($model, $this->formWidget->getSaveData()); Db::transaction(function () use ($modelsToSave) { foreach ($modelsToSave as $modelToSave) { $modelToSave->save(null, $this->formWidget->getSessionKey()); } }); $this->controller->formAfterSave($model); $this->controller->formAfterUpdate($model); Flash::success($this->getLang("{$this->context}[flashSave]", 'backend::lang.form.update_success')); if ($redirect = $this->makeRedirect('update', $model)) { return $redirect; } }
[ "public", "function", "update_onSave", "(", "$", "recordId", "=", "null", ",", "$", "context", "=", "null", ")", "{", "$", "this", "->", "context", "=", "strlen", "(", "$", "context", ")", "?", "$", "context", ":", "$", "this", "->", "getConfig", "("...
AJAX handler "onSave" called from the update action and primarily used for updating existing records. This handler will invoke the unique controller overrides `formBeforeUpdate` and `formAfterUpdate`. @param int $recordId Record identifier @param string $context Form context @return mixed
[ "AJAX", "handler", "onSave", "called", "from", "the", "update", "action", "and", "primarily", "used", "for", "updating", "existing", "records", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/FormController.php#L301-L325
train
Save record on save
[ 30522, 2270, 3853, 10651, 1035, 2006, 3736, 3726, 1006, 1002, 2501, 3593, 1027, 19701, 1010, 1002, 6123, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 6123, 1027, 2358, 20927, 2078, 1006, 1002, 6123, 1007, 1029, 1002, 6123, 1024, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php
RuntimeInstantiator.instantiateProxy
public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator) { return $this->factory->createProxy( $this->factory->getGenerator()->getProxifiedClass($definition), function (&$wrappedInstance, LazyLoadingInterface $proxy) use ($realInstantiator) { $wrappedInstance = $realInstantiator(); $proxy->setProxyInitializer(null); return true; } ); }
php
public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator) { return $this->factory->createProxy( $this->factory->getGenerator()->getProxifiedClass($definition), function (&$wrappedInstance, LazyLoadingInterface $proxy) use ($realInstantiator) { $wrappedInstance = $realInstantiator(); $proxy->setProxyInitializer(null); return true; } ); }
[ "public", "function", "instantiateProxy", "(", "ContainerInterface", "$", "container", ",", "Definition", "$", "definition", ",", "$", "id", ",", "$", "realInstantiator", ")", "{", "return", "$", "this", "->", "factory", "->", "createProxy", "(", "$", "this", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php#L41-L53
train
Instantiates a proxy for the given definition.
[ 30522, 2270, 3853, 7107, 13143, 21572, 18037, 1006, 11661, 18447, 2121, 12172, 1002, 11661, 1010, 6210, 1002, 6210, 1010, 1002, 8909, 1010, 1002, 2613, 7076, 5794, 10711, 4263, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 4713, 1011, 1028, 344...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.orderByRaw
public function orderByRaw($sql, $bindings = []) { $type = 'Raw'; $this->{$this->unions ? 'unionOrders' : 'orders'}[] = compact('type', 'sql'); $this->addBinding($bindings, 'order'); return $this; }
php
public function orderByRaw($sql, $bindings = []) { $type = 'Raw'; $this->{$this->unions ? 'unionOrders' : 'orders'}[] = compact('type', 'sql'); $this->addBinding($bindings, 'order'); return $this; }
[ "public", "function", "orderByRaw", "(", "$", "sql", ",", "$", "bindings", "=", "[", "]", ")", "{", "$", "type", "=", "'Raw'", ";", "$", "this", "->", "{", "$", "this", "->", "unions", "?", "'unionOrders'", ":", "'orders'", "}", "[", "]", "=", "c...
Add a raw "order by" clause to the query. @param string $sql @param array $bindings @return $this
[ "Add", "a", "raw", "order", "by", "clause", "to", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1868-L1877
train
Order by raw
[ 30522, 2270, 3853, 2344, 3762, 2527, 2860, 1006, 1002, 29296, 1010, 1002, 8031, 2015, 1027, 1031, 1033, 1007, 1063, 1002, 2828, 1027, 1005, 6315, 1005, 1025, 1002, 2023, 1011, 1028, 1063, 1002, 2023, 1011, 1028, 9209, 1029, 1005, 2586, 85...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Core/Authorization/Voter/Voter.php
Voter.vote
public function vote(TokenInterface $token, $subject, array $attributes) { // abstain vote by default in case none of the attributes are supported $vote = self::ACCESS_ABSTAIN; foreach ($attributes as $attribute) { if (!$this->supports($attribute, $subject)) { continue; } // as soon as at least one attribute is supported, default is to deny access $vote = self::ACCESS_DENIED; if ($this->voteOnAttribute($attribute, $subject, $token)) { // grant access as soon as at least one attribute returns a positive response return self::ACCESS_GRANTED; } } return $vote; }
php
public function vote(TokenInterface $token, $subject, array $attributes) { // abstain vote by default in case none of the attributes are supported $vote = self::ACCESS_ABSTAIN; foreach ($attributes as $attribute) { if (!$this->supports($attribute, $subject)) { continue; } // as soon as at least one attribute is supported, default is to deny access $vote = self::ACCESS_DENIED; if ($this->voteOnAttribute($attribute, $subject, $token)) { // grant access as soon as at least one attribute returns a positive response return self::ACCESS_GRANTED; } } return $vote; }
[ "public", "function", "vote", "(", "TokenInterface", "$", "token", ",", "$", "subject", ",", "array", "$", "attributes", ")", "{", "// abstain vote by default in case none of the attributes are supported", "$", "vote", "=", "self", "::", "ACCESS_ABSTAIN", ";", "foreac...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authorization/Voter/Voter.php#L27-L47
train
Vote for the subject and token
[ 30522, 2270, 3853, 3789, 1006, 19204, 18447, 2121, 12172, 1002, 19204, 1010, 1002, 3395, 1010, 9140, 1002, 12332, 1007, 1063, 1013, 1013, 14689, 18249, 3789, 2011, 12398, 1999, 2553, 3904, 1997, 1996, 12332, 2024, 3569, 1002, 3789, 1027, 29...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/PropertyAccess/PropertyAccessor.php
PropertyAccessor.getReadAccessInfo
private function getReadAccessInfo($class, $property) { $key = str_replace('\\', '.', $class).'..'.$property; if (isset($this->readPropertyCache[$key])) { return $this->readPropertyCache[$key]; } if ($this->cacheItemPool) { $item = $this->cacheItemPool->getItem(self::CACHE_PREFIX_READ.rawurlencode($key)); if ($item->isHit()) { return $this->readPropertyCache[$key] = $item->get(); } } $access = []; $reflClass = new \ReflectionClass($class); $access[self::ACCESS_HAS_PROPERTY] = $reflClass->hasProperty($property); $camelProp = $this->camelize($property); $getter = 'get'.$camelProp; $getsetter = lcfirst($camelProp); // jQuery style, e.g. read: last(), write: last($item) $isser = 'is'.$camelProp; $hasser = 'has'.$camelProp; $canAccessor = 'can'.$camelProp; if ($reflClass->hasMethod($getter) && $reflClass->getMethod($getter)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $getter; } elseif ($reflClass->hasMethod($getsetter) && $reflClass->getMethod($getsetter)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $getsetter; } elseif ($reflClass->hasMethod($isser) && $reflClass->getMethod($isser)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $isser; } elseif ($reflClass->hasMethod($hasser) && $reflClass->getMethod($hasser)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $hasser; } elseif ($reflClass->hasMethod($canAccessor) && $reflClass->getMethod($canAccessor)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $canAccessor; } elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY; $access[self::ACCESS_NAME] = $property; $access[self::ACCESS_REF] = false; } elseif ($access[self::ACCESS_HAS_PROPERTY] && $reflClass->getProperty($property)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY; $access[self::ACCESS_NAME] = $property; $access[self::ACCESS_REF] = true; } elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) { // we call the getter and hope the __call do the job $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_MAGIC; $access[self::ACCESS_NAME] = $getter; } else { $methods = [$getter, $getsetter, $isser, $hasser, '__get']; if ($this->magicCall) { $methods[] = '__call'; } $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_NOT_FOUND; $access[self::ACCESS_NAME] = sprintf( 'Neither the property "%s" nor one of the methods "%s()" '. 'exist and have public access in class "%s".', $property, implode('()", "', $methods), $reflClass->name ); } if (isset($item)) { $this->cacheItemPool->save($item->set($access)); } return $this->readPropertyCache[$key] = $access; }
php
private function getReadAccessInfo($class, $property) { $key = str_replace('\\', '.', $class).'..'.$property; if (isset($this->readPropertyCache[$key])) { return $this->readPropertyCache[$key]; } if ($this->cacheItemPool) { $item = $this->cacheItemPool->getItem(self::CACHE_PREFIX_READ.rawurlencode($key)); if ($item->isHit()) { return $this->readPropertyCache[$key] = $item->get(); } } $access = []; $reflClass = new \ReflectionClass($class); $access[self::ACCESS_HAS_PROPERTY] = $reflClass->hasProperty($property); $camelProp = $this->camelize($property); $getter = 'get'.$camelProp; $getsetter = lcfirst($camelProp); // jQuery style, e.g. read: last(), write: last($item) $isser = 'is'.$camelProp; $hasser = 'has'.$camelProp; $canAccessor = 'can'.$camelProp; if ($reflClass->hasMethod($getter) && $reflClass->getMethod($getter)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $getter; } elseif ($reflClass->hasMethod($getsetter) && $reflClass->getMethod($getsetter)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $getsetter; } elseif ($reflClass->hasMethod($isser) && $reflClass->getMethod($isser)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $isser; } elseif ($reflClass->hasMethod($hasser) && $reflClass->getMethod($hasser)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $hasser; } elseif ($reflClass->hasMethod($canAccessor) && $reflClass->getMethod($canAccessor)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_METHOD; $access[self::ACCESS_NAME] = $canAccessor; } elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY; $access[self::ACCESS_NAME] = $property; $access[self::ACCESS_REF] = false; } elseif ($access[self::ACCESS_HAS_PROPERTY] && $reflClass->getProperty($property)->isPublic()) { $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_PROPERTY; $access[self::ACCESS_NAME] = $property; $access[self::ACCESS_REF] = true; } elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) { // we call the getter and hope the __call do the job $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_MAGIC; $access[self::ACCESS_NAME] = $getter; } else { $methods = [$getter, $getsetter, $isser, $hasser, '__get']; if ($this->magicCall) { $methods[] = '__call'; } $access[self::ACCESS_TYPE] = self::ACCESS_TYPE_NOT_FOUND; $access[self::ACCESS_NAME] = sprintf( 'Neither the property "%s" nor one of the methods "%s()" '. 'exist and have public access in class "%s".', $property, implode('()", "', $methods), $reflClass->name ); } if (isset($item)) { $this->cacheItemPool->save($item->set($access)); } return $this->readPropertyCache[$key] = $access; }
[ "private", "function", "getReadAccessInfo", "(", "$", "class", ",", "$", "property", ")", "{", "$", "key", "=", "str_replace", "(", "'\\\\'", ",", "'.'", ",", "$", "class", ")", ".", "'..'", ".", "$", "property", ";", "if", "(", "isset", "(", "$", ...
Guesses how to read the property value. @param string $class @param string $property @return array
[ "Guesses", "how", "to", "read", "the", "property", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyAccess/PropertyAccessor.php#L437-L511
train
Get read access info
[ 30522, 2797, 3853, 2131, 16416, 2850, 9468, 7971, 2378, 14876, 1006, 1002, 2465, 1010, 1002, 3200, 1007, 1063, 1002, 3145, 1027, 2358, 2099, 1035, 5672, 1006, 1005, 1032, 1032, 1005, 1010, 1005, 1012, 1005, 1010, 1002, 2465, 1007, 1012, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/Data/Bundle/Reader/IntlBundleReader.php
IntlBundleReader.read
public function read($path, $locale) { // Point for future extension: Modify this class so that it works also // if the \ResourceBundle class is not available. try { // Never enable fallback. We want to know if a bundle cannot be found $bundle = new \ResourceBundle($locale, $path, false); } catch (\Exception $e) { $bundle = null; } // The bundle is NULL if the path does not look like a resource bundle // (i.e. contain a bunch of *.res files) if (null === $bundle) { throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s/%s.res" could not be found.', $path, $locale)); } // Other possible errors are U_USING_FALLBACK_WARNING and U_ZERO_ERROR, // which are OK for us. return new ArrayAccessibleResourceBundle($bundle); }
php
public function read($path, $locale) { // Point for future extension: Modify this class so that it works also // if the \ResourceBundle class is not available. try { // Never enable fallback. We want to know if a bundle cannot be found $bundle = new \ResourceBundle($locale, $path, false); } catch (\Exception $e) { $bundle = null; } // The bundle is NULL if the path does not look like a resource bundle // (i.e. contain a bunch of *.res files) if (null === $bundle) { throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s/%s.res" could not be found.', $path, $locale)); } // Other possible errors are U_USING_FALLBACK_WARNING and U_ZERO_ERROR, // which are OK for us. return new ArrayAccessibleResourceBundle($bundle); }
[ "public", "function", "read", "(", "$", "path", ",", "$", "locale", ")", "{", "// Point for future extension: Modify this class so that it works also", "// if the \\ResourceBundle class is not available.", "try", "{", "// Never enable fallback. We want to know if a bundle cannot be fou...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Bundle/Reader/IntlBundleReader.php#L29-L49
train
Reads the resource bundle
[ 30522, 2270, 3853, 3191, 1006, 30524, 2005, 2925, 5331, 1024, 19933, 2023, 2465, 2061, 2008, 2009, 2573, 2036, 1013, 1013, 2065, 1996, 1032, 7692, 27265, 2571, 2465, 2003, 2025, 2800, 1012, 3046, 1063, 1013, 1013, 2196, 9585, 2991, 5963, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Adapter/GD.php
GD.filled_rectangle
public function filled_rectangle($x1, $y1, $w, $h, $color) { // Scale by the AA factor and DPI $x1 = $this->_upscale($x1); $y1 = $this->_upscale($y1); $w = $this->_upscale($w); $h = $this->_upscale($h); $c = $this->_allocate_color($color); imagefilledrectangle($this->get_image(), $x1, $y1, $x1 + $w, $y1 + $h, $c); }
php
public function filled_rectangle($x1, $y1, $w, $h, $color) { // Scale by the AA factor and DPI $x1 = $this->_upscale($x1); $y1 = $this->_upscale($y1); $w = $this->_upscale($w); $h = $this->_upscale($h); $c = $this->_allocate_color($color); imagefilledrectangle($this->get_image(), $x1, $y1, $x1 + $w, $y1 + $h, $c); }
[ "public", "function", "filled_rectangle", "(", "$", "x1", ",", "$", "y1", ",", "$", "w", ",", "$", "h", ",", "$", "color", ")", "{", "// Scale by the AA factor and DPI", "$", "x1", "=", "$", "this", "->", "_upscale", "(", "$", "x1", ")", ";", "$", ...
Draws a filled rectangle at x1,y1 with width w and height h See {@link Style::munge_color()} for the format of the color array. @param float $x1 @param float $y1 @param float $w @param float $h @param array $color
[ "Draws", "a", "filled", "rectangle", "at", "x1", "y1", "with", "width", "w", "and", "height", "h" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/GD.php#L488-L499
train
filled_rectangle - Filled Rectangle
[ 30522, 2270, 3853, 3561, 1035, 28667, 23395, 1006, 1002, 1060, 2487, 1010, 1002, 1061, 2487, 1010, 1002, 1059, 1010, 1002, 1044, 1010, 1002, 3609, 1007, 1063, 1013, 1013, 4094, 2011, 1996, 9779, 5387, 1998, 1040, 8197, 1002, 1060, 2487, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
SqlServerGrammar.compileDropPrimary
public function compileDropPrimary(Blueprint $blueprint, Fluent $command) { $index = $this->wrap($command->index); return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; }
php
public function compileDropPrimary(Blueprint $blueprint, Fluent $command) { $index = $this->wrap($command->index); return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; }
[ "public", "function", "compileDropPrimary", "(", "Blueprint", "$", "blueprint", ",", "Fluent", "$", "command", ")", "{", "$", "index", "=", "$", "this", "->", "wrap", "(", "$", "command", "->", "index", ")", ";", "return", "\"alter table {$this->wrapTable($blu...
Compile a drop primary key command. @param \Illuminate\Database\Schema\Blueprint $blueprint @param \Illuminate\Support\Fluent $command @return string
[ "Compile", "a", "drop", "primary", "key", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php#L205-L210
train
Compiles a drop primary constraint command.
[ 30522, 2270, 3853, 9227, 18981, 18098, 9581, 2854, 1006, 2630, 16550, 1002, 2630, 16550, 1010, 19376, 1002, 3094, 1007, 1063, 1002, 5950, 1027, 1002, 2023, 1011, 1028, 10236, 1006, 1002, 3094, 1011, 1028, 5950, 1007, 1025, 2709, 1000, 11477...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Archive.php
Archive.getDataTableExpanded
public function getDataTableExpanded($name, $idSubtable = null, $depth = null, $addMetadataSubtableId = true) { $data = $this->get($name, 'blob', self::ID_SUBTABLE_LOAD_ALL_SUBTABLES); return $data->getExpandedDataTable($this->getResultIndices(), $idSubtable, $depth, $addMetadataSubtableId); }
php
public function getDataTableExpanded($name, $idSubtable = null, $depth = null, $addMetadataSubtableId = true) { $data = $this->get($name, 'blob', self::ID_SUBTABLE_LOAD_ALL_SUBTABLES); return $data->getExpandedDataTable($this->getResultIndices(), $idSubtable, $depth, $addMetadataSubtableId); }
[ "public", "function", "getDataTableExpanded", "(", "$", "name", ",", "$", "idSubtable", "=", "null", ",", "$", "depth", "=", "null", ",", "$", "addMetadataSubtableId", "=", "true", ")", "{", "$", "data", "=", "$", "this", "->", "get", "(", "$", "name",...
Queries and returns one report with all of its subtables loaded. If multiple sites were requested in {@link build()} or {@link factory()} the result will be a DataTable\Map that is indexed by site ID. If multiple periods were requested in {@link build()} or {@link factory()} the result will be a DataTable\Map that is indexed by period. The site ID index is always first, so if multiple sites & periods were requested, the result will be a {@link DataTable\Map indexed} by site ID which contains {@link DataTable\Map} instances that are indexed by period. @param string $name The name of the record to get. @param int|string|null $idSubtable The ID of the subtable to get (if any). The subtable will be expanded. @param int|null $depth The maximum number of subtable levels to load. If null, all levels are loaded. For example, if `1` is supplied, then the DataTable returned will have its subtables loaded. Those subtables, however, will NOT have their subtables loaded. @param bool $addMetadataSubtableId Whether to add the database subtable ID as metadata to each datatable, or not. @return DataTable|DataTable\Map
[ "Queries", "and", "returns", "one", "report", "with", "all", "of", "its", "subtables", "loaded", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive.php#L374-L378
train
Get a DataTable with subtable data
[ 30522, 2270, 3853, 2131, 2850, 29336, 3085, 10288, 9739, 5732, 1006, 1002, 2171, 1010, 1002, 8909, 6342, 19279, 3085, 1027, 19701, 1010, 1002, 5995, 1027, 19701, 1010, 1002, 5587, 11368, 8447, 10230, 12083, 10880, 3593, 1027, 2995, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/controllers/Updates.php
Updates.onApplyUpdates
public function onApplyUpdates() { try { /* * Process core */ $coreHash = post('hash'); $coreBuild = post('build'); $core = [$coreHash, $coreBuild]; /* * Process plugins */ $plugins = post('plugins'); if (is_array($plugins)) { $pluginCodes = []; foreach ($plugins as $code => $hash) { $pluginCodes[] = $this->decodeCode($code); } $plugins = array_combine($pluginCodes, $plugins); } else { $plugins = []; } /* * Process themes */ $themes = post('themes'); if (is_array($themes)) { $themeCodes = []; foreach ($themes as $code => $hash) { $themeCodes[] = $this->decodeCode($code); } $themes = array_combine($themeCodes, $themes); } else { $themes = []; } /* * Process important update actions */ $pluginActions = (array) post('plugin_actions'); foreach ($plugins as $code => $hash) { $_code = $this->encodeCode($code); if (!array_key_exists($_code, $pluginActions)) { continue; } $pluginAction = $pluginActions[$_code]; if (!$pluginAction) { throw new ApplicationException('Please select an action for plugin '. $code); } if ($pluginAction != 'confirm') { unset($plugins[$code]); } if ($pluginAction == 'ignore') { PluginVersion::whereCode($code)->update([ 'is_frozen' => true ]); } } /* * Update steps */ $updateSteps = $this->buildUpdateSteps($core, $plugins, $themes, false); /* * Finish up */ $updateSteps[] = [ 'code' => 'completeUpdate', 'label' => Lang::get('system::lang.updates.update_completing'), ]; $this->vars['updateSteps'] = $updateSteps; } catch (Exception $ex) { $this->handleError($ex); } return $this->makePartial('execute'); }
php
public function onApplyUpdates() { try { /* * Process core */ $coreHash = post('hash'); $coreBuild = post('build'); $core = [$coreHash, $coreBuild]; /* * Process plugins */ $plugins = post('plugins'); if (is_array($plugins)) { $pluginCodes = []; foreach ($plugins as $code => $hash) { $pluginCodes[] = $this->decodeCode($code); } $plugins = array_combine($pluginCodes, $plugins); } else { $plugins = []; } /* * Process themes */ $themes = post('themes'); if (is_array($themes)) { $themeCodes = []; foreach ($themes as $code => $hash) { $themeCodes[] = $this->decodeCode($code); } $themes = array_combine($themeCodes, $themes); } else { $themes = []; } /* * Process important update actions */ $pluginActions = (array) post('plugin_actions'); foreach ($plugins as $code => $hash) { $_code = $this->encodeCode($code); if (!array_key_exists($_code, $pluginActions)) { continue; } $pluginAction = $pluginActions[$_code]; if (!$pluginAction) { throw new ApplicationException('Please select an action for plugin '. $code); } if ($pluginAction != 'confirm') { unset($plugins[$code]); } if ($pluginAction == 'ignore') { PluginVersion::whereCode($code)->update([ 'is_frozen' => true ]); } } /* * Update steps */ $updateSteps = $this->buildUpdateSteps($core, $plugins, $themes, false); /* * Finish up */ $updateSteps[] = [ 'code' => 'completeUpdate', 'label' => Lang::get('system::lang.updates.update_completing'), ]; $this->vars['updateSteps'] = $updateSteps; } catch (Exception $ex) { $this->handleError($ex); } return $this->makePartial('execute'); }
[ "public", "function", "onApplyUpdates", "(", ")", "{", "try", "{", "/*\n * Process core\n */", "$", "coreHash", "=", "post", "(", "'hash'", ")", ";", "$", "coreBuild", "=", "post", "(", "'build'", ")", ";", "$", "core", "=", "[", "$",...
Converts the update data to an actionable array of steps.
[ "Converts", "the", "update", "data", "to", "an", "actionable", "array", "of", "steps", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/controllers/Updates.php#L464-L554
train
Apply updates to the plugins and themes
[ 30522, 2270, 3853, 2006, 29098, 2135, 6279, 27122, 1006, 1007, 1063, 3046, 1063, 1013, 1008, 1008, 2832, 4563, 1008, 1013, 1002, 4563, 14949, 2232, 1027, 2695, 1006, 1005, 23325, 1005, 1007, 1025, 1002, 4563, 8569, 4014, 2094, 1027, 2695, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
ProfilerController.searchBarAction
public function searchBarAction(Request $request) { $this->denyAccessIfProfilerDisabled(); if (null !== $this->cspHandler) { $this->cspHandler->disableCsp(); } if (!$request->hasSession()) { $ip = $method = $statusCode = $url = $start = $end = $limit = $token = null; } else { $session = $request->getSession(); $ip = $request->query->get('ip', $session->get('_profiler_search_ip')); $method = $request->query->get('method', $session->get('_profiler_search_method')); $statusCode = $request->query->get('status_code', $session->get('_profiler_search_status_code')); $url = $request->query->get('url', $session->get('_profiler_search_url')); $start = $request->query->get('start', $session->get('_profiler_search_start')); $end = $request->query->get('end', $session->get('_profiler_search_end')); $limit = $request->query->get('limit', $session->get('_profiler_search_limit')); $token = $request->query->get('token', $session->get('_profiler_search_token')); } return new Response( $this->twig->render('@WebProfiler/Profiler/search.html.twig', [ 'token' => $token, 'ip' => $ip, 'method' => $method, 'status_code' => $statusCode, 'url' => $url, 'start' => $start, 'end' => $end, 'limit' => $limit, 'request' => $request, ]), 200, ['Content-Type' => 'text/html'] ); }
php
public function searchBarAction(Request $request) { $this->denyAccessIfProfilerDisabled(); if (null !== $this->cspHandler) { $this->cspHandler->disableCsp(); } if (!$request->hasSession()) { $ip = $method = $statusCode = $url = $start = $end = $limit = $token = null; } else { $session = $request->getSession(); $ip = $request->query->get('ip', $session->get('_profiler_search_ip')); $method = $request->query->get('method', $session->get('_profiler_search_method')); $statusCode = $request->query->get('status_code', $session->get('_profiler_search_status_code')); $url = $request->query->get('url', $session->get('_profiler_search_url')); $start = $request->query->get('start', $session->get('_profiler_search_start')); $end = $request->query->get('end', $session->get('_profiler_search_end')); $limit = $request->query->get('limit', $session->get('_profiler_search_limit')); $token = $request->query->get('token', $session->get('_profiler_search_token')); } return new Response( $this->twig->render('@WebProfiler/Profiler/search.html.twig', [ 'token' => $token, 'ip' => $ip, 'method' => $method, 'status_code' => $statusCode, 'url' => $url, 'start' => $start, 'end' => $end, 'limit' => $limit, 'request' => $request, ]), 200, ['Content-Type' => 'text/html'] ); }
[ "public", "function", "searchBarAction", "(", "Request", "$", "request", ")", "{", "$", "this", "->", "denyAccessIfProfilerDisabled", "(", ")", ";", "if", "(", "null", "!==", "$", "this", "->", "cspHandler", ")", "{", "$", "this", "->", "cspHandler", "->",...
Renders the profiler search bar. @return Response A Response instance @throws NotFoundHttpException
[ "Renders", "the", "profiler", "search", "bar", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L163-L208
train
This action renders the search bar
[ 30522, 2270, 3853, 3945, 20709, 7542, 1006, 5227, 1002, 5227, 1007, 1063, 1002, 2023, 1011, 1028, 9772, 6305, 9623, 5332, 22540, 3217, 8873, 3917, 10521, 3085, 2094, 1006, 1007, 1025, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SitesManager/Model.php
Model.getSitesGroups
public function getSitesGroups() { $db = $this->getDb(); $groups = $db->fetchAll("SELECT DISTINCT `group` FROM " . $this->table); $cleanedGroups = array(); foreach ($groups as $group) { $cleanedGroups[] = $group['group']; } return $cleanedGroups; }
php
public function getSitesGroups() { $db = $this->getDb(); $groups = $db->fetchAll("SELECT DISTINCT `group` FROM " . $this->table); $cleanedGroups = array(); foreach ($groups as $group) { $cleanedGroups[] = $group['group']; } return $cleanedGroups; }
[ "public", "function", "getSitesGroups", "(", ")", "{", "$", "db", "=", "$", "this", "->", "getDb", "(", ")", ";", "$", "groups", "=", "$", "db", "->", "fetchAll", "(", "\"SELECT DISTINCT `group` FROM \"", ".", "$", "this", "->", "table", ")", ";", "$",...
Returns the list of website groups, including the empty group if no group were specified for some websites @return array of group names strings
[ "Returns", "the", "list", "of", "website", "groups", "including", "the", "empty", "group", "if", "no", "group", "were", "specified", "for", "some", "websites" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/Model.php#L57-L68
train
Get all the groups in the site table
[ 30522, 2270, 3853, 4152, 7616, 17058, 2015, 1006, 1007, 1063, 1002, 16962, 1027, 1002, 2023, 1011, 1028, 2131, 18939, 1006, 1007, 1025, 1002, 2967, 1027, 1002, 16962, 1011, 1028, 18584, 8095, 1006, 1000, 7276, 5664, 1036, 2177, 1036, 2013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/FormConfigBuilder.php
FormConfigBuilder.validateName
public static function validateName($name) { if (null !== $name && !\is_string($name) && !\is_int($name)) { throw new UnexpectedTypeException($name, 'string, integer or null'); } if (!self::isValidName($name)) { throw new InvalidArgumentException(sprintf('The name "%s" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").', $name)); } }
php
public static function validateName($name) { if (null !== $name && !\is_string($name) && !\is_int($name)) { throw new UnexpectedTypeException($name, 'string, integer or null'); } if (!self::isValidName($name)) { throw new InvalidArgumentException(sprintf('The name "%s" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").', $name)); } }
[ "public", "static", "function", "validateName", "(", "$", "name", ")", "{", "if", "(", "null", "!==", "$", "name", "&&", "!", "\\", "is_string", "(", "$", "name", ")", "&&", "!", "\\", "is_int", "(", "$", "name", ")", ")", "{", "throw", "new", "U...
Validates whether the given variable is a valid form name. @param string|int|null $name The tested form name @throws UnexpectedTypeException if the name is not a string or an integer @throws InvalidArgumentException if the name contains invalid characters
[ "Validates", "whether", "the", "given", "variable", "is", "a", "valid", "form", "name", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormConfigBuilder.php#L775-L784
train
Validate the name
[ 30522, 2270, 10763, 3853, 9398, 3686, 18442, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2171, 1004, 1004, 999, 1032, 2003, 1035, 5164, 1006, 1002, 2171, 1007, 1004, 1004, 999, 1032, 2003, 1035, 20014, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
walkor/Workerman
Protocols/Ws.php
Ws.onClose
public static function onClose($connection) { $connection->handshakeStep = null; $connection->websocketCurrentFrameLength = 0; $connection->tmpWebsocketData = ''; $connection->websocketDataBuffer = ''; if (!empty($connection->websocketPingTimer)) { Timer::del($connection->websocketPingTimer); $connection->websocketPingTimer = null; } }
php
public static function onClose($connection) { $connection->handshakeStep = null; $connection->websocketCurrentFrameLength = 0; $connection->tmpWebsocketData = ''; $connection->websocketDataBuffer = ''; if (!empty($connection->websocketPingTimer)) { Timer::del($connection->websocketPingTimer); $connection->websocketPingTimer = null; } }
[ "public", "static", "function", "onClose", "(", "$", "connection", ")", "{", "$", "connection", "->", "handshakeStep", "=", "null", ";", "$", "connection", "->", "websocketCurrentFrameLength", "=", "0", ";", "$", "connection", "->", "tmpWebsocketData", "=", "'...
Clean @param $connection
[ "Clean" ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Protocols/Ws.php#L341-L351
train
Close the connection
[ 30522, 2270, 10763, 3853, 2006, 20464, 9232, 1006, 1002, 4434, 1007, 1063, 1002, 4434, 1011, 1028, 2398, 20459, 4355, 13699, 1027, 19701, 1025, 1002, 4434, 1011, 1028, 4773, 6499, 19869, 13535, 29264, 15643, 7770, 13512, 2232, 1027, 1014, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Application.php
Application.doRun
public function doRun(InputInterface $input, OutputInterface $output) { if (true === $input->hasParameterOption(['--version', '-V'], true)) { $output->writeln($this->getLongVersion()); return 0; } try { // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument. $input->bind($this->getDefinition()); } catch (ExceptionInterface $e) { // Errors must be ignored, full binding/validation happens later when the command is known. } $name = $this->getCommandName($input); if (true === $input->hasParameterOption(['--help', '-h'], true)) { if (!$name) { $name = 'help'; $input = new ArrayInput(['command_name' => $this->defaultCommand]); } else { $this->wantHelps = true; } } if (!$name) { $name = $this->defaultCommand; $definition = $this->getDefinition(); $definition->setArguments(array_merge( $definition->getArguments(), [ 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name), ] )); } try { $this->runningCommand = null; // the command name MUST be the first element of the input $command = $this->find($name); } catch (\Throwable $e) { if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) { if (null !== $this->dispatcher) { $event = new ConsoleErrorEvent($input, $output, $e); $this->dispatcher->dispatch($event, ConsoleEvents::ERROR); if (0 === $event->getExitCode()) { return 0; } $e = $event->getError(); } throw $e; } $alternative = $alternatives[0]; $style = new SymfonyStyle($input, $output); $style->block(sprintf("\nCommand \"%s\" is not defined.\n", $name), null, 'error'); if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) { if (null !== $this->dispatcher) { $event = new ConsoleErrorEvent($input, $output, $e); $this->dispatcher->dispatch($event, ConsoleEvents::ERROR); return $event->getExitCode(); } return 1; } $command = $this->find($alternative); } $this->runningCommand = $command; $exitCode = $this->doRunCommand($command, $input, $output); $this->runningCommand = null; return $exitCode; }
php
public function doRun(InputInterface $input, OutputInterface $output) { if (true === $input->hasParameterOption(['--version', '-V'], true)) { $output->writeln($this->getLongVersion()); return 0; } try { // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument. $input->bind($this->getDefinition()); } catch (ExceptionInterface $e) { // Errors must be ignored, full binding/validation happens later when the command is known. } $name = $this->getCommandName($input); if (true === $input->hasParameterOption(['--help', '-h'], true)) { if (!$name) { $name = 'help'; $input = new ArrayInput(['command_name' => $this->defaultCommand]); } else { $this->wantHelps = true; } } if (!$name) { $name = $this->defaultCommand; $definition = $this->getDefinition(); $definition->setArguments(array_merge( $definition->getArguments(), [ 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name), ] )); } try { $this->runningCommand = null; // the command name MUST be the first element of the input $command = $this->find($name); } catch (\Throwable $e) { if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) { if (null !== $this->dispatcher) { $event = new ConsoleErrorEvent($input, $output, $e); $this->dispatcher->dispatch($event, ConsoleEvents::ERROR); if (0 === $event->getExitCode()) { return 0; } $e = $event->getError(); } throw $e; } $alternative = $alternatives[0]; $style = new SymfonyStyle($input, $output); $style->block(sprintf("\nCommand \"%s\" is not defined.\n", $name), null, 'error'); if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) { if (null !== $this->dispatcher) { $event = new ConsoleErrorEvent($input, $output, $e); $this->dispatcher->dispatch($event, ConsoleEvents::ERROR); return $event->getExitCode(); } return 1; } $command = $this->find($alternative); } $this->runningCommand = $command; $exitCode = $this->doRunCommand($command, $input, $output); $this->runningCommand = null; return $exitCode; }
[ "public", "function", "doRun", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "if", "(", "true", "===", "$", "input", "->", "hasParameterOption", "(", "[", "'--version'", ",", "'-V'", "]", ",", "true", ")", ")", "{"...
Runs the current application. @return int 0 if everything went fine, or an error code
[ "Runs", "the", "current", "application", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Application.php#L198-L277
train
Runs the command
[ 30522, 2270, 3853, 2079, 15532, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 2065, 1006, 2995, 1027, 1027, 1027, 1002, 7953, 1011, 1028, 2038, 28689, 22828, 7361, 3508, 1006, 1031, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Filter/Layout/Layout.php
Layout.columns
public function columns() { if ($this->columns->isEmpty()) { $this->columns->push($this->current); } return $this->columns; }
php
public function columns() { if ($this->columns->isEmpty()) { $this->columns->push($this->current); } return $this->columns; }
[ "public", "function", "columns", "(", ")", "{", "if", "(", "$", "this", "->", "columns", "->", "isEmpty", "(", ")", ")", "{", "$", "this", "->", "columns", "->", "push", "(", "$", "this", "->", "current", ")", ";", "}", "return", "$", "this", "->...
Get all columns in filter layout. @return Collection
[ "Get", "all", "columns", "in", "filter", "layout", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Layout/Layout.php#L77-L84
train
Get the columns
[ 30522, 2270, 3853, 7753, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 7753, 1011, 1028, 2003, 6633, 13876, 2100, 1006, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 7753, 1011, 1028, 5245, 1006, 1002, 2023, 1011, 1028, 2783, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Medium/ImageMedium.php
ImageMedium.height
public function height($value = 'auto') { if (!$value || $value === 'auto') { $this->attributes['height'] = $this->get('height'); } else { $this->attributes['height'] = $value; } return $this; }
php
public function height($value = 'auto') { if (!$value || $value === 'auto') { $this->attributes['height'] = $this->get('height'); } else { $this->attributes['height'] = $value; } return $this; }
[ "public", "function", "height", "(", "$", "value", "=", "'auto'", ")", "{", "if", "(", "!", "$", "value", "||", "$", "value", "===", "'auto'", ")", "{", "$", "this", "->", "attributes", "[", "'height'", "]", "=", "$", "this", "->", "get", "(", "'...
Allows to set the height attribute from Markdown or Twig Examples: ![Example](myimg.png?width=200&height=400) ![Example](myimg.png?resize=100,200&width=100&height=200) ![Example](myimg.png?width=auto&height=auto) ![Example](myimg.png?width&height) {{ page.media['myimg.png'].width().height().html }} {{ page.media['myimg.png'].resize(100,200).width(100).height(200).html }} @param mixed $value A value or 'auto' or empty to use the height of the image @return $this
[ "Allows", "to", "set", "the", "height", "attribute", "from", "Markdown", "or", "Twig", "Examples", ":", "!", "[", "Example", "]", "(", "myimg", ".", "png?width", "=", "200&height", "=", "400", ")", "!", "[", "Example", "]", "(", "myimg", ".", "png?resi...
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L508-L517
train
Set or get the height attribute
[ 30522, 2270, 3853, 4578, 1006, 1002, 3643, 1027, 1005, 8285, 1005, 1007, 1063, 2065, 1006, 999, 1002, 3643, 1064, 1064, 1002, 3643, 1027, 1027, 1027, 1005, 8285, 1005, 1007, 1063, 1002, 2023, 1011, 1028, 12332, 1031, 1005, 4578, 1005, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/Style.php
Style.set_font_size
function set_font_size($size) { $this->__font_size_calculated = false; //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["font_size"] = null; $this->_props["font_size"] = $size; }
php
function set_font_size($size) { $this->__font_size_calculated = false; //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["font_size"] = null; $this->_props["font_size"] = $size; }
[ "function", "set_font_size", "(", "$", "size", ")", "{", "$", "this", "->", "__font_size_calculated", "=", "false", ";", "//see __set and __get, on all assignments clear cache, not needed on direct set through __set", "$", "this", "->", "_prop_cache", "[", "\"font_size\"", ...
Sets the font size $size can be any acceptable CSS size @link http://www.w3.org/TR/CSS21/fonts.html#propdef-font-size @param string|float $size
[ "Sets", "the", "font", "size" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L1954-L1960
train
set font size
[ 30522, 3853, 2275, 1035, 15489, 1035, 2946, 1006, 1002, 2946, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 1035, 15489, 1035, 2946, 1035, 10174, 1027, 6270, 1025, 1013, 1013, 2156, 1035, 1035, 2275, 1998, 1035, 1035, 2131, 1010, 2006, 2035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Model.php
Model.bootTraits
protected static function bootTraits() { $class = static::class; $booted = []; static::$traitInitializers[$class] = []; foreach (class_uses_recursive($class) as $trait) { $method = 'boot'.class_basename($trait); if (method_exists($class, $method) && ! in_array($method, $booted)) { forward_static_call([$class, $method]); $booted[] = $method; } if (method_exists($class, $method = 'initialize'.class_basename($trait))) { static::$traitInitializers[$class][] = $method; static::$traitInitializers[$class] = array_unique( static::$traitInitializers[$class] ); } } }
php
protected static function bootTraits() { $class = static::class; $booted = []; static::$traitInitializers[$class] = []; foreach (class_uses_recursive($class) as $trait) { $method = 'boot'.class_basename($trait); if (method_exists($class, $method) && ! in_array($method, $booted)) { forward_static_call([$class, $method]); $booted[] = $method; } if (method_exists($class, $method = 'initialize'.class_basename($trait))) { static::$traitInitializers[$class][] = $method; static::$traitInitializers[$class] = array_unique( static::$traitInitializers[$class] ); } } }
[ "protected", "static", "function", "bootTraits", "(", ")", "{", "$", "class", "=", "static", "::", "class", ";", "$", "booted", "=", "[", "]", ";", "static", "::", "$", "traitInitializers", "[", "$", "class", "]", "=", "[", "]", ";", "foreach", "(", ...
Boot all of the bootable traits on the model. @return void
[ "Boot", "all", "of", "the", "bootable", "traits", "on", "the", "model", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L207-L232
train
Boot all traits
[ 30522, 5123, 10763, 3853, 9573, 6494, 12762, 1006, 1007, 1063, 1002, 2465, 1027, 10763, 1024, 1024, 2465, 1025, 1002, 9573, 2098, 1027, 1031, 1033, 1025, 10763, 1024, 1024, 1002, 18275, 5498, 20925, 17629, 2015, 1031, 1002, 2465, 1033, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.invalidOperator
protected function invalidOperator($operator) { return ! in_array(strtolower($operator), $this->operators, true) && ! in_array(strtolower($operator), $this->grammar->getOperators(), true); }
php
protected function invalidOperator($operator) { return ! in_array(strtolower($operator), $this->operators, true) && ! in_array(strtolower($operator), $this->grammar->getOperators(), true); }
[ "protected", "function", "invalidOperator", "(", "$", "operator", ")", "{", "return", "!", "in_array", "(", "strtolower", "(", "$", "operator", ")", ",", "$", "this", "->", "operators", ",", "true", ")", "&&", "!", "in_array", "(", "strtolower", "(", "$"...
Determine if the given operator is supported. @param string $operator @return bool
[ "Determine", "if", "the", "given", "operator", "is", "supported", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L730-L734
train
Internal method to check if the operator is not in the list of operators
[ 30522, 5123, 3853, 19528, 25918, 8844, 1006, 1002, 6872, 1007, 1063, 2709, 999, 1999, 1035, 9140, 1006, 2358, 5339, 12898, 13777, 1006, 1002, 6872, 1007, 1010, 1002, 2023, 1011, 1028, 9224, 1010, 2995, 1007, 1004, 1004, 999, 1999, 1035, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php
ColumnCallbackAddColumnQuotient.getDivisor
protected function getDivisor($row) { if (!is_null($this->totalValueUsedAsDivisor)) { return $this->totalValueUsedAsDivisor; } elseif ($this->getDivisorFromSummaryRow) { $summaryRow = $this->table->getRowFromId(DataTable::ID_SUMMARY_ROW); return $summaryRow->getColumn($this->columnNameUsedAsDivisor); } else { return $row->getColumn($this->columnNameUsedAsDivisor); } }
php
protected function getDivisor($row) { if (!is_null($this->totalValueUsedAsDivisor)) { return $this->totalValueUsedAsDivisor; } elseif ($this->getDivisorFromSummaryRow) { $summaryRow = $this->table->getRowFromId(DataTable::ID_SUMMARY_ROW); return $summaryRow->getColumn($this->columnNameUsedAsDivisor); } else { return $row->getColumn($this->columnNameUsedAsDivisor); } }
[ "protected", "function", "getDivisor", "(", "$", "row", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "totalValueUsedAsDivisor", ")", ")", "{", "return", "$", "this", "->", "totalValueUsedAsDivisor", ";", "}", "elseif", "(", "$", "this", "...
Returns the divisor to use when calculating the new column value. Can be overridden by descendent classes to customize behavior. @param Row $row The row being modified. @return int|float
[ "Returns", "the", "divisor", "to", "use", "when", "calculating", "the", "new", "column", "value", ".", "Can", "be", "overridden", "by", "descendent", "classes", "to", "customize", "behavior", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php#L135-L145
train
Obtain Divisor for a row
[ 30522, 5123, 3853, 2131, 4305, 11365, 2953, 1006, 1002, 5216, 1007, 1063, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 2023, 1011, 1028, 2561, 10175, 5657, 13901, 3022, 4305, 11365, 2953, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/UrlGenerator.php
UrlGenerator.format
public function format($root, $path, $route = null) { $path = '/'.trim($path, '/'); if ($this->formatHostUsing) { $root = call_user_func($this->formatHostUsing, $root, $route); } if ($this->formatPathUsing) { $path = call_user_func($this->formatPathUsing, $path, $route); } return trim($root.$path, '/'); }
php
public function format($root, $path, $route = null) { $path = '/'.trim($path, '/'); if ($this->formatHostUsing) { $root = call_user_func($this->formatHostUsing, $root, $route); } if ($this->formatPathUsing) { $path = call_user_func($this->formatPathUsing, $path, $route); } return trim($root.$path, '/'); }
[ "public", "function", "format", "(", "$", "root", ",", "$", "path", ",", "$", "route", "=", "null", ")", "{", "$", "path", "=", "'/'", ".", "trim", "(", "$", "path", ",", "'/'", ")", ";", "if", "(", "$", "this", "->", "formatHostUsing", ")", "{...
Format the given URL segments into a single URL. @param string $root @param string $path @param \Illuminate\Routing\Route|null $route @return string
[ "Format", "the", "given", "URL", "segments", "into", "a", "single", "URL", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/UrlGenerator.php#L513-L526
train
Formats the root and path using the formatHostUsing and formatPathUsing methods.
[ 30522, 2270, 3853, 4289, 1006, 1002, 7117, 1010, 1002, 4130, 1010, 1002, 2799, 1027, 19701, 1007, 1063, 1002, 4130, 1027, 1005, 1013, 1005, 1012, 12241, 1006, 1002, 4130, 1010, 1005, 1013, 1005, 1007, 1025, 2065, 1006, 1002, 2023, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/MediaManager.php
MediaManager.onApplyName
public function onApplyName() { $this->abortIfReadOnly(); $newName = trim(Input::get('name')); if (!strlen($newName)) { throw new ApplicationException(Lang::get('cms::lang.asset.name_cant_be_empty')); } if (!$this->validateFileName($newName)) { throw new ApplicationException(Lang::get('cms::lang.asset.invalid_name')); } $originalPath = Input::get('originalPath'); $originalPath = MediaLibrary::validatePath($originalPath); $newPath = dirname($originalPath).'/'.$newName; $type = Input::get('type'); if ($type == MediaLibraryItem::TYPE_FILE) { /* * Validate extension */ if (!$this->validateFileType($newName)) { throw new ApplicationException(Lang::get('backend::lang.media.type_blocked')); } /* * Move single file */ MediaLibrary::instance()->moveFile($originalPath, $newPath); /** * @event media.file.rename * Called after a file is renamed / moved * * Example usage: * * Event::listen('media.file.rename', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $originalPath, (string) $newPath) { * \Log::info($originalPath . " was moved to " . $path); * }); * * Or * * $mediaWidget->bindEvent('file.rename', function ((string) $originalPath, (string) $newPath) { * \Log::info($originalPath . " was moved to " . $path); * }); * */ $this->fireSystemEvent('media.file.rename', [$originalPath, $newPath]); } else { /* * Move single folder */ MediaLibrary::instance()->moveFolder($originalPath, $newPath); /** * @event media.folder.rename * Called after a folder is renamed / moved * * Example usage: * * Event::listen('media.folder.rename', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $originalPath, (string) $newPath) { * \Log::info($originalPath . " was moved to " . $path); * }); * * Or * * $mediaWidget->bindEvent('folder.rename', function ((string) $originalPath, (string) $newPath) { * \Log::info($originalPath . " was moved to " . $path); * }); * */ $this->fireSystemEvent('media.folder.rename', [$originalPath, $newPath]); } MediaLibrary::instance()->resetCache(); }
php
public function onApplyName() { $this->abortIfReadOnly(); $newName = trim(Input::get('name')); if (!strlen($newName)) { throw new ApplicationException(Lang::get('cms::lang.asset.name_cant_be_empty')); } if (!$this->validateFileName($newName)) { throw new ApplicationException(Lang::get('cms::lang.asset.invalid_name')); } $originalPath = Input::get('originalPath'); $originalPath = MediaLibrary::validatePath($originalPath); $newPath = dirname($originalPath).'/'.$newName; $type = Input::get('type'); if ($type == MediaLibraryItem::TYPE_FILE) { /* * Validate extension */ if (!$this->validateFileType($newName)) { throw new ApplicationException(Lang::get('backend::lang.media.type_blocked')); } /* * Move single file */ MediaLibrary::instance()->moveFile($originalPath, $newPath); /** * @event media.file.rename * Called after a file is renamed / moved * * Example usage: * * Event::listen('media.file.rename', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $originalPath, (string) $newPath) { * \Log::info($originalPath . " was moved to " . $path); * }); * * Or * * $mediaWidget->bindEvent('file.rename', function ((string) $originalPath, (string) $newPath) { * \Log::info($originalPath . " was moved to " . $path); * }); * */ $this->fireSystemEvent('media.file.rename', [$originalPath, $newPath]); } else { /* * Move single folder */ MediaLibrary::instance()->moveFolder($originalPath, $newPath); /** * @event media.folder.rename * Called after a folder is renamed / moved * * Example usage: * * Event::listen('media.folder.rename', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $originalPath, (string) $newPath) { * \Log::info($originalPath . " was moved to " . $path); * }); * * Or * * $mediaWidget->bindEvent('folder.rename', function ((string) $originalPath, (string) $newPath) { * \Log::info($originalPath . " was moved to " . $path); * }); * */ $this->fireSystemEvent('media.folder.rename', [$originalPath, $newPath]); } MediaLibrary::instance()->resetCache(); }
[ "public", "function", "onApplyName", "(", ")", "{", "$", "this", "->", "abortIfReadOnly", "(", ")", ";", "$", "newName", "=", "trim", "(", "Input", "::", "get", "(", "'name'", ")", ")", ";", "if", "(", "!", "strlen", "(", "$", "newName", ")", ")", ...
Reanem library item AJAX handler @return array
[ "Reanem", "library", "item", "AJAX", "handler" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L399-L476
train
This action applies the name of the asset
[ 30522, 2270, 3853, 2006, 29098, 9644, 14074, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 11113, 11589, 10128, 16416, 5280, 2135, 1006, 1007, 1025, 1002, 2047, 18442, 1027, 12241, 1006, 7953, 1024, 1024, 2131, 1006, 1005, 2171, 1005, 1007, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Annotations/AnnotationList.php
AnnotationList.makeAnnotation
private function makeAnnotation($date, $note, $starred = 0) { return array('date' => $date, 'note' => $note, 'starred' => (int)$starred, 'user' => Piwik::getCurrentUserLogin()); }
php
private function makeAnnotation($date, $note, $starred = 0) { return array('date' => $date, 'note' => $note, 'starred' => (int)$starred, 'user' => Piwik::getCurrentUserLogin()); }
[ "private", "function", "makeAnnotation", "(", "$", "date", ",", "$", "note", ",", "$", "starred", "=", "0", ")", "{", "return", "array", "(", "'date'", "=>", "$", "date", ",", "'note'", "=>", "$", "note", ",", "'starred'", "=>", "(", "int", ")", "$...
Utility function. Creates a new annotation. @param string $date @param string $note @param int $starred @return array
[ "Utility", "function", ".", "Creates", "a", "new", "annotation", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Annotations/AnnotationList.php#L312-L318
train
Returns an array with the date note starred and user information
[ 30522, 2797, 3853, 2191, 11639, 17287, 3508, 1006, 1002, 3058, 1010, 1002, 3602, 1010, 1002, 5652, 1027, 1014, 1007, 1063, 2709, 9140, 1006, 1005, 3058, 1005, 1027, 1028, 1002, 3058, 1010, 1005, 3602, 1005, 1027, 1028, 1002, 3602, 1010, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
HandleExceptions.fatalExceptionFromError
protected function fatalExceptionFromError(array $error, $traceOffset = null) { return new FatalErrorException( $error['message'], $error['type'], 0, $error['file'], $error['line'], $traceOffset ); }
php
protected function fatalExceptionFromError(array $error, $traceOffset = null) { return new FatalErrorException( $error['message'], $error['type'], 0, $error['file'], $error['line'], $traceOffset ); }
[ "protected", "function", "fatalExceptionFromError", "(", "array", "$", "error", ",", "$", "traceOffset", "=", "null", ")", "{", "return", "new", "FatalErrorException", "(", "$", "error", "[", "'message'", "]", ",", "$", "error", "[", "'type'", "]", ",", "0...
Create a new fatal exception instance from an error array. @param array $error @param int|null $traceOffset @return \Symfony\Component\Debug\Exception\FatalErrorException
[ "Create", "a", "new", "fatal", "exception", "instance", "from", "an", "error", "array", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php#L134-L139
train
Create a fatal exception from an error array
[ 30522, 5123, 3853, 10611, 10288, 24422, 19699, 8462, 18933, 2099, 1006, 9140, 1002, 7561, 1010, 1002, 7637, 27475, 3388, 1027, 19701, 1007, 1063, 2709, 2047, 10611, 2121, 29165, 10288, 24422, 1006, 1002, 7561, 1031, 1005, 4471, 1005, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Http.php
Http.sendHttpRequestBy
public static function sendHttpRequestBy( $method = 'socket', $aUrl, $timeout, $userAgent = null, $destinationPath = null, $file = null, $followDepth = 0, $acceptLanguage = false, $acceptInvalidSslCertificate = false, $byteRange = false, $getExtendedInfo = false, $httpMethod = 'GET', $httpUsername = null, $httpPassword = null, $requestBody = null, $additionalHeaders = array() ) { if ($followDepth > 5) { throw new Exception('Too many redirects (' . $followDepth . ')'); } $contentLength = 0; $fileLength = 0; if (!empty($requestBody) && is_array($requestBody)) { $requestBody = self::buildQuery($requestBody); } // Piwik services behave like a proxy, so we should act like one. $xff = 'X-Forwarded-For: ' . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] . ',' : '') . IP::getIpFromHeader(); if (empty($userAgent)) { $userAgent = self::getUserAgent(); } $via = 'Via: ' . (isset($_SERVER['HTTP_VIA']) && !empty($_SERVER['HTTP_VIA']) ? $_SERVER['HTTP_VIA'] . ', ' : '') . Version::VERSION . ' ' . ($userAgent ? " ($userAgent)" : ''); // range header $rangeHeader = ''; if (!empty($byteRange)) { $rangeHeader = 'Range: bytes=' . $byteRange[0] . '-' . $byteRange[1] . "\r\n"; } list($proxyHost, $proxyPort, $proxyUser, $proxyPassword) = self::getProxyConfiguration($aUrl); $aUrl = trim($aUrl); // other result data $status = null; $headers = array(); $httpAuthIsUsed = !empty($httpUsername) || !empty($httpPassword); if ($method == 'socket') { if (!self::isSocketEnabled()) { // can be triggered in tests throw new Exception("HTTP socket support is not enabled (php function fsockopen is not available) "); } // initialization $url = @parse_url($aUrl); if ($url === false || !isset($url['scheme'])) { throw new Exception('Malformed URL: ' . $aUrl); } if ($url['scheme'] != 'http' && $url['scheme'] != 'https') { throw new Exception('Invalid protocol/scheme: ' . $url['scheme']); } $host = $url['host']; $port = isset($url['port']) ? $url['port'] : ('https' == $url['scheme'] ? 443 : 80); $path = isset($url['path']) ? $url['path'] : '/'; if (isset($url['query'])) { $path .= '?' . $url['query']; } $errno = null; $errstr = null; if ((!empty($proxyHost) && !empty($proxyPort)) || !empty($byteRange) ) { $httpVer = '1.1'; } else { $httpVer = '1.0'; } $proxyAuth = null; if (!empty($proxyHost) && !empty($proxyPort)) { $connectHost = $proxyHost; $connectPort = $proxyPort; if (!empty($proxyUser) && !empty($proxyPassword)) { $proxyAuth = 'Proxy-Authorization: Basic ' . base64_encode("$proxyUser:$proxyPassword") . "\r\n"; } $requestHeader = "$httpMethod $aUrl HTTP/$httpVer\r\n"; } else { $connectHost = $host; $connectPort = $port; $requestHeader = "$httpMethod $path HTTP/$httpVer\r\n"; if ('https' == $url['scheme']) { $connectHost = 'ssl://' . $connectHost; } } // connection attempt if (($fsock = @fsockopen($connectHost, $connectPort, $errno, $errstr, $timeout)) === false || !is_resource($fsock)) { if (is_resource($file)) { @fclose($file); } throw new Exception("Error while connecting to: $host. Please try again later. $errstr"); } $httpAuth = ''; if ($httpAuthIsUsed) { $httpAuth = 'Authorization: Basic ' . base64_encode($httpUsername.':'.$httpPassword) . "\r\n"; } // send HTTP request header $requestHeader .= "Host: $host" . ($port != 80 && ('https' == $url['scheme'] && $port != 443) ? ':' . $port : '') . "\r\n" . ($httpAuth ? $httpAuth : '') . ($proxyAuth ? $proxyAuth : '') . 'User-Agent: ' . $userAgent . "\r\n" . ($acceptLanguage ? $acceptLanguage . "\r\n" : '') . $xff . "\r\n" . $via . "\r\n" . $rangeHeader . (!empty($additionalHeaders) ? implode("\r\n", $additionalHeaders) . "\r\n" : '') . "Connection: close\r\n"; fwrite($fsock, $requestHeader); if (strtolower($httpMethod) === 'post' && !empty($requestBody)) { fwrite($fsock, self::buildHeadersForPost($requestBody)); fwrite($fsock, "\r\n"); fwrite($fsock, $requestBody); } else { fwrite($fsock, "\r\n"); } $streamMetaData = array('timed_out' => false); @stream_set_blocking($fsock, true); if (function_exists('stream_set_timeout')) { @stream_set_timeout($fsock, $timeout); } elseif (function_exists('socket_set_timeout')) { @socket_set_timeout($fsock, $timeout); } // process header $status = null; while (!feof($fsock)) { $line = fgets($fsock, 4096); $streamMetaData = @stream_get_meta_data($fsock); if ($streamMetaData['timed_out']) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); throw new Exception('Timed out waiting for server response'); } // a blank line marks the end of the server response header if (rtrim($line, "\r\n") == '') { break; } // parse first line of server response header if (!$status) { // expect first line to be HTTP response status line, e.g., HTTP/1.1 200 OK if (!preg_match('~^HTTP/(\d\.\d)\s+(\d+)(\s*.*)?~', $line, $m)) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); throw new Exception('Expected server response code. Got ' . rtrim($line, "\r\n")); } $status = (integer)$m[2]; // Informational 1xx or Client Error 4xx if ($status < 200 || $status >= 400) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); if (!$getExtendedInfo) { return false; } else { return array('status' => $status); } } continue; } // handle redirect if (preg_match('/^Location:\s*(.+)/', rtrim($line, "\r\n"), $m)) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); // Successful 2xx vs Redirect 3xx if ($status < 300) { throw new Exception('Unexpected redirect to Location: ' . rtrim($line) . ' for status code ' . $status); } return self::sendHttpRequestBy( $method, trim($m[1]), $timeout, $userAgent, $destinationPath, $file, $followDepth + 1, $acceptLanguage, $acceptInvalidSslCertificate = false, $byteRange, $getExtendedInfo, $httpMethod, $httpUsername, $httpPassword, $requestBody, $additionalHeaders ); } // save expected content length for later verification if (preg_match('/^Content-Length:\s*(\d+)/', $line, $m)) { $contentLength = (integer)$m[1]; } self::parseHeaderLine($headers, $line); } if (feof($fsock) && $httpMethod != 'HEAD' ) { throw new Exception('Unexpected end of transmission'); } // process content/body $response = ''; while (!feof($fsock)) { $line = fread($fsock, 8192); $streamMetaData = @stream_get_meta_data($fsock); if ($streamMetaData['timed_out']) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); throw new Exception('Timed out waiting for server response'); } $fileLength += strlen($line); if (is_resource($file)) { // save to file fwrite($file, $line); } else { // concatenate to response string $response .= $line; } } // determine success or failure @fclose(@$fsock); } elseif ($method == 'fopen') { $response = false; // we make sure the request takes less than a few seconds to fail // we create a stream_context (works in php >= 5.2.1) // we also set the socket_timeout (for php < 5.2.1) $default_socket_timeout = @ini_get('default_socket_timeout'); @ini_set('default_socket_timeout', $timeout); $httpAuth = ''; if ($httpAuthIsUsed) { $httpAuth = 'Authorization: Basic ' . base64_encode($httpUsername.':'.$httpPassword) . "\r\n"; } $ctx = null; if (function_exists('stream_context_create')) { $stream_options = array( 'http' => array( 'header' => 'User-Agent: ' . $userAgent . "\r\n" . ($httpAuth ? $httpAuth : '') . ($acceptLanguage ? $acceptLanguage . "\r\n" : '') . $xff . "\r\n" . $via . "\r\n" . (!empty($additionalHeaders) ? implode("\r\n", $additionalHeaders) . "\r\n" : '') . $rangeHeader, 'max_redirects' => 5, // PHP 5.1.0 'timeout' => $timeout, // PHP 5.2.1 ) ); if (!empty($proxyHost) && !empty($proxyPort)) { $stream_options['http']['proxy'] = 'tcp://' . $proxyHost . ':' . $proxyPort; $stream_options['http']['request_fulluri'] = true; // required by squid proxy if (!empty($proxyUser) && !empty($proxyPassword)) { $stream_options['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode("$proxyUser:$proxyPassword") . "\r\n"; } } if (strtolower($httpMethod) === 'post' && !empty($requestBody)) { $postHeader = self::buildHeadersForPost($requestBody); $postHeader .= "\r\n"; $stream_options['http']['method'] = 'POST'; $stream_options['http']['header'] .= $postHeader; $stream_options['http']['content'] = $requestBody; } $ctx = stream_context_create($stream_options); } // save to file if (is_resource($file)) { if (!($handle = fopen($aUrl, 'rb', false, $ctx))) { throw new Exception("Unable to open $aUrl"); } while (!feof($handle)) { $response = fread($handle, 8192); $fileLength += strlen($response); fwrite($file, $response); } fclose($handle); } else { $response = @file_get_contents($aUrl, 0, $ctx); // try to get http status code from response headers if (isset($http_response_header) && preg_match('~^HTTP/(\d\.\d)\s+(\d+)(\s*.*)?~', implode("\n", $http_response_header), $m)) { $status = (int)$m[2]; } if (!$status && $response === false) { $error = error_get_last(); throw new \Exception($error['message']); } $fileLength = strlen($response); } // restore the socket_timeout value if (!empty($default_socket_timeout)) { @ini_set('default_socket_timeout', $default_socket_timeout); } } elseif ($method == 'curl') { if (!self::isCurlEnabled()) { // can be triggered in tests throw new Exception("CURL is not enabled in php.ini, but is being used."); } $ch = @curl_init(); if (!empty($proxyHost) && !empty($proxyPort)) { @curl_setopt($ch, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); if (!empty($proxyUser) && !empty($proxyPassword)) { // PROXYAUTH defaults to BASIC @curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyUser . ':' . $proxyPassword); } } $curl_options = array( // internal to ext/curl CURLOPT_BINARYTRANSFER => is_resource($file), // curl options (sorted oldest to newest) CURLOPT_URL => $aUrl, CURLOPT_USERAGENT => $userAgent, CURLOPT_HTTPHEADER => array_merge(array( $xff, $via, $rangeHeader, $acceptLanguage ), $additionalHeaders), // only get header info if not saving directly to file CURLOPT_HEADER => is_resource($file) ? false : true, CURLOPT_CONNECTTIMEOUT => $timeout, CURLOPT_TIMEOUT => $timeout, ); // Case core:archive command is triggering archiving on https:// and the certificate is not valid if ($acceptInvalidSslCertificate) { $curl_options += array( CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, ); } @curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $httpMethod); if ($httpMethod == 'HEAD') { @curl_setopt($ch, CURLOPT_NOBODY, true); } if (strtolower($httpMethod) === 'post' && !empty($requestBody)) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody); } if (!empty($httpUsername) && !empty($httpPassword)) { $curl_options += array( CURLOPT_USERPWD => $httpUsername . ':' . $httpPassword, ); } @curl_setopt_array($ch, $curl_options); self::configCurlCertificate($ch); /* * as of php 5.2.0, CURLOPT_FOLLOWLOCATION can't be set if * in safe_mode or open_basedir is set */ if ((string)ini_get('safe_mode') == '' && ini_get('open_basedir') == '') { $curl_options = array( // curl options (sorted oldest to newest) CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, ); @curl_setopt_array($ch, $curl_options); } if (is_resource($file)) { // write output directly to file @curl_setopt($ch, CURLOPT_FILE, $file); } else { // internal to ext/curl @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); } ob_start(); $response = @curl_exec($ch); ob_end_clean(); if ($response === true) { $response = ''; } elseif ($response === false) { $errstr = curl_error($ch); if ($errstr != '') { throw new Exception('curl_exec: ' . $errstr . '. Hostname requested was: ' . UrlHelper::getHostFromUrl($aUrl)); } $response = ''; } else { $header = ''; // redirects are included in the output html, so we look for the last line that starts w/ HTTP/... // to split the response while (substr($response, 0, 5) == "HTTP/") { $split = explode("\r\n\r\n", $response, 2); if(count($split) == 2) { list($header, $response) = $split; } else { $response = ''; $header = $split; } } foreach (explode("\r\n", $header) as $line) { self::parseHeaderLine($headers, $line); } } $contentLength = @curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); $fileLength = is_resource($file) ? @curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD) : strlen($response); $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE); @curl_close($ch); unset($ch); } else { throw new Exception('Invalid request method: ' . $method); } if (is_resource($file)) { fflush($file); @fclose($file); $fileSize = filesize($destinationPath); if ((($contentLength > 0) && ($fileLength != $contentLength)) || ($fileSize != $fileLength) ) { throw new Exception('File size error: ' . $destinationPath . '; expected ' . $contentLength . ' bytes; received ' . $fileLength . ' bytes; saved ' . $fileSize . ' bytes to file'); } return true; } if (!$getExtendedInfo) { return trim($response); } else { return array( 'status' => $status, 'headers' => $headers, 'data' => $response ); } }
php
public static function sendHttpRequestBy( $method = 'socket', $aUrl, $timeout, $userAgent = null, $destinationPath = null, $file = null, $followDepth = 0, $acceptLanguage = false, $acceptInvalidSslCertificate = false, $byteRange = false, $getExtendedInfo = false, $httpMethod = 'GET', $httpUsername = null, $httpPassword = null, $requestBody = null, $additionalHeaders = array() ) { if ($followDepth > 5) { throw new Exception('Too many redirects (' . $followDepth . ')'); } $contentLength = 0; $fileLength = 0; if (!empty($requestBody) && is_array($requestBody)) { $requestBody = self::buildQuery($requestBody); } // Piwik services behave like a proxy, so we should act like one. $xff = 'X-Forwarded-For: ' . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] . ',' : '') . IP::getIpFromHeader(); if (empty($userAgent)) { $userAgent = self::getUserAgent(); } $via = 'Via: ' . (isset($_SERVER['HTTP_VIA']) && !empty($_SERVER['HTTP_VIA']) ? $_SERVER['HTTP_VIA'] . ', ' : '') . Version::VERSION . ' ' . ($userAgent ? " ($userAgent)" : ''); // range header $rangeHeader = ''; if (!empty($byteRange)) { $rangeHeader = 'Range: bytes=' . $byteRange[0] . '-' . $byteRange[1] . "\r\n"; } list($proxyHost, $proxyPort, $proxyUser, $proxyPassword) = self::getProxyConfiguration($aUrl); $aUrl = trim($aUrl); // other result data $status = null; $headers = array(); $httpAuthIsUsed = !empty($httpUsername) || !empty($httpPassword); if ($method == 'socket') { if (!self::isSocketEnabled()) { // can be triggered in tests throw new Exception("HTTP socket support is not enabled (php function fsockopen is not available) "); } // initialization $url = @parse_url($aUrl); if ($url === false || !isset($url['scheme'])) { throw new Exception('Malformed URL: ' . $aUrl); } if ($url['scheme'] != 'http' && $url['scheme'] != 'https') { throw new Exception('Invalid protocol/scheme: ' . $url['scheme']); } $host = $url['host']; $port = isset($url['port']) ? $url['port'] : ('https' == $url['scheme'] ? 443 : 80); $path = isset($url['path']) ? $url['path'] : '/'; if (isset($url['query'])) { $path .= '?' . $url['query']; } $errno = null; $errstr = null; if ((!empty($proxyHost) && !empty($proxyPort)) || !empty($byteRange) ) { $httpVer = '1.1'; } else { $httpVer = '1.0'; } $proxyAuth = null; if (!empty($proxyHost) && !empty($proxyPort)) { $connectHost = $proxyHost; $connectPort = $proxyPort; if (!empty($proxyUser) && !empty($proxyPassword)) { $proxyAuth = 'Proxy-Authorization: Basic ' . base64_encode("$proxyUser:$proxyPassword") . "\r\n"; } $requestHeader = "$httpMethod $aUrl HTTP/$httpVer\r\n"; } else { $connectHost = $host; $connectPort = $port; $requestHeader = "$httpMethod $path HTTP/$httpVer\r\n"; if ('https' == $url['scheme']) { $connectHost = 'ssl://' . $connectHost; } } // connection attempt if (($fsock = @fsockopen($connectHost, $connectPort, $errno, $errstr, $timeout)) === false || !is_resource($fsock)) { if (is_resource($file)) { @fclose($file); } throw new Exception("Error while connecting to: $host. Please try again later. $errstr"); } $httpAuth = ''; if ($httpAuthIsUsed) { $httpAuth = 'Authorization: Basic ' . base64_encode($httpUsername.':'.$httpPassword) . "\r\n"; } // send HTTP request header $requestHeader .= "Host: $host" . ($port != 80 && ('https' == $url['scheme'] && $port != 443) ? ':' . $port : '') . "\r\n" . ($httpAuth ? $httpAuth : '') . ($proxyAuth ? $proxyAuth : '') . 'User-Agent: ' . $userAgent . "\r\n" . ($acceptLanguage ? $acceptLanguage . "\r\n" : '') . $xff . "\r\n" . $via . "\r\n" . $rangeHeader . (!empty($additionalHeaders) ? implode("\r\n", $additionalHeaders) . "\r\n" : '') . "Connection: close\r\n"; fwrite($fsock, $requestHeader); if (strtolower($httpMethod) === 'post' && !empty($requestBody)) { fwrite($fsock, self::buildHeadersForPost($requestBody)); fwrite($fsock, "\r\n"); fwrite($fsock, $requestBody); } else { fwrite($fsock, "\r\n"); } $streamMetaData = array('timed_out' => false); @stream_set_blocking($fsock, true); if (function_exists('stream_set_timeout')) { @stream_set_timeout($fsock, $timeout); } elseif (function_exists('socket_set_timeout')) { @socket_set_timeout($fsock, $timeout); } // process header $status = null; while (!feof($fsock)) { $line = fgets($fsock, 4096); $streamMetaData = @stream_get_meta_data($fsock); if ($streamMetaData['timed_out']) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); throw new Exception('Timed out waiting for server response'); } // a blank line marks the end of the server response header if (rtrim($line, "\r\n") == '') { break; } // parse first line of server response header if (!$status) { // expect first line to be HTTP response status line, e.g., HTTP/1.1 200 OK if (!preg_match('~^HTTP/(\d\.\d)\s+(\d+)(\s*.*)?~', $line, $m)) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); throw new Exception('Expected server response code. Got ' . rtrim($line, "\r\n")); } $status = (integer)$m[2]; // Informational 1xx or Client Error 4xx if ($status < 200 || $status >= 400) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); if (!$getExtendedInfo) { return false; } else { return array('status' => $status); } } continue; } // handle redirect if (preg_match('/^Location:\s*(.+)/', rtrim($line, "\r\n"), $m)) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); // Successful 2xx vs Redirect 3xx if ($status < 300) { throw new Exception('Unexpected redirect to Location: ' . rtrim($line) . ' for status code ' . $status); } return self::sendHttpRequestBy( $method, trim($m[1]), $timeout, $userAgent, $destinationPath, $file, $followDepth + 1, $acceptLanguage, $acceptInvalidSslCertificate = false, $byteRange, $getExtendedInfo, $httpMethod, $httpUsername, $httpPassword, $requestBody, $additionalHeaders ); } // save expected content length for later verification if (preg_match('/^Content-Length:\s*(\d+)/', $line, $m)) { $contentLength = (integer)$m[1]; } self::parseHeaderLine($headers, $line); } if (feof($fsock) && $httpMethod != 'HEAD' ) { throw new Exception('Unexpected end of transmission'); } // process content/body $response = ''; while (!feof($fsock)) { $line = fread($fsock, 8192); $streamMetaData = @stream_get_meta_data($fsock); if ($streamMetaData['timed_out']) { if (is_resource($file)) { @fclose($file); } @fclose($fsock); throw new Exception('Timed out waiting for server response'); } $fileLength += strlen($line); if (is_resource($file)) { // save to file fwrite($file, $line); } else { // concatenate to response string $response .= $line; } } // determine success or failure @fclose(@$fsock); } elseif ($method == 'fopen') { $response = false; // we make sure the request takes less than a few seconds to fail // we create a stream_context (works in php >= 5.2.1) // we also set the socket_timeout (for php < 5.2.1) $default_socket_timeout = @ini_get('default_socket_timeout'); @ini_set('default_socket_timeout', $timeout); $httpAuth = ''; if ($httpAuthIsUsed) { $httpAuth = 'Authorization: Basic ' . base64_encode($httpUsername.':'.$httpPassword) . "\r\n"; } $ctx = null; if (function_exists('stream_context_create')) { $stream_options = array( 'http' => array( 'header' => 'User-Agent: ' . $userAgent . "\r\n" . ($httpAuth ? $httpAuth : '') . ($acceptLanguage ? $acceptLanguage . "\r\n" : '') . $xff . "\r\n" . $via . "\r\n" . (!empty($additionalHeaders) ? implode("\r\n", $additionalHeaders) . "\r\n" : '') . $rangeHeader, 'max_redirects' => 5, // PHP 5.1.0 'timeout' => $timeout, // PHP 5.2.1 ) ); if (!empty($proxyHost) && !empty($proxyPort)) { $stream_options['http']['proxy'] = 'tcp://' . $proxyHost . ':' . $proxyPort; $stream_options['http']['request_fulluri'] = true; // required by squid proxy if (!empty($proxyUser) && !empty($proxyPassword)) { $stream_options['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode("$proxyUser:$proxyPassword") . "\r\n"; } } if (strtolower($httpMethod) === 'post' && !empty($requestBody)) { $postHeader = self::buildHeadersForPost($requestBody); $postHeader .= "\r\n"; $stream_options['http']['method'] = 'POST'; $stream_options['http']['header'] .= $postHeader; $stream_options['http']['content'] = $requestBody; } $ctx = stream_context_create($stream_options); } // save to file if (is_resource($file)) { if (!($handle = fopen($aUrl, 'rb', false, $ctx))) { throw new Exception("Unable to open $aUrl"); } while (!feof($handle)) { $response = fread($handle, 8192); $fileLength += strlen($response); fwrite($file, $response); } fclose($handle); } else { $response = @file_get_contents($aUrl, 0, $ctx); // try to get http status code from response headers if (isset($http_response_header) && preg_match('~^HTTP/(\d\.\d)\s+(\d+)(\s*.*)?~', implode("\n", $http_response_header), $m)) { $status = (int)$m[2]; } if (!$status && $response === false) { $error = error_get_last(); throw new \Exception($error['message']); } $fileLength = strlen($response); } // restore the socket_timeout value if (!empty($default_socket_timeout)) { @ini_set('default_socket_timeout', $default_socket_timeout); } } elseif ($method == 'curl') { if (!self::isCurlEnabled()) { // can be triggered in tests throw new Exception("CURL is not enabled in php.ini, but is being used."); } $ch = @curl_init(); if (!empty($proxyHost) && !empty($proxyPort)) { @curl_setopt($ch, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); if (!empty($proxyUser) && !empty($proxyPassword)) { // PROXYAUTH defaults to BASIC @curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyUser . ':' . $proxyPassword); } } $curl_options = array( // internal to ext/curl CURLOPT_BINARYTRANSFER => is_resource($file), // curl options (sorted oldest to newest) CURLOPT_URL => $aUrl, CURLOPT_USERAGENT => $userAgent, CURLOPT_HTTPHEADER => array_merge(array( $xff, $via, $rangeHeader, $acceptLanguage ), $additionalHeaders), // only get header info if not saving directly to file CURLOPT_HEADER => is_resource($file) ? false : true, CURLOPT_CONNECTTIMEOUT => $timeout, CURLOPT_TIMEOUT => $timeout, ); // Case core:archive command is triggering archiving on https:// and the certificate is not valid if ($acceptInvalidSslCertificate) { $curl_options += array( CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, ); } @curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $httpMethod); if ($httpMethod == 'HEAD') { @curl_setopt($ch, CURLOPT_NOBODY, true); } if (strtolower($httpMethod) === 'post' && !empty($requestBody)) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody); } if (!empty($httpUsername) && !empty($httpPassword)) { $curl_options += array( CURLOPT_USERPWD => $httpUsername . ':' . $httpPassword, ); } @curl_setopt_array($ch, $curl_options); self::configCurlCertificate($ch); /* * as of php 5.2.0, CURLOPT_FOLLOWLOCATION can't be set if * in safe_mode or open_basedir is set */ if ((string)ini_get('safe_mode') == '' && ini_get('open_basedir') == '') { $curl_options = array( // curl options (sorted oldest to newest) CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, ); @curl_setopt_array($ch, $curl_options); } if (is_resource($file)) { // write output directly to file @curl_setopt($ch, CURLOPT_FILE, $file); } else { // internal to ext/curl @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); } ob_start(); $response = @curl_exec($ch); ob_end_clean(); if ($response === true) { $response = ''; } elseif ($response === false) { $errstr = curl_error($ch); if ($errstr != '') { throw new Exception('curl_exec: ' . $errstr . '. Hostname requested was: ' . UrlHelper::getHostFromUrl($aUrl)); } $response = ''; } else { $header = ''; // redirects are included in the output html, so we look for the last line that starts w/ HTTP/... // to split the response while (substr($response, 0, 5) == "HTTP/") { $split = explode("\r\n\r\n", $response, 2); if(count($split) == 2) { list($header, $response) = $split; } else { $response = ''; $header = $split; } } foreach (explode("\r\n", $header) as $line) { self::parseHeaderLine($headers, $line); } } $contentLength = @curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); $fileLength = is_resource($file) ? @curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD) : strlen($response); $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE); @curl_close($ch); unset($ch); } else { throw new Exception('Invalid request method: ' . $method); } if (is_resource($file)) { fflush($file); @fclose($file); $fileSize = filesize($destinationPath); if ((($contentLength > 0) && ($fileLength != $contentLength)) || ($fileSize != $fileLength) ) { throw new Exception('File size error: ' . $destinationPath . '; expected ' . $contentLength . ' bytes; received ' . $fileLength . ' bytes; saved ' . $fileSize . ' bytes to file'); } return true; } if (!$getExtendedInfo) { return trim($response); } else { return array( 'status' => $status, 'headers' => $headers, 'data' => $response ); } }
[ "public", "static", "function", "sendHttpRequestBy", "(", "$", "method", "=", "'socket'", ",", "$", "aUrl", ",", "$", "timeout", ",", "$", "userAgent", "=", "null", ",", "$", "destinationPath", "=", "null", ",", "$", "file", "=", "null", ",", "$", "fol...
Sends an HTTP request using the specified transport method. @param string $method @param string $aUrl @param int $timeout in seconds @param string $userAgent @param string $destinationPath @param resource $file @param int $followDepth @param bool|string $acceptLanguage Accept-language header @param bool $acceptInvalidSslCertificate Only used with $method == 'curl'. If set to true (NOT recommended!) the SSL certificate will not be checked @param array|bool $byteRange For Range: header. Should be two element array of bytes, eg, array(0, 1024) Doesn't work w/ fopen method. @param bool $getExtendedInfo True to return status code, headers & response, false if just response. @param string $httpMethod The HTTP method to use. Defaults to `'GET'`. @param string $httpUsername HTTP Auth username @param string $httpPassword HTTP Auth password @param array|string $requestBody If $httpMethod is 'POST' this may accept an array of variables or a string that needs to be posted @param array $additionalHeaders List of additional headers to set for the request @throws Exception @return bool true (or string/array) on success; false on HTTP response error code (1xx or 4xx)
[ "Sends", "an", "HTTP", "request", "using", "the", "specified", "transport", "method", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Http.php#L141-L640
train
Sends HTTP request by using the standard HTTP methods
[ 30522, 2270, 10763, 3853, 4604, 11039, 25856, 2890, 15500, 3762, 1006, 1002, 4118, 1027, 1005, 22278, 1005, 1010, 1002, 8740, 12190, 1010, 1002, 2051, 5833, 1010, 1002, 5310, 4270, 3372, 1027, 19701, 1010, 1002, 7688, 15069, 1027, 19701, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Medium/AbstractMedia.php
AbstractMedia.getFileParts
protected function getFileParts($filename) { if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) { $name = $matches[1]; $extension = $matches[3]; $extra = (int) $matches[2]; $type = 'alternative'; if ($extra === 1) { $type = 'base'; $extra = null; } } else { $fileParts = explode('.', $filename); $name = array_shift($fileParts); $extension = null; $extra = null; $type = 'base'; while (($part = array_shift($fileParts)) !== null) { if ($part !== 'meta' && $part !== 'thumb') { if (null !== $extension) { $name .= '.' . $extension; } $extension = $part; } else { $type = $part; $extra = '.' . $part . '.' . implode('.', $fileParts); break; } } } return array($name, $extension, $type, $extra); }
php
protected function getFileParts($filename) { if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) { $name = $matches[1]; $extension = $matches[3]; $extra = (int) $matches[2]; $type = 'alternative'; if ($extra === 1) { $type = 'base'; $extra = null; } } else { $fileParts = explode('.', $filename); $name = array_shift($fileParts); $extension = null; $extra = null; $type = 'base'; while (($part = array_shift($fileParts)) !== null) { if ($part !== 'meta' && $part !== 'thumb') { if (null !== $extension) { $name .= '.' . $extension; } $extension = $part; } else { $type = $part; $extra = '.' . $part . '.' . implode('.', $fileParts); break; } } } return array($name, $extension, $type, $extra); }
[ "protected", "function", "getFileParts", "(", "$", "filename", ")", "{", "if", "(", "preg_match", "(", "'/(.*)@(\\d+)x\\.(.*)$/'", ",", "$", "filename", ",", "$", "matches", ")", ")", "{", "$", "name", "=", "$", "matches", "[", "1", "]", ";", "$", "ext...
Get filename, extension and meta part. @param string $filename @return array
[ "Get", "filename", "extension", "and", "meta", "part", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/AbstractMedia.php#L205-L240
train
Returns the file parts of the file
[ 30522, 5123, 3853, 2131, 8873, 2571, 26950, 1006, 1002, 5371, 18442, 1007, 1063, 2065, 1006, 3653, 2290, 1035, 2674, 1006, 1005, 1013, 1006, 1012, 1008, 1007, 1030, 1006, 1032, 1040, 1009, 1007, 1060, 1032, 1012, 1006, 1012, 1008, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Factory.php
HTML_QuickForm2_Factory.createRule
public static function createRule($type, HTML_QuickForm2_Node $owner, $message = '', $config = null) { $type = strtolower($type); if (!isset(self::$registeredRules[$type])) { throw new HTML_QuickForm2_InvalidArgumentException("Rule '$type' is not known"); } list($className, $includeFile) = self::$registeredRules[$type]; if (!class_exists($className)) { HTML_QuickForm2_Loader::loadClass($className, $includeFile); } if (isset(self::$registeredRules[$type][2])) { $config = call_user_func(array($className, 'mergeConfig'), $config, self::$registeredRules[$type][2]); } return new $className($owner, $message, $config); }
php
public static function createRule($type, HTML_QuickForm2_Node $owner, $message = '', $config = null) { $type = strtolower($type); if (!isset(self::$registeredRules[$type])) { throw new HTML_QuickForm2_InvalidArgumentException("Rule '$type' is not known"); } list($className, $includeFile) = self::$registeredRules[$type]; if (!class_exists($className)) { HTML_QuickForm2_Loader::loadClass($className, $includeFile); } if (isset(self::$registeredRules[$type][2])) { $config = call_user_func(array($className, 'mergeConfig'), $config, self::$registeredRules[$type][2]); } return new $className($owner, $message, $config); }
[ "public", "static", "function", "createRule", "(", "$", "type", ",", "HTML_QuickForm2_Node", "$", "owner", ",", "$", "message", "=", "''", ",", "$", "config", "=", "null", ")", "{", "$", "type", "=", "strtolower", "(", "$", "type", ")", ";", "if", "(...
Creates a new Rule of the given type @param string Rule type name (treated case-insensitively) @param HTML_QuickForm2_Node Element to validate by the rule @param string Message to display if validation fails @param mixed Configuration data for the rule @return HTML_QuickForm2_Rule A created Rule @throws HTML_QuickForm2_InvalidArgumentException If rule type is unknown @throws HTML_QuickForm2_NotFoundException If class for the rule can't be found and/or loaded from file
[ "Creates", "a", "new", "Rule", "of", "the", "given", "type" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Factory.php#L215-L231
train
Creates a new rule object
[ 30522, 2270, 10763, 3853, 3443, 6820, 2571, 1006, 1002, 2828, 1010, 16129, 1035, 4248, 14192, 2475, 1035, 13045, 1002, 3954, 1010, 1002, 4471, 1027, 1005, 1005, 1010, 1002, 9530, 8873, 2290, 1027, 19701, 1007, 1063, 1002, 2828, 1027, 2358, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Psr7/ServerRequest.php
ServerRequest.getContentLength
public function getContentLength(): ?int { $result = $this->getRequest()->getHeader('Content-Length'); return $result ? (int) $result[0] : null; }
php
public function getContentLength(): ?int { $result = $this->getRequest()->getHeader('Content-Length'); return $result ? (int) $result[0] : null; }
[ "public", "function", "getContentLength", "(", ")", ":", "?", "int", "{", "$", "result", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getHeader", "(", "'Content-Length'", ")", ";", "return", "$", "result", "?", "(", "int", ")", "$", "result",...
Get serverRequest content length, if known. Note: This method is not part of the PSR-7 standard. @return int|null
[ "Get", "serverRequest", "content", "length", "if", "known", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Psr7/ServerRequest.php#L79-L84
train
Get Content - Length of the request
[ 30522, 2270, 3853, 2131, 8663, 6528, 9286, 3070, 2705, 1006, 1007, 1024, 1029, 20014, 1063, 1002, 2765, 1027, 1002, 2023, 1011, 1028, 2131, 2890, 15500, 1006, 1007, 1011, 1028, 2131, 4974, 2121, 1006, 1005, 4180, 1011, 3091, 1005, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Finder/Comparator/Comparator.php
Comparator.setOperator
public function setOperator($operator) { if (!$operator) { $operator = '=='; } if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) { throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator)); } $this->operator = $operator; }
php
public function setOperator($operator) { if (!$operator) { $operator = '=='; } if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) { throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator)); } $this->operator = $operator; }
[ "public", "function", "setOperator", "(", "$", "operator", ")", "{", "if", "(", "!", "$", "operator", ")", "{", "$", "operator", "=", "'=='", ";", "}", "if", "(", "!", "\\", "in_array", "(", "$", "operator", ",", "[", "'>'", ",", "'<'", ",", "'>=...
Sets the comparison operator. @param string $operator A valid operator @throws \InvalidArgumentException
[ "Sets", "the", "comparison", "operator", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Comparator/Comparator.php#L61-L72
train
Set operator.
[ 30522, 2270, 3853, 2275, 25918, 8844, 1006, 1002, 6872, 1007, 1063, 2065, 1006, 999, 1002, 6872, 1007, 1063, 1002, 6872, 1027, 1005, 1027, 1027, 1005, 1025, 30524, 1010, 1005, 1026, 1005, 1010, 1005, 1028, 1027, 1005, 1010, 1005, 1026, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
HttpCache.mayServeStaleWhileRevalidate
private function mayServeStaleWhileRevalidate(Response $entry): bool { $timeout = $entry->headers->getCacheControlDirective('stale-while-revalidate'); if (null === $timeout) { $timeout = $this->options['stale_while_revalidate']; } return abs($entry->getTtl()) < $timeout; }
php
private function mayServeStaleWhileRevalidate(Response $entry): bool { $timeout = $entry->headers->getCacheControlDirective('stale-while-revalidate'); if (null === $timeout) { $timeout = $this->options['stale_while_revalidate']; } return abs($entry->getTtl()) < $timeout; }
[ "private", "function", "mayServeStaleWhileRevalidate", "(", "Response", "$", "entry", ")", ":", "bool", "{", "$", "timeout", "=", "$", "entry", "->", "headers", "->", "getCacheControlDirective", "(", "'stale-while-revalidate'", ")", ";", "if", "(", "null", "==="...
Checks whether the given (cached) response may be served as "stale" when a revalidation is currently in progress.
[ "Checks", "whether", "the", "given", "(", "cached", ")", "response", "may", "be", "served", "as", "stale", "when", "a", "revalidation", "is", "currently", "in", "progress", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L690-L699
train
Checks if the response may be stale while revalidating.
[ 30522, 2797, 3853, 2089, 8043, 6961, 22059, 19927, 2890, 10175, 8524, 2618, 1006, 3433, 1002, 4443, 1007, 1024, 22017, 2140, 1063, 1002, 2051, 5833, 1027, 1002, 4443, 1011, 1028, 20346, 2015, 1011, 1028, 2131, 3540, 5403, 8663, 13181, 6392,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Classification/DecisionTree.php
DecisionTree.getSplitNodesByColumn
protected function getSplitNodesByColumn(int $column, DecisionTreeLeaf $node): array { if ($node->isTerminal) { return []; } $nodes = []; if ($node->columnIndex === $column) { $nodes[] = $node; } $lNodes = []; $rNodes = []; if ($node->leftLeaf !== null) { $lNodes = $this->getSplitNodesByColumn($column, $node->leftLeaf); } if ($node->rightLeaf !== null) { $rNodes = $this->getSplitNodesByColumn($column, $node->rightLeaf); } return array_merge($nodes, $lNodes, $rNodes); }
php
protected function getSplitNodesByColumn(int $column, DecisionTreeLeaf $node): array { if ($node->isTerminal) { return []; } $nodes = []; if ($node->columnIndex === $column) { $nodes[] = $node; } $lNodes = []; $rNodes = []; if ($node->leftLeaf !== null) { $lNodes = $this->getSplitNodesByColumn($column, $node->leftLeaf); } if ($node->rightLeaf !== null) { $rNodes = $this->getSplitNodesByColumn($column, $node->rightLeaf); } return array_merge($nodes, $lNodes, $rNodes); }
[ "protected", "function", "getSplitNodesByColumn", "(", "int", "$", "column", ",", "DecisionTreeLeaf", "$", "node", ")", ":", "array", "{", "if", "(", "$", "node", "->", "isTerminal", ")", "{", "return", "[", "]", ";", "}", "$", "nodes", "=", "[", "]", ...
Collects and returns an array of internal nodes that use the given column as a split criterion
[ "Collects", "and", "returns", "an", "array", "of", "internal", "nodes", "that", "use", "the", "given", "column", "as", "a", "split", "criterion" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/DecisionTree.php#L440-L462
train
Returns the split nodes by a given column
[ 30522, 5123, 3853, 4152, 24759, 4183, 3630, 6155, 3762, 25778, 2819, 2078, 1006, 20014, 1002, 5930, 1010, 3247, 13334, 19213, 1002, 13045, 1007, 1024, 9140, 1063, 2065, 1006, 1002, 13045, 1011, 1028, 21541, 2121, 22311, 2140, 1007, 1063, 27...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php
FilecontentFilterIterator.accept
public function accept() { if (!$this->matchRegexps && !$this->noMatchRegexps) { return true; } $fileinfo = $this->current(); if ($fileinfo->isDir() || !$fileinfo->isReadable()) { return false; } $content = $fileinfo->getContents(); if (!$content) { return false; } return $this->isAccepted($content); }
php
public function accept() { if (!$this->matchRegexps && !$this->noMatchRegexps) { return true; } $fileinfo = $this->current(); if ($fileinfo->isDir() || !$fileinfo->isReadable()) { return false; } $content = $fileinfo->getContents(); if (!$content) { return false; } return $this->isAccepted($content); }
[ "public", "function", "accept", "(", ")", "{", "if", "(", "!", "$", "this", "->", "matchRegexps", "&&", "!", "$", "this", "->", "noMatchRegexps", ")", "{", "return", "true", ";", "}", "$", "fileinfo", "=", "$", "this", "->", "current", "(", ")", ";...
Filters the iterator values. @return bool true if the value should be kept, false otherwise
[ "Filters", "the", "iterator", "values", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php#L27-L45
train
Accept a file
[ 30522, 2270, 3853, 5138, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2674, 2890, 3351, 2595, 4523, 1004, 1004, 999, 1002, 2023, 1011, 1028, 2053, 18900, 2818, 2890, 3351, 2595, 4523, 1007, 1063, 2709, 2995, 1025, 1065, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Plugin/Controller.php
Controller.getLastUnitGraph
protected function getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod) { $view = ViewDataTableFactory::build( Evolution::ID, $apiMethod, $currentModuleName . '.' . $currentControllerAction, $forceDefault = true); $view->config->show_goals = false; return $view; }
php
protected function getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod) { $view = ViewDataTableFactory::build( Evolution::ID, $apiMethod, $currentModuleName . '.' . $currentControllerAction, $forceDefault = true); $view->config->show_goals = false; return $view; }
[ "protected", "function", "getLastUnitGraph", "(", "$", "currentModuleName", ",", "$", "currentControllerAction", ",", "$", "apiMethod", ")", "{", "$", "view", "=", "ViewDataTableFactory", "::", "build", "(", "Evolution", "::", "ID", ",", "$", "apiMethod", ",", ...
Returns a ViewDataTable object that will render a jqPlot evolution graph for the last30 days/weeks/etc. of the current period, relative to the current date. @param string $currentModuleName The name of the current plugin. @param string $currentControllerAction The name of the action that renders the desired report. @param string $apiMethod The API method that the ViewDataTable will use to get graph data. @return ViewDataTable @api
[ "Returns", "a", "ViewDataTable", "object", "that", "will", "render", "a", "jqPlot", "evolution", "graph", "for", "the", "last30", "days", "/", "weeks", "/", "etc", ".", "of", "the", "current", "period", "relative", "to", "the", "current", "date", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Controller.php#L365-L371
train
Get last unit graph
[ 30522, 5123, 3853, 2131, 8523, 8525, 3490, 2102, 14413, 1006, 1002, 2783, 5302, 8566, 20844, 4168, 1010, 1002, 2783, 8663, 13181, 10820, 18908, 3258, 1010, 1002, 17928, 11368, 6806, 2094, 1007, 1063, 1002, 3193, 1027, 3193, 2850, 29336, 308...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Access.php
Access.getRoleForSite
public function getRoleForSite($idSite) { if ($this->hasSuperUserAccess || in_array($idSite, $this->getSitesIdWithAdminAccess()) ) { return 'admin'; } if (in_array($idSite, $this->getSitesIdWithWriteAccess())) { return 'write'; } if (in_array($idSite, $this->getSitesIdWithViewAccess())) { return 'view'; } return 'noaccess'; }
php
public function getRoleForSite($idSite) { if ($this->hasSuperUserAccess || in_array($idSite, $this->getSitesIdWithAdminAccess()) ) { return 'admin'; } if (in_array($idSite, $this->getSitesIdWithWriteAccess())) { return 'write'; } if (in_array($idSite, $this->getSitesIdWithViewAccess())) { return 'view'; } return 'noaccess'; }
[ "public", "function", "getRoleForSite", "(", "$", "idSite", ")", "{", "if", "(", "$", "this", "->", "hasSuperUserAccess", "||", "in_array", "(", "$", "idSite", ",", "$", "this", "->", "getSitesIdWithAdminAccess", "(", ")", ")", ")", "{", "return", "'admin'...
Returns the level of access the current user has to the given site. @param int $idSite The site to check. @return string The access level, eg, 'view', 'admin', 'noaccess'.
[ "Returns", "the", "level", "of", "access", "the", "current", "user", "has", "to", "the", "given", "site", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Access.php#L652-L669
train
Get the role for the given site
[ 30522, 2270, 3853, 2131, 13153, 12879, 5668, 4221, 1006, 1002, 8909, 28032, 2063, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2038, 6342, 4842, 20330, 6305, 9623, 2015, 30524, 24415, 4215, 22311, 9468, 7971, 1006, 1007, 1007, 1007, 1063...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Traits/PdoTrait.php
PdoTrait.doDelete
protected function doDelete(array $ids) { $sql = str_pad('', (\count($ids) << 1) - 1, '?,'); $sql = "DELETE FROM $this->table WHERE $this->idCol IN ($sql)"; try { $stmt = $this->getConnection()->prepare($sql); $stmt->execute(array_values($ids)); } catch (TableNotFoundException $e) { } return true; }
php
protected function doDelete(array $ids) { $sql = str_pad('', (\count($ids) << 1) - 1, '?,'); $sql = "DELETE FROM $this->table WHERE $this->idCol IN ($sql)"; try { $stmt = $this->getConnection()->prepare($sql); $stmt->execute(array_values($ids)); } catch (TableNotFoundException $e) { } return true; }
[ "protected", "function", "doDelete", "(", "array", "$", "ids", ")", "{", "$", "sql", "=", "str_pad", "(", "''", ",", "(", "\\", "count", "(", "$", "ids", ")", "<<", "1", ")", "-", "1", ",", "'?,'", ")", ";", "$", "sql", "=", "\"DELETE FROM $this-...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/PdoTrait.php#L255-L266
train
Delete all records from the table
[ 30522, 5123, 3853, 26489, 12260, 2618, 1006, 9140, 1002, 8909, 2015, 1007, 1063, 1002, 29296, 1027, 2358, 2099, 1035, 11687, 1006, 1005, 1005, 1010, 1006, 1032, 4175, 1006, 1002, 8909, 2015, 1007, 1026, 1026, 1015, 1007, 1011, 1015, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/PluginManager.php
PluginManager.getDependencies
public function getDependencies($plugin) { if (is_string($plugin) && (!$plugin = $this->findByIdentifier($plugin))) { return false; } if (!isset($plugin->require) || !$plugin->require) { return null; } return is_array($plugin->require) ? $plugin->require : [$plugin->require]; }
php
public function getDependencies($plugin) { if (is_string($plugin) && (!$plugin = $this->findByIdentifier($plugin))) { return false; } if (!isset($plugin->require) || !$plugin->require) { return null; } return is_array($plugin->require) ? $plugin->require : [$plugin->require]; }
[ "public", "function", "getDependencies", "(", "$", "plugin", ")", "{", "if", "(", "is_string", "(", "$", "plugin", ")", "&&", "(", "!", "$", "plugin", "=", "$", "this", "->", "findByIdentifier", "(", "$", "plugin", ")", ")", ")", "{", "return", "fals...
Returns the plugin identifiers that are required by the supplied plugin. @param string $plugin Plugin identifier, object or class @return array
[ "Returns", "the", "plugin", "identifiers", "that", "are", "required", "by", "the", "supplied", "plugin", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L680-L691
train
Get the dependencies of a plugin
[ 30522, 2270, 3853, 2131, 3207, 11837, 4181, 9243, 1006, 1002, 13354, 2378, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 13354, 2378, 1007, 1004, 1004, 1006, 999, 1002, 13354, 2378, 1027, 1002, 2023, 1011, 1028, 2424, 3762, 5178, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
slimphp/Slim
Slim/Handlers/PhpError.php
PhpError.renderXmlErrorMessage
protected function renderXmlErrorMessage(Throwable $error) { $xml = "<error>\n <message>Slim Application Error</message>\n"; if ($this->displayErrorDetails) { do { $xml .= " <error>\n"; $xml .= " <type>" . get_class($error) . "</type>\n"; $xml .= " <code>" . $error->getCode() . "</code>\n"; $xml .= " <message>" . $this->createCdataSection($error->getMessage()) . "</message>\n"; $xml .= " <file>" . $error->getFile() . "</file>\n"; $xml .= " <line>" . $error->getLine() . "</line>\n"; $xml .= " <trace>" . $this->createCdataSection($error->getTraceAsString()) . "</trace>\n"; $xml .= " </error>\n"; } while ($error = $error->getPrevious()); } $xml .= "</error>"; return $xml; }
php
protected function renderXmlErrorMessage(Throwable $error) { $xml = "<error>\n <message>Slim Application Error</message>\n"; if ($this->displayErrorDetails) { do { $xml .= " <error>\n"; $xml .= " <type>" . get_class($error) . "</type>\n"; $xml .= " <code>" . $error->getCode() . "</code>\n"; $xml .= " <message>" . $this->createCdataSection($error->getMessage()) . "</message>\n"; $xml .= " <file>" . $error->getFile() . "</file>\n"; $xml .= " <line>" . $error->getLine() . "</line>\n"; $xml .= " <trace>" . $this->createCdataSection($error->getTraceAsString()) . "</trace>\n"; $xml .= " </error>\n"; } while ($error = $error->getPrevious()); } $xml .= "</error>"; return $xml; }
[ "protected", "function", "renderXmlErrorMessage", "(", "Throwable", "$", "error", ")", "{", "$", "xml", "=", "\"<error>\\n <message>Slim Application Error</message>\\n\"", ";", "if", "(", "$", "this", "->", "displayErrorDetails", ")", "{", "do", "{", "$", "xml", ...
Render XML error @param Throwable $error @return string
[ "Render", "XML", "error" ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Handlers/PhpError.php#L168-L186
train
Render XML error message
[ 30522, 5123, 3853, 17552, 2595, 18602, 29165, 7834, 3736, 3351, 1006, 5466, 3085, 30524, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 4653, 2121, 29165, 3207, 22081, 1007, 1063, 2079, 1063, 1002, 20950, 1012, 1027, 1000, 1026, 7561, 1028, 1032...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Traits/RedisTrait.php
RedisTrait.doFetch
protected function doFetch(array $ids) { if (!$ids) { return []; } $result = []; if ($this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof ClusterInterface) { $values = $this->pipeline(function () use ($ids) { foreach ($ids as $id) { yield 'get' => [$id]; } }); } else { $values = array_combine($ids, $this->redis->mget($ids)); } foreach ($values as $id => $v) { if ($v) { $result[$id] = $this->marshaller->unmarshall($v); } } return $result; }
php
protected function doFetch(array $ids) { if (!$ids) { return []; } $result = []; if ($this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof ClusterInterface) { $values = $this->pipeline(function () use ($ids) { foreach ($ids as $id) { yield 'get' => [$id]; } }); } else { $values = array_combine($ids, $this->redis->mget($ids)); } foreach ($values as $id => $v) { if ($v) { $result[$id] = $this->marshaller->unmarshall($v); } } return $result; }
[ "protected", "function", "doFetch", "(", "array", "$", "ids", ")", "{", "if", "(", "!", "$", "ids", ")", "{", "return", "[", "]", ";", "}", "$", "result", "=", "[", "]", ";", "if", "(", "$", "this", "->", "redis", "instanceof", "\\", "Predis", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/RedisTrait.php#L283-L308
train
Do fetch.
[ 30522, 5123, 3853, 2079, 7959, 10649, 1006, 9140, 1002, 8909, 2015, 1007, 1063, 2065, 1006, 999, 1002, 8909, 2015, 1007, 1063, 2709, 1031, 1033, 1025, 1065, 1002, 2765, 1027, 1031, 1033, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 2417, 248...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/AttributeTranslator.php
AttributeTranslator._set_table_cellspacing
static protected function _set_table_cellspacing(\DOMElement $node, $value) { $style = rtrim($node->getAttribute(self::$_style_attr), ";"); if ($value == 0) { $style .= "; border-collapse: collapse;"; } else { $style .= "; border-spacing: {$value}px; border-collapse: separate;"; } return ltrim($style, ";"); }
php
static protected function _set_table_cellspacing(\DOMElement $node, $value) { $style = rtrim($node->getAttribute(self::$_style_attr), ";"); if ($value == 0) { $style .= "; border-collapse: collapse;"; } else { $style .= "; border-spacing: {$value}px; border-collapse: separate;"; } return ltrim($style, ";"); }
[ "static", "protected", "function", "_set_table_cellspacing", "(", "\\", "DOMElement", "$", "node", ",", "$", "value", ")", "{", "$", "style", "=", "rtrim", "(", "$", "node", "->", "getAttribute", "(", "self", "::", "$", "_style_attr", ")", ",", "\";\"", ...
@param \DOMElement $node @param string $value @return string
[ "@param", "\\", "DOMElement", "$node", "@param", "string", "$value" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/AttributeTranslator.php#L401-L412
train
Set Table cell spacing
[ 30522, 10763, 5123, 3853, 1035, 2275, 1035, 2795, 1035, 4442, 19498, 2075, 1006, 1032, 8514, 16930, 4765, 1002, 13045, 1010, 1002, 3643, 1007, 1063, 1002, 2806, 1027, 19387, 20026, 1006, 1002, 13045, 1011, 1028, 2131, 19321, 3089, 8569, 261...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
Descriptor.write
protected function write($content, $decorated = false) { $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW); }
php
protected function write($content, $decorated = false) { $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW); }
[ "protected", "function", "write", "(", "$", "content", ",", "$", "decorated", "=", "false", ")", "{", "$", "this", "->", "output", "->", "write", "(", "$", "content", ",", "false", ",", "$", "decorated", "?", "OutputInterface", "::", "OUTPUT_NORMAL", ":"...
Writes content to output. @param string $content @param bool $decorated
[ "Writes", "content", "to", "output", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php#L103-L106
train
Write content to the output
[ 30522, 5123, 3853, 4339, 1006, 1002, 4180, 1010, 1002, 7429, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 6434, 1011, 1028, 4339, 1006, 1002, 4180, 1010, 6270, 1010, 1002, 7429, 1029, 6434, 18447, 2121, 12172, 1024, 1024, 6434, 1035, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php
ThumbnailImageMedium.bubble
protected function bubble($method, array $arguments = [], $testLinked = true) { if (!$testLinked || $this->linked) { return $this->parent ? call_user_func_array(array($this->parent, $method), $arguments) : $this; } return call_user_func_array(array($this, 'parent::' . $method), $arguments); }
php
protected function bubble($method, array $arguments = [], $testLinked = true) { if (!$testLinked || $this->linked) { return $this->parent ? call_user_func_array(array($this->parent, $method), $arguments) : $this; } return call_user_func_array(array($this, 'parent::' . $method), $arguments); }
[ "protected", "function", "bubble", "(", "$", "method", ",", "array", "$", "arguments", "=", "[", "]", ",", "$", "testLinked", "=", "true", ")", "{", "if", "(", "!", "$", "testLinked", "||", "$", "this", "->", "linked", ")", "{", "return", "$", "thi...
Bubble a function call up to either the superclass function or the parent Medium instance @param string $method @param array $arguments @param bool $testLinked @return Medium
[ "Bubble", "a", "function", "call", "up", "to", "either", "the", "superclass", "function", "or", "the", "parent", "Medium", "instance" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php#L124-L131
train
Bubble the method to the parent class
[ 30522, 5123, 3853, 11957, 1006, 1002, 4118, 1010, 9140, 1002, 9918, 1027, 1031, 1033, 1010, 1002, 3231, 13767, 2098, 1027, 2995, 1007, 1063, 2065, 1006, 999, 1002, 3231, 13767, 2098, 1064, 1064, 1002, 2023, 1011, 1028, 5799, 1007, 1063, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Rule/Compare.php
HTML_QuickForm2_Rule_Compare.toCanonicalForm
protected static function toCanonicalForm($config, $key = 'operand') { if (!is_array($config)) { return array($key => $config); } elseif (array_key_exists('operator', $config) || array_key_exists('operand', $config) ) { return $config; } elseif (1 == count($config)) { return array($key => end($config)); } else { return array('operator' => reset($config), 'operand' => end($config)); } }
php
protected static function toCanonicalForm($config, $key = 'operand') { if (!is_array($config)) { return array($key => $config); } elseif (array_key_exists('operator', $config) || array_key_exists('operand', $config) ) { return $config; } elseif (1 == count($config)) { return array($key => end($config)); } else { return array('operator' => reset($config), 'operand' => end($config)); } }
[ "protected", "static", "function", "toCanonicalForm", "(", "$", "config", ",", "$", "key", "=", "'operand'", ")", "{", "if", "(", "!", "is_array", "(", "$", "config", ")", ")", "{", "return", "array", "(", "$", "key", "=>", "$", "config", ")", ";", ...
Converts configuration data to a canonical associative array form @param mixed Configuration data @param string Array key to assign $config to if it is scalar @return array Associative array that may contain 'operand' and 'operator' keys
[ "Converts", "configuration", "data", "to", "a", "canonical", "associative", "array", "form" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule/Compare.php#L195-L211
train
Returns the canonical form of the operator and operand configuration
[ 30522, 5123, 10763, 3853, 2000, 23803, 20913, 14192, 1006, 1002, 9530, 8873, 2290, 1010, 1002, 3145, 1027, 1005, 3850, 4859, 1005, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 9530, 8873, 2290, 1007, 1007, 1063, 2709, 9140, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/Kernel.php
Kernel.getRootDir
public function getRootDir(/* $triggerDeprecation = true */) { if (0 === \func_num_args() || func_get_arg(0)) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use getProjectDir() instead.', __METHOD__), E_USER_DEPRECATED); } if (null === $this->rootDir) { $r = new \ReflectionObject($this); $this->rootDir = \dirname($r->getFileName()); } return $this->rootDir; }
php
public function getRootDir(/* $triggerDeprecation = true */) { if (0 === \func_num_args() || func_get_arg(0)) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use getProjectDir() instead.', __METHOD__), E_USER_DEPRECATED); } if (null === $this->rootDir) { $r = new \ReflectionObject($this); $this->rootDir = \dirname($r->getFileName()); } return $this->rootDir; }
[ "public", "function", "getRootDir", "(", "/* $triggerDeprecation = true */", ")", "{", "if", "(", "0", "===", "\\", "func_num_args", "(", ")", "||", "func_get_arg", "(", "0", ")", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'The \"%s()\" method is depr...
{@inheritdoc} @deprecated since Symfony 4.2, use getProjectDir() instead
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Kernel.php#L323-L335
train
Returns the root directory of the current project.
[ 30522, 2270, 3853, 2131, 3217, 4140, 4305, 2099, 1006, 1013, 1008, 1002, 9495, 3207, 28139, 10719, 1027, 2995, 1008, 1013, 1007, 1063, 2065, 1006, 1014, 1027, 1027, 1027, 1032, 4569, 2278, 1035, 16371, 2213, 1035, 12098, 5620, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Show/Field.php
Field.link
public function link($href = '', $target = '_blank') { return $this->unescape()->as(function ($link) use ($href, $target) { $href = $href ?: $link; return "<a href='$href' target='{$target}'>{$link}</a>"; }); }
php
public function link($href = '', $target = '_blank') { return $this->unescape()->as(function ($link) use ($href, $target) { $href = $href ?: $link; return "<a href='$href' target='{$target}'>{$link}</a>"; }); }
[ "public", "function", "link", "(", "$", "href", "=", "''", ",", "$", "target", "=", "'_blank'", ")", "{", "return", "$", "this", "->", "unescape", "(", ")", "->", "as", "(", "function", "(", "$", "link", ")", "use", "(", "$", "href", ",", "$", ...
Show field as a link. @param string $href @param string $target @return Field
[ "Show", "field", "as", "a", "link", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Field.php#L300-L307
train
Returns a link tag
[ 30522, 2270, 3853, 4957, 1006, 1002, 17850, 12879, 1027, 1005, 1005, 1010, 1002, 4539, 1027, 1005, 1035, 8744, 1005, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 16655, 15782, 5051, 1006, 1007, 1011, 1028, 2004, 1006, 3853, 1006, 1002, 4957, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php
Argon2iPasswordEncoder.isPasswordValid
public function isPasswordValid($encoded, $raw, $salt) { // If $encoded was created via "sodium_crypto_pwhash_str()", the hashing algorithm may be "argon2id" instead of "argon2i". // In this case, "password_verify()" cannot be used. if (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I') && (false === strpos($encoded, '$argon2id$'))) { return !$this->isPasswordTooLong($raw) && password_verify($raw, $encoded); } if (\function_exists('sodium_crypto_pwhash_str_verify')) { $valid = !$this->isPasswordTooLong($raw) && \sodium_crypto_pwhash_str_verify($encoded, $raw); \sodium_memzero($raw); return $valid; } if (\extension_loaded('libsodium')) { $valid = !$this->isPasswordTooLong($raw) && \Sodium\crypto_pwhash_str_verify($encoded, $raw); \Sodium\memzero($raw); return $valid; } throw new \LogicException('Argon2i algorithm is not supported. Please install the libsodium extension or upgrade to PHP 7.2+.'); }
php
public function isPasswordValid($encoded, $raw, $salt) { // If $encoded was created via "sodium_crypto_pwhash_str()", the hashing algorithm may be "argon2id" instead of "argon2i". // In this case, "password_verify()" cannot be used. if (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I') && (false === strpos($encoded, '$argon2id$'))) { return !$this->isPasswordTooLong($raw) && password_verify($raw, $encoded); } if (\function_exists('sodium_crypto_pwhash_str_verify')) { $valid = !$this->isPasswordTooLong($raw) && \sodium_crypto_pwhash_str_verify($encoded, $raw); \sodium_memzero($raw); return $valid; } if (\extension_loaded('libsodium')) { $valid = !$this->isPasswordTooLong($raw) && \Sodium\crypto_pwhash_str_verify($encoded, $raw); \Sodium\memzero($raw); return $valid; } throw new \LogicException('Argon2i algorithm is not supported. Please install the libsodium extension or upgrade to PHP 7.2+.'); }
[ "public", "function", "isPasswordValid", "(", "$", "encoded", ",", "$", "raw", ",", "$", "salt", ")", "{", "// If $encoded was created via \"sodium_crypto_pwhash_str()\", the hashing algorithm may be \"argon2id\" instead of \"argon2i\".", "// In this case, \"password_verify()\" cannot ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php#L86-L107
train
Return true if the password is valid
[ 30522, 2270, 3853, 2003, 15194, 18351, 10175, 3593, 1006, 1002, 12359, 1010, 1002, 6315, 1010, 1002, 5474, 1007, 1063, 1013, 1013, 2065, 1002, 12359, 2001, 2580, 3081, 1000, 13365, 1035, 19888, 2080, 1035, 1052, 2860, 14949, 2232, 1035, 235...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Mapping/PropertyMetadata.php
PropertyMetadata.newReflectionMember
protected function newReflectionMember($objectOrClassName) { $originalClass = \is_string($objectOrClassName) ? $objectOrClassName : \get_class($objectOrClassName); while (!property_exists($objectOrClassName, $this->getName())) { $objectOrClassName = get_parent_class($objectOrClassName); if (false === $objectOrClassName) { throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $this->getName(), $originalClass)); } } $member = new \ReflectionProperty($objectOrClassName, $this->getName()); $member->setAccessible(true); return $member; }
php
protected function newReflectionMember($objectOrClassName) { $originalClass = \is_string($objectOrClassName) ? $objectOrClassName : \get_class($objectOrClassName); while (!property_exists($objectOrClassName, $this->getName())) { $objectOrClassName = get_parent_class($objectOrClassName); if (false === $objectOrClassName) { throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $this->getName(), $originalClass)); } } $member = new \ReflectionProperty($objectOrClassName, $this->getName()); $member->setAccessible(true); return $member; }
[ "protected", "function", "newReflectionMember", "(", "$", "objectOrClassName", ")", "{", "$", "originalClass", "=", "\\", "is_string", "(", "$", "objectOrClassName", ")", "?", "$", "objectOrClassName", ":", "\\", "get_class", "(", "$", "objectOrClassName", ")", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php#L57-L73
train
Create new reflection member
[ 30522, 5123, 3853, 2047, 2890, 21031, 7542, 4168, 21784, 1006, 1002, 4874, 2953, 26266, 18442, 1007, 1063, 1002, 2434, 26266, 1027, 1032, 2003, 1035, 5164, 1006, 1002, 4874, 2953, 26266, 18442, 1007, 1029, 1002, 4874, 2953, 26266, 18442, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Pdo/Ibm/Ids.php
Zend_Db_Adapter_Pdo_Ibm_Ids.limit
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count < 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid"); } else if ($count == 0) { $limit_sql = str_ireplace("SELECT", "SELECT * FROM (SELECT", $sql); $limit_sql .= ") WHERE 0 = 1"; } else { $offset = intval($offset); if ($offset < 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid"); } if ($offset == 0) { $limit_sql = str_ireplace("SELECT", "SELECT FIRST $count", $sql); } else { $limit_sql = str_ireplace("SELECT", "SELECT SKIP $offset LIMIT $count", $sql); } } return $limit_sql; }
php
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count < 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid"); } else if ($count == 0) { $limit_sql = str_ireplace("SELECT", "SELECT * FROM (SELECT", $sql); $limit_sql .= ") WHERE 0 = 1"; } else { $offset = intval($offset); if ($offset < 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid"); } if ($offset == 0) { $limit_sql = str_ireplace("SELECT", "SELECT FIRST $count", $sql); } else { $limit_sql = str_ireplace("SELECT", "SELECT SKIP $offset LIMIT $count", $sql); } } return $limit_sql; }
[ "public", "function", "limit", "(", "$", "sql", ",", "$", "count", ",", "$", "offset", "=", "0", ")", "{", "$", "count", "=", "intval", "(", "$", "count", ")", ";", "if", "(", "$", "count", "<", "0", ")", "{", "/** @see Zend_Db_Adapter_Exception */",...
Adds an IDS-specific LIMIT clause to the SELECT statement. @param string $sql @param integer $count @param integer $offset OPTIONAL @throws Zend_Db_Adapter_Exception @return string
[ "Adds", "an", "IDS", "-", "specific", "LIMIT", "clause", "to", "the", "SELECT", "statement", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Ibm/Ids.php#L248-L272
train
Limit statement to specific number of records
[ 30522, 2270, 3853, 5787, 1006, 1002, 29296, 1010, 1002, 4175, 1010, 1002, 16396, 1027, 1014, 1007, 1063, 1002, 4175, 1027, 20014, 10175, 1006, 1002, 4175, 1007, 1025, 2065, 1006, 1002, 4175, 1026, 1014, 1007, 1063, 1013, 1008, 1008, 1030, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Referrers/Tasks.php
Tasks.updateSocials
public function updateSocials() { $url = 'https://raw.githubusercontent.com/matomo-org/searchengine-and-social-list/master/Socials.yml'; $list = Http::sendHttpRequest($url, 30); $socials = Social::getInstance()->loadYmlData($list); if (count($socials) < 50) { return; } Option::set(Social::OPTION_STORAGE_NAME, base64_encode(serialize($socials))); }
php
public function updateSocials() { $url = 'https://raw.githubusercontent.com/matomo-org/searchengine-and-social-list/master/Socials.yml'; $list = Http::sendHttpRequest($url, 30); $socials = Social::getInstance()->loadYmlData($list); if (count($socials) < 50) { return; } Option::set(Social::OPTION_STORAGE_NAME, base64_encode(serialize($socials))); }
[ "public", "function", "updateSocials", "(", ")", "{", "$", "url", "=", "'https://raw.githubusercontent.com/matomo-org/searchengine-and-social-list/master/Socials.yml'", ";", "$", "list", "=", "Http", "::", "sendHttpRequest", "(", "$", "url", ",", "30", ")", ";", "$", ...
Update the social definitions @see https://github.com/matomo-org/searchengine-and-social-list
[ "Update", "the", "social", "definitions" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Tasks.php#L47-L56
train
Update the social list of all search engines
[ 30522, 2270, 3853, 14409, 10085, 26340, 1006, 1007, 1063, 1002, 24471, 2140, 1027, 1005, 16770, 1024, 1013, 1013, 6315, 1012, 21025, 2705, 12083, 20330, 8663, 6528, 2102, 1012, 4012, 1013, 13523, 19506, 1011, 8917, 1013, 3945, 13159, 3170, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
DataCollector.cloneVar
protected function cloneVar($var) { if ($var instanceof Data) { return $var; } if (null === $this->cloner) { if (!class_exists(CutStub::class)) { throw new \LogicException(sprintf('The VarDumper component is needed for the %s() method. Install symfony/var-dumper version 3.4 or above.', __METHOD__)); } $this->cloner = new VarCloner(); $this->cloner->setMaxItems(-1); $this->cloner->addCasters($this->getCasters()); } return $this->cloner->cloneVar($var); }
php
protected function cloneVar($var) { if ($var instanceof Data) { return $var; } if (null === $this->cloner) { if (!class_exists(CutStub::class)) { throw new \LogicException(sprintf('The VarDumper component is needed for the %s() method. Install symfony/var-dumper version 3.4 or above.', __METHOD__)); } $this->cloner = new VarCloner(); $this->cloner->setMaxItems(-1); $this->cloner->addCasters($this->getCasters()); } return $this->cloner->cloneVar($var); }
[ "protected", "function", "cloneVar", "(", "$", "var", ")", "{", "if", "(", "$", "var", "instanceof", "Data", ")", "{", "return", "$", "var", ";", "}", "if", "(", "null", "===", "$", "this", "->", "cloner", ")", "{", "if", "(", "!", "class_exists", ...
Converts the variable into a serializable Data instance. This array can be displayed in the template using the VarDumper component. @param mixed $var @return Data
[ "Converts", "the", "variable", "into", "a", "serializable", "Data", "instance", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php#L71-L86
train
Clones a variable
[ 30522, 5123, 3853, 17598, 10755, 1006, 1002, 13075, 1007, 1063, 2065, 1006, 1002, 13075, 6013, 11253, 2951, 1007, 1063, 2709, 1002, 13075, 1025, 1065, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 17598, 2099, 1007, 1063, 206...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.mb_substr_replace
public static function mb_substr_replace($original, $replacement, $position, $length) { $startString = mb_substr($original, 0, $position, "UTF-8"); $endString = mb_substr($original, $position + $length, mb_strlen($original), "UTF-8"); return $startString . $replacement . $endString; }
php
public static function mb_substr_replace($original, $replacement, $position, $length) { $startString = mb_substr($original, 0, $position, "UTF-8"); $endString = mb_substr($original, $position + $length, mb_strlen($original), "UTF-8"); return $startString . $replacement . $endString; }
[ "public", "static", "function", "mb_substr_replace", "(", "$", "original", ",", "$", "replacement", ",", "$", "position", ",", "$", "length", ")", "{", "$", "startString", "=", "mb_substr", "(", "$", "original", ",", "0", ",", "$", "position", ",", "\"UT...
Multibyte compatible substr_replace @param string $original @param string $replacement @param int $position @param int $length @return string
[ "Multibyte", "compatible", "substr_replace" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L256-L262
train
UTF - 8 aware alternative to mb_substr_replace
[ 30522, 2270, 10763, 3853, 16914, 1035, 4942, 3367, 2099, 1035, 5672, 1006, 1002, 2434, 1010, 1002, 6110, 1010, 1002, 2597, 1010, 1002, 3091, 1007, 1063, 1002, 4627, 18886, 3070, 1027, 16914, 1035, 4942, 3367, 2099, 1006, 1002, 2434, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php
ObjectCollectionTrait.group
public function group($property) { $list = []; /** @var ObjectInterface $element */ foreach ($this->getIterator() as $element) { $list[(string) $element->getProperty($property)][] = $element; } return $list; }
php
public function group($property) { $list = []; /** @var ObjectInterface $element */ foreach ($this->getIterator() as $element) { $list[(string) $element->getProperty($property)][] = $element; } return $list; }
[ "public", "function", "group", "(", "$", "property", ")", "{", "$", "list", "=", "[", "]", ";", "/** @var ObjectInterface $element */", "foreach", "(", "$", "this", "->", "getIterator", "(", ")", "as", "$", "element", ")", "{", "$", "list", "[", "(", "...
Group items in the collection by a field and return them as associated array. @param string $property @return array
[ "Group", "items", "in", "the", "collection", "by", "a", "field", "and", "return", "them", "as", "associated", "array", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php#L151-L161
train
Group elements by property
[ 30522, 2270, 3853, 2177, 1006, 1002, 3200, 1007, 1063, 1002, 2862, 1027, 1031, 1033, 1025, 1013, 1008, 1008, 1030, 13075, 4874, 18447, 2121, 12172, 1002, 5783, 1008, 1013, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 21646, 30524, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Inflector.php
Inflector.monthize
public static function monthize($days) { $now = new \DateTime(); $end = new \DateTime(); $duration = new \DateInterval("P{$days}D"); $diff = $end->add($duration)->diff($now); // handle years if ($diff->y > 0) { $diff->m += 12 * $diff->y; } return $diff->m; }
php
public static function monthize($days) { $now = new \DateTime(); $end = new \DateTime(); $duration = new \DateInterval("P{$days}D"); $diff = $end->add($duration)->diff($now); // handle years if ($diff->y > 0) { $diff->m += 12 * $diff->y; } return $diff->m; }
[ "public", "static", "function", "monthize", "(", "$", "days", ")", "{", "$", "now", "=", "new", "\\", "DateTime", "(", ")", ";", "$", "end", "=", "new", "\\", "DateTime", "(", ")", ";", "$", "duration", "=", "new", "\\", "DateInterval", "(", "\"P{$...
Converts a number of days to a number of months @param int $days @return int
[ "Converts", "a", "number", "of", "days", "to", "a", "number", "of", "months" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Inflector.php#L312-L327
train
Adjusts the month value based on the days
[ 30522, 2270, 10763, 3853, 3204, 4697, 1006, 1002, 2420, 1007, 1063, 1002, 2085, 1027, 2047, 1032, 3058, 7292, 1006, 1007, 1025, 1002, 2203, 1027, 2047, 1032, 3058, 7292, 1006, 1007, 1025, 1002, 9367, 1027, 2047, 1032, 3058, 18447, 2121, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Updater.php
Updater.markComponentSuccessfullyUninstalled
public function markComponentSuccessfullyUninstalled($name) { try { Option::delete(self::getNameInOptionTable($name)); } catch (\Exception $e) { // case when the option table is not yet created (before 0.2.10) } /** * Event triggered after a component has been uninstalled. * * @param string $name The component that has been uninstalled. */ Piwik::postEvent('Updater.componentUninstalled', array($name)); }
php
public function markComponentSuccessfullyUninstalled($name) { try { Option::delete(self::getNameInOptionTable($name)); } catch (\Exception $e) { // case when the option table is not yet created (before 0.2.10) } /** * Event triggered after a component has been uninstalled. * * @param string $name The component that has been uninstalled. */ Piwik::postEvent('Updater.componentUninstalled', array($name)); }
[ "public", "function", "markComponentSuccessfullyUninstalled", "(", "$", "name", ")", "{", "try", "{", "Option", "::", "delete", "(", "self", "::", "getNameInOptionTable", "(", "$", "name", ")", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")",...
Marks a component as successfully uninstalled. Deletes an option that looks like `"version_$componentName"`. @param string $name The component name. Eg, a plugin name, `'core'` or dimension column name.
[ "Marks", "a", "component", "as", "successfully", "uninstalled", ".", "Deletes", "an", "option", "that", "looks", "like", "version_$componentName", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater.php#L148-L162
train
Mark a component as successfully uninstalled
[ 30522, 2270, 3853, 2928, 9006, 29513, 7666, 14194, 9623, 22747, 18083, 10513, 11483, 9153, 11001, 1006, 1002, 2171, 1007, 1063, 3046, 1063, 30524, 1025, 1065, 4608, 1006, 1032, 6453, 1002, 1041, 1007, 1063, 1013, 1013, 2553, 2043, 1996, 572...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/MemcachedStore.php
MemcachedStore.increment
public function increment($key, $value = 1) { return $this->memcached->increment($this->prefix.$key, $value); }
php
public function increment($key, $value = 1) { return $this->memcached->increment($this->prefix.$key, $value); }
[ "public", "function", "increment", "(", "$", "key", ",", "$", "value", "=", "1", ")", "{", "return", "$", "this", "->", "memcached", "->", "increment", "(", "$", "this", "->", "prefix", ".", "$", "key", ",", "$", "value", ")", ";", "}" ]
Increment the value of an item in the cache. @param string $key @param mixed $value @return int|bool
[ "Increment", "the", "value", "of", "an", "item", "in", "the", "cache", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/MemcachedStore.php#L152-L155
train
Increment value of key in cache
[ 30522, 2270, 3853, 4297, 28578, 4765, 1006, 1002, 3145, 1010, 1002, 3643, 1027, 1015, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2033, 12458, 15395, 2094, 1011, 1028, 4297, 28578, 4765, 1006, 1002, 2023, 1011, 1028, 17576, 1012, 1002, 3145, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Segment.php
Segment.getSelectQuery
public function getSelectQuery($select, $from, $where = false, $bind = array(), $orderBy = false, $groupBy = false, $limit = 0, $offset = 0) { $segmentExpression = $this->segmentExpression; $limitAndOffset = null; if($limit > 0) { $limitAndOffset = (int) $offset . ', ' . (int) $limit; } return $this->segmentQueryBuilder->getSelectQueryString($segmentExpression, $select, $from, $where, $bind, $groupBy, $orderBy, $limitAndOffset); }
php
public function getSelectQuery($select, $from, $where = false, $bind = array(), $orderBy = false, $groupBy = false, $limit = 0, $offset = 0) { $segmentExpression = $this->segmentExpression; $limitAndOffset = null; if($limit > 0) { $limitAndOffset = (int) $offset . ', ' . (int) $limit; } return $this->segmentQueryBuilder->getSelectQueryString($segmentExpression, $select, $from, $where, $bind, $groupBy, $orderBy, $limitAndOffset); }
[ "public", "function", "getSelectQuery", "(", "$", "select", ",", "$", "from", ",", "$", "where", "=", "false", ",", "$", "bind", "=", "array", "(", ")", ",", "$", "orderBy", "=", "false", ",", "$", "groupBy", "=", "false", ",", "$", "limit", "=", ...
Extend an SQL query that aggregates data over one of the 'log_' tables with segment expressions. @param string $select The select clause. Should NOT include the **SELECT** just the columns, eg, `'t1.col1 as col1, t2.col2 as col2'`. @param array $from Array of table names (without prefix), eg, `array('log_visit', 'log_conversion')`. @param false|string $where (optional) Where clause, eg, `'t1.col1 = ? AND t2.col2 = ?'`. @param array|string $bind (optional) Bind parameters, eg, `array($col1Value, $col2Value)`. @param false|string $orderBy (optional) Order by clause, eg, `"t1.col1 ASC"`. @param false|string $groupBy (optional) Group by clause, eg, `"t2.col2"`. @param int $limit Limit number of result to $limit @param int $offset Specified the offset of the first row to return @param int If set to value >= 1 then the Select query (and All inner queries) will be LIMIT'ed by this value. Use only when you're not aggregating or it will sample the data. @return string The entire select query.
[ "Extend", "an", "SQL", "query", "that", "aggregates", "data", "over", "one", "of", "the", "log_", "tables", "with", "segment", "expressions", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Segment.php#L335-L346
train
Get Select Query
[ 30522, 2270, 3853, 4152, 12260, 6593, 4226, 2854, 1006, 1002, 7276, 1010, 1002, 2013, 1010, 1002, 2073, 1027, 6270, 1010, 1002, 14187, 1027, 9140, 1006, 1007, 1010, 1002, 2344, 3762, 1027, 6270, 1010, 1002, 2177, 3762, 1027, 6270, 1010, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/VersionManager.php
VersionManager.updatePlugin
public function updatePlugin($plugin, $stopOnVersion = null) { $code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin); if (!$this->hasVersionFile($code)) { return false; } $currentVersion = $this->getLatestFileVersion($code); $databaseVersion = $this->getDatabaseVersion($code); // No updates needed if ($currentVersion == $databaseVersion) { $this->note('- <info>Nothing to update.</info>'); return; } $newUpdates = $this->getNewFileVersions($code, $databaseVersion); foreach ($newUpdates as $version => $details) { $this->applyPluginUpdate($code, $version, $details); if ($stopOnVersion === $version) { return true; } } return true; }
php
public function updatePlugin($plugin, $stopOnVersion = null) { $code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin); if (!$this->hasVersionFile($code)) { return false; } $currentVersion = $this->getLatestFileVersion($code); $databaseVersion = $this->getDatabaseVersion($code); // No updates needed if ($currentVersion == $databaseVersion) { $this->note('- <info>Nothing to update.</info>'); return; } $newUpdates = $this->getNewFileVersions($code, $databaseVersion); foreach ($newUpdates as $version => $details) { $this->applyPluginUpdate($code, $version, $details); if ($stopOnVersion === $version) { return true; } } return true; }
[ "public", "function", "updatePlugin", "(", "$", "plugin", ",", "$", "stopOnVersion", "=", "null", ")", "{", "$", "code", "=", "is_string", "(", "$", "plugin", ")", "?", "$", "plugin", ":", "$", "this", "->", "pluginManager", "->", "getIdentifier", "(", ...
Updates a single plugin by its code or object with it's latest changes. If the $stopOnVersion parameter is specified, the process stops after the specified version is applied.
[ "Updates", "a", "single", "plugin", "by", "its", "code", "or", "object", "with", "it", "s", "latest", "changes", ".", "If", "the", "$stopOnVersion", "parameter", "is", "specified", "the", "process", "stops", "after", "the", "specified", "version", "is", "app...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/VersionManager.php#L79-L106
train
Update a plugin
[ 30522, 2270, 3853, 10651, 24759, 15916, 2378, 1006, 1002, 13354, 2378, 1010, 1002, 2644, 2239, 27774, 1027, 19701, 1007, 1063, 1002, 3642, 1027, 2003, 1035, 5164, 1006, 1002, 13354, 2378, 1007, 1029, 1002, 13354, 2378, 1024, 1002, 2023, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Auth/Access/Gate.php
Gate.resource
public function resource($name, $class, array $abilities = null) { $abilities = $abilities ?: [ 'view' => 'view', 'create' => 'create', 'update' => 'update', 'delete' => 'delete', ]; foreach ($abilities as $ability => $method) { $this->define($name.'.'.$ability, $class.'@'.$method); } return $this; }
php
public function resource($name, $class, array $abilities = null) { $abilities = $abilities ?: [ 'view' => 'view', 'create' => 'create', 'update' => 'update', 'delete' => 'delete', ]; foreach ($abilities as $ability => $method) { $this->define($name.'.'.$ability, $class.'@'.$method); } return $this; }
[ "public", "function", "resource", "(", "$", "name", ",", "$", "class", ",", "array", "$", "abilities", "=", "null", ")", "{", "$", "abilities", "=", "$", "abilities", "?", ":", "[", "'view'", "=>", "'view'", ",", "'create'", "=>", "'create'", ",", "'...
Define abilities for a resource. @param string $name @param string $class @param array|null $abilities @return $this
[ "Define", "abilities", "for", "a", "resource", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L150-L164
train
Define resource methods
[ 30522, 2270, 3853, 7692, 1006, 1002, 2171, 1010, 1002, 2465, 1010, 9140, 1002, 7590, 1027, 19701, 1007, 1063, 1002, 7590, 1027, 1002, 7590, 1029, 1024, 1031, 1005, 3193, 1005, 1027, 1028, 1005, 3193, 1005, 1010, 1005, 3443, 1005, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Row.php
Row.export
public function export() { return array( self::COLUMNS => $this->getArrayCopy(), self::METADATA => $this->metadata, self::DATATABLE_ASSOCIATED => $this->subtableId, ); }
php
public function export() { return array( self::COLUMNS => $this->getArrayCopy(), self::METADATA => $this->metadata, self::DATATABLE_ASSOCIATED => $this->subtableId, ); }
[ "public", "function", "export", "(", ")", "{", "return", "array", "(", "self", "::", "COLUMNS", "=>", "$", "this", "->", "getArrayCopy", "(", ")", ",", "self", "::", "METADATA", "=>", "$", "this", "->", "metadata", ",", "self", "::", "DATATABLE_ASSOCIATE...
Used when archiving to serialize the Row's properties. @return array @ignore
[ "Used", "when", "archiving", "to", "serialize", "the", "Row", "s", "properties", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Row.php#L88-L95
train
Export the data to an array
[ 30522, 2270, 3853, 9167, 1006, 1007, 1063, 2709, 9140, 1006, 2969, 1024, 1024, 7753, 1027, 1028, 1002, 2023, 1011, 1028, 2131, 2906, 9447, 3597, 7685, 1006, 1007, 1010, 2969, 1024, 1024, 27425, 1027, 1028, 1002, 2023, 1011, 1028, 27425, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/Intl.php
Intl.getCurrencyBundle
public static function getCurrencyBundle() { @trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Currencies::class), E_USER_DEPRECATED); if (null === self::$currencyBundle) { self::$currencyBundle = new CurrencyBundle( self::getDataDirectory().'/'.self::CURRENCY_DIR, self::getEntryReader(), self::$localeBundle ?? self::$localeBundle = new LocaleBundle(self::getDataDirectory().'/'.self::LOCALE_DIR, self::getEntryReader()) ); } return self::$currencyBundle; }
php
public static function getCurrencyBundle() { @trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Currencies::class), E_USER_DEPRECATED); if (null === self::$currencyBundle) { self::$currencyBundle = new CurrencyBundle( self::getDataDirectory().'/'.self::CURRENCY_DIR, self::getEntryReader(), self::$localeBundle ?? self::$localeBundle = new LocaleBundle(self::getDataDirectory().'/'.self::LOCALE_DIR, self::getEntryReader()) ); } return self::$currencyBundle; }
[ "public", "static", "function", "getCurrencyBundle", "(", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'The method \"%s()\" is deprecated since Symfony 4.3, use \"%s\" instead.'", ",", "__METHOD__", ",", "Currencies", "::", "class", ")", ",", "E_USER_DEPRECATED", ...
Returns the bundle containing currency information. @return CurrencyBundleInterface The currency resource bundle @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Currencies} instead.
[ "Returns", "the", "bundle", "containing", "currency", "information", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Intl.php#L124-L137
train
Returns the CurrencyBundle
[ 30522, 2270, 10763, 3853, 2131, 10841, 14343, 9407, 27265, 2571, 1006, 1007, 1063, 1030, 9495, 1035, 7561, 1006, 9043, 2546, 1006, 1005, 1996, 4118, 1000, 1003, 1055, 1006, 1007, 1000, 2003, 2139, 28139, 12921, 2144, 25353, 2213, 14876, 489...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
ChromePhpHandler.onKernelResponse
public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { return; } if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) { $this->sendHeaders = false; $this->headers = []; return; } $this->response = $event->getResponse(); foreach ($this->headers as $header => $content) { $this->response->headers->set($header, $content); } $this->headers = []; }
php
public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { return; } if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) { $this->sendHeaders = false; $this->headers = []; return; } $this->response = $event->getResponse(); foreach ($this->headers as $header => $content) { $this->response->headers->set($header, $content); } $this->headers = []; }
[ "public", "function", "onKernelResponse", "(", "FilterResponseEvent", "$", "event", ")", "{", "if", "(", "!", "$", "event", "->", "isMasterRequest", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "preg_match", "(", "static", "::", "USER_AGENT_REGE...
Adds the headers to the response once it's created.
[ "Adds", "the", "headers", "to", "the", "response", "once", "it", "s", "created", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php#L37-L55
train
Called when kernel response is dispatched
[ 30522, 2270, 3853, 2006, 5484, 11877, 6072, 26029, 3366, 1006, 11307, 6072, 26029, 19763, 15338, 1002, 2724, 1007, 1063, 2065, 1006, 999, 1002, 2724, 1011, 1028, 2003, 8706, 2890, 15500, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 2065, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
SecurityExtension.createUserProviders
private function createUserProviders($config, ContainerBuilder $container) { $providerIds = []; foreach ($config['providers'] as $name => $provider) { $id = $this->createUserDaoProvider($name, $provider, $container); $providerIds[str_replace('-', '_', $name)] = $id; } return $providerIds; }
php
private function createUserProviders($config, ContainerBuilder $container) { $providerIds = []; foreach ($config['providers'] as $name => $provider) { $id = $this->createUserDaoProvider($name, $provider, $container); $providerIds[str_replace('-', '_', $name)] = $id; } return $providerIds; }
[ "private", "function", "createUserProviders", "(", "$", "config", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "providerIds", "=", "[", "]", ";", "foreach", "(", "$", "config", "[", "'providers'", "]", "as", "$", "name", "=>", "$", "provider",...
Parses user providers and returns an array of their ids
[ "Parses", "user", "providers", "and", "returns", "an", "array", "of", "their", "ids" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L621-L630
train
Create user providers
[ 30522, 2797, 3853, 3443, 20330, 21572, 17258, 2545, 1006, 1002, 9530, 8873, 2290, 1010, 11661, 8569, 23891, 2099, 1002, 11661, 1007, 1063, 1002, 10802, 9821, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 9530, 8873, 30524, 1002, 8909, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Queue/SerializableClosure.php
SerializableClosure.transformUseVariables
protected function transformUseVariables($data) { foreach ($data as $key => $value) { $data[$key] = $this->getSerializedPropertyValue($value); } return $data; }
php
protected function transformUseVariables($data) { foreach ($data as $key => $value) { $data[$key] = $this->getSerializedPropertyValue($value); } return $data; }
[ "protected", "function", "transformUseVariables", "(", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "data", "[", "$", "key", "]", "=", "$", "this", "->", "getSerializedPropertyValue", "(", "$"...
Transform the use variables before serialization. @param array $data The Closure's use variables @return array
[ "Transform", "the", "use", "variables", "before", "serialization", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/SerializableClosure.php#L17-L24
train
Transform use variables
[ 30522, 5123, 3853, 10938, 8557, 10755, 19210, 2015, 1006, 1002, 2951, 1007, 1063, 18921, 6776, 1006, 1002, 2951, 2004, 1002, 3145, 1027, 1028, 1002, 3643, 1007, 1063, 1002, 2951, 1031, 1002, 3145, 1033, 1027, 1002, 2023, 1011, 1028, 4152, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Columns/Dimension.php
Dimension.getNamePlural
public function getNamePlural() { if (!empty($this->namePlural)) { return Piwik::translate($this->namePlural); } return $this->getName(); }
php
public function getNamePlural() { if (!empty($this->namePlural)) { return Piwik::translate($this->namePlural); } return $this->getName(); }
[ "public", "function", "getNamePlural", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "namePlural", ")", ")", "{", "return", "Piwik", "::", "translate", "(", "$", "this", "->", "namePlural", ")", ";", "}", "return", "$", "this", "->"...
Returns a translated name in plural for this dimension. @return string @api since Piwik 3.2.0
[ "Returns", "a", "translated", "name", "in", "plural", "for", "this", "dimension", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Columns/Dimension.php#L358-L365
train
Returns the name of the language
[ 30522, 2270, 3853, 2131, 18442, 24759, 11137, 1006, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 2023, 1011, 1028, 2171, 24759, 11137, 1007, 1007, 1063, 2709, 14255, 9148, 2243, 1024, 1024, 17637, 1006, 1002, 2023, 1011, 1028, 2171, 24759...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php
EntryManager.remove
public function remove(Entry $entry) { $con = $this->getConnectionResource(); if (!@ldap_delete($con, $entry->getDn())) { throw new LdapException(sprintf('Could not remove entry "%s": %s.', $entry->getDn(), ldap_error($con))); } }
php
public function remove(Entry $entry) { $con = $this->getConnectionResource(); if (!@ldap_delete($con, $entry->getDn())) { throw new LdapException(sprintf('Could not remove entry "%s": %s.', $entry->getDn(), ldap_error($con))); } }
[ "public", "function", "remove", "(", "Entry", "$", "entry", ")", "{", "$", "con", "=", "$", "this", "->", "getConnectionResource", "(", ")", ";", "if", "(", "!", "@", "ldap_delete", "(", "$", "con", ",", "$", "entry", "->", "getDn", "(", ")", ")", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php#L62-L69
train
Remove an entry from the current LDAP directory
[ 30522, 2270, 3853, 6366, 1006, 4443, 1002, 4443, 1007, 1063, 1002, 9530, 1027, 1002, 2023, 1011, 1028, 2131, 8663, 2638, 7542, 6072, 8162, 3401, 1006, 1007, 1025, 2065, 1006, 999, 1030, 25510, 9331, 1035, 3972, 12870, 1006, 1002, 9530, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/Stylesheet.php
Stylesheet.add_style
function add_style($key, Style $style) { if (!is_string($key)) { throw new Exception("CSS rule must be keyed by a string."); } if (!isset($this->_styles[$key])) { $this->_styles[$key] = array(); } $new_style = clone $style; $new_style->set_origin($this->_current_origin); $this->_styles[$key][] = $new_style; }
php
function add_style($key, Style $style) { if (!is_string($key)) { throw new Exception("CSS rule must be keyed by a string."); } if (!isset($this->_styles[$key])) { $this->_styles[$key] = array(); } $new_style = clone $style; $new_style->set_origin($this->_current_origin); $this->_styles[$key][] = $new_style; }
[ "function", "add_style", "(", "$", "key", ",", "Style", "$", "style", ")", "{", "if", "(", "!", "is_string", "(", "$", "key", ")", ")", "{", "throw", "new", "Exception", "(", "\"CSS rule must be keyed by a string.\"", ")", ";", "}", "if", "(", "!", "is...
Add a new Style object to the stylesheet add_style() adds a new Style object to the current stylesheet, or merges a new Style with an existing one. @param string $key the Style's selector @param Style $style the Style to be added @throws \Dompdf\Exception
[ "Add", "a", "new", "Style", "object", "to", "the", "stylesheet", "add_style", "()", "adds", "a", "new", "Style", "object", "to", "the", "current", "stylesheet", "or", "merges", "a", "new", "Style", "with", "an", "existing", "one", "." ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Stylesheet.php#L273-L285
train
Adds a new style to the list of rules
[ 30522, 3853, 5587, 1035, 2806, 1006, 1002, 3145, 1010, 2806, 1002, 2806, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5164, 1006, 1002, 3145, 1007, 1007, 1063, 5466, 2047, 6453, 1006, 1000, 20116, 2015, 3627, 2442, 2022, 3145, 2098, 2011, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
slimphp/Slim
Slim/Handlers/Error.php
Error.renderXmlErrorMessage
protected function renderXmlErrorMessage(Exception $exception) { $xml = "<error>\n <message>Slim Application Error</message>\n"; if ($this->displayErrorDetails) { do { $xml .= " <exception>\n"; $xml .= " <type>" . get_class($exception) . "</type>\n"; $xml .= " <code>" . $exception->getCode() . "</code>\n"; $xml .= " <message>" . $this->createCdataSection($exception->getMessage()) . "</message>\n"; $xml .= " <file>" . $exception->getFile() . "</file>\n"; $xml .= " <line>" . $exception->getLine() . "</line>\n"; $xml .= " <trace>" . $this->createCdataSection($exception->getTraceAsString()) . "</trace>\n"; $xml .= " </exception>\n"; } while ($exception = $exception->getPrevious()); } $xml .= "</error>"; return $xml; }
php
protected function renderXmlErrorMessage(Exception $exception) { $xml = "<error>\n <message>Slim Application Error</message>\n"; if ($this->displayErrorDetails) { do { $xml .= " <exception>\n"; $xml .= " <type>" . get_class($exception) . "</type>\n"; $xml .= " <code>" . $exception->getCode() . "</code>\n"; $xml .= " <message>" . $this->createCdataSection($exception->getMessage()) . "</message>\n"; $xml .= " <file>" . $exception->getFile() . "</file>\n"; $xml .= " <line>" . $exception->getLine() . "</line>\n"; $xml .= " <trace>" . $this->createCdataSection($exception->getTraceAsString()) . "</trace>\n"; $xml .= " </exception>\n"; } while ($exception = $exception->getPrevious()); } $xml .= "</error>"; return $xml; }
[ "protected", "function", "renderXmlErrorMessage", "(", "Exception", "$", "exception", ")", "{", "$", "xml", "=", "\"<error>\\n <message>Slim Application Error</message>\\n\"", ";", "if", "(", "$", "this", "->", "displayErrorDetails", ")", "{", "do", "{", "$", "xml"...
Render XML error @param Exception $exception @return string
[ "Render", "XML", "error" ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Handlers/Error.php#L190-L208
train
Render XML error message
[ 30522, 5123, 3853, 17552, 2595, 18602, 29165, 7834, 3736, 3351, 1006, 6453, 1002, 6453, 1007, 1063, 1002, 20950, 1027, 1000, 1026, 7561, 1028, 1032, 1050, 1026, 4471, 1028, 11754, 4646, 7561, 1026, 1013, 4471, 1028, 1032, 1050, 1000, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Sqlsrv.php
Zend_Db_Adapter_Sqlsrv.getServerVersion
public function getServerVersion() { $this->_connect(); $serverInfo = sqlsrv_server_info($this->_connection); if ($serverInfo !== false) { return $serverInfo['SQLServerVersion']; } return null; }
php
public function getServerVersion() { $this->_connect(); $serverInfo = sqlsrv_server_info($this->_connection); if ($serverInfo !== false) { return $serverInfo['SQLServerVersion']; } return null; }
[ "public", "function", "getServerVersion", "(", ")", "{", "$", "this", "->", "_connect", "(", ")", ";", "$", "serverInfo", "=", "sqlsrv_server_info", "(", "$", "this", "->", "_connection", ")", ";", "if", "(", "$", "serverInfo", "!==", "false", ")", "{", ...
Retrieve server version in PHP style @return string
[ "Retrieve", "server", "version", "in", "PHP", "style" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Sqlsrv.php#L662-L672
train
Returns the SQL Server Version
[ 30522, 2270, 3853, 4152, 2121, 6299, 27774, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 7532, 1006, 1007, 1025, 1002, 8241, 2378, 14876, 1027, 29296, 21338, 2615, 1035, 8241, 1035, 18558, 1006, 1002, 2023, 1011, 1028, 1035, 4434, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php
NodeDefinition.validation
protected function validation() { if (null === $this->validation) { $this->validation = new ValidationBuilder($this); } return $this->validation; }
php
protected function validation() { if (null === $this->validation) { $this->validation = new ValidationBuilder($this); } return $this->validation; }
[ "protected", "function", "validation", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "validation", ")", "{", "$", "this", "->", "validation", "=", "new", "ValidationBuilder", "(", "$", "this", ")", ";", "}", "return", "$", "this", "->", ...
Gets the builder for validation rules. @return ValidationBuilder
[ "Gets", "the", "builder", "for", "validation", "rules", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php#L306-L313
train
Get the ValidationBuilder
[ 30522, 5123, 3853, 27354, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 27354, 1007, 1063, 1002, 2023, 1011, 1028, 27354, 1027, 2047, 27354, 8569, 23891, 2099, 1006, 1002, 2023, 1007, 1025, 1065, 2709, 1002,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Select.php
Zend_Db_Select.joinNatural
public function joinNatural($name, $cols = self::SQL_WILDCARD, $schema = null) { return $this->_join(self::NATURAL_JOIN, $name, null, $cols, $schema); }
php
public function joinNatural($name, $cols = self::SQL_WILDCARD, $schema = null) { return $this->_join(self::NATURAL_JOIN, $name, null, $cols, $schema); }
[ "public", "function", "joinNatural", "(", "$", "name", ",", "$", "cols", "=", "self", "::", "SQL_WILDCARD", ",", "$", "schema", "=", "null", ")", "{", "return", "$", "this", "->", "_join", "(", "self", "::", "NATURAL_JOIN", ",", "$", "name", ",", "nu...
Add a NATURAL JOIN table and colums to the query. A natural join assumes an equi-join across any column(s) that appear with the same name in both tables. Only natural inner joins are supported by this API, even though SQL permits natural outer joins as well. The $name and $cols parameters follow the same logic as described in the from() method. @param array|string|Zend_Db_Expr $name The table name. @param array|string $cols The columns to select from the joined table. @param string $schema The database name to specify, if any. @return Zend_Db_Select This Zend_Db_Select object.
[ "Add", "a", "NATURAL", "JOIN", "table", "and", "colums", "to", "the", "query", ".", "A", "natural", "join", "assumes", "an", "equi", "-", "join", "across", "any", "column", "(", "s", ")", "that", "appear", "with", "the", "same", "name", "in", "both", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L436-L439
train
Join the table with the natural table
[ 30522, 2270, 3853, 3693, 19833, 11137, 1006, 1002, 2171, 1010, 1002, 30524, 19701, 1010, 1002, 8902, 2015, 1010, 1002, 8040, 28433, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Debug/DebugClassLoader.php
DebugClassLoader.disable
public static function disable() { if (!\is_array($functions = spl_autoload_functions())) { return; } foreach ($functions as $function) { spl_autoload_unregister($function); } foreach ($functions as $function) { if (\is_array($function) && $function[0] instanceof self) { $function = $function[0]->getClassLoader(); } spl_autoload_register($function); } }
php
public static function disable() { if (!\is_array($functions = spl_autoload_functions())) { return; } foreach ($functions as $function) { spl_autoload_unregister($function); } foreach ($functions as $function) { if (\is_array($function) && $function[0] instanceof self) { $function = $function[0]->getClassLoader(); } spl_autoload_register($function); } }
[ "public", "static", "function", "disable", "(", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "functions", "=", "spl_autoload_functions", "(", ")", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "functions", "as", "$", "function", ")",...
Disables the wrapping.
[ "Disables", "the", "wrapping", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/DebugClassLoader.php#L112-L129
train
Disable the autoloader
[ 30522, 2270, 10763, 3853, 4487, 19150, 1006, 1007, 1063, 2065, 1006, 999, 1032, 2003, 1035, 9140, 1006, 1002, 4972, 1027, 11867, 2140, 1035, 8285, 11066, 1035, 4972, 1006, 1007, 1007, 1007, 1063, 2709, 1025, 1065, 18921, 6776, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Queue/SyncQueue.php
SyncQueue.handleException
protected function handleException($queueJob, $e) { $this->raiseExceptionOccurredJobEvent($queueJob, $e); $queueJob->fail($e); throw $e; }
php
protected function handleException($queueJob, $e) { $this->raiseExceptionOccurredJobEvent($queueJob, $e); $queueJob->fail($e); throw $e; }
[ "protected", "function", "handleException", "(", "$", "queueJob", ",", "$", "e", ")", "{", "$", "this", "->", "raiseExceptionOccurredJobEvent", "(", "$", "queueJob", ",", "$", "e", ")", ";", "$", "queueJob", "->", "fail", "(", "$", "e", ")", ";", "thro...
Handle an exception that occurred while processing a job. @param \Illuminate\Queue\Jobs\Job $queueJob @param \Exception $e @return void @throws \Exception
[ "Handle", "an", "exception", "that", "occurred", "while", "processing", "a", "job", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/SyncQueue.php#L115-L122
train
Handle exception thrown by the queue
[ 30522, 5123, 3853, 5047, 10288, 24422, 1006, 1002, 24240, 5558, 2497, 1010, 1002, 1041, 1007, 1063, 1002, 2023, 1011, 1028, 5333, 10288, 24422, 10085, 10841, 20529, 5558, 4783, 15338, 1006, 1002, 24240, 5558, 2497, 1010, 1002, 1041, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/File.php
Zend_Cache_Backend_File.getMetadatas
public function getMetadatas($id) { $metadatas = $this->_getMetadatas($id); if (!$metadatas) { return false; } if (time() > $metadatas['expire']) { return false; } return array( 'expire' => $metadatas['expire'], 'tags' => $metadatas['tags'], 'mtime' => $metadatas['mtime'] ); }
php
public function getMetadatas($id) { $metadatas = $this->_getMetadatas($id); if (!$metadatas) { return false; } if (time() > $metadatas['expire']) { return false; } return array( 'expire' => $metadatas['expire'], 'tags' => $metadatas['tags'], 'mtime' => $metadatas['mtime'] ); }
[ "public", "function", "getMetadatas", "(", "$", "id", ")", "{", "$", "metadatas", "=", "$", "this", "->", "_getMetadatas", "(", "$", "id", ")", ";", "if", "(", "!", "$", "metadatas", ")", "{", "return", "false", ";", "}", "if", "(", "time", "(", ...
Return an array of metadatas for the given cache id The array must include these keys : - expire : the expire timestamp - tags : a string array of tags - mtime : timestamp of last modification time @param string $id cache id @return array array of metadatas (false if the cache id is not found)
[ "Return", "an", "array", "of", "metadatas", "for", "the", "given", "cache", "id" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L382-L396
train
Return array of metadatas
[ 30522, 2270, 3853, 2131, 11368, 8447, 10230, 1006, 1002, 8909, 1007, 1063, 1002, 27425, 2015, 1027, 1002, 2023, 1011, 1028, 1035, 2131, 11368, 8447, 10230, 1006, 1002, 8909, 1007, 1025, 2065, 1006, 999, 1002, 27425, 2015, 1007, 1063, 2709, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Filesystem/FilesystemAdapter.php
FilesystemAdapter.get
public function get($path) { try { return $this->driver->read($path); } catch (FileNotFoundException $e) { throw new ContractFileNotFoundException($path, $e->getCode(), $e); } }
php
public function get($path) { try { return $this->driver->read($path); } catch (FileNotFoundException $e) { throw new ContractFileNotFoundException($path, $e->getCode(), $e); } }
[ "public", "function", "get", "(", "$", "path", ")", "{", "try", "{", "return", "$", "this", "->", "driver", "->", "read", "(", "$", "path", ")", ";", "}", "catch", "(", "FileNotFoundException", "$", "e", ")", "{", "throw", "new", "ContractFileNotFoundE...
Get the contents of a file. @param string $path @return string @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
[ "Get", "the", "contents", "of", "a", "file", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/FilesystemAdapter.php#L119-L126
train
Get the content of a file
[ 30522, 2270, 3853, 2131, 1006, 1002, 4130, 1007, 1063, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 4062, 1011, 1028, 3191, 1006, 1002, 4130, 1007, 1025, 1065, 4608, 1006, 5371, 17048, 14876, 8630, 10288, 24422, 1002, 1041, 1007, 1063, 5466, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Libmemcached.php
Zend_Cache_Backend_Libmemcached.touch
public function touch($id, $extraLifetime) { $tmp = $this->_memcache->get($id); if (isset($tmp[0], $tmp[1], $tmp[2])) { $data = $tmp[0]; $mtime = $tmp[1]; $lifetime = $tmp[2]; $newLifetime = $lifetime - (time() - $mtime) + $extraLifetime; if ($newLifetime <=0) { return false; } // #ZF-5702 : we try replace() first becase set() seems to be slower if (!($result = $this->_memcache->replace($id, array($data, time(), $newLifetime), $newLifetime))) { $result = $this->_memcache->set($id, array($data, time(), $newLifetime), $newLifetime); if ($result === false) { $rsCode = $this->_memcache->getResultCode(); $rsMsg = $this->_memcache->getResultMessage(); $this->_log("Memcached::set() failed: [{$rsCode}] {$rsMsg}"); } } return $result; } return false; }
php
public function touch($id, $extraLifetime) { $tmp = $this->_memcache->get($id); if (isset($tmp[0], $tmp[1], $tmp[2])) { $data = $tmp[0]; $mtime = $tmp[1]; $lifetime = $tmp[2]; $newLifetime = $lifetime - (time() - $mtime) + $extraLifetime; if ($newLifetime <=0) { return false; } // #ZF-5702 : we try replace() first becase set() seems to be slower if (!($result = $this->_memcache->replace($id, array($data, time(), $newLifetime), $newLifetime))) { $result = $this->_memcache->set($id, array($data, time(), $newLifetime), $newLifetime); if ($result === false) { $rsCode = $this->_memcache->getResultCode(); $rsMsg = $this->_memcache->getResultMessage(); $this->_log("Memcached::set() failed: [{$rsCode}] {$rsMsg}"); } } return $result; } return false; }
[ "public", "function", "touch", "(", "$", "id", ",", "$", "extraLifetime", ")", "{", "$", "tmp", "=", "$", "this", "->", "_memcache", "->", "get", "(", "$", "id", ")", ";", "if", "(", "isset", "(", "$", "tmp", "[", "0", "]", ",", "$", "tmp", "...
Give (if possible) an extra lifetime to the given cache id @param string $id cache id @param int $extraLifetime @return boolean true if ok
[ "Give", "(", "if", "possible", ")", "an", "extra", "lifetime", "to", "the", "given", "cache", "id" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Libmemcached.php#L433-L456
train
Touch an entry in the cache
[ 30522, 2270, 3853, 3543, 1006, 1002, 8909, 1010, 1002, 4469, 15509, 7292, 1007, 1063, 1002, 1056, 8737, 1027, 1002, 2023, 1011, 1028, 1035, 2033, 12458, 15395, 1011, 1028, 2131, 1006, 1002, 8909, 1007, 1025, 2065, 1006, 26354, 3388, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Config.php
Config.getHostname
public static function getHostname() { // Check trusted requires config file which is not ready yet $host = Url::getHost($checkIfTrusted = false); // Remove any port number to get actual hostname $host = Url::getHostSanitized($host); return $host; }
php
public static function getHostname() { // Check trusted requires config file which is not ready yet $host = Url::getHost($checkIfTrusted = false); // Remove any port number to get actual hostname $host = Url::getHostSanitized($host); return $host; }
[ "public", "static", "function", "getHostname", "(", ")", "{", "// Check trusted requires config file which is not ready yet", "$", "host", "=", "Url", "::", "getHost", "(", "$", "checkIfTrusted", "=", "false", ")", ";", "// Remove any port number to get actual hostname", ...
Returns the hostname of the current request (without port number) @return string
[ "Returns", "the", "hostname", "of", "the", "current", "request", "(", "without", "port", "number", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Config.php#L222-L231
train
Get hostname of current domain
[ 30522, 2270, 10763, 3853, 2131, 15006, 2102, 18442, 1006, 1007, 1063, 1013, 1013, 4638, 9480, 5942, 9530, 8873, 2290, 5371, 2029, 2003, 2025, 3201, 2664, 1002, 3677, 1027, 24471, 2140, 1024, 1024, 2131, 15006, 2102, 1006, 1002, 4638, 10128,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataAccess/LogAggregator.php
LogAggregator.getGeneralQueryBindParams
public function getGeneralQueryBindParams() { $bind = array($this->dateStart->toString(Date::DATE_TIME_FORMAT), $this->dateEnd->toString(Date::DATE_TIME_FORMAT)); $bind = array_merge($bind, $this->sites); return $bind; }
php
public function getGeneralQueryBindParams() { $bind = array($this->dateStart->toString(Date::DATE_TIME_FORMAT), $this->dateEnd->toString(Date::DATE_TIME_FORMAT)); $bind = array_merge($bind, $this->sites); return $bind; }
[ "public", "function", "getGeneralQueryBindParams", "(", ")", "{", "$", "bind", "=", "array", "(", "$", "this", "->", "dateStart", "->", "toString", "(", "Date", "::", "DATE_TIME_FORMAT", ")", ",", "$", "this", "->", "dateEnd", "->", "toString", "(", "Date"...
Returns general bind parameters for all log aggregation queries. This includes the datetime start of entities, datetime end of entities and IDs of all sites. @return array
[ "Returns", "general", "bind", "parameters", "for", "all", "log", "aggregation", "queries", ".", "This", "includes", "the", "datetime", "start", "of", "entities", "datetime", "end", "of", "entities", "and", "IDs", "of", "all", "sites", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/LogAggregator.php#L528-L534
train
Get General Query Bind Params
[ 30522, 2270, 3853, 2131, 6914, 21673, 4226, 2854, 8428, 18927, 5400, 5244, 1006, 1007, 1063, 1002, 14187, 1027, 9140, 1006, 1002, 2023, 1011, 1028, 5246, 7559, 2102, 1011, 1028, 2000, 3367, 4892, 1006, 3058, 1024, 1024, 3058, 1035, 2051, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/ApcStore.php
ApcStore.put
public function put($key, $value, $seconds) { return $this->apc->put($this->prefix.$key, $value, $seconds); }
php
public function put($key, $value, $seconds) { return $this->apc->put($this->prefix.$key, $value, $seconds); }
[ "public", "function", "put", "(", "$", "key", ",", "$", "value", ",", "$", "seconds", ")", "{", "return", "$", "this", "->", "apc", "->", "put", "(", "$", "this", "->", "prefix", ".", "$", "key", ",", "$", "value", ",", "$", "seconds", ")", ";"...
Store an item in the cache for a given number of seconds. @param string $key @param mixed $value @param int $seconds @return bool
[ "Store", "an", "item", "in", "the", "cache", "for", "a", "given", "number", "of", "seconds", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/ApcStore.php#L59-L62
train
Put value into cache
[ 30522, 2270, 3853, 2404, 1006, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 3823, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 9706, 2278, 1011, 1028, 2404, 1006, 1002, 2023, 1011, 1028, 17576, 1012, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 38...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/VisitExcluded.php
VisitExcluded.isUserAgentExcluded
protected function isUserAgentExcluded() { $excludedAgents = $this->getAttributes('excluded_user_agents', 'global_excluded_user_agents'); if (!empty($excludedAgents)) { foreach ($excludedAgents as $excludedUserAgent) { // if the excluded user agent string part is in this visit's user agent, this visit should be excluded if (stripos($this->userAgent, $excludedUserAgent) !== false) { return true; } } } return false; }
php
protected function isUserAgentExcluded() { $excludedAgents = $this->getAttributes('excluded_user_agents', 'global_excluded_user_agents'); if (!empty($excludedAgents)) { foreach ($excludedAgents as $excludedUserAgent) { // if the excluded user agent string part is in this visit's user agent, this visit should be excluded if (stripos($this->userAgent, $excludedUserAgent) !== false) { return true; } } } return false; }
[ "protected", "function", "isUserAgentExcluded", "(", ")", "{", "$", "excludedAgents", "=", "$", "this", "->", "getAttributes", "(", "'excluded_user_agents'", ",", "'global_excluded_user_agents'", ")", ";", "if", "(", "!", "empty", "(", "$", "excludedAgents", ")", ...
Returns true if the specified user agent should be excluded for the current site or not. Visits whose user agent string contains one of the excluded_user_agents strings for the site being tracked (or one of the global strings) will be excluded. @internal param string $this ->userAgent The user agent string. @return bool
[ "Returns", "true", "if", "the", "specified", "user", "agent", "should", "be", "excluded", "for", "the", "current", "site", "or", "not", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/VisitExcluded.php#L342-L356
train
Returns true if the user agent string part of the visit should be excluded
[ 30522, 5123, 3853, 2003, 20330, 4270, 10111, 2595, 20464, 13936, 1006, 1007, 1063, 1002, 12421, 4270, 7666, 1027, 1002, 2023, 1011, 1028, 2131, 19321, 3089, 8569, 4570, 1006, 1005, 12421, 1035, 5310, 1035, 6074, 1005, 1010, 1005, 3795, 1035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Column.php
Column.isSorted
protected function isSorted() { $this->sort = app('request')->get($this->grid->model()->getSortName()); if (empty($this->sort)) { return false; } return isset($this->sort['column']) && $this->sort['column'] == $this->name; }
php
protected function isSorted() { $this->sort = app('request')->get($this->grid->model()->getSortName()); if (empty($this->sort)) { return false; } return isset($this->sort['column']) && $this->sort['column'] == $this->name; }
[ "protected", "function", "isSorted", "(", ")", "{", "$", "this", "->", "sort", "=", "app", "(", "'request'", ")", "->", "get", "(", "$", "this", "->", "grid", "->", "model", "(", ")", "->", "getSortName", "(", ")", ")", ";", "if", "(", "empty", "...
Determine if this column is currently sorted. @return bool
[ "Determine", "if", "this", "column", "is", "currently", "sorted", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L590-L599
train
Return true if the column is sorted
[ 30522, 5123, 3853, 26354, 15613, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 4066, 1027, 10439, 1006, 1005, 5227, 1005, 1007, 1011, 1028, 2131, 1006, 1002, 2023, 1011, 1028, 8370, 1011, 1028, 2944, 1006, 1007, 1011, 1028, 4152, 11589, 18442, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
JsonDescriptor.describeContainerDefinition
protected function describeContainerDefinition(Definition $definition, array $options = []) { $this->writeData($this->getContainerDefinitionData($definition, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']), $options); }
php
protected function describeContainerDefinition(Definition $definition, array $options = []) { $this->writeData($this->getContainerDefinitionData($definition, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']), $options); }
[ "protected", "function", "describeContainerDefinition", "(", "Definition", "$", "definition", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "writeData", "(", "$", "this", "->", "getContainerDefinitionData", "(", "$", "definition", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php#L135-L138
train
Describes a container definition
[ 30522, 5123, 3853, 6235, 8663, 18249, 2121, 3207, 16294, 22753, 1006, 6210, 1002, 6210, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 2023, 1011, 1028, 4339, 2850, 2696, 1006, 1002, 2023, 1011, 1028, 2131, 8663, 18249, 2121, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Definition.php
Definition.hasMethodCall
public function hasMethodCall($method) { foreach ($this->calls as $call) { if ($call[0] === $method) { return true; } } return false; }
php
public function hasMethodCall($method) { foreach ($this->calls as $call) { if ($call[0] === $method) { return true; } } return false; }
[ "public", "function", "hasMethodCall", "(", "$", "method", ")", "{", "foreach", "(", "$", "this", "->", "calls", "as", "$", "call", ")", "{", "if", "(", "$", "call", "[", "0", "]", "===", "$", "method", ")", "{", "return", "true", ";", "}", "}", ...
Check if the current definition has a given method to call after service initialization. @param string $method The method name to search for @return bool
[ "Check", "if", "the", "current", "definition", "has", "a", "given", "method", "to", "call", "after", "service", "initialization", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Definition.php#L388-L397
train
Has method call
[ 30522, 2270, 3853, 2038, 11368, 6806, 16409, 8095, 1006, 1002, 4118, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 4455, 2004, 1002, 2655, 1007, 1063, 2065, 1006, 1002, 2655, 1031, 1014, 1033, 1027, 1027, 1027, 1002, 4118, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Row.php
Row.deleteMetadata
public function deleteMetadata($name = false) { if ($name === false) { $this->metadata = array(); return true; } if (!isset($this->metadata[$name])) { return false; } unset($this->metadata[$name]); return true; }
php
public function deleteMetadata($name = false) { if ($name === false) { $this->metadata = array(); return true; } if (!isset($this->metadata[$name])) { return false; } unset($this->metadata[$name]); return true; }
[ "public", "function", "deleteMetadata", "(", "$", "name", "=", "false", ")", "{", "if", "(", "$", "name", "===", "false", ")", "{", "$", "this", "->", "metadata", "=", "array", "(", ")", ";", "return", "true", ";", "}", "if", "(", "!", "isset", "...
Deletes one metadata value or all metadata values. @param bool|string $name Metadata name (omit to delete entire metadata). @return bool `true` on success, `false` if the column didn't exist
[ "Deletes", "one", "metadata", "value", "or", "all", "metadata", "values", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Row.php#L371-L382
train
Delete metadata from the current object
[ 30522, 2270, 3853, 3972, 12870, 11368, 8447, 2696, 1006, 1002, 2171, 1027, 6270, 1007, 1063, 2065, 1006, 1002, 2171, 1027, 1027, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 27425, 1027, 9140, 1006, 1007, 1025, 2709, 2995, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Session/DatabaseSessionHandler.php
DatabaseSessionHandler.addUserInformation
protected function addUserInformation(&$payload) { if ($this->container->bound(Guard::class)) { $payload['user_id'] = $this->userId(); } return $this; }
php
protected function addUserInformation(&$payload) { if ($this->container->bound(Guard::class)) { $payload['user_id'] = $this->userId(); } return $this; }
[ "protected", "function", "addUserInformation", "(", "&", "$", "payload", ")", "{", "if", "(", "$", "this", "->", "container", "->", "bound", "(", "Guard", "::", "class", ")", ")", "{", "$", "payload", "[", "'user_id'", "]", "=", "$", "this", "->", "u...
Add the user information to the session payload. @param array $payload @return $this
[ "Add", "the", "user", "information", "to", "the", "session", "payload", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/DatabaseSessionHandler.php#L197-L204
train
Add User Information
[ 30522, 5123, 3853, 5587, 20330, 2378, 14192, 3370, 1006, 1004, 1002, 18093, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 11661, 1011, 1028, 5391, 1006, 3457, 1024, 1024, 2465, 1007, 1007, 1063, 1002, 18093, 1031, 1005, 5310, 1035, 8909, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Translation/Loader/CsvFileLoader.php
CsvFileLoader.loadResource
protected function loadResource($resource) { $messages = []; try { $file = new \SplFileObject($resource, 'rb'); } catch (\RuntimeException $e) { throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e); } $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); foreach ($file as $data) { if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) { $messages[$data[0]] = $data[1]; } } return $messages; }
php
protected function loadResource($resource) { $messages = []; try { $file = new \SplFileObject($resource, 'rb'); } catch (\RuntimeException $e) { throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e); } $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); foreach ($file as $data) { if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) { $messages[$data[0]] = $data[1]; } } return $messages; }
[ "protected", "function", "loadResource", "(", "$", "resource", ")", "{", "$", "messages", "=", "[", "]", ";", "try", "{", "$", "file", "=", "new", "\\", "SplFileObject", "(", "$", "resource", ",", "'rb'", ")", ";", "}", "catch", "(", "\\", "RuntimeEx...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Loader/CsvFileLoader.php#L30-L50
train
Load the messages from a resource
[ 30522, 5123, 3853, 7170, 6072, 8162, 3401, 1006, 1002, 7692, 1007, 1063, 1002, 7696, 1027, 1031, 1033, 1025, 3046, 1063, 1002, 5371, 1027, 2047, 1032, 11867, 10270, 9463, 16429, 20614, 1006, 1002, 7692, 1010, 1005, 21144, 1005, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mime/Message.php
Zend_Mime_Message.getPartHeaders
public function getPartHeaders($partnum, $EOL = Zend_Mime::LINEEND) { return $this->_parts[$partnum]->getHeaders($EOL); }
php
public function getPartHeaders($partnum, $EOL = Zend_Mime::LINEEND) { return $this->_parts[$partnum]->getHeaders($EOL); }
[ "public", "function", "getPartHeaders", "(", "$", "partnum", ",", "$", "EOL", "=", "Zend_Mime", "::", "LINEEND", ")", "{", "return", "$", "this", "->", "_parts", "[", "$", "partnum", "]", "->", "getHeaders", "(", "$", "EOL", ")", ";", "}" ]
Get the headers of a given part as a string @param int $partnum @return string
[ "Get", "the", "headers", "of", "a", "given", "part", "as", "a", "string" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime/Message.php#L177-L180
train
Returns the headers of a part
[ 30522, 2270, 3853, 2131, 19362, 10760, 9648, 2869, 1006, 1002, 2112, 19172, 1010, 1002, 1041, 4747, 1027, 16729, 2094, 1035, 2771, 4168, 1024, 1024, 2240, 10497, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 1035, 3033, 1031, 1002, 2112, 19172,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Access/RolesProvider.php
RolesProvider.getAllRoleIds
public function getAllRoleIds() { $ids = array(); foreach ($this->getAllRoles() as $role) { $ids[] = $role->getId(); } return $ids; }
php
public function getAllRoleIds() { $ids = array(); foreach ($this->getAllRoles() as $role) { $ids[] = $role->getId(); } return $ids; }
[ "public", "function", "getAllRoleIds", "(", ")", "{", "$", "ids", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getAllRoles", "(", ")", "as", "$", "role", ")", "{", "$", "ids", "[", "]", "=", "$", "role", "->", "getId", "(", ...
Returns the list of the existing Access level. Useful when a given API method requests a given acccess Level. We first check that the required access level exists. @return array
[ "Returns", "the", "list", "of", "the", "existing", "Access", "level", ".", "Useful", "when", "a", "given", "API", "method", "requests", "a", "given", "acccess", "Level", ".", "We", "first", "check", "that", "the", "required", "access", "level", "exists", "...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Access/RolesProvider.php#L38-L45
train
Get all role ids
[ 30522, 2270, 3853, 2131, 8095, 13153, 7416, 5104, 1006, 1007, 1063, 1002, 8909, 2015, 1027, 9140, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 8095, 13153, 2229, 1006, 1007, 2004, 1002, 2535, 1007, 1063, 1002, 8909, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DomCrawler/Field/FileFormField.php
FileFormField.setErrorCode
public function setErrorCode($error) { $codes = [UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION]; if (!\in_array($error, $codes)) { throw new \InvalidArgumentException(sprintf('The error code %s is not valid.', $error)); } $this->value = ['name' => '', 'type' => '', 'tmp_name' => '', 'error' => $error, 'size' => 0]; }
php
public function setErrorCode($error) { $codes = [UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION]; if (!\in_array($error, $codes)) { throw new \InvalidArgumentException(sprintf('The error code %s is not valid.', $error)); } $this->value = ['name' => '', 'type' => '', 'tmp_name' => '', 'error' => $error, 'size' => 0]; }
[ "public", "function", "setErrorCode", "(", "$", "error", ")", "{", "$", "codes", "=", "[", "UPLOAD_ERR_INI_SIZE", ",", "UPLOAD_ERR_FORM_SIZE", ",", "UPLOAD_ERR_PARTIAL", ",", "UPLOAD_ERR_NO_FILE", ",", "UPLOAD_ERR_NO_TMP_DIR", ",", "UPLOAD_ERR_CANT_WRITE", ",", "UPLOA...
Sets the PHP error code associated with the field. @param int $error The error code (one of UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, or UPLOAD_ERR_EXTENSION) @throws \InvalidArgumentException When error code doesn't exist
[ "Sets", "the", "PHP", "error", "code", "associated", "with", "the", "field", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Field/FileFormField.php#L28-L36
train
Set the error code
[ 30522, 2270, 3853, 2275, 2121, 29165, 16044, 1006, 1002, 7561, 1007, 1063, 1002, 9537, 1027, 1031, 2039, 11066, 1035, 9413, 2099, 1035, 1999, 2072, 1035, 2946, 1010, 2039, 11066, 1035, 9413, 2099, 1035, 2433, 1035, 2946, 1010, 2039, 11066, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Common.php
Common.mb_substr
public static function mb_substr($string, $start) { $length = func_num_args() > 2 ? func_get_arg(2) : self::mb_strlen($string); if (function_exists('mb_substr')) { return mb_substr($string, $start, $length, 'UTF-8'); } return substr($string, $start, $length); }
php
public static function mb_substr($string, $start) { $length = func_num_args() > 2 ? func_get_arg(2) : self::mb_strlen($string); if (function_exists('mb_substr')) { return mb_substr($string, $start, $length, 'UTF-8'); } return substr($string, $start, $length); }
[ "public", "static", "function", "mb_substr", "(", "$", "string", ",", "$", "start", ")", "{", "$", "length", "=", "func_num_args", "(", ")", ">", "2", "?", "func_get_arg", "(", "2", ")", ":", "self", "::", "mb_strlen", "(", "$", "string", ")", ";", ...
Multi-byte substr() - works with UTF-8. Calls `mb_substr` if available and falls back to `substr` if it's not. @param string $string @param int $start @param int ... optional length @return string @api
[ "Multi", "-", "byte", "substr", "()", "-", "works", "with", "UTF", "-", "8", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L190-L201
train
UTF - 8 aware alternative to substr
[ 30522, 2270, 10763, 3853, 16914, 1035, 4942, 3367, 2099, 1006, 1002, 5164, 1010, 1002, 2707, 1007, 1063, 1002, 3091, 1027, 4569, 2278, 1035, 16371, 2213, 1035, 12098, 5620, 1006, 1007, 1028, 1016, 1029, 4569, 2278, 1035, 2131, 1035, 12098, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Updater/Migration/Db/Factory.php
Factory.sql
public function sql($sql, $errorCodesToIgnore = array()) { if ($errorCodesToIgnore === false) { $errorCodesToIgnore = array(); } return $this->container->make('Piwik\Updater\Migration\Db\Sql', array( 'sql' => $sql, 'errorCodesToIgnore' => $errorCodesToIgnore )); }
php
public function sql($sql, $errorCodesToIgnore = array()) { if ($errorCodesToIgnore === false) { $errorCodesToIgnore = array(); } return $this->container->make('Piwik\Updater\Migration\Db\Sql', array( 'sql' => $sql, 'errorCodesToIgnore' => $errorCodesToIgnore )); }
[ "public", "function", "sql", "(", "$", "sql", ",", "$", "errorCodesToIgnore", "=", "array", "(", ")", ")", "{", "if", "(", "$", "errorCodesToIgnore", "===", "false", ")", "{", "$", "errorCodesToIgnore", "=", "array", "(", ")", ";", "}", "return", "$", ...
Performs a custom SQL query during the update. Example: $factory->sql("DELETE * FROM table_name WHERE plugin_name = 'MyPluginName'"); @param string $sql The SQL query that should be executed. Make sure to prefix a table name via {@link Piwik\Commin::prefixTable()}. @param int|int[] $errorCodesToIgnore Any given MySQL server error code will be ignored. For a list of all possible error codes have a look at {@link \Piwik\Updater\Migration\Db}. If no error should be ignored use an empty array or `false`. @return Sql
[ "Performs", "a", "custom", "SQL", "query", "during", "the", "update", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L46-L55
train
Returns a new SQL statement object
[ 30522, 2270, 3853, 29296, 1006, 1002, 29296, 1010, 1002, 7561, 23237, 3406, 23773, 5686, 1027, 9140, 1006, 1007, 1007, 1063, 2065, 1006, 1002, 7561, 23237, 3406, 23773, 5686, 1027, 1027, 1027, 6270, 1007, 1063, 1002, 7561, 23237, 3406, 2377...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Connectors/SqlServerConnector.php
SqlServerConnector.buildHostString
protected function buildHostString(array $config, $separator) { if (isset($config['port']) && ! empty($config['port'])) { return $config['host'].$separator.$config['port']; } else { return $config['host']; } }
php
protected function buildHostString(array $config, $separator) { if (isset($config['port']) && ! empty($config['port'])) { return $config['host'].$separator.$config['port']; } else { return $config['host']; } }
[ "protected", "function", "buildHostString", "(", "array", "$", "config", ",", "$", "separator", ")", "{", "if", "(", "isset", "(", "$", "config", "[", "'port'", "]", ")", "&&", "!", "empty", "(", "$", "config", "[", "'port'", "]", ")", ")", "{", "r...
Build a host string from the given configuration. @param array $config @param string $separator @return string
[ "Build", "a", "host", "string", "from", "the", "given", "configuration", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connectors/SqlServerConnector.php#L167-L174
train
Build Host String
[ 30522, 5123, 3853, 3857, 15006, 3215, 18886, 3070, 1006, 9140, 1002, 9530, 8873, 2290, 1010, 1002, 19802, 25879, 2953, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 9530, 8873, 2290, 1031, 1005, 3417, 1005, 1033, 1007, 1004, 1004, 999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Mapping/ClassMetadata.php
ClassMetadata.addConstraint
public function addConstraint(Constraint $constraint) { if (!\in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) { throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint))); } if ($constraint instanceof Valid) { throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint))); } if ($constraint instanceof Traverse) { if ($constraint->traverse) { // If traverse is true, traversal should be explicitly enabled $this->traversalStrategy = TraversalStrategy::TRAVERSE; } else { // If traverse is false, traversal should be explicitly disabled $this->traversalStrategy = TraversalStrategy::NONE; } // The constraint is not added return $this; } $constraint->addImplicitGroupName($this->getDefaultGroup()); parent::addConstraint($constraint); return $this; }
php
public function addConstraint(Constraint $constraint) { if (!\in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) { throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint))); } if ($constraint instanceof Valid) { throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint))); } if ($constraint instanceof Traverse) { if ($constraint->traverse) { // If traverse is true, traversal should be explicitly enabled $this->traversalStrategy = TraversalStrategy::TRAVERSE; } else { // If traverse is false, traversal should be explicitly disabled $this->traversalStrategy = TraversalStrategy::NONE; } // The constraint is not added return $this; } $constraint->addImplicitGroupName($this->getDefaultGroup()); parent::addConstraint($constraint); return $this; }
[ "public", "function", "addConstraint", "(", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "\\", "in_array", "(", "Constraint", "::", "CLASS_CONSTRAINT", ",", "(", "array", ")", "$", "constraint", "->", "getTargets", "(", ")", ")", ")", "{", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/ClassMetadata.php#L175-L203
train
Add a constraint to the hierarchy
[ 30522, 2270, 3853, 5587, 8663, 20528, 18447, 1006, 27142, 1002, 27142, 1007, 1063, 2065, 30524, 1006, 1005, 1996, 27142, 1000, 1003, 1055, 1000, 3685, 2022, 2404, 2006, 4280, 1012, 1005, 1010, 1032, 2131, 1035, 2465, 1006, 1002, 27142, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/WinCache.php
Zend_Cache_Backend_WinCache.getIds
public function getIds() { $res = array(); $array = wincache_ucache_info(); $records = $array['ucache_entries']; foreach ($records as $record) { $res[] = $record['key_name']; } return $res; }
php
public function getIds() { $res = array(); $array = wincache_ucache_info(); $records = $array['ucache_entries']; foreach ($records as $record) { $res[] = $record['key_name']; } return $res; }
[ "public", "function", "getIds", "(", ")", "{", "$", "res", "=", "array", "(", ")", ";", "$", "array", "=", "wincache_ucache_info", "(", ")", ";", "$", "records", "=", "$", "array", "[", "'ucache_entries'", "]", ";", "foreach", "(", "$", "records", "a...
Return an array of stored cache ids @return array array of stored cache ids (string)
[ "Return", "an", "array", "of", "stored", "cache", "ids" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/WinCache.php#L256-L265
train
Get all the ids of all the usercache entries
[ 30522, 2270, 3853, 2131, 9821, 1006, 1007, 1063, 1002, 24501, 1027, 9140, 1006, 1007, 1025, 1002, 9140, 1027, 2663, 3540, 5403, 1035, 15384, 15395, 1035, 18558, 1006, 1007, 1025, 1002, 2636, 1027, 1002, 9140, 1031, 1005, 15384, 15395, 1035,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Grammars/MySqlGrammar.php
MySqlGrammar.compileUpdate
public function compileUpdate(Builder $query, $values) { $table = $this->wrapTable($query->from); // Each one of the columns in the update statements needs to be wrapped in the // keyword identifiers, also a place-holder needs to be created for each of // the values in the list of bindings so we can make the sets statements. $columns = $this->compileUpdateColumns($values); // If the query has any "join" clauses, we will setup the joins on the builder // and compile them so we can attach them to this update, as update queries // can get join statements to attach to other tables when they're needed. $joins = ''; if (isset($query->joins)) { $joins = ' '.$this->compileJoins($query, $query->joins); } // Of course, update queries may also be constrained by where clauses so we'll // need to compile the where clauses and attach it to the query so only the // intended records are updated by the SQL statements we generate to run. $where = $this->compileWheres($query); $sql = rtrim("update {$table}{$joins} set $columns $where"); // If the query has an order by clause we will compile it since MySQL supports // order bys on update statements. We'll compile them using the typical way // of compiling order bys. Then they will be appended to the SQL queries. if (! empty($query->orders)) { $sql .= ' '.$this->compileOrders($query, $query->orders); } // Updates on MySQL also supports "limits", which allow you to easily update a // single record very easily. This is not supported by all database engines // so we have customized this update compiler here in order to add it in. if (isset($query->limit)) { $sql .= ' '.$this->compileLimit($query, $query->limit); } return rtrim($sql); }
php
public function compileUpdate(Builder $query, $values) { $table = $this->wrapTable($query->from); // Each one of the columns in the update statements needs to be wrapped in the // keyword identifiers, also a place-holder needs to be created for each of // the values in the list of bindings so we can make the sets statements. $columns = $this->compileUpdateColumns($values); // If the query has any "join" clauses, we will setup the joins on the builder // and compile them so we can attach them to this update, as update queries // can get join statements to attach to other tables when they're needed. $joins = ''; if (isset($query->joins)) { $joins = ' '.$this->compileJoins($query, $query->joins); } // Of course, update queries may also be constrained by where clauses so we'll // need to compile the where clauses and attach it to the query so only the // intended records are updated by the SQL statements we generate to run. $where = $this->compileWheres($query); $sql = rtrim("update {$table}{$joins} set $columns $where"); // If the query has an order by clause we will compile it since MySQL supports // order bys on update statements. We'll compile them using the typical way // of compiling order bys. Then they will be appended to the SQL queries. if (! empty($query->orders)) { $sql .= ' '.$this->compileOrders($query, $query->orders); } // Updates on MySQL also supports "limits", which allow you to easily update a // single record very easily. This is not supported by all database engines // so we have customized this update compiler here in order to add it in. if (isset($query->limit)) { $sql .= ' '.$this->compileLimit($query, $query->limit); } return rtrim($sql); }
[ "public", "function", "compileUpdate", "(", "Builder", "$", "query", ",", "$", "values", ")", "{", "$", "table", "=", "$", "this", "->", "wrapTable", "(", "$", "query", "->", "from", ")", ";", "// Each one of the columns in the update statements needs to be wrappe...
Compile an update statement into SQL. @param \Illuminate\Database\Query\Builder $query @param array $values @return string
[ "Compile", "an", "update", "statement", "into", "SQL", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php#L134-L174
train
Compiles an update statement into SQL
[ 30522, 2270, 3853, 4012, 22090, 6279, 13701, 1006, 12508, 1002, 23032, 1010, 1002, 5300, 1007, 1063, 1002, 2795, 1027, 1002, 2023, 1011, 1028, 10236, 10880, 1006, 1002, 23032, 1011, 1028, 2013, 1007, 1025, 1013, 1013, 2169, 2028, 1997, 1996...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Statement/Oracle.php
Zend_Db_Statement_Oracle.fetchAll
public function fetchAll($style = null, $col = 0) { if (!$this->_stmt) { return false; } // make sure we have a fetch mode if ($style === null) { $style = $this->_fetchMode; } $flags = OCI_FETCHSTATEMENT_BY_ROW; switch ($style) { case Zend_Db::FETCH_BOTH: /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception( array( 'code' => 'HYC00', 'message' => "OCI8 driver does not support fetchAll(FETCH_BOTH), use fetch() in a loop instead" ) ); // notreached $flags |= OCI_NUM; $flags |= OCI_ASSOC; break; case Zend_Db::FETCH_NUM: $flags |= OCI_NUM; break; case Zend_Db::FETCH_ASSOC: $flags |= OCI_ASSOC; break; case Zend_Db::FETCH_OBJ: break; case Zend_Db::FETCH_COLUMN: $flags = $flags &~ OCI_FETCHSTATEMENT_BY_ROW; $flags |= OCI_FETCHSTATEMENT_BY_COLUMN; $flags |= OCI_NUM; break; default: /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception( array( 'code' => 'HYC00', 'message' => "Invalid fetch mode '$style' specified" ) ); break; } $result = Array(); if ($flags != OCI_FETCHSTATEMENT_BY_ROW) { /* not Zend_Db::FETCH_OBJ */ if (! ($rows = oci_fetch_all($this->_stmt, $result, 0, -1, $flags) )) { if ($error = oci_error($this->_stmt)) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception($error); } if (!$rows) { return array(); } } if ($style == Zend_Db::FETCH_COLUMN) { $result = $result[$col]; } foreach ($result as &$row) { if (is_array($row) && array_key_exists('zend_db_rownum', $row)) { unset($row['zend_db_rownum']); } } } else { while (($row = oci_fetch_object($this->_stmt)) !== false) { $result [] = $row; } if ($error = oci_error($this->_stmt)) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception($error); } } return $result; }
php
public function fetchAll($style = null, $col = 0) { if (!$this->_stmt) { return false; } // make sure we have a fetch mode if ($style === null) { $style = $this->_fetchMode; } $flags = OCI_FETCHSTATEMENT_BY_ROW; switch ($style) { case Zend_Db::FETCH_BOTH: /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception( array( 'code' => 'HYC00', 'message' => "OCI8 driver does not support fetchAll(FETCH_BOTH), use fetch() in a loop instead" ) ); // notreached $flags |= OCI_NUM; $flags |= OCI_ASSOC; break; case Zend_Db::FETCH_NUM: $flags |= OCI_NUM; break; case Zend_Db::FETCH_ASSOC: $flags |= OCI_ASSOC; break; case Zend_Db::FETCH_OBJ: break; case Zend_Db::FETCH_COLUMN: $flags = $flags &~ OCI_FETCHSTATEMENT_BY_ROW; $flags |= OCI_FETCHSTATEMENT_BY_COLUMN; $flags |= OCI_NUM; break; default: /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception( array( 'code' => 'HYC00', 'message' => "Invalid fetch mode '$style' specified" ) ); break; } $result = Array(); if ($flags != OCI_FETCHSTATEMENT_BY_ROW) { /* not Zend_Db::FETCH_OBJ */ if (! ($rows = oci_fetch_all($this->_stmt, $result, 0, -1, $flags) )) { if ($error = oci_error($this->_stmt)) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception($error); } if (!$rows) { return array(); } } if ($style == Zend_Db::FETCH_COLUMN) { $result = $result[$col]; } foreach ($result as &$row) { if (is_array($row) && array_key_exists('zend_db_rownum', $row)) { unset($row['zend_db_rownum']); } } } else { while (($row = oci_fetch_object($this->_stmt)) !== false) { $result [] = $row; } if ($error = oci_error($this->_stmt)) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception($error); } } return $result; }
[ "public", "function", "fetchAll", "(", "$", "style", "=", "null", ",", "$", "col", "=", "0", ")", "{", "if", "(", "!", "$", "this", "->", "_stmt", ")", "{", "return", "false", ";", "}", "// make sure we have a fetch mode", "if", "(", "$", "style", "=...
Returns an array containing all of the result set rows. @param int $style OPTIONAL Fetch mode. @param int $col OPTIONAL Column number, if fetch mode is by column. @return array Collection of rows, each in a format by the fetch mode. @throws Zend_Db_Statement_Exception
[ "Returns", "an", "array", "containing", "all", "of", "the", "result", "set", "rows", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Oracle.php#L359-L451
train
Fetch all rows from the result set
[ 30522, 2270, 3853, 18584, 8095, 1006, 1002, 2806, 1027, 19701, 1010, 1002, 8902, 1027, 1014, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1007, 1063, 2709, 6270, 1025, 1065, 1013, 1013, 2191, 2469, 2057, 2031, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php
ObjectCollectionTrait.collectionGroup
public function collectionGroup($property) { $collections = []; foreach ($this->group($property) as $id => $elements) { $collection = $this->createFrom($elements); $collections[$id] = $collection; } return $collections; }
php
public function collectionGroup($property) { $collections = []; foreach ($this->group($property) as $id => $elements) { $collection = $this->createFrom($elements); $collections[$id] = $collection; } return $collections; }
[ "public", "function", "collectionGroup", "(", "$", "property", ")", "{", "$", "collections", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "group", "(", "$", "property", ")", "as", "$", "id", "=>", "$", "elements", ")", "{", "$", "collection...
Group items in the collection by a field and return them as associated array of collections. @param string $property @return static[]
[ "Group", "items", "in", "the", "collection", "by", "a", "field", "and", "return", "them", "as", "associated", "array", "of", "collections", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php#L169-L179
train
Get all the collections of a property
[ 30522, 2270, 3853, 3074, 17058, 1006, 1002, 3200, 1007, 1063, 1002, 6407, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2177, 1006, 1002, 3200, 1007, 2004, 1002, 8909, 1027, 1028, 1002, 3787, 1007, 1063, 1002, 3074, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/ErrorHandler.php
ErrorHandler.handleCustomError
public function handleCustomError() { if (Config::get('app.debug', false)) { return null; } $theme = Theme::getActiveTheme(); $router = new Router($theme); // Use the default view if no "/error" URL is found. if (!$router->findByUrl('/error')) { return View::make('cms::error'); } // Route to the CMS error page. $controller = new CmsController($theme); $result = $controller->run('/error'); // Extract content from response object if ($result instanceof \Symfony\Component\HttpFoundation\Response) { $result = $result->getContent(); } return $result; }
php
public function handleCustomError() { if (Config::get('app.debug', false)) { return null; } $theme = Theme::getActiveTheme(); $router = new Router($theme); // Use the default view if no "/error" URL is found. if (!$router->findByUrl('/error')) { return View::make('cms::error'); } // Route to the CMS error page. $controller = new CmsController($theme); $result = $controller->run('/error'); // Extract content from response object if ($result instanceof \Symfony\Component\HttpFoundation\Response) { $result = $result->getContent(); } return $result; }
[ "public", "function", "handleCustomError", "(", ")", "{", "if", "(", "Config", "::", "get", "(", "'app.debug'", ",", "false", ")", ")", "{", "return", "null", ";", "}", "$", "theme", "=", "Theme", "::", "getActiveTheme", "(", ")", ";", "$", "router", ...
Looks up an error page using the CMS route "/error". If the route does not exist, this function will use the error view found in the Cms module. @return mixed Error page contents.
[ "Looks", "up", "an", "error", "page", "using", "the", "CMS", "route", "/", "error", ".", "If", "the", "route", "does", "not", "exist", "this", "function", "will", "use", "the", "error", "view", "found", "in", "the", "Cms", "module", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/ErrorHandler.php#L54-L78
train
Handle custom error page
[ 30522, 2270, 3853, 5047, 7874, 20389, 2121, 29165, 1006, 1007, 1063, 2065, 1006, 9530, 8873, 2290, 1024, 1024, 2131, 1006, 1005, 10439, 1012, 2139, 8569, 2290, 1005, 1010, 6270, 1007, 1007, 1063, 2709, 19701, 1025, 1065, 1002, 4323, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
HasAttributes.asDateTime
protected function asDateTime($value) { // If this value is already a Carbon instance, we shall just return it as is. // This prevents us having to re-instantiate a Carbon instance when we know // it already is one, which wouldn't be fulfilled by the DateTime check. if ($value instanceof Carbon || $value instanceof CarbonInterface) { return Date::instance($value); } // If the value is already a DateTime instance, we will just skip the rest of // these checks since they will be a waste of time, and hinder performance // when checking the field. We will just return the DateTime right away. if ($value instanceof DateTimeInterface) { return Date::parse( $value->format('Y-m-d H:i:s.u'), $value->getTimezone() ); } // If this value is an integer, we will assume it is a UNIX timestamp's value // and format a Carbon object from this timestamp. This allows flexibility // when defining your date fields as they might be UNIX timestamps here. if (is_numeric($value)) { return Date::createFromTimestamp($value); } // If the value is in simply year, month, day format, we will instantiate the // Carbon instances from that format. Again, this provides for simple date // fields on the database, while still supporting Carbonized conversion. if ($this->isStandardDateFormat($value)) { return Date::instance(Carbon::createFromFormat('Y-m-d', $value)->startOfDay()); } $format = $this->getDateFormat(); // https://bugs.php.net/bug.php?id=75577 if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) { $format = str_replace('.v', '.u', $format); } // Finally, we will just assume this date is in the format used by default on // the database connection and use that format to create the Carbon object // that is returned back out to the developers after we convert it here. return Date::createFromFormat($format, $value); }
php
protected function asDateTime($value) { // If this value is already a Carbon instance, we shall just return it as is. // This prevents us having to re-instantiate a Carbon instance when we know // it already is one, which wouldn't be fulfilled by the DateTime check. if ($value instanceof Carbon || $value instanceof CarbonInterface) { return Date::instance($value); } // If the value is already a DateTime instance, we will just skip the rest of // these checks since they will be a waste of time, and hinder performance // when checking the field. We will just return the DateTime right away. if ($value instanceof DateTimeInterface) { return Date::parse( $value->format('Y-m-d H:i:s.u'), $value->getTimezone() ); } // If this value is an integer, we will assume it is a UNIX timestamp's value // and format a Carbon object from this timestamp. This allows flexibility // when defining your date fields as they might be UNIX timestamps here. if (is_numeric($value)) { return Date::createFromTimestamp($value); } // If the value is in simply year, month, day format, we will instantiate the // Carbon instances from that format. Again, this provides for simple date // fields on the database, while still supporting Carbonized conversion. if ($this->isStandardDateFormat($value)) { return Date::instance(Carbon::createFromFormat('Y-m-d', $value)->startOfDay()); } $format = $this->getDateFormat(); // https://bugs.php.net/bug.php?id=75577 if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) { $format = str_replace('.v', '.u', $format); } // Finally, we will just assume this date is in the format used by default on // the database connection and use that format to create the Carbon object // that is returned back out to the developers after we convert it here. return Date::createFromFormat($format, $value); }
[ "protected", "function", "asDateTime", "(", "$", "value", ")", "{", "// If this value is already a Carbon instance, we shall just return it as is.", "// This prevents us having to re-instantiate a Carbon instance when we know", "// it already is one, which wouldn't be fulfilled by the DateTime c...
Return a timestamp as DateTime object. @param mixed $value @return \Illuminate\Support\Carbon
[ "Return", "a", "timestamp", "as", "DateTime", "object", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L763-L806
train
Returns the value as a DateTime object
[ 30522, 5123, 3853, 2004, 13701, 7292, 1006, 1002, 3643, 1007, 1063, 1013, 1013, 2065, 2023, 3643, 2003, 2525, 1037, 6351, 6013, 1010, 2057, 4618, 2074, 2709, 2009, 30524, 1064, 1002, 3643, 6013, 11253, 6351, 18447, 2121, 12172, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Session/Store.php
Store.now
public function now($key, $value) { $this->put($key, $value); $this->push('_flash.old', $key); }
php
public function now($key, $value) { $this->put($key, $value); $this->push('_flash.old', $key); }
[ "public", "function", "now", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "put", "(", "$", "key", ",", "$", "value", ")", ";", "$", "this", "->", "push", "(", "'_flash.old'", ",", "$", "key", ")", ";", "}" ]
Flash a key / value pair to the session for immediate use. @param string $key @param mixed $value @return void
[ "Flash", "a", "key", "/", "value", "pair", "to", "the", "session", "for", "immediate", "use", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Store.php#L359-L364
train
Write a flash value to the current session
[ 30522, 2270, 3853, 2085, 1006, 1002, 3145, 1010, 1002, 3643, 1007, 1063, 1002, 2023, 1011, 1028, 2404, 1006, 1002, 3145, 1010, 1002, 3643, 1007, 1025, 1002, 2023, 1011, 1028, 5245, 1006, 1005, 1035, 5956, 1012, 2214, 1005, 1010, 1002, 314...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Mail/PendingMail.php
PendingMail.to
public function to($users) { $this->to = $users; if (! $this->locale && $users instanceof HasLocalePreference) { $this->locale($users->preferredLocale()); } return $this; }
php
public function to($users) { $this->to = $users; if (! $this->locale && $users instanceof HasLocalePreference) { $this->locale($users->preferredLocale()); } return $this; }
[ "public", "function", "to", "(", "$", "users", ")", "{", "$", "this", "->", "to", "=", "$", "users", ";", "if", "(", "!", "$", "this", "->", "locale", "&&", "$", "users", "instanceof", "HasLocalePreference", ")", "{", "$", "this", "->", "locale", "...
Set the recipients of the message. @param mixed $users @return $this
[ "Set", "the", "recipients", "of", "the", "message", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/PendingMail.php#L77-L86
train
Set to users
[ 30522, 2270, 3853, 2000, 1006, 1002, 5198, 1007, 1063, 1002, 2023, 1011, 1028, 2000, 1027, 1002, 5198, 1025, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2334, 2063, 1004, 1004, 1002, 5198, 6013, 11253, 2038, 4135, 9289, 13699, 2890, 25523, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...