repo
stringclasses
21 values
path
stringlengths
10
105
func_name
stringlengths
6
64
original_string
stringlengths
105
15.6k
language
stringclasses
1 value
code
stringlengths
105
15.6k
code_tokens
listlengths
29
2.15k
docstring
stringlengths
11
2.85k
docstring_tokens
listlengths
1
290
sha
stringclasses
21 values
url
stringlengths
100
194
partition
stringclasses
1 value
summary
stringlengths
8
319
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
symfony/symfony
src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
InMemoryUserProvider.refreshUser
public function refreshUser(UserInterface $user) { if (!$user instanceof User) { throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user))); } $storedUser = $this->getUser($user->getUsername()); return new User($storedUser->getUsername(), $storedUser->getPassword(), $storedUser->getRoles(), $storedUser->isEnabled(), $storedUser->isAccountNonExpired(), $storedUser->isCredentialsNonExpired() && $storedUser->getPassword() === $user->getPassword(), $storedUser->isAccountNonLocked()); }
php
public function refreshUser(UserInterface $user) { if (!$user instanceof User) { throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user))); } $storedUser = $this->getUser($user->getUsername()); return new User($storedUser->getUsername(), $storedUser->getPassword(), $storedUser->getRoles(), $storedUser->isEnabled(), $storedUser->isAccountNonExpired(), $storedUser->isCredentialsNonExpired() && $storedUser->getPassword() === $user->getPassword(), $storedUser->isAccountNonLocked()); }
[ "public", "function", "refreshUser", "(", "UserInterface", "$", "user", ")", "{", "if", "(", "!", "$", "user", "instanceof", "User", ")", "{", "throw", "new", "UnsupportedUserException", "(", "sprintf", "(", "'Instances of \"%s\" are not supported.'", ",", "\\", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php#L74-L83
train
Refreshes a user
[ 30522, 2270, 3853, 25416, 21898, 20330, 1006, 5310, 18447, 2121, 12172, 1002, 5310, 1007, 1063, 2065, 1006, 999, 1002, 5310, 6013, 11253, 5310, 1007, 1063, 5466, 2047, 4895, 6342, 9397, 15613, 20330, 10288, 24422, 1006, 9043, 2546, 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...
symfony/symfony
src/Symfony/Component/HttpClient/Response/MockResponse.php
MockResponse.perform
protected static function perform(ClientState $multi, array &$responses): void { foreach ($responses as $response) { $id = $response->id; if (!$response->body) { // Last chunk $multi->handlesActivity[$id][] = null; $multi->handlesActivity[$id][] = null !== $response->info['error'] ? new TransportException($response->info['error']) : null; } elseif (null === $chunk = array_shift($response->body)) { // Last chunk $multi->handlesActivity[$id][] = null; $multi->handlesActivity[$id][] = array_shift($response->body); } elseif (\is_array($chunk)) { // First chunk try { $offset = 0; $chunk[1]->getStatusCode(); $response->headers = $chunk[1]->getHeaders(false); $multi->handlesActivity[$id][] = new FirstChunk(); self::readResponse($response, $chunk[0], $chunk[1], $offset); } catch (\Throwable $e) { $multi->handlesActivity[$id][] = null; $multi->handlesActivity[$id][] = $e; } } else { // Data or timeout chunk $multi->handlesActivity[$id][] = $chunk; if (\is_string($chunk) && null !== $response->content) { // Buffer response body fwrite($response->content, $chunk); } } } }
php
protected static function perform(ClientState $multi, array &$responses): void { foreach ($responses as $response) { $id = $response->id; if (!$response->body) { // Last chunk $multi->handlesActivity[$id][] = null; $multi->handlesActivity[$id][] = null !== $response->info['error'] ? new TransportException($response->info['error']) : null; } elseif (null === $chunk = array_shift($response->body)) { // Last chunk $multi->handlesActivity[$id][] = null; $multi->handlesActivity[$id][] = array_shift($response->body); } elseif (\is_array($chunk)) { // First chunk try { $offset = 0; $chunk[1]->getStatusCode(); $response->headers = $chunk[1]->getHeaders(false); $multi->handlesActivity[$id][] = new FirstChunk(); self::readResponse($response, $chunk[0], $chunk[1], $offset); } catch (\Throwable $e) { $multi->handlesActivity[$id][] = null; $multi->handlesActivity[$id][] = $e; } } else { // Data or timeout chunk $multi->handlesActivity[$id][] = $chunk; if (\is_string($chunk) && null !== $response->content) { // Buffer response body fwrite($response->content, $chunk); } } } }
[ "protected", "static", "function", "perform", "(", "ClientState", "$", "multi", ",", "array", "&", "$", "responses", ")", ":", "void", "{", "foreach", "(", "$", "responses", "as", "$", "response", ")", "{", "$", "id", "=", "$", "response", "->", "id", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/Response/MockResponse.php#L146-L181
train
Perform processing of activity responses
[ 30522, 5123, 10763, 3853, 4685, 1006, 7846, 12259, 1002, 4800, 1010, 9140, 1004, 1002, 10960, 1007, 1024, 11675, 1063, 18921, 6776, 1006, 1002, 10960, 2004, 1002, 3433, 1007, 1063, 1002, 8909, 1027, 1002, 3433, 1011, 1028, 8909, 1025, 2065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Uri.php
Uri.post
public function post($element = null, $filter_type = null) { if (!$this->post) { $content_type = $this->getContentType(); if ($content_type === 'application/json') { $json = file_get_contents('php://input'); $this->post = json_decode($json, true); } elseif (!empty($_POST)) { $this->post = (array)$_POST; } $event = new Event(['post' => &$this->post]); Grav::instance()->fireEvent('onHttpPostFilter', $event); } if ($this->post && null !== $element) { $item = Utils::getDotNotation($this->post, $element); if ($filter_type) { $item = filter_var($item, $filter_type); } return $item; } return $this->post; }
php
public function post($element = null, $filter_type = null) { if (!$this->post) { $content_type = $this->getContentType(); if ($content_type === 'application/json') { $json = file_get_contents('php://input'); $this->post = json_decode($json, true); } elseif (!empty($_POST)) { $this->post = (array)$_POST; } $event = new Event(['post' => &$this->post]); Grav::instance()->fireEvent('onHttpPostFilter', $event); } if ($this->post && null !== $element) { $item = Utils::getDotNotation($this->post, $element); if ($filter_type) { $item = filter_var($item, $filter_type); } return $item; } return $this->post; }
[ "public", "function", "post", "(", "$", "element", "=", "null", ",", "$", "filter_type", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "post", ")", "{", "$", "content_type", "=", "$", "this", "->", "getContentType", "(", ")", ";", "if",...
Get's post from either $_POST or JSON response object By default returns all data, or can return a single item @param string $element @param string $filter_type @return array|mixed|null
[ "Get", "s", "post", "from", "either", "$_POST", "or", "JSON", "response", "object", "By", "default", "returns", "all", "data", "or", "can", "return", "a", "single", "item" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L1296-L1320
train
POST - Method
[ 30522, 2270, 3853, 2695, 1006, 1002, 5783, 1027, 19701, 1010, 1002, 11307, 1035, 2828, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2695, 1007, 1063, 1002, 4180, 1035, 2828, 1027, 1002, 2023, 1011, 1028, 2131, 8663, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Console/AppNameCommand.php
AppNameCommand.setBootstrapNamespaces
protected function setBootstrapNamespaces() { $search = [ $this->currentRoot.'\\Http', $this->currentRoot.'\\Console', $this->currentRoot.'\\Exceptions', ]; $replace = [ $this->argument('name').'\\Http', $this->argument('name').'\\Console', $this->argument('name').'\\Exceptions', ]; $this->replaceIn($this->getBootstrapPath(), $search, $replace); }
php
protected function setBootstrapNamespaces() { $search = [ $this->currentRoot.'\\Http', $this->currentRoot.'\\Console', $this->currentRoot.'\\Exceptions', ]; $replace = [ $this->argument('name').'\\Http', $this->argument('name').'\\Console', $this->argument('name').'\\Exceptions', ]; $this->replaceIn($this->getBootstrapPath(), $search, $replace); }
[ "protected", "function", "setBootstrapNamespaces", "(", ")", "{", "$", "search", "=", "[", "$", "this", "->", "currentRoot", ".", "'\\\\Http'", ",", "$", "this", "->", "currentRoot", ".", "'\\\\Console'", ",", "$", "this", "->", "currentRoot", ".", "'\\\\Exc...
Set the bootstrap namespaces. @return void
[ "Set", "the", "bootstrap", "namespaces", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/AppNameCommand.php#L128-L143
train
Set the namespaces in the bootstrap file.
[ 30522, 5123, 3853, 2275, 27927, 20528, 2361, 18442, 23058, 2015, 1006, 1007, 1063, 1002, 3945, 1027, 1031, 1002, 2023, 1011, 1028, 2783, 3217, 4140, 1012, 1005, 1032, 1032, 8299, 1005, 1010, 1002, 2023, 1011, 1028, 2783, 3217, 4140, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Simple/PhpArrayCache.php
PhpArrayCache.getMultiple
public function getMultiple($keys, $default = null) { if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } foreach ($keys as $key) { if (!\is_string($key)) { throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); } } if (null === $this->values) { $this->initialize(); } return $this->generateItems($keys, $default); }
php
public function getMultiple($keys, $default = null) { if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } foreach ($keys as $key) { if (!\is_string($key)) { throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', \is_object($key) ? \get_class($key) : \gettype($key))); } } if (null === $this->values) { $this->initialize(); } return $this->generateItems($keys, $default); }
[ "public", "function", "getMultiple", "(", "$", "keys", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "keys", "instanceof", "\\", "Traversable", ")", "{", "$", "keys", "=", "iterator_to_array", "(", "$", "keys", ",", "false", ")", ";", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/PhpArrayCache.php#L91-L108
train
Get multiple items from cache
[ 30522, 2270, 3853, 2131, 12274, 7096, 11514, 2571, 1006, 1002, 6309, 1010, 1002, 12398, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 6309, 6013, 11253, 1032, 29053, 3085, 1007, 1063, 1002, 6309, 1027, 30524, 1035, 9140, 1006, 1002, 6309, 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/Intl/Data/Provider/CurrencyDataProvider.php
CurrencyDataProvider.getFractionDigits
public function getFractionDigits($currency) { try { return $this->reader->readEntry($this->path, 'meta', ['Meta', $currency, static::INDEX_FRACTION_DIGITS]); } catch (MissingResourceException $e) { return $this->reader->readEntry($this->path, 'meta', ['Meta', 'DEFAULT', static::INDEX_FRACTION_DIGITS]); } }
php
public function getFractionDigits($currency) { try { return $this->reader->readEntry($this->path, 'meta', ['Meta', $currency, static::INDEX_FRACTION_DIGITS]); } catch (MissingResourceException $e) { return $this->reader->readEntry($this->path, 'meta', ['Meta', 'DEFAULT', static::INDEX_FRACTION_DIGITS]); } }
[ "public", "function", "getFractionDigits", "(", "$", "currency", ")", "{", "try", "{", "return", "$", "this", "->", "reader", "->", "readEntry", "(", "$", "this", "->", "path", ",", "'meta'", ",", "[", "'Meta'", ",", "$", "currency", ",", "static", "::...
Data provider for {@link \Symfony\Component\Intl\Currency::getFractionDigits()}.
[ "Data", "provider", "for", "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Provider/CurrencyDataProvider.php#L106-L113
train
Get Number of Currency Fractions
[ 30522, 2270, 3853, 2131, 27843, 7542, 4305, 23806, 2015, 1006, 1002, 9598, 1007, 1063, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 8068, 1011, 1028, 3191, 4765, 2854, 1006, 1002, 2023, 1011, 1028, 4130, 1010, 1005, 18804, 1005, 1010, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Serializer/Mapping/ClassMetadata.php
ClassMetadata.merge
public function merge(ClassMetadataInterface $classMetadata) { foreach ($classMetadata->getAttributesMetadata() as $attributeMetadata) { if (isset($this->attributesMetadata[$attributeMetadata->getName()])) { $this->attributesMetadata[$attributeMetadata->getName()]->merge($attributeMetadata); } else { $this->addAttributeMetadata($attributeMetadata); } } }
php
public function merge(ClassMetadataInterface $classMetadata) { foreach ($classMetadata->getAttributesMetadata() as $attributeMetadata) { if (isset($this->attributesMetadata[$attributeMetadata->getName()])) { $this->attributesMetadata[$attributeMetadata->getName()]->merge($attributeMetadata); } else { $this->addAttributeMetadata($attributeMetadata); } } }
[ "public", "function", "merge", "(", "ClassMetadataInterface", "$", "classMetadata", ")", "{", "foreach", "(", "$", "classMetadata", "->", "getAttributesMetadata", "(", ")", "as", "$", "attributeMetadata", ")", "{", "if", "(", "isset", "(", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Mapping/ClassMetadata.php#L90-L99
train
Merge the attributes of the passed class metadata into this one.
[ 30522, 2270, 3853, 13590, 1006, 2465, 11368, 8447, 18249, 3334, 12172, 1002, 2465, 11368, 8447, 2696, 1007, 1063, 18921, 6776, 1006, 1002, 2465, 11368, 8447, 2696, 1011, 1028, 2131, 19321, 3089, 8569, 4570, 11368, 8447, 2696, 1006, 1007, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Util/LocaleScanner.php
LocaleScanner.scanAliases
public function scanAliases($sourceDir) { $locales = $this->scanLocales($sourceDir); $aliases = []; // Delete locales that are no aliases foreach ($locales as $locale) { $content = file_get_contents($sourceDir.'/'.$locale.'.txt'); // Aliases contain the text "%%ALIAS" followed by the aliased locale if (preg_match('/"%%ALIAS"\{"([^"]+)"\}/', $content, $matches)) { $aliases[$locale] = $matches[1]; } } return $aliases; }
php
public function scanAliases($sourceDir) { $locales = $this->scanLocales($sourceDir); $aliases = []; // Delete locales that are no aliases foreach ($locales as $locale) { $content = file_get_contents($sourceDir.'/'.$locale.'.txt'); // Aliases contain the text "%%ALIAS" followed by the aliased locale if (preg_match('/"%%ALIAS"\{"([^"]+)"\}/', $content, $matches)) { $aliases[$locale] = $matches[1]; } } return $aliases; }
[ "public", "function", "scanAliases", "(", "$", "sourceDir", ")", "{", "$", "locales", "=", "$", "this", "->", "scanLocales", "(", "$", "sourceDir", ")", ";", "$", "aliases", "=", "[", "]", ";", "// Delete locales that are no aliases", "foreach", "(", "$", ...
Returns all locale aliases found in the given directory. @param string $sourceDir The directory with ICU files @return array An array with the locale aliases as keys and the aliased locales as values
[ "Returns", "all", "locale", "aliases", "found", "in", "the", "given", "directory", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php#L68-L84
train
Scan aliases in the source directory
[ 30522, 2270, 3853, 13594, 22786, 8583, 1006, 1002, 23184, 4313, 1007, 1063, 1002, 2334, 2229, 1027, 1002, 2023, 1011, 1028, 13594, 4135, 9289, 2229, 1006, 1002, 23184, 4313, 1007, 1025, 1002, 14593, 2229, 1027, 1031, 1033, 1025, 1013, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Form.php
Form.isValid
public function isValid() { if (!$this->submitted) { throw new LogicException('Cannot check if an unsubmitted form is valid. Call Form::isSubmitted() before Form::isValid().'); } if ($this->isDisabled()) { return true; } return 0 === \count($this->getErrors(true)); }
php
public function isValid() { if (!$this->submitted) { throw new LogicException('Cannot check if an unsubmitted form is valid. Call Form::isSubmitted() before Form::isValid().'); } if ($this->isDisabled()) { return true; } return 0 === \count($this->getErrors(true)); }
[ "public", "function", "isValid", "(", ")", "{", "if", "(", "!", "$", "this", "->", "submitted", ")", "{", "throw", "new", "LogicException", "(", "'Cannot check if an unsubmitted form is valid. Call Form::isSubmitted() before Form::isValid().'", ")", ";", "}", "if", "(...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L740-L751
train
Returns true if the form is valid.
[ 30522, 2270, 3853, 2003, 10175, 3593, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 7864, 1007, 1063, 5466, 2047, 7961, 10288, 24422, 1006, 1005, 3685, 4638, 2065, 2019, 4895, 6342, 25526, 27100, 2094, 2433, 2003, 9398, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Settings/Measurable/MeasurableSettings.php
MeasurableSettings.makeSetting
protected function makeSetting($name, $defaultValue, $type, $fieldConfigCallback) { $setting = new MeasurableSetting($name, $defaultValue, $type, $this->pluginName, $this->idSite); $setting->setConfigureCallback($fieldConfigCallback); $this->addSetting($setting); return $setting; }
php
protected function makeSetting($name, $defaultValue, $type, $fieldConfigCallback) { $setting = new MeasurableSetting($name, $defaultValue, $type, $this->pluginName, $this->idSite); $setting->setConfigureCallback($fieldConfigCallback); $this->addSetting($setting); return $setting; }
[ "protected", "function", "makeSetting", "(", "$", "name", ",", "$", "defaultValue", ",", "$", "type", ",", "$", "fieldConfigCallback", ")", "{", "$", "setting", "=", "new", "MeasurableSetting", "(", "$", "name", ",", "$", "defaultValue", ",", "$", "type", ...
Creates a new measurable setting. Settings will be displayed in the UI depending on the order of `makeSetting` calls. This means you can define the order of the displayed settings by calling makeSetting first for more important settings. @param string $name The name of the setting that shall be created @param mixed $defaultValue The default value for this setting. Note the value will not be converted to the specified type. @param string $type The PHP internal type the value of this setting should have. Use one of FieldConfig::TYPE_* constancts @param \Closure $fieldConfigCallback A callback method to configure the field that shall be displayed in the UI to define the value for this setting @return MeasurableSetting Returns an instance of the created measurable setting. @throws Exception
[ "Creates", "a", "new", "measurable", "setting", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Settings/Measurable/MeasurableSettings.php#L89-L97
train
Create and add a new measurable setting
[ 30522, 5123, 3853, 3084, 18319, 3070, 1006, 1002, 2171, 1010, 1002, 12398, 10175, 5657, 1010, 1002, 2828, 1010, 1002, 2492, 8663, 8873, 18195, 8095, 5963, 1007, 1063, 1002, 4292, 1027, 2047, 2033, 28329, 21678, 2075, 1006, 1002, 2171, 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...
matomo-org/matomo
libs/Zend/Mime/Message.php
Zend_Mime_Message.getPartContent
public function getPartContent($partnum, $EOL = Zend_Mime::LINEEND) { return $this->_parts[$partnum]->getContent($EOL); }
php
public function getPartContent($partnum, $EOL = Zend_Mime::LINEEND) { return $this->_parts[$partnum]->getContent($EOL); }
[ "public", "function", "getPartContent", "(", "$", "partnum", ",", "$", "EOL", "=", "Zend_Mime", "::", "LINEEND", ")", "{", "return", "$", "this", "->", "_parts", "[", "$", "partnum", "]", "->", "getContent", "(", "$", "EOL", ")", ";", "}" ]
Get the (encoded) content of a given part as a string @param int $partnum @return string
[ "Get", "the", "(", "encoded", ")", "content", "of", "a", "given", "part", "as", "a", "string" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime/Message.php#L188-L191
train
Returns the content of a part
[ 30522, 2270, 3853, 2131, 19362, 13535, 28040, 3372, 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...
laravel/framework
src/Illuminate/Notifications/Channels/DatabaseChannel.php
DatabaseChannel.send
public function send($notifiable, Notification $notification) { return $notifiable->routeNotificationFor('database', $notification)->create( $this->buildPayload($notifiable, $notification) ); }
php
public function send($notifiable, Notification $notification) { return $notifiable->routeNotificationFor('database', $notification)->create( $this->buildPayload($notifiable, $notification) ); }
[ "public", "function", "send", "(", "$", "notifiable", ",", "Notification", "$", "notification", ")", "{", "return", "$", "notifiable", "->", "routeNotificationFor", "(", "'database'", ",", "$", "notification", ")", "->", "create", "(", "$", "this", "->", "bu...
Send the given notification. @param mixed $notifiable @param \Illuminate\Notifications\Notification $notification @return \Illuminate\Database\Eloquent\Model
[ "Send", "the", "given", "notification", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Channels/DatabaseChannel.php#L17-L22
train
Send a notification to the database
[ 30522, 2270, 3853, 4604, 1006, 1002, 2025, 10128, 19210, 1010, 26828, 1002, 26828, 1007, 1063, 2709, 1002, 2025, 10128, 19210, 1011, 1028, 2799, 17048, 9031, 29278, 1006, 1005, 7809, 1005, 1010, 1002, 26828, 1007, 1011, 1028, 3443, 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...
getgrav/grav
system/src/Grav/Console/ConsoleTrait.php
ConsoleTrait.setupConsole
public function setupConsole(InputInterface $input, OutputInterface $output) { // Initialize cache with CLI compatibility Grav::instance()['config']->set('system.cache.cli_compatibility', true); Grav::instance()['cache']; $this->argv = $_SERVER['argv'][0]; $this->input = $input; $this->output = $output; $this->output->getFormatter()->setStyle('normal', new OutputFormatterStyle('white')); $this->output->getFormatter()->setStyle('yellow', new OutputFormatterStyle('yellow', null, array('bold'))); $this->output->getFormatter()->setStyle('red', new OutputFormatterStyle('red', null, array('bold'))); $this->output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan', null, array('bold'))); $this->output->getFormatter()->setStyle('green', new OutputFormatterStyle('green', null, array('bold'))); $this->output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta', null, array('bold'))); $this->output->getFormatter()->setStyle('white', new OutputFormatterStyle('white', null, array('bold'))); }
php
public function setupConsole(InputInterface $input, OutputInterface $output) { // Initialize cache with CLI compatibility Grav::instance()['config']->set('system.cache.cli_compatibility', true); Grav::instance()['cache']; $this->argv = $_SERVER['argv'][0]; $this->input = $input; $this->output = $output; $this->output->getFormatter()->setStyle('normal', new OutputFormatterStyle('white')); $this->output->getFormatter()->setStyle('yellow', new OutputFormatterStyle('yellow', null, array('bold'))); $this->output->getFormatter()->setStyle('red', new OutputFormatterStyle('red', null, array('bold'))); $this->output->getFormatter()->setStyle('cyan', new OutputFormatterStyle('cyan', null, array('bold'))); $this->output->getFormatter()->setStyle('green', new OutputFormatterStyle('green', null, array('bold'))); $this->output->getFormatter()->setStyle('magenta', new OutputFormatterStyle('magenta', null, array('bold'))); $this->output->getFormatter()->setStyle('white', new OutputFormatterStyle('white', null, array('bold'))); }
[ "public", "function", "setupConsole", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "// Initialize cache with CLI compatibility", "Grav", "::", "instance", "(", ")", "[", "'config'", "]", "->", "set", "(", "'system.cache.cli_c...
Set colors style definition for the formatter. @param InputInterface $input @param OutputInterface $output
[ "Set", "colors", "style", "definition", "for", "the", "formatter", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/ConsoleTrait.php#L42-L59
train
Setup the console
[ 30522, 2270, 3853, 16437, 8663, 19454, 2063, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1013, 1013, 3988, 4697, 17053, 2007, 18856, 2072, 21778, 24665, 11431, 1024, 1024, 6013, 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/Component/Cache/Simple/ArrayCache.php
ArrayCache.setMultiple
public function setMultiple($values, $ttl = null) { if (!\is_array($values) && !$values instanceof \Traversable) { throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); } $valuesArray = []; foreach ($values as $key => $value) { if (!\is_int($key) && !(\is_string($key) && isset($this->expiries[$key]))) { CacheItem::validateKey($key); } $valuesArray[$key] = $value; } if (false === $ttl = $this->normalizeTtl($ttl)) { return $this->deleteMultiple(array_keys($valuesArray)); } $expiry = 0 < $ttl ? microtime(true) + $ttl : PHP_INT_MAX; foreach ($valuesArray as $key => $value) { if ($this->storeSerialized && null === $value = $this->freeze($value, $key)) { return false; } $this->values[$key] = $value; $this->expiries[$key] = $expiry; } return true; }
php
public function setMultiple($values, $ttl = null) { if (!\is_array($values) && !$values instanceof \Traversable) { throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); } $valuesArray = []; foreach ($values as $key => $value) { if (!\is_int($key) && !(\is_string($key) && isset($this->expiries[$key]))) { CacheItem::validateKey($key); } $valuesArray[$key] = $value; } if (false === $ttl = $this->normalizeTtl($ttl)) { return $this->deleteMultiple(array_keys($valuesArray)); } $expiry = 0 < $ttl ? microtime(true) + $ttl : PHP_INT_MAX; foreach ($valuesArray as $key => $value) { if ($this->storeSerialized && null === $value = $this->freeze($value, $key)) { return false; } $this->values[$key] = $value; $this->expiries[$key] = $expiry; } return true; }
[ "public", "function", "setMultiple", "(", "$", "values", ",", "$", "ttl", "=", "null", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "values", ")", "&&", "!", "$", "values", "instanceof", "\\", "Traversable", ")", "{", "throw", "new", "Invali...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/ArrayCache.php#L117-L144
train
Set multiple cache items
[ 30522, 2270, 3853, 2275, 12274, 7096, 11514, 2571, 1006, 1002, 5300, 1010, 1002, 23746, 2140, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1032, 2003, 1035, 9140, 1006, 1002, 5300, 1007, 1004, 1004, 999, 1002, 5300, 6013, 11253, 1032, 29053, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/CombineAssets.php
CombineAssets.combineToFile
public function combineToFile($assets = [], $destination, $localPath = null) { // Disable cache always $this->storagePath = null; // Prefix all assets if ($localPath) { if (substr($localPath, -1) !== '/') { $localPath = $localPath.'/'; } $assets = array_map(function($asset) use ($localPath) { if (substr($asset, 0, 1) === '@') return $asset; return $localPath.$asset; }, $assets); } list($assets, $extension) = $this->prepareAssets($assets); $rewritePath = File::localToPublic(dirname($destination)); $combiner = $this->prepareCombiner($assets, $rewritePath); $contents = $combiner->dump(); File::put($destination, $contents); }
php
public function combineToFile($assets = [], $destination, $localPath = null) { // Disable cache always $this->storagePath = null; // Prefix all assets if ($localPath) { if (substr($localPath, -1) !== '/') { $localPath = $localPath.'/'; } $assets = array_map(function($asset) use ($localPath) { if (substr($asset, 0, 1) === '@') return $asset; return $localPath.$asset; }, $assets); } list($assets, $extension) = $this->prepareAssets($assets); $rewritePath = File::localToPublic(dirname($destination)); $combiner = $this->prepareCombiner($assets, $rewritePath); $contents = $combiner->dump(); File::put($destination, $contents); }
[ "public", "function", "combineToFile", "(", "$", "assets", "=", "[", "]", ",", "$", "destination", ",", "$", "localPath", "=", "null", ")", "{", "// Disable cache always", "$", "this", "->", "storagePath", "=", "null", ";", "// Prefix all assets", "if", "(",...
Combines a collection of assets files to a destination file $assets = [ 'assets/less/header.less', 'assets/less/footer.less', ]; CombineAssets::combineToFile( $assets, base_path('themes/website/assets/theme.less'), base_path('themes/website') ); @param array $assets Collection of assets @param string $destination Write the combined file to this location @param string $localPath Prefix all assets with this path (optional) @return void
[ "Combines", "a", "collection", "of", "assets", "files", "to", "a", "destination", "file" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/CombineAssets.php#L205-L228
train
Combine assets to a file
[ 30522, 2270, 3853, 11506, 3406, 8873, 2571, 1006, 1002, 7045, 1027, 1031, 1033, 1010, 1002, 7688, 1010, 1002, 2334, 15069, 1027, 19701, 1007, 1063, 1013, 1013, 4487, 19150, 17053, 2467, 1002, 2023, 1011, 1028, 5527, 15069, 1027, 19701, 3052...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Cellmap.php
Cellmap.remove_row
public function remove_row(Frame $row) { $key = $row->get_id(); if (!isset($this->_frames[$key])) { return; // Presumably this row has alredy been removed } $this->__row = $this->_num_rows--; $rows = $this->_frames[$key]["rows"]; $columns = $this->_frames[$key]["columns"]; // Remove all frames from this row foreach ($rows as $r) { foreach ($columns as $c) { if (isset($this->_cells[$r][$c])) { $id = $this->_cells[$r][$c]->get_id(); $this->_cells[$r][$c] = null; unset($this->_cells[$r][$c]); // has multiple rows? if (isset($this->_frames[$id]) && count($this->_frames[$id]["rows"]) > 1) { // remove just the desired row, but leave the frame if (($row_key = array_search($r, $this->_frames[$id]["rows"])) !== false) { unset($this->_frames[$id]["rows"][$row_key]); } continue; } $this->_frames[$id] = null; unset($this->_frames[$id]); } } $this->_rows[$r] = null; unset($this->_rows[$r]); } $this->_frames[$key] = null; unset($this->_frames[$key]); }
php
public function remove_row(Frame $row) { $key = $row->get_id(); if (!isset($this->_frames[$key])) { return; // Presumably this row has alredy been removed } $this->__row = $this->_num_rows--; $rows = $this->_frames[$key]["rows"]; $columns = $this->_frames[$key]["columns"]; // Remove all frames from this row foreach ($rows as $r) { foreach ($columns as $c) { if (isset($this->_cells[$r][$c])) { $id = $this->_cells[$r][$c]->get_id(); $this->_cells[$r][$c] = null; unset($this->_cells[$r][$c]); // has multiple rows? if (isset($this->_frames[$id]) && count($this->_frames[$id]["rows"]) > 1) { // remove just the desired row, but leave the frame if (($row_key = array_search($r, $this->_frames[$id]["rows"])) !== false) { unset($this->_frames[$id]["rows"][$row_key]); } continue; } $this->_frames[$id] = null; unset($this->_frames[$id]); } } $this->_rows[$r] = null; unset($this->_rows[$r]); } $this->_frames[$key] = null; unset($this->_frames[$key]); }
[ "public", "function", "remove_row", "(", "Frame", "$", "row", ")", "{", "$", "key", "=", "$", "row", "->", "get_id", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "_frames", "[", "$", "key", "]", ")", ")", "{", "return", ";", ...
Remove a row from the cellmap. @param Frame
[ "Remove", "a", "row", "from", "the", "cellmap", "." ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Cellmap.php#L726-L767
train
Remove a row from the table
[ 30522, 2270, 3853, 6366, 1035, 5216, 1006, 4853, 1002, 5216, 1007, 1063, 1002, 3145, 1027, 1002, 5216, 1011, 1028, 2131, 1035, 30524, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 1035, 11048, 1031, 1002, 3145, 1033, 1007, 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
plugins/Referrers/Columns/Base.php
Base.detectReferrerDirectEntry
protected function detectReferrerDirectEntry() { if (empty($this->referrerHost)) { return false; } $urlsByHost = $this->getCachedUrlsByHostAndIdSite(); $directEntry = new SiteUrls(); $matchingSites = $directEntry->getIdSitesMatchingUrl($this->referrerUrlParse, $urlsByHost); if (isset($matchingSites) && is_array($matchingSites) && in_array($this->idsite, $matchingSites)) { $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; return true; } elseif (isset($matchingSites)) { return false; } $site = Cache::getCacheWebsiteAttributes($this->idsite); $excludeUnknowns = $site['exclude_unknown_urls']; // fallback logic if the referrer domain is not known to any site to not break BC if (!$excludeUnknowns && isset($this->currentUrlParse['host'])) { // this might be actually buggy if first thing tracked is eg an outlink and referrer is from that site $currentHost = Common::mb_strtolower($this->currentUrlParse['host']); if ($currentHost == Common::mb_strtolower($this->referrerHost)) { $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; return true; } } return false; }
php
protected function detectReferrerDirectEntry() { if (empty($this->referrerHost)) { return false; } $urlsByHost = $this->getCachedUrlsByHostAndIdSite(); $directEntry = new SiteUrls(); $matchingSites = $directEntry->getIdSitesMatchingUrl($this->referrerUrlParse, $urlsByHost); if (isset($matchingSites) && is_array($matchingSites) && in_array($this->idsite, $matchingSites)) { $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; return true; } elseif (isset($matchingSites)) { return false; } $site = Cache::getCacheWebsiteAttributes($this->idsite); $excludeUnknowns = $site['exclude_unknown_urls']; // fallback logic if the referrer domain is not known to any site to not break BC if (!$excludeUnknowns && isset($this->currentUrlParse['host'])) { // this might be actually buggy if first thing tracked is eg an outlink and referrer is from that site $currentHost = Common::mb_strtolower($this->currentUrlParse['host']); if ($currentHost == Common::mb_strtolower($this->referrerHost)) { $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; return true; } } return false; }
[ "protected", "function", "detectReferrerDirectEntry", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "referrerHost", ")", ")", "{", "return", "false", ";", "}", "$", "urlsByHost", "=", "$", "this", "->", "getCachedUrlsByHostAndIdSite", "(", ")", ...
We have previously tried to detect the campaign variables in the URL so at this stage, if the referrer host is the current host, or if the referrer host is any of the registered URL for this website, it is considered a direct entry @return bool
[ "We", "have", "previously", "tried", "to", "detect", "the", "campaign", "variables", "in", "the", "URL", "so", "at", "this", "stage", "if", "the", "referrer", "host", "is", "the", "current", "host", "or", "if", "the", "referrer", "host", "is", "any", "of...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Columns/Base.php#L340-L372
train
Detects whether the referrer domain is from any of the site s IDs
[ 30522, 5123, 3853, 11487, 2890, 7512, 14544, 4305, 2890, 6593, 4765, 2854, 1006, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 2023, 1011, 1028, 6523, 14544, 15006, 2102, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 1002, 24471, 4877, 3762, 15006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/HttpFoundation/Session/Storage/NativeSessionStorage.php
NativeSessionStorage.setSaveHandler
public function setSaveHandler($saveHandler = null) { if (!$saveHandler instanceof AbstractProxy && !$saveHandler instanceof \SessionHandlerInterface && null !== $saveHandler) { throw new \InvalidArgumentException('Must be instance of AbstractProxy; implement \SessionHandlerInterface; or be null.'); } // Wrap $saveHandler in proxy and prevent double wrapping of proxy if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) { $saveHandler = new SessionHandlerProxy($saveHandler); } elseif (!$saveHandler instanceof AbstractProxy) { $saveHandler = new SessionHandlerProxy(new StrictSessionHandler(new \SessionHandler())); } $this->saveHandler = $saveHandler; if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) { return; } if ($this->saveHandler instanceof SessionHandlerProxy) { session_set_save_handler($this->saveHandler, false); } }
php
public function setSaveHandler($saveHandler = null) { if (!$saveHandler instanceof AbstractProxy && !$saveHandler instanceof \SessionHandlerInterface && null !== $saveHandler) { throw new \InvalidArgumentException('Must be instance of AbstractProxy; implement \SessionHandlerInterface; or be null.'); } // Wrap $saveHandler in proxy and prevent double wrapping of proxy if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) { $saveHandler = new SessionHandlerProxy($saveHandler); } elseif (!$saveHandler instanceof AbstractProxy) { $saveHandler = new SessionHandlerProxy(new StrictSessionHandler(new \SessionHandler())); } $this->saveHandler = $saveHandler; if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) { return; } if ($this->saveHandler instanceof SessionHandlerProxy) { session_set_save_handler($this->saveHandler, false); } }
[ "public", "function", "setSaveHandler", "(", "$", "saveHandler", "=", "null", ")", "{", "if", "(", "!", "$", "saveHandler", "instanceof", "AbstractProxy", "&&", "!", "$", "saveHandler", "instanceof", "\\", "SessionHandlerInterface", "&&", "null", "!==", "$", "...
Registers session save handler as a PHP session handler. To use internal PHP session save handlers, override this method using ini_set with session.save_handler and session.save_path e.g. ini_set('session.save_handler', 'files'); ini_set('session.save_path', '/tmp'); or pass in a \SessionHandler instance which configures session.save_handler in the constructor, for a template see NativeFileSessionHandler or use handlers in composer package drak/native-session @see http://php.net/session-set-save-handler @see http://php.net/sessionhandlerinterface @see http://php.net/sessionhandler @see http://github.com/drak/NativeSession @param \SessionHandlerInterface|null $saveHandler @throws \InvalidArgumentException
[ "Registers", "session", "save", "handler", "as", "a", "PHP", "session", "handler", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L409-L432
train
Set save handler
[ 30522, 2270, 3853, 4520, 10696, 11774, 3917, 1006, 1002, 3828, 11774, 3917, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 3828, 11774, 3917, 6013, 11253, 10061, 21572, 18037, 1004, 1004, 999, 1002, 3828, 11774, 3917, 6013, 11253, 1032, 52...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Http.php
Http.tryGcSessions
public static function tryGcSessions() { if (HttpCache::$sessionGcProbability <= 0 || HttpCache::$sessionGcDivisor <= 0 || rand(1, HttpCache::$sessionGcDivisor) > HttpCache::$sessionGcProbability) { return; } $time_now = time(); foreach(glob(HttpCache::$sessionPath.'/ses*') as $file) { if(is_file($file) && $time_now - filemtime($file) > HttpCache::$sessionGcMaxLifeTime) { unlink($file); } } }
php
public static function tryGcSessions() { if (HttpCache::$sessionGcProbability <= 0 || HttpCache::$sessionGcDivisor <= 0 || rand(1, HttpCache::$sessionGcDivisor) > HttpCache::$sessionGcProbability) { return; } $time_now = time(); foreach(glob(HttpCache::$sessionPath.'/ses*') as $file) { if(is_file($file) && $time_now - filemtime($file) > HttpCache::$sessionGcMaxLifeTime) { unlink($file); } } }
[ "public", "static", "function", "tryGcSessions", "(", ")", "{", "if", "(", "HttpCache", "::", "$", "sessionGcProbability", "<=", "0", "||", "HttpCache", "::", "$", "sessionGcDivisor", "<=", "0", "||", "rand", "(", "1", ",", "HttpCache", "::", "$", "session...
Try GC sessions. @return void
[ "Try", "GC", "sessions", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Protocols/Http.php#L591-L605
train
Try Gc sessions
[ 30522, 2270, 10763, 3853, 3046, 18195, 8583, 27466, 1006, 1007, 1063, 2065, 1006, 8299, 3540, 5403, 1024, 1024, 1002, 5219, 18195, 21572, 3676, 8553, 1026, 1027, 1014, 1064, 1064, 8299, 3540, 5403, 1024, 1024, 1002, 5219, 18195, 4305, 11365...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ArrayNode.php
ArrayNode.normalizeValue
protected function normalizeValue($value) { if (false === $value) { return $value; } $value = $this->remapXml($value); $normalized = []; foreach ($value as $name => $val) { if (isset($this->children[$name])) { try { $normalized[$name] = $this->children[$name]->normalize($val); } catch (UnsetKeyException $e) { } unset($value[$name]); } elseif (!$this->removeExtraKeys) { $normalized[$name] = $val; } } // if extra fields are present, throw exception if (\count($value) && !$this->ignoreExtraKeys) { $proposals = array_keys($this->children); sort($proposals); $guesses = []; foreach (array_keys($value) as $subject) { $minScore = INF; foreach ($proposals as $proposal) { $distance = levenshtein($subject, $proposal); if ($distance <= $minScore && $distance < 3) { $guesses[$proposal] = $distance; $minScore = $distance; } } } $msg = sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath()); if (\count($guesses)) { asort($guesses); $msg .= sprintf('. Did you mean "%s"?', implode('", "', array_keys($guesses))); } else { $msg .= sprintf('. Available option%s %s "%s".', 1 === \count($proposals) ? '' : 's', 1 === \count($proposals) ? 'is' : 'are', implode('", "', $proposals)); } $ex = new InvalidConfigurationException($msg); $ex->setPath($this->getPath()); throw $ex; } return $normalized; }
php
protected function normalizeValue($value) { if (false === $value) { return $value; } $value = $this->remapXml($value); $normalized = []; foreach ($value as $name => $val) { if (isset($this->children[$name])) { try { $normalized[$name] = $this->children[$name]->normalize($val); } catch (UnsetKeyException $e) { } unset($value[$name]); } elseif (!$this->removeExtraKeys) { $normalized[$name] = $val; } } // if extra fields are present, throw exception if (\count($value) && !$this->ignoreExtraKeys) { $proposals = array_keys($this->children); sort($proposals); $guesses = []; foreach (array_keys($value) as $subject) { $minScore = INF; foreach ($proposals as $proposal) { $distance = levenshtein($subject, $proposal); if ($distance <= $minScore && $distance < 3) { $guesses[$proposal] = $distance; $minScore = $distance; } } } $msg = sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath()); if (\count($guesses)) { asort($guesses); $msg .= sprintf('. Did you mean "%s"?', implode('", "', array_keys($guesses))); } else { $msg .= sprintf('. Available option%s %s "%s".', 1 === \count($proposals) ? '' : 's', 1 === \count($proposals) ? 'is' : 'are', implode('", "', $proposals)); } $ex = new InvalidConfigurationException($msg); $ex->setPath($this->getPath()); throw $ex; } return $normalized; }
[ "protected", "function", "normalizeValue", "(", "$", "value", ")", "{", "if", "(", "false", "===", "$", "value", ")", "{", "return", "$", "value", ";", "}", "$", "value", "=", "$", "this", "->", "remapXml", "(", "$", "value", ")", ";", "$", "normal...
Normalizes the value. @param mixed $value The value to normalize @return mixed The normalized value @throws InvalidConfigurationException
[ "Normalizes", "the", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/ArrayNode.php#L284-L338
train
Normalize the value of the option
[ 30522, 5123, 3853, 3671, 4697, 10175, 5657, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 6270, 1027, 1027, 1027, 1002, 3643, 1007, 1063, 2709, 1002, 3643, 1025, 1065, 1002, 3643, 1027, 1002, 2023, 1011, 1028, 2128, 2863, 2361, 2595, 19968, 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/helpers/Backend.php
Backend.baseUrl
public function baseUrl($path = null) { $backendUri = $this->uri(); $baseUrl = Request::getBaseUrl(); if ($path === null) { return $baseUrl . '/' . $backendUri; } $path = RouterHelper::normalizeUrl($path); return $baseUrl . '/' . $backendUri . $path; }
php
public function baseUrl($path = null) { $backendUri = $this->uri(); $baseUrl = Request::getBaseUrl(); if ($path === null) { return $baseUrl . '/' . $backendUri; } $path = RouterHelper::normalizeUrl($path); return $baseUrl . '/' . $backendUri . $path; }
[ "public", "function", "baseUrl", "(", "$", "path", "=", "null", ")", "{", "$", "backendUri", "=", "$", "this", "->", "uri", "(", ")", ";", "$", "baseUrl", "=", "Request", "::", "getBaseUrl", "(", ")", ";", "if", "(", "$", "path", "===", "null", "...
Returns the base backend URL
[ "Returns", "the", "base", "backend", "URL" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/helpers/Backend.php#L40-L51
train
Get Base Url
[ 30522, 2270, 3853, 2918, 3126, 2140, 1006, 1002, 4130, 1027, 19701, 1007, 1063, 1002, 2067, 10497, 9496, 1027, 1002, 2023, 1011, 1028, 24471, 2072, 1006, 1007, 1025, 1002, 2918, 3126, 2140, 1027, 5227, 1024, 1024, 2131, 15058, 3126, 2140, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ExprBuilder.php
ExprBuilder.ifTrue
public function ifTrue(\Closure $closure = null) { if (null === $closure) { $closure = function ($v) { return true === $v; }; } $this->ifPart = $closure; return $this; }
php
public function ifTrue(\Closure $closure = null) { if (null === $closure) { $closure = function ($v) { return true === $v; }; } $this->ifPart = $closure; return $this; }
[ "public", "function", "ifTrue", "(", "\\", "Closure", "$", "closure", "=", "null", ")", "{", "if", "(", "null", "===", "$", "closure", ")", "{", "$", "closure", "=", "function", "(", "$", "v", ")", "{", "return", "true", "===", "$", "v", ";", "}"...
Sets a closure to use as tests. The default one tests if the value is true. @return $this
[ "Sets", "a", "closure", "to", "use", "as", "tests", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php#L56-L65
train
if true - > true
[ 30522, 2270, 3853, 2065, 16344, 5657, 1006, 1032, 8503, 1002, 8503, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 8503, 1007, 1063, 1002, 8503, 1027, 3853, 1006, 1002, 1058, 1007, 1063, 2709, 2995, 1027, 1027, 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/Connection.php
Connection.getReadPdo
public function getReadPdo() { if ($this->transactions > 0) { return $this->getPdo(); } if ($this->recordsModified && $this->getConfig('sticky')) { return $this->getPdo(); } if ($this->readPdo instanceof Closure) { return $this->readPdo = call_user_func($this->readPdo); } return $this->readPdo ?: $this->getPdo(); }
php
public function getReadPdo() { if ($this->transactions > 0) { return $this->getPdo(); } if ($this->recordsModified && $this->getConfig('sticky')) { return $this->getPdo(); } if ($this->readPdo instanceof Closure) { return $this->readPdo = call_user_func($this->readPdo); } return $this->readPdo ?: $this->getPdo(); }
[ "public", "function", "getReadPdo", "(", ")", "{", "if", "(", "$", "this", "->", "transactions", ">", "0", ")", "{", "return", "$", "this", "->", "getPdo", "(", ")", ";", "}", "if", "(", "$", "this", "->", "recordsModified", "&&", "$", "this", "->"...
Get the current PDO connection used for reading. @return \PDO
[ "Get", "the", "current", "PDO", "connection", "used", "for", "reading", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connection.php#L929-L944
train
Get the read pdo
[ 30522, 2270, 3853, 2131, 16416, 18927, 3527, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 11817, 1028, 1014, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2131, 17299, 2080, 1006, 1007, 1025, 1065, 2065, 1006, 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...
matomo-org/matomo
libs/Zend/Db/Adapter/Oracle.php
Zend_Db_Adapter_Oracle.limit
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception("LIMIT argument offset=$offset is not valid"); } /** * Oracle does not implement the LIMIT clause as some RDBMS do. * We have to simulate it with subqueries and ROWNUM. * Unfortunately because we use the column wildcard "*", * this puts an extra column into the query result set. */ $limit_sql = "SELECT z2.* FROM ( SELECT z1.*, ROWNUM AS \"zend_db_rownum\" FROM ( " . $sql . " ) z1 ) z2 WHERE z2.\"zend_db_rownum\" BETWEEN " . ($offset+1) . " AND " . ($offset+$count); return $limit_sql; }
php
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception("LIMIT argument offset=$offset is not valid"); } /** * Oracle does not implement the LIMIT clause as some RDBMS do. * We have to simulate it with subqueries and ROWNUM. * Unfortunately because we use the column wildcard "*", * this puts an extra column into the query result set. */ $limit_sql = "SELECT z2.* FROM ( SELECT z1.*, ROWNUM AS \"zend_db_rownum\" FROM ( " . $sql . " ) z1 ) z2 WHERE z2.\"zend_db_rownum\" BETWEEN " . ($offset+1) . " AND " . ($offset+$count); return $limit_sql; }
[ "public", "function", "limit", "(", "$", "sql", ",", "$", "count", ",", "$", "offset", "=", "0", ")", "{", "$", "count", "=", "intval", "(", "$", "count", ")", ";", "if", "(", "$", "count", "<=", "0", ")", "{", "/**\n * @see Zend_Db_Adapt...
Adds an adapter-specific LIMIT clause to the SELECT statement. @param string $sql @param integer $count @param integer $offset OPTIONAL @return string @throws Zend_Db_Adapter_Oracle_Exception
[ "Adds", "an", "adapter", "-", "specific", "LIMIT", "clause", "to", "the", "SELECT", "statement", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Oracle.php#L539-L574
train
Return the limit statement
[ 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, 1027, 1014, 1007, 1063, 1013, 1008, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Message.php
Message.cc
public function cc($address, $name = null, $override = false) { if ($override) { $this->swift->setCc($address, $name); return $this; } return $this->addAddresses($address, $name, 'Cc'); }
php
public function cc($address, $name = null, $override = false) { if ($override) { $this->swift->setCc($address, $name); return $this; } return $this->addAddresses($address, $name, 'Cc'); }
[ "public", "function", "cc", "(", "$", "address", ",", "$", "name", "=", "null", ",", "$", "override", "=", "false", ")", "{", "if", "(", "$", "override", ")", "{", "$", "this", "->", "swift", "->", "setCc", "(", "$", "address", ",", "$", "name", ...
Add a carbon copy to the message. @param string|array $address @param string|null $name @param bool $override @return $this
[ "Add", "a", "carbon", "copy", "to", "the", "message", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Message.php#L109-L118
train
Add a cc address to the message
[ 30522, 2270, 3853, 10507, 1006, 1002, 4769, 1010, 1002, 2171, 1027, 19701, 1010, 1002, 2058, 15637, 1027, 6270, 1007, 1063, 2065, 1006, 1002, 2058, 15637, 1007, 1063, 1002, 2023, 1011, 1028, 9170, 1011, 30524, 4769, 1010, 1002, 2171, 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...
symfony/symfony
src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php
SessionTokenStorage.hasToken
public function hasToken($tokenId) { if (!$this->session->isStarted()) { $this->session->start(); } return $this->session->has($this->namespace.'/'.$tokenId); }
php
public function hasToken($tokenId) { if (!$this->session->isStarted()) { $this->session->start(); } return $this->session->has($this->namespace.'/'.$tokenId); }
[ "public", "function", "hasToken", "(", "$", "tokenId", ")", "{", "if", "(", "!", "$", "this", "->", "session", "->", "isStarted", "(", ")", ")", "{", "$", "this", "->", "session", "->", "start", "(", ")", ";", "}", "return", "$", "this", "->", "s...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php#L75-L82
train
Has Token?
[ 30522, 2270, 3853, 2038, 18715, 2368, 1006, 1002, 19204, 3593, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 5219, 1011, 1028, 26354, 7559, 3064, 1006, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 5219, 1011, 1028, 2707, 1006, 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
plugins/CoreVisualizations/Visualizations/Sparklines/Config.php
Config.getUrlSparkline
private function getUrlSparkline($customParameters = array()) { $customParameters['viewDataTable'] = 'sparkline'; $params = $this->getGraphParamsModified($customParameters); // convert array values to comma separated foreach ($params as &$value) { if (is_array($value)) { $value = rawurlencode(implode(',', $value)); } } $url = Url::getCurrentQueryStringWithParametersModified($params); return $url; }
php
private function getUrlSparkline($customParameters = array()) { $customParameters['viewDataTable'] = 'sparkline'; $params = $this->getGraphParamsModified($customParameters); // convert array values to comma separated foreach ($params as &$value) { if (is_array($value)) { $value = rawurlencode(implode(',', $value)); } } $url = Url::getCurrentQueryStringWithParametersModified($params); return $url; }
[ "private", "function", "getUrlSparkline", "(", "$", "customParameters", "=", "array", "(", ")", ")", "{", "$", "customParameters", "[", "'viewDataTable'", "]", "=", "'sparkline'", ";", "$", "params", "=", "$", "this", "->", "getGraphParamsModified", "(", "$", ...
Returns a URL to a sparkline image for a report served by the current plugin. The result of this URL should be used with the [sparkline()](/api-reference/Piwik/View#twig) twig function. The current site ID and period will be used. @param array $customParameters The array of query parameter name/value pairs that should be set in result URL. @return string The generated URL.
[ "Returns", "a", "URL", "to", "a", "sparkline", "image", "for", "a", "report", "served", "by", "the", "current", "plugin", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreVisualizations/Visualizations/Sparklines/Config.php#L327-L341
train
Returns the url to the sparkline view
[ 30522, 2797, 3853, 2131, 3126, 4877, 14432, 4179, 1006, 1002, 7661, 28689, 22828, 2015, 1027, 9140, 1006, 1007, 1007, 1063, 1002, 7661, 28689, 22828, 2015, 1031, 1005, 3193, 2850, 29336, 3085, 1005, 1033, 1027, 1005, 12125, 4179, 1005, 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...
overtrue/wechat
src/OfficialAccount/TemplateMessage/Client.php
Client.formatData
protected function formatData(array $data) { $formatted = []; foreach ($data as $key => $value) { if (is_array($value)) { if (isset($value['value'])) { $formatted[$key] = $value; continue; } if (count($value) >= 2) { $value = [ 'value' => $value[0], 'color' => $value[1], ]; } } else { $value = [ 'value' => strval($value), ]; } $formatted[$key] = $value; } return $formatted; }
php
protected function formatData(array $data) { $formatted = []; foreach ($data as $key => $value) { if (is_array($value)) { if (isset($value['value'])) { $formatted[$key] = $value; continue; } if (count($value) >= 2) { $value = [ 'value' => $value[0], 'color' => $value[1], ]; } } else { $value = [ 'value' => strval($value), ]; } $formatted[$key] = $value; } return $formatted; }
[ "protected", "function", "formatData", "(", "array", "$", "data", ")", "{", "$", "formatted", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{"...
@param array $data @return array
[ "@param", "array", "$data" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/TemplateMessage/Client.php#L178-L206
train
Formats the data into a formatable array
[ 30522, 5123, 3853, 4289, 30524, 3145, 1027, 1028, 1002, 3643, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 3643, 1007, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 3643, 1031, 1005, 3643, 1005, 1033, 1007, 1007, 1063, 1002, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/HttpClient/Chunk/ErrorChunk.php
ErrorChunk.isTimeout
public function isTimeout(): bool { $this->didThrow = true; if (null !== $this->error) { throw new TransportException($this->errorMessage, 0, $this->error); } return true; }
php
public function isTimeout(): bool { $this->didThrow = true; if (null !== $this->error) { throw new TransportException($this->errorMessage, 0, $this->error); } return true; }
[ "public", "function", "isTimeout", "(", ")", ":", "bool", "{", "$", "this", "->", "didThrow", "=", "true", ";", "if", "(", "null", "!==", "$", "this", "->", "error", ")", "{", "throw", "new", "TransportException", "(", "$", "this", "->", "errorMessage"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/Chunk/ErrorChunk.php#L39-L48
train
Is this the timeout?
[ 30522, 2270, 3853, 21541, 14428, 5833, 1006, 1007, 1024, 22017, 2140, 1063, 1002, 2023, 1011, 1028, 2106, 2705, 10524, 1027, 2995, 1025, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 7561, 1007, 1063, 5466, 2047, 3665, 10288, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Console/Kernel.php
Kernel.bootstrap
public function bootstrap() { if (! $this->app->hasBeenBootstrapped()) { $this->app->bootstrapWith($this->bootstrappers()); } $this->app->loadDeferredProviders(); if (! $this->commandsLoaded) { $this->commands(); $this->commandsLoaded = true; } }
php
public function bootstrap() { if (! $this->app->hasBeenBootstrapped()) { $this->app->bootstrapWith($this->bootstrappers()); } $this->app->loadDeferredProviders(); if (! $this->commandsLoaded) { $this->commands(); $this->commandsLoaded = true; } }
[ "public", "function", "bootstrap", "(", ")", "{", "if", "(", "!", "$", "this", "->", "app", "->", "hasBeenBootstrapped", "(", ")", ")", "{", "$", "this", "->", "app", "->", "bootstrapWith", "(", "$", "this", "->", "bootstrappers", "(", ")", ")", ";",...
Bootstrap the application for artisan commands. @return void
[ "Bootstrap", "the", "application", "for", "artisan", "commands", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/Kernel.php#L308-L321
train
Bootstraps the application and loads the deferred providers.
[ 30522, 2270, 3853, 6879, 6494, 2361, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 10439, 1011, 1028, 2038, 11306, 27698, 17206, 20528, 11469, 1006, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 10439, 1011, 1028, 6879, 6494, 28400...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ParameterBag/ParameterBag.php
ParameterBag.resolve
public function resolve() { if ($this->resolved) { return; } $parameters = []; foreach ($this->parameters as $key => $value) { try { $value = $this->resolveValue($value); $parameters[$key] = $this->unescapeValue($value); } catch (ParameterNotFoundException $e) { $e->setSourceKey($key); throw $e; } } $this->parameters = $parameters; $this->resolved = true; }
php
public function resolve() { if ($this->resolved) { return; } $parameters = []; foreach ($this->parameters as $key => $value) { try { $value = $this->resolveValue($value); $parameters[$key] = $this->unescapeValue($value); } catch (ParameterNotFoundException $e) { $e->setSourceKey($key); throw $e; } } $this->parameters = $parameters; $this->resolved = true; }
[ "public", "function", "resolve", "(", ")", "{", "if", "(", "$", "this", "->", "resolved", ")", "{", "return", ";", "}", "$", "parameters", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "parameters", "as", "$", "key", "=>", "$", "value", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php#L138-L158
train
Resolves parameters and returns the result.
[ 30522, 2270, 3853, 10663, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 10395, 1007, 1063, 2709, 1025, 1065, 1002, 11709, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 11709, 2004, 1002, 3145, 1027, 1028, 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/Cache/FileStore.php
FileStore.flush
public function flush() { if (! $this->files->isDirectory($this->directory)) { return false; } foreach ($this->files->directories($this->directory) as $directory) { if (! $this->files->deleteDirectory($directory)) { return false; } } return true; }
php
public function flush() { if (! $this->files->isDirectory($this->directory)) { return false; } foreach ($this->files->directories($this->directory) as $directory) { if (! $this->files->deleteDirectory($directory)) { return false; } } return true; }
[ "public", "function", "flush", "(", ")", "{", "if", "(", "!", "$", "this", "->", "files", "->", "isDirectory", "(", "$", "this", "->", "directory", ")", ")", "{", "return", "false", ";", "}", "foreach", "(", "$", "this", "->", "files", "->", "direc...
Remove all items from the cache. @return bool
[ "Remove", "all", "items", "from", "the", "cache", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/FileStore.php#L144-L157
train
Flushes the cache
[ 30522, 2270, 3853, 13862, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6764, 1011, 1028, 2003, 4305, 2890, 16761, 2100, 1006, 1002, 2023, 1011, 1028, 14176, 1007, 1007, 1063, 2709, 6270, 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...
octobercms/october
modules/cms/classes/CmsObjectCollection.php
CmsObjectCollection.whereComponent
public function whereComponent($components, $property, $value, $strict = false) { return $this->filter(function ($object) use ($components, $property, $value, $strict) { $hasComponent = false; foreach ((array) $components as $componentName) { if (!$componentAlias = $object->hasComponent($componentName)) { continue; } $componentSettings = array_get($object->settings, 'components', []); if (!array_key_exists($componentAlias, $componentSettings)) { continue; } $settings = $componentSettings[$componentAlias]; if (!array_key_exists($property, $settings)) { continue; } if ( ($strict && $settings[$property] === $value) || (!$strict && $settings[$property] == $value) ) { $hasComponent = true; } } return $hasComponent; }); }
php
public function whereComponent($components, $property, $value, $strict = false) { return $this->filter(function ($object) use ($components, $property, $value, $strict) { $hasComponent = false; foreach ((array) $components as $componentName) { if (!$componentAlias = $object->hasComponent($componentName)) { continue; } $componentSettings = array_get($object->settings, 'components', []); if (!array_key_exists($componentAlias, $componentSettings)) { continue; } $settings = $componentSettings[$componentAlias]; if (!array_key_exists($property, $settings)) { continue; } if ( ($strict && $settings[$property] === $value) || (!$strict && $settings[$property] == $value) ) { $hasComponent = true; } } return $hasComponent; }); }
[ "public", "function", "whereComponent", "(", "$", "components", ",", "$", "property", ",", "$", "value", ",", "$", "strict", "=", "false", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "object", ")", "use", "(", "$", "co...
Returns objects whose component properties match the supplied value. @param mixed $components @param string $property @param string $value @param bool $strict @return static
[ "Returns", "objects", "whose", "component", "properties", "match", "the", "supplied", "value", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsObjectCollection.php#L69-L103
train
Filter the result by a component property
[ 30522, 2270, 3853, 2073, 9006, 29513, 3372, 1006, 1002, 6177, 1010, 1002, 3200, 1010, 1002, 3643, 1010, 1002, 9384, 1027, 6270, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 11307, 1006, 3853, 1006, 1002, 4874, 1007, 2224, 1006, 1002, 6177, 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/Config/Definition/Builder/VariableNodeDefinition.php
VariableNodeDefinition.createNode
protected function createNode() { $node = $this->instantiateNode(); if (null !== $this->normalization) { $node->setNormalizationClosures($this->normalization->before); } if (null !== $this->merge) { $node->setAllowOverwrite($this->merge->allowOverwrite); } if (true === $this->default) { $node->setDefaultValue($this->defaultValue); } $node->setAllowEmptyValue($this->allowEmptyValue); $node->addEquivalentValue(null, $this->nullEquivalent); $node->addEquivalentValue(true, $this->trueEquivalent); $node->addEquivalentValue(false, $this->falseEquivalent); $node->setRequired($this->required); $node->setDeprecated($this->deprecationMessage); if (null !== $this->validation) { $node->setFinalValidationClosures($this->validation->rules); } return $node; }
php
protected function createNode() { $node = $this->instantiateNode(); if (null !== $this->normalization) { $node->setNormalizationClosures($this->normalization->before); } if (null !== $this->merge) { $node->setAllowOverwrite($this->merge->allowOverwrite); } if (true === $this->default) { $node->setDefaultValue($this->defaultValue); } $node->setAllowEmptyValue($this->allowEmptyValue); $node->addEquivalentValue(null, $this->nullEquivalent); $node->addEquivalentValue(true, $this->trueEquivalent); $node->addEquivalentValue(false, $this->falseEquivalent); $node->setRequired($this->required); $node->setDeprecated($this->deprecationMessage); if (null !== $this->validation) { $node->setFinalValidationClosures($this->validation->rules); } return $node; }
[ "protected", "function", "createNode", "(", ")", "{", "$", "node", "=", "$", "this", "->", "instantiateNode", "(", ")", ";", "if", "(", "null", "!==", "$", "this", "->", "normalization", ")", "{", "$", "node", "->", "setNormalizationClosures", "(", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php#L36-L64
train
Creates a new node and sets all the necessary information
[ 30522, 5123, 3853, 3443, 3630, 3207, 1006, 1007, 1063, 1002, 13045, 1027, 1002, 2023, 1011, 1028, 7107, 13143, 3630, 3207, 1006, 1007, 1025, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 3671, 3989, 1007, 1063, 1002, 13045, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/classes/BackendController.php
BackendController.run
public function run($url = null) { $params = RouterHelper::segmentizeUrl($url); /* * Database check */ if (!App::hasDatabase()) { return Config::get('app.debug', false) ? Response::make(View::make('backend::no_database'), 200) : $this->passToCmsController($url); } /* * Look for a Module controller */ $module = $params[0] ?? 'backend'; $controller = $params[1] ?? 'index'; self::$action = $action = isset($params[2]) ? $this->parseAction($params[2]) : 'index'; self::$params = $controllerParams = array_slice($params, 3); $controllerClass = '\\'.$module.'\Controllers\\'.$controller; if ($controllerObj = $this->findController( $controllerClass, $action, base_path().'/modules' )) { return $controllerObj->run($action, $controllerParams); } /* * Look for a Plugin controller */ if (count($params) >= 2) { list($author, $plugin) = $params; $pluginCode = ucfirst($author) . '.' . ucfirst($plugin); if (PluginManager::instance()->isDisabled($pluginCode)) { return Response::make(View::make('backend::404'), 404); } $controller = $params[2] ?? 'index'; self::$action = $action = isset($params[3]) ? $this->parseAction($params[3]) : 'index'; self::$params = $controllerParams = array_slice($params, 4); $controllerClass = '\\'.$author.'\\'.$plugin.'\Controllers\\'.$controller; if ($controllerObj = $this->findController( $controllerClass, $action, plugins_path() )) { return $controllerObj->run($action, $controllerParams); } } /* * Fall back on Cms controller */ return $this->passToCmsController($url); }
php
public function run($url = null) { $params = RouterHelper::segmentizeUrl($url); /* * Database check */ if (!App::hasDatabase()) { return Config::get('app.debug', false) ? Response::make(View::make('backend::no_database'), 200) : $this->passToCmsController($url); } /* * Look for a Module controller */ $module = $params[0] ?? 'backend'; $controller = $params[1] ?? 'index'; self::$action = $action = isset($params[2]) ? $this->parseAction($params[2]) : 'index'; self::$params = $controllerParams = array_slice($params, 3); $controllerClass = '\\'.$module.'\Controllers\\'.$controller; if ($controllerObj = $this->findController( $controllerClass, $action, base_path().'/modules' )) { return $controllerObj->run($action, $controllerParams); } /* * Look for a Plugin controller */ if (count($params) >= 2) { list($author, $plugin) = $params; $pluginCode = ucfirst($author) . '.' . ucfirst($plugin); if (PluginManager::instance()->isDisabled($pluginCode)) { return Response::make(View::make('backend::404'), 404); } $controller = $params[2] ?? 'index'; self::$action = $action = isset($params[3]) ? $this->parseAction($params[3]) : 'index'; self::$params = $controllerParams = array_slice($params, 4); $controllerClass = '\\'.$author.'\\'.$plugin.'\Controllers\\'.$controller; if ($controllerObj = $this->findController( $controllerClass, $action, plugins_path() )) { return $controllerObj->run($action, $controllerParams); } } /* * Fall back on Cms controller */ return $this->passToCmsController($url); }
[ "public", "function", "run", "(", "$", "url", "=", "null", ")", "{", "$", "params", "=", "RouterHelper", "::", "segmentizeUrl", "(", "$", "url", ")", ";", "/*\n * Database check\n */", "if", "(", "!", "App", "::", "hasDatabase", "(", ")", "...
Finds and serves the requested backend controller. If the controller cannot be found, returns the Cms page with the URL /404. If the /404 page doesn't exist, returns the system 404 page. @param string $url Specifies the requested page URL. If the parameter is omitted, the current URL used. @return string Returns the processed page content.
[ "Finds", "and", "serves", "the", "requested", "backend", "controller", ".", "If", "the", "controller", "cannot", "be", "found", "returns", "the", "Cms", "page", "with", "the", "URL", "/", "404", ".", "If", "the", "/", "404", "page", "doesn", "t", "exist"...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/BackendController.php#L86-L143
train
Runs the action on the given URL
[ 30522, 2270, 3853, 2448, 1006, 1002, 24471, 2140, 1027, 19701, 1007, 1063, 1002, 11498, 5244, 1027, 2799, 25032, 2884, 4842, 1024, 1024, 6903, 4697, 3126, 2140, 1006, 1002, 24471, 2140, 1007, 1025, 1013, 1008, 1008, 7809, 4638, 1008, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/DatabaseStore.php
DatabaseStore.unserialize
protected function unserialize($value) { if ($this->connection instanceof PostgresConnection && ! Str::contains($value, [':', ';'])) { $value = base64_decode($value); } return unserialize($value); }
php
protected function unserialize($value) { if ($this->connection instanceof PostgresConnection && ! Str::contains($value, [':', ';'])) { $value = base64_decode($value); } return unserialize($value); }
[ "protected", "function", "unserialize", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "connection", "instanceof", "PostgresConnection", "&&", "!", "Str", "::", "contains", "(", "$", "value", ",", "[", "':'", ",", "';'", "]", ")", ")", "{",...
Unserialize the given value. @param string $value @return mixed
[ "Unserialize", "the", "given", "value", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/DatabaseStore.php#L286-L293
train
Unserialize the value
[ 30522, 5123, 3853, 4895, 8043, 4818, 4697, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 4434, 6013, 11253, 2695, 17603, 9363, 10087, 7542, 1004, 1004, 999, 2358, 2099, 1024, 1024, 3397, 1006, 1002, 3643, 1010, 1031, 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/Common/Utils.php
Utils.setDotNotation
public static function setDotNotation(&$array, $key, $value, $merge = false) { if (null === $key) { return $array = $value; } $keys = explode('.', $key); while (count($keys) > 1) { $key = array_shift($keys); if ( ! isset($array[$key]) || ! is_array($array[$key])) { $array[$key] = array(); } $array =& $array[$key]; } $key = array_shift($keys); if (!$merge || !isset($array[$key])) { $array[$key] = $value; } else { $array[$key] = array_merge($array[$key], $value); } return $array; }
php
public static function setDotNotation(&$array, $key, $value, $merge = false) { if (null === $key) { return $array = $value; } $keys = explode('.', $key); while (count($keys) > 1) { $key = array_shift($keys); if ( ! isset($array[$key]) || ! is_array($array[$key])) { $array[$key] = array(); } $array =& $array[$key]; } $key = array_shift($keys); if (!$merge || !isset($array[$key])) { $array[$key] = $value; } else { $array[$key] = array_merge($array[$key], $value); } return $array; }
[ "public", "static", "function", "setDotNotation", "(", "&", "$", "array", ",", "$", "key", ",", "$", "value", ",", "$", "merge", "=", "false", ")", "{", "if", "(", "null", "===", "$", "key", ")", "{", "return", "$", "array", "=", "$", "value", ";...
Set portion of array (passed by reference) for a dot-notation key and set the value @param array $array @param string|int $key @param mixed $value @param bool $merge @return mixed
[ "Set", "portion", "of", "array", "(", "passed", "by", "reference", ")", "for", "a", "dot", "-", "notation", "key", "and", "set", "the", "value" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1195-L1223
train
Set the value of a key using dot notation
[ 30522, 2270, 10763, 3853, 2275, 27364, 17048, 3370, 1006, 1004, 1002, 9140, 1010, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 13590, 1027, 6270, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 3145, 1007, 1063, 2709, 1002, 9140, 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...
getgrav/grav
system/src/Grav/Common/Data/Validation.php
Validation.typeNumber
public static function typeNumber($value, array $params, array $field) { if (!is_numeric($value)) { return false; } if (isset($params['min']) && $value < $params['min']) { return false; } if (isset($params['max']) && $value > $params['max']) { return false; } $min = $params['min'] ?? 0; return !(isset($params['step']) && fmod($value - $min, $params['step']) === 0); }
php
public static function typeNumber($value, array $params, array $field) { if (!is_numeric($value)) { return false; } if (isset($params['min']) && $value < $params['min']) { return false; } if (isset($params['max']) && $value > $params['max']) { return false; } $min = $params['min'] ?? 0; return !(isset($params['step']) && fmod($value - $min, $params['step']) === 0); }
[ "public", "static", "function", "typeNumber", "(", "$", "value", ",", "array", "$", "params", ",", "array", "$", "field", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "value", ")", ")", "{", "return", "false", ";", "}", "if", "(", "isset", "("...
HTML5 input: number @param mixed $value Value to be validated. @param array $params Validation parameters. @param array $field Blueprint for the field. @return bool True if validation succeeded.
[ "HTML5", "input", ":", "number" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L338-L355
train
Type number.
[ 30522, 2270, 10763, 3853, 2828, 19172, 5677, 1006, 1002, 3643, 1010, 9140, 1002, 11498, 5244, 1010, 9140, 1002, 2492, 1007, 1063, 2065, 1006, 999, 2003, 1035, 16371, 25531, 1006, 1002, 3643, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Console/Gpm/InstallCommand.php
InstallCommand.downloadPackage
private function downloadPackage($package, $license = null) { $tmp_dir = Grav::instance()['locator']->findResource('tmp://', true, true); $this->tmp = $tmp_dir . '/Grav-' . uniqid(); $filename = $package->slug . basename($package->zipball_url); $filename = preg_replace('/[\\\\\/:"*?&<>|]+/m', '-', $filename); $query = ''; if (!empty($package->premium)) { $query = \json_encode(array_merge( $package->premium, [ 'slug' => $package->slug, 'filename' => $package->premium['filename'], 'license_key' => $license ] )); $query = '?d=' . base64_encode($query); } try { $output = Response::get($package->zipball_url . $query, [], [$this, 'progress']); } catch (\Exception $e) { $error = str_replace("\n", "\n | '- ", $e->getMessage()); $this->output->write("\x0D"); // extra white spaces to clear out the buffer properly $this->output->writeln(' |- Downloading package... <red>error</red> '); $this->output->writeln(" | '- " . $error); return false; } Folder::create($this->tmp); $this->output->write("\x0D"); $this->output->write(' |- Downloading package... 100%'); $this->output->writeln(''); file_put_contents($this->tmp . DS . $filename, $output); return $this->tmp . DS . $filename; }
php
private function downloadPackage($package, $license = null) { $tmp_dir = Grav::instance()['locator']->findResource('tmp://', true, true); $this->tmp = $tmp_dir . '/Grav-' . uniqid(); $filename = $package->slug . basename($package->zipball_url); $filename = preg_replace('/[\\\\\/:"*?&<>|]+/m', '-', $filename); $query = ''; if (!empty($package->premium)) { $query = \json_encode(array_merge( $package->premium, [ 'slug' => $package->slug, 'filename' => $package->premium['filename'], 'license_key' => $license ] )); $query = '?d=' . base64_encode($query); } try { $output = Response::get($package->zipball_url . $query, [], [$this, 'progress']); } catch (\Exception $e) { $error = str_replace("\n", "\n | '- ", $e->getMessage()); $this->output->write("\x0D"); // extra white spaces to clear out the buffer properly $this->output->writeln(' |- Downloading package... <red>error</red> '); $this->output->writeln(" | '- " . $error); return false; } Folder::create($this->tmp); $this->output->write("\x0D"); $this->output->write(' |- Downloading package... 100%'); $this->output->writeln(''); file_put_contents($this->tmp . DS . $filename, $output); return $this->tmp . DS . $filename; }
[ "private", "function", "downloadPackage", "(", "$", "package", ",", "$", "license", "=", "null", ")", "{", "$", "tmp_dir", "=", "Grav", "::", "instance", "(", ")", "[", "'locator'", "]", "->", "findResource", "(", "'tmp://'", ",", "true", ",", "true", ...
@param Package $package @param string $license @return string
[ "@param", "Package", "$package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/InstallCommand.php#L559-L601
train
Download package from remote
[ 30522, 2797, 3853, 8816, 23947, 4270, 1006, 1002, 7427, 1010, 1002, 6105, 1027, 19701, 1007, 1063, 1002, 1056, 8737, 1035, 16101, 1027, 24665, 11431, 1024, 1024, 6013, 1006, 1007, 1031, 1005, 8840, 11266, 2953, 1005, 1033, 1011, 1028, 2424,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Redis/Connections/PhpRedisConnection.php
PhpRedisConnection.pipeline
public function pipeline(callable $callback = null) { $pipeline = $this->client()->pipeline(); return is_null($callback) ? $pipeline : tap($pipeline, $callback)->exec(); }
php
public function pipeline(callable $callback = null) { $pipeline = $this->client()->pipeline(); return is_null($callback) ? $pipeline : tap($pipeline, $callback)->exec(); }
[ "public", "function", "pipeline", "(", "callable", "$", "callback", "=", "null", ")", "{", "$", "pipeline", "=", "$", "this", "->", "client", "(", ")", "->", "pipeline", "(", ")", ";", "return", "is_null", "(", "$", "callback", ")", "?", "$", "pipeli...
Execute commands in a pipeline. @param callable|null $callback @return \Redis|array
[ "Execute", "commands", "in", "a", "pipeline", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connections/PhpRedisConnection.php#L298-L305
train
Pipeline the results of the query.
[ 30522, 2270, 3853, 13117, 1006, 2655, 3085, 1002, 2655, 5963, 1027, 19701, 1007, 1063, 1002, 13117, 1027, 1002, 2023, 1011, 1028, 7396, 1006, 1007, 1011, 1028, 13117, 1006, 1007, 1025, 2709, 2003, 1035, 19701, 1006, 1002, 2655, 5963, 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/Plugin/Visualization.php
Visualization.getClientSideParametersToSet
protected function getClientSideParametersToSet() { // build javascript variables to set $javascriptVariablesToSet = array(); foreach ($this->config->custom_parameters as $name => $value) { $javascriptVariablesToSet[$name] = $value; } foreach ($_GET as $name => $value) { try { $requestValue = Common::getRequestVar($name); } catch (\Exception $e) { $requestValue = ''; } $javascriptVariablesToSet[$name] = $requestValue; } foreach ($this->requestConfig->clientSideParameters as $name) { if (isset($javascriptVariablesToSet[$name])) { continue; } $valueToConvert = false; if (property_exists($this->requestConfig, $name)) { $valueToConvert = $this->requestConfig->$name; } elseif (property_exists($this->config, $name)) { $valueToConvert = $this->config->$name; } if (false !== $valueToConvert) { $javascriptVariablesToSet[$name] = $this->getIntIfValueIsBool($valueToConvert); } } $javascriptVariablesToSet['module'] = $this->config->controllerName; $javascriptVariablesToSet['action'] = $this->config->controllerAction; if (!isset($javascriptVariablesToSet['viewDataTable'])) { $javascriptVariablesToSet['viewDataTable'] = static::getViewDataTableId(); } if ($this->dataTable && // Set doesn't have the method !($this->dataTable instanceof DataTable\Map) && empty($javascriptVariablesToSet['totalRows']) ) { $javascriptVariablesToSet['totalRows'] = $this->dataTable->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME) ?: $this->dataTable->getRowsCount(); } $deleteFromJavascriptVariables = array( 'filter_excludelowpop', 'filter_excludelowpop_value', ); foreach ($deleteFromJavascriptVariables as $name) { if (isset($javascriptVariablesToSet[$name])) { unset($javascriptVariablesToSet[$name]); } } $rawSegment = \Piwik\API\Request::getRawSegmentFromRequest(); if (!empty($rawSegment)) { $javascriptVariablesToSet['segment'] = $rawSegment; } return $javascriptVariablesToSet; }
php
protected function getClientSideParametersToSet() { // build javascript variables to set $javascriptVariablesToSet = array(); foreach ($this->config->custom_parameters as $name => $value) { $javascriptVariablesToSet[$name] = $value; } foreach ($_GET as $name => $value) { try { $requestValue = Common::getRequestVar($name); } catch (\Exception $e) { $requestValue = ''; } $javascriptVariablesToSet[$name] = $requestValue; } foreach ($this->requestConfig->clientSideParameters as $name) { if (isset($javascriptVariablesToSet[$name])) { continue; } $valueToConvert = false; if (property_exists($this->requestConfig, $name)) { $valueToConvert = $this->requestConfig->$name; } elseif (property_exists($this->config, $name)) { $valueToConvert = $this->config->$name; } if (false !== $valueToConvert) { $javascriptVariablesToSet[$name] = $this->getIntIfValueIsBool($valueToConvert); } } $javascriptVariablesToSet['module'] = $this->config->controllerName; $javascriptVariablesToSet['action'] = $this->config->controllerAction; if (!isset($javascriptVariablesToSet['viewDataTable'])) { $javascriptVariablesToSet['viewDataTable'] = static::getViewDataTableId(); } if ($this->dataTable && // Set doesn't have the method !($this->dataTable instanceof DataTable\Map) && empty($javascriptVariablesToSet['totalRows']) ) { $javascriptVariablesToSet['totalRows'] = $this->dataTable->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME) ?: $this->dataTable->getRowsCount(); } $deleteFromJavascriptVariables = array( 'filter_excludelowpop', 'filter_excludelowpop_value', ); foreach ($deleteFromJavascriptVariables as $name) { if (isset($javascriptVariablesToSet[$name])) { unset($javascriptVariablesToSet[$name]); } } $rawSegment = \Piwik\API\Request::getRawSegmentFromRequest(); if (!empty($rawSegment)) { $javascriptVariablesToSet['segment'] = $rawSegment; } return $javascriptVariablesToSet; }
[ "protected", "function", "getClientSideParametersToSet", "(", ")", "{", "// build javascript variables to set", "$", "javascriptVariablesToSet", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "config", "->", "custom_parameters", "as", "$", "name", "...
This functions reads the customization values for the DataTable and returns an array (name,value) to be printed in Javascript. This array defines things such as: - name of the module & action to call to request data for this table - optional filters information, eg. filter_limit and filter_offset - etc. The values are loaded: - from the generic filters that are applied by default @see Piwik\API\DataTableGenericFilter::getGenericFiltersInformation() - from the values already available in the GET array - from the values set using methods from this class (eg. setSearchPattern(), setLimit(), etc.) @return array eg. array('show_offset_information' => 0, 'show_...
[ "This", "functions", "reads", "the", "customization", "values", "for", "the", "DataTable", "and", "returns", "an", "array", "(", "name", "value", ")", "to", "be", "printed", "in", "Javascript", ".", "This", "array", "defines", "things", "such", "as", ":", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Visualization.php#L580-L648
train
Returns the client side parameters to set
[ 30522, 5123, 3853, 2131, 20464, 11638, 7363, 28689, 22828, 16033, 13462, 1006, 1007, 1063, 1013, 1013, 3857, 9262, 22483, 10857, 2000, 2275, 1002, 9262, 22483, 10755, 19210, 16033, 13462, 1027, 9140, 1006, 1007, 1025, 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...
matomo-org/matomo
plugins/Transitions/API.php
API.addInternalReferrers
private function addInternalReferrers($logAggregator, &$report, $idaction, $actionType, $limitBeforeGrouping) { $data = $this->queryInternalReferrers($idaction, $actionType, $logAggregator, $limitBeforeGrouping); if ($data['pageviews'] == 0) { throw new Exception('NoDataForAction'); } $report['previousPages'] = & $data['previousPages']; $report['previousSiteSearches'] = & $data['previousSiteSearches']; $report['pageMetrics']['loops'] = $data['loops']; $report['pageMetrics']['pageviews'] = $data['pageviews']; }
php
private function addInternalReferrers($logAggregator, &$report, $idaction, $actionType, $limitBeforeGrouping) { $data = $this->queryInternalReferrers($idaction, $actionType, $logAggregator, $limitBeforeGrouping); if ($data['pageviews'] == 0) { throw new Exception('NoDataForAction'); } $report['previousPages'] = & $data['previousPages']; $report['previousSiteSearches'] = & $data['previousSiteSearches']; $report['pageMetrics']['loops'] = $data['loops']; $report['pageMetrics']['pageviews'] = $data['pageviews']; }
[ "private", "function", "addInternalReferrers", "(", "$", "logAggregator", ",", "&", "$", "report", ",", "$", "idaction", ",", "$", "actionType", ",", "$", "limitBeforeGrouping", ")", "{", "$", "data", "=", "$", "this", "->", "queryInternalReferrers", "(", "$...
Add the internal referrers to the report: previous pages and previous site searches @param LogAggregator $logAggregator @param $report @param $idaction @param string $actionType @param $limitBeforeGrouping @throws Exception
[ "Add", "the", "internal", "referrers", "to", "the", "report", ":", "previous", "pages", "and", "previous", "site", "searches" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Transitions/API.php#L172-L184
train
Add internal referrers to the report
[ 30522, 2797, 3853, 5587, 18447, 11795, 2389, 2890, 7512, 14544, 2015, 1006, 1002, 8833, 8490, 17603, 20697, 2953, 1010, 1004, 1002, 3189, 1010, 1002, 16096, 7542, 1010, 1002, 2895, 13874, 1010, 1002, 5787, 4783, 29278, 13910, 22107, 2075, 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
plugins/UserId/Archiver.php
Archiver.setVisitorIds
private function setVisitorIds(DataTable $dataTable) { foreach ($dataTable->getRows() as $row) { $userId = $row->getColumn('label'); if (isset($this->visitorIdsUserIdsMap[$userId])) { $row->setMetadata(self::VISITOR_ID_FIELD, $this->visitorIdsUserIdsMap[$userId]); } } }
php
private function setVisitorIds(DataTable $dataTable) { foreach ($dataTable->getRows() as $row) { $userId = $row->getColumn('label'); if (isset($this->visitorIdsUserIdsMap[$userId])) { $row->setMetadata(self::VISITOR_ID_FIELD, $this->visitorIdsUserIdsMap[$userId]); } } }
[ "private", "function", "setVisitorIds", "(", "DataTable", "$", "dataTable", ")", "{", "foreach", "(", "$", "dataTable", "->", "getRows", "(", ")", "as", "$", "row", ")", "{", "$", "userId", "=", "$", "row", "->", "getColumn", "(", "'label'", ")", ";", ...
Fill visitor ID as metadata before actual inserting rows to DB. @param DataTable $dataTable
[ "Fill", "visitor", "ID", "as", "metadata", "before", "actual", "inserting", "rows", "to", "DB", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserId/Archiver.php#L130-L138
train
Set visitor id metadata for each row
[ 30522, 2797, 3853, 2275, 11365, 15660, 9821, 1006, 2951, 10880, 1002, 2951, 10880, 1007, 1063, 18921, 6776, 1006, 1002, 2951, 10880, 1011, 1028, 2131, 10524, 2015, 1006, 1007, 2004, 1002, 5216, 1007, 1063, 1002, 5310, 3593, 1027, 1002, 5216...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/AbstractExtension.php
AbstractExtension.initTypeExtensions
private function initTypeExtensions() { $this->typeExtensions = []; foreach ($this->loadTypeExtensions() as $extension) { if (!$extension instanceof FormTypeExtensionInterface) { throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormTypeExtensionInterface'); } if (method_exists($extension, 'getExtendedTypes')) { $extendedTypes = []; foreach ($extension::getExtendedTypes() as $extendedType) { $extendedTypes[] = $extendedType; } } else { @trigger_error(sprintf('Not implementing the static getExtendedTypes() method in %s when implementing the %s is deprecated since Symfony 4.2. The method will be added to the interface in 5.0.', \get_class($extension), FormTypeExtensionInterface::class), E_USER_DEPRECATED); $extendedTypes = [$extension->getExtendedType()]; } foreach ($extendedTypes as $extendedType) { $this->typeExtensions[$extendedType][] = $extension; } } }
php
private function initTypeExtensions() { $this->typeExtensions = []; foreach ($this->loadTypeExtensions() as $extension) { if (!$extension instanceof FormTypeExtensionInterface) { throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormTypeExtensionInterface'); } if (method_exists($extension, 'getExtendedTypes')) { $extendedTypes = []; foreach ($extension::getExtendedTypes() as $extendedType) { $extendedTypes[] = $extendedType; } } else { @trigger_error(sprintf('Not implementing the static getExtendedTypes() method in %s when implementing the %s is deprecated since Symfony 4.2. The method will be added to the interface in 5.0.', \get_class($extension), FormTypeExtensionInterface::class), E_USER_DEPRECATED); $extendedTypes = [$extension->getExtendedType()]; } foreach ($extendedTypes as $extendedType) { $this->typeExtensions[$extendedType][] = $extension; } } }
[ "private", "function", "initTypeExtensions", "(", ")", "{", "$", "this", "->", "typeExtensions", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "loadTypeExtensions", "(", ")", "as", "$", "extension", ")", "{", "if", "(", "!", "$", "extension", ...
Initializes the type extensions. @throws UnexpectedTypeException if any registered type extension is not an instance of FormTypeExtensionInterface
[ "Initializes", "the", "type", "extensions", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/AbstractExtension.php#L169-L194
train
Initializes the type extensions
[ 30522, 2797, 3853, 1999, 12474, 18863, 10288, 29048, 2015, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 2828, 10288, 29048, 2015, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 7170, 13874, 10288, 29048, 2015, 1006, 1007, 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...
symfony/symfony
src/Symfony/Component/DomCrawler/Crawler.php
Crawler.convertToHtmlEntities
private function convertToHtmlEntities(string $htmlContent, string $charset = 'UTF-8'): string { set_error_handler(function () { throw new \Exception(); }); try { return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset); } catch (\Exception $e) { try { $htmlContent = iconv($charset, 'UTF-8', $htmlContent); $htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8'); } catch (\Exception $e) { } return $htmlContent; } finally { restore_error_handler(); } }
php
private function convertToHtmlEntities(string $htmlContent, string $charset = 'UTF-8'): string { set_error_handler(function () { throw new \Exception(); }); try { return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset); } catch (\Exception $e) { try { $htmlContent = iconv($charset, 'UTF-8', $htmlContent); $htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8'); } catch (\Exception $e) { } return $htmlContent; } finally { restore_error_handler(); } }
[ "private", "function", "convertToHtmlEntities", "(", "string", "$", "htmlContent", ",", "string", "$", "charset", "=", "'UTF-8'", ")", ":", "string", "{", "set_error_handler", "(", "function", "(", ")", "{", "throw", "new", "\\", "Exception", "(", ")", ";", ...
Converts charset to HTML-entities to ensure valid parsing.
[ "Converts", "charset", "to", "HTML", "-", "entities", "to", "ensure", "valid", "parsing", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L1143-L1160
train
Convert HTML - Entities to UTF - 8
[ 30522, 2797, 3853, 10463, 3406, 11039, 19968, 4765, 6447, 1006, 5164, 1002, 16129, 8663, 6528, 2102, 1010, 5164, 1002, 25869, 13462, 1027, 1005, 21183, 2546, 1011, 1022, 1005, 1007, 1024, 5164, 1063, 2275, 1035, 7561, 1035, 28213, 1006, 385...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/DefaultServicesProvider.php
DefaultServicesProvider.register
public function register($container) { if (!isset($container['environment'])) { /** * This service MUST return a shared instance of \Slim\Http\Environment. * * @return Environment */ $container['environment'] = function () { return new Environment($_SERVER); }; } if (!isset($container['request'])) { /** * PSR-7 Request object * * @param Container $container * * @return ServerRequestInterface */ $container['request'] = function ($container) { return Request::createFromEnvironment($container->get('environment')); }; } if (!isset($container['response'])) { /** * PSR-7 Response object * * @param Container $container * * @return ResponseInterface */ $container['response'] = function ($container) { $headers = new Headers(['Content-Type' => 'text/html; charset=UTF-8']); $response = new Response(200, $headers); return $response->withProtocolVersion($container->get('settings')['httpVersion']); }; } if (!isset($container['router'])) { /** * This service MUST return a shared instance of \Slim\Interfaces\RouterInterface. * * @param Container $container * * @return RouterInterface */ $container['router'] = function ($container) { $routerCacheFile = false; if (isset($container->get('settings')['routerCacheFile'])) { $routerCacheFile = $container->get('settings')['routerCacheFile']; } $router = (new Router)->setCacheFile($routerCacheFile); if (method_exists($router, 'setContainer')) { $router->setContainer($container); } return $router; }; } if (!isset($container['foundHandler'])) { /** * This service MUST return a SHARED instance InvocationStrategyInterface. * * @return InvocationStrategyInterface */ $container['foundHandler'] = function () { return new RequestResponse; }; } if (!isset($container['phpErrorHandler'])) { /** * This service MUST return a callable that accepts three arguments: * * 1. Instance of ServerRequestInterface * 2. Instance of ResponseInterface * 3. Instance of Error * * The callable MUST return an instance of ResponseInterface. * * @param Container $container * * @return callable */ $container['phpErrorHandler'] = function ($container) { return new PhpError($container->get('settings')['displayErrorDetails']); }; } if (!isset($container['errorHandler'])) { /** * This service MUST return a callable that accepts three arguments: * * 1. Instance of \Psr\Http\Message\ServerRequestInterface * 2. Instance of \Psr\Http\Message\ResponseInterface * 3. Instance of \Exception * * The callable MUST return an instance of ResponseInterface. * * @param Container $container * * @return callable */ $container['errorHandler'] = function ($container) { return new Error( $container->get('settings')['displayErrorDetails'] ); }; } if (!isset($container['notFoundHandler'])) { /** * This service MUST return a callable that accepts two arguments: * * 1. Instance of ServerRequestInterface * 2. Instance of ResponseInterface * * The callable MUST return an instance of ResponseInterface. * * @return callable */ $container['notFoundHandler'] = function () { return new NotFound; }; } if (!isset($container['notAllowedHandler'])) { /** * This service MUST return a callable that accepts three arguments: * * 1. Instance of ServerRequestInterface * 2. Instance of ResponseInterface * 3. Array of allowed HTTP methods * * The callable MUST return an instance of ResponseInterface. * * @return callable */ $container['notAllowedHandler'] = function () { return new NotAllowed; }; } if (!isset($container['callableResolver'])) { /** * Instance of CallableResolverInterface * * @param Container $container * * @return CallableResolverInterface */ $container['callableResolver'] = function ($container) { return new CallableResolver($container); }; } }
php
public function register($container) { if (!isset($container['environment'])) { /** * This service MUST return a shared instance of \Slim\Http\Environment. * * @return Environment */ $container['environment'] = function () { return new Environment($_SERVER); }; } if (!isset($container['request'])) { /** * PSR-7 Request object * * @param Container $container * * @return ServerRequestInterface */ $container['request'] = function ($container) { return Request::createFromEnvironment($container->get('environment')); }; } if (!isset($container['response'])) { /** * PSR-7 Response object * * @param Container $container * * @return ResponseInterface */ $container['response'] = function ($container) { $headers = new Headers(['Content-Type' => 'text/html; charset=UTF-8']); $response = new Response(200, $headers); return $response->withProtocolVersion($container->get('settings')['httpVersion']); }; } if (!isset($container['router'])) { /** * This service MUST return a shared instance of \Slim\Interfaces\RouterInterface. * * @param Container $container * * @return RouterInterface */ $container['router'] = function ($container) { $routerCacheFile = false; if (isset($container->get('settings')['routerCacheFile'])) { $routerCacheFile = $container->get('settings')['routerCacheFile']; } $router = (new Router)->setCacheFile($routerCacheFile); if (method_exists($router, 'setContainer')) { $router->setContainer($container); } return $router; }; } if (!isset($container['foundHandler'])) { /** * This service MUST return a SHARED instance InvocationStrategyInterface. * * @return InvocationStrategyInterface */ $container['foundHandler'] = function () { return new RequestResponse; }; } if (!isset($container['phpErrorHandler'])) { /** * This service MUST return a callable that accepts three arguments: * * 1. Instance of ServerRequestInterface * 2. Instance of ResponseInterface * 3. Instance of Error * * The callable MUST return an instance of ResponseInterface. * * @param Container $container * * @return callable */ $container['phpErrorHandler'] = function ($container) { return new PhpError($container->get('settings')['displayErrorDetails']); }; } if (!isset($container['errorHandler'])) { /** * This service MUST return a callable that accepts three arguments: * * 1. Instance of \Psr\Http\Message\ServerRequestInterface * 2. Instance of \Psr\Http\Message\ResponseInterface * 3. Instance of \Exception * * The callable MUST return an instance of ResponseInterface. * * @param Container $container * * @return callable */ $container['errorHandler'] = function ($container) { return new Error( $container->get('settings')['displayErrorDetails'] ); }; } if (!isset($container['notFoundHandler'])) { /** * This service MUST return a callable that accepts two arguments: * * 1. Instance of ServerRequestInterface * 2. Instance of ResponseInterface * * The callable MUST return an instance of ResponseInterface. * * @return callable */ $container['notFoundHandler'] = function () { return new NotFound; }; } if (!isset($container['notAllowedHandler'])) { /** * This service MUST return a callable that accepts three arguments: * * 1. Instance of ServerRequestInterface * 2. Instance of ResponseInterface * 3. Array of allowed HTTP methods * * The callable MUST return an instance of ResponseInterface. * * @return callable */ $container['notAllowedHandler'] = function () { return new NotAllowed; }; } if (!isset($container['callableResolver'])) { /** * Instance of CallableResolverInterface * * @param Container $container * * @return CallableResolverInterface */ $container['callableResolver'] = function ($container) { return new CallableResolver($container); }; } }
[ "public", "function", "register", "(", "$", "container", ")", "{", "if", "(", "!", "isset", "(", "$", "container", "[", "'environment'", "]", ")", ")", "{", "/**\n * This service MUST return a shared instance of \\Slim\\Http\\Environment.\n *\n ...
Register Slim's default services. @param Container $container A DI container implementing ArrayAccess and container-interop.
[ "Register", "Slim", "s", "default", "services", "." ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/DefaultServicesProvider.php#L32-L193
train
Registers the container
[ 30522, 2270, 3853, 4236, 1006, 1002, 11661, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 11661, 1031, 1005, 4044, 1005, 1033, 1007, 1007, 1063, 1013, 1008, 1008, 1008, 2023, 2326, 2442, 2709, 1037, 4207, 6013, 1997, 1032, 11754, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/PrivacyManager/DoNotTrackHeaderChecker.php
DoNotTrackHeaderChecker.checkHeaderInTracker
public function checkHeaderInTracker(&$exclude) { if ($exclude) { Common::printDebug("Visit is already excluded, no need to check DoNotTrack support."); return; } $exclude = $this->isDoNotTrackFound(); if($exclude) { IgnoreCookie::deleteThirdPartyCookieUIDIfExists(); // this is an optional supplement to the site's tracking status resource at: // /.well-known/dnt // per Tracking Preference Expression //Tracking Perference Expression has been updated to require Tk: N rather than Tk: 1 Common::sendHeader('Tk: N'); } }
php
public function checkHeaderInTracker(&$exclude) { if ($exclude) { Common::printDebug("Visit is already excluded, no need to check DoNotTrack support."); return; } $exclude = $this->isDoNotTrackFound(); if($exclude) { IgnoreCookie::deleteThirdPartyCookieUIDIfExists(); // this is an optional supplement to the site's tracking status resource at: // /.well-known/dnt // per Tracking Preference Expression //Tracking Perference Expression has been updated to require Tk: N rather than Tk: 1 Common::sendHeader('Tk: N'); } }
[ "public", "function", "checkHeaderInTracker", "(", "&", "$", "exclude", ")", "{", "if", "(", "$", "exclude", ")", "{", "Common", "::", "printDebug", "(", "\"Visit is already excluded, no need to check DoNotTrack support.\"", ")", ";", "return", ";", "}", "$", "exc...
Checks for DoNotTrack headers and if found, sets `$exclude` to `true`.
[ "Checks", "for", "DoNotTrack", "headers", "and", "if", "found", "sets", "$exclude", "to", "true", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/DoNotTrackHeaderChecker.php#L35-L55
train
Check header in Tracking Status
[ 30522, 2270, 3853, 4638, 4974, 23282, 6494, 9102, 1006, 1004, 1002, 30524, 2003, 2525, 12421, 1010, 2053, 2342, 2000, 4638, 2123, 14517, 22648, 2243, 2490, 1012, 1000, 1007, 1025, 2709, 1025, 1065, 1002, 23329, 1027, 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/Validation/Concerns/ValidatesAttributes.php
ValidatesAttributes.validateUrl
public function validateUrl($attribute, $value) { if (! is_string($value)) { return false; } /* * This pattern is derived from Symfony\Component\Validator\Constraints\UrlValidator (2.7.4). * * (c) Fabien Potencier <fabien@symfony.com> http://symfony.com */ $pattern = '~^ ((aaa|aaas|about|acap|acct|acr|adiumxtra|afp|afs|aim|apt|attachment|aw|barion|beshare|bitcoin|blob|bolo|callto|cap|chrome|chrome-extension|cid|coap|coaps|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-playcontainer|dlna-playsingle|dns|dntp|dtn|dvb|ed2k|example|facetime|fax|feed|feedready|file|filesystem|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|ham|hcp|http|https|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris.beep|iris.lwz|iris.xpc|iris.xpcs|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|ms-help|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|msnim|msrp|msrps|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|oid|opaquelocktoken|pack|palm|paparazzi|pkcs11|platform|pop|pres|prospero|proxy|psyc|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|secondlife|s3|service|session|sftp|sgn|shttp|sieve|sip|sips|skype|smb|sms|smtp|snews|snmp|soap.beep|soap.beeps|soldat|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|things|thismessage|tip|tn3270|turn|turns|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|videotex|view-source|wais|webcal|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc\.beep|xmlrpc.beeps|xmpp|xri|ymsgr|z39\.50|z39\.50r|z39\.50s)):// # protocol (([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth ( ([\pL\pN\pS\-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name | # or \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address | # or \[ (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) \] # an IPv6 address ) (:[0-9]+)? # a port (optional) (/?|/\S+|\?\S*|\#\S*) # a /, nothing, a / with something, a query or a fragment $~ixu'; return preg_match($pattern, $value) > 0; }
php
public function validateUrl($attribute, $value) { if (! is_string($value)) { return false; } /* * This pattern is derived from Symfony\Component\Validator\Constraints\UrlValidator (2.7.4). * * (c) Fabien Potencier <fabien@symfony.com> http://symfony.com */ $pattern = '~^ ((aaa|aaas|about|acap|acct|acr|adiumxtra|afp|afs|aim|apt|attachment|aw|barion|beshare|bitcoin|blob|bolo|callto|cap|chrome|chrome-extension|cid|coap|coaps|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-playcontainer|dlna-playsingle|dns|dntp|dtn|dvb|ed2k|example|facetime|fax|feed|feedready|file|filesystem|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|ham|hcp|http|https|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris.beep|iris.lwz|iris.xpc|iris.xpcs|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|ms-help|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|msnim|msrp|msrps|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|oid|opaquelocktoken|pack|palm|paparazzi|pkcs11|platform|pop|pres|prospero|proxy|psyc|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|secondlife|s3|service|session|sftp|sgn|shttp|sieve|sip|sips|skype|smb|sms|smtp|snews|snmp|soap.beep|soap.beeps|soldat|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|things|thismessage|tip|tn3270|turn|turns|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|videotex|view-source|wais|webcal|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc\.beep|xmlrpc.beeps|xmpp|xri|ymsgr|z39\.50|z39\.50r|z39\.50s)):// # protocol (([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth ( ([\pL\pN\pS\-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name | # or \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address | # or \[ (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) \] # an IPv6 address ) (:[0-9]+)? # a port (optional) (/?|/\S+|\?\S*|\#\S*) # a /, nothing, a / with something, a query or a fragment $~ixu'; return preg_match($pattern, $value) > 0; }
[ "public", "function", "validateUrl", "(", "$", "attribute", ",", "$", "value", ")", "{", "if", "(", "!", "is_string", "(", "$", "value", ")", ")", "{", "return", "false", ";", "}", "/*\n * This pattern is derived from Symfony\\Component\\Validator\\Constrain...
Validate that an attribute is a valid URL. @param string $attribute @param mixed $value @return bool
[ "Validate", "that", "an", "attribute", "is", "a", "valid", "URL", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L1582-L1610
train
Validate the url
[ 30522, 2270, 3853, 9398, 3686, 3126, 2140, 1006, 1002, 17961, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5164, 1006, 1002, 3643, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 1013, 1008, 1008, 2023, 5418, 2003, 5173, 2013, 253...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Cookie.php
Cookie.get
public function get($name) { $name = self::escapeValue($name); if (false === $this->keyStore) { if (isset($this->value[$name])) { return self::escapeValue($this->value[$name]); } return false; } if (isset($this->value[$this->keyStore][$name])) { return self::escapeValue($this->value[$this->keyStore][$name]); } return false; }
php
public function get($name) { $name = self::escapeValue($name); if (false === $this->keyStore) { if (isset($this->value[$name])) { return self::escapeValue($this->value[$name]); } return false; } if (isset($this->value[$this->keyStore][$name])) { return self::escapeValue($this->value[$this->keyStore][$name]); } return false; }
[ "public", "function", "get", "(", "$", "name", ")", "{", "$", "name", "=", "self", "::", "escapeValue", "(", "$", "name", ")", ";", "if", "(", "false", "===", "$", "this", "->", "keyStore", ")", "{", "if", "(", "isset", "(", "$", "this", "->", ...
Returns the value defined by $name from the cookie. @param string|integer Index name of the value to return @return mixed The value if found, false if the value is not found
[ "Returns", "the", "value", "defined", "by", "$name", "from", "the", "cookie", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Cookie.php#L354-L370
train
Get the value of a key
[ 30522, 2270, 3853, 2131, 1006, 1002, 2171, 1007, 1063, 1002, 2171, 1027, 2969, 1024, 1024, 4019, 10175, 5657, 1006, 1002, 2171, 1007, 1025, 2065, 1006, 6270, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 6309, 19277, 1007, 1063, 2065, 1006, 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
plugins/ExampleCommand/Commands/HelloWorld.php
HelloWorld.execute
protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getOption('name'); $message = sprintf('<info>HelloWorld: %s</info>', $name); $output->writeln($message); }
php
protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getOption('name'); $message = sprintf('<info>HelloWorld: %s</info>', $name); $output->writeln($message); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "name", "=", "$", "input", "->", "getOption", "(", "'name'", ")", ";", "$", "message", "=", "sprintf", "(", "'<info>HelloWorld: %s<...
The actual task is defined in this method. Here you can access any option or argument that was defined on the command line via $input and write anything to the console via $output argument. In case anything went wrong during the execution you should throw an exception to make sure the user will get a useful error message and to make sure the command does not exit with the status code 0. Ideally, the actual command is quite short as it acts like a controller. It should only receive the input values, execute the task by calling a method of another class and output any useful information. Execute the command like: ./console examplecommand:helloworld --name="The Piwik Team"
[ "The", "actual", "task", "is", "defined", "in", "this", "method", ".", "Here", "you", "can", "access", "any", "option", "or", "argument", "that", "was", "defined", "on", "the", "command", "line", "via", "$input", "and", "write", "anything", "to", "the", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/ExampleCommand/Commands/HelloWorld.php#L47-L54
train
Display the message of the user
[ 30522, 5123, 3853, 15389, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1002, 2171, 1027, 1002, 7953, 1011, 1028, 2131, 7361, 3508, 1006, 1005, 2171, 1005, 1007, 1025, 1002, 4471, 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...
matomo-org/matomo
libs/Zend/Mime/Decode.php
Zend_Mime_Decode.splitMessageStruct
public static function splitMessageStruct($message, $boundary, $EOL = Zend_Mime::LINEEND) { $parts = self::splitMime($message, $boundary); if (count($parts) <= 0) { return null; } $result = array(); foreach ($parts as $part) { self::splitMessage($part, $headers, $body, $EOL); $result[] = array('header' => $headers, 'body' => $body ); } return $result; }
php
public static function splitMessageStruct($message, $boundary, $EOL = Zend_Mime::LINEEND) { $parts = self::splitMime($message, $boundary); if (count($parts) <= 0) { return null; } $result = array(); foreach ($parts as $part) { self::splitMessage($part, $headers, $body, $EOL); $result[] = array('header' => $headers, 'body' => $body ); } return $result; }
[ "public", "static", "function", "splitMessageStruct", "(", "$", "message", ",", "$", "boundary", ",", "$", "EOL", "=", "Zend_Mime", "::", "LINEEND", ")", "{", "$", "parts", "=", "self", "::", "splitMime", "(", "$", "message", ",", "$", "boundary", ")", ...
decodes a mime encoded String and returns a struct of parts with header and body @param string $message raw message content @param string $boundary boundary as found in content-type @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} @return array|null parts as array('header' => array(name => value), 'body' => content), null if no parts found @throws Zend_Exception
[ "decodes", "a", "mime", "encoded", "String", "and", "returns", "a", "struct", "of", "parts", "with", "header", "and", "body" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime/Decode.php#L90-L103
train
Split message into parts
[ 30522, 2270, 10763, 3853, 3975, 7834, 3736, 8449, 18300, 1006, 1002, 4471, 1010, 1002, 6192, 1010, 1002, 1041, 4747, 1027, 16729, 2094, 1035, 2771, 4168, 1024, 1024, 2240, 10497, 1007, 1063, 1002, 3033, 1027, 2969, 1024, 1024, 3975, 4328, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Message.php
Message.embed
public function embed($file) { if (isset($this->embeddedFiles[$file])) { return $this->embeddedFiles[$file]; } return $this->embeddedFiles[$file] = $this->swift->embed( Swift_Image::fromPath($file) ); }
php
public function embed($file) { if (isset($this->embeddedFiles[$file])) { return $this->embeddedFiles[$file]; } return $this->embeddedFiles[$file] = $this->swift->embed( Swift_Image::fromPath($file) ); }
[ "public", "function", "embed", "(", "$", "file", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "embeddedFiles", "[", "$", "file", "]", ")", ")", "{", "return", "$", "this", "->", "embeddedFiles", "[", "$", "file", "]", ";", "}", "return", ...
Embed a file in the message and get the CID. @param string $file @return string
[ "Embed", "a", "file", "in", "the", "message", "and", "get", "the", "CID", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Message.php#L254-L263
train
Embed an image into the stack.
[ 30522, 2270, 3853, 7861, 8270, 1006, 1002, 5371, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 11157, 8873, 4244, 1031, 1002, 5371, 1033, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 11157, 8873, 4244, 1031, 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/Foundation/Auth/Access/AuthorizesRequests.php
AuthorizesRequests.authorize
public function authorize($ability, $arguments = []) { [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); return app(Gate::class)->authorize($ability, $arguments); }
php
public function authorize($ability, $arguments = []) { [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); return app(Gate::class)->authorize($ability, $arguments); }
[ "public", "function", "authorize", "(", "$", "ability", ",", "$", "arguments", "=", "[", "]", ")", "{", "[", "$", "ability", ",", "$", "arguments", "]", "=", "$", "this", "->", "parseAbilityAndArguments", "(", "$", "ability", ",", "$", "arguments", ")"...
Authorize a given action for the current user. @param mixed $ability @param mixed|array $arguments @return \Illuminate\Auth\Access\Response @throws \Illuminate\Auth\Access\AuthorizationException
[ "Authorize", "a", "given", "action", "for", "the", "current", "user", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php#L19-L24
train
Authorize the user with the given ability and arguments.
[ 30522, 2270, 3853, 3166, 4697, 1006, 1002, 3754, 1010, 1002, 9918, 1027, 1031, 1033, 1007, 1063, 1031, 1002, 3754, 1010, 1002, 9918, 1033, 1027, 1002, 2023, 1011, 1028, 11968, 17310, 8553, 13832, 10623, 27417, 3215, 1006, 1002, 3754, 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...
matomo-org/matomo
core/Tracker/Db/Mysqli.php
Mysqli.fetchAll
public function fetchAll($query, $parameters = array()) { try { if (self::$profiling) { $timer = $this->initProfiler(); } $rows = array(); $query = $this->prepare($query, $parameters); $rs = mysqli_query($this->connection, $query); if (is_bool($rs)) { throw new DbException('fetchAll() failed: ' . mysqli_error($this->connection) . ' : ' . $query); } while ($row = mysqli_fetch_array($rs, MYSQLI_ASSOC)) { $rows[] = $row; } mysqli_free_result($rs); if (self::$profiling && isset($timer)) { $this->recordQueryProfile($query, $timer); } return $rows; } catch (Exception $e) { throw new DbException("Error query: " . $e->getMessage()); } }
php
public function fetchAll($query, $parameters = array()) { try { if (self::$profiling) { $timer = $this->initProfiler(); } $rows = array(); $query = $this->prepare($query, $parameters); $rs = mysqli_query($this->connection, $query); if (is_bool($rs)) { throw new DbException('fetchAll() failed: ' . mysqli_error($this->connection) . ' : ' . $query); } while ($row = mysqli_fetch_array($rs, MYSQLI_ASSOC)) { $rows[] = $row; } mysqli_free_result($rs); if (self::$profiling && isset($timer)) { $this->recordQueryProfile($query, $timer); } return $rows; } catch (Exception $e) { throw new DbException("Error query: " . $e->getMessage()); } }
[ "public", "function", "fetchAll", "(", "$", "query", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "try", "{", "if", "(", "self", "::", "$", "profiling", ")", "{", "$", "timer", "=", "$", "this", "->", "initProfiler", "(", ")", ";", "...
Returns an array containing all the rows of a query result, using optional bound parameters. @see query() @param string $query Query @param array $parameters Parameters to bind @return array @throws Exception|DbException if an exception occurred
[ "Returns", "an", "array", "containing", "all", "the", "rows", "of", "a", "query", "result", "using", "optional", "bound", "parameters", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Db/Mysqli.php#L161-L187
train
Fetches all rows from the result set of a query
[ 30522, 2270, 3853, 18584, 8095, 1006, 1002, 23032, 1010, 1002, 11709, 1027, 9140, 1006, 1007, 1007, 1063, 3046, 1063, 2065, 1006, 2969, 1024, 1024, 1002, 11268, 16281, 1007, 1063, 1002, 25309, 1027, 1002, 2023, 1011, 1028, 1999, 4183, 21572...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/FormRenderer.php
FormRenderer.searchAndRenderBlock
public function searchAndRenderBlock(FormView $view, $blockNameSuffix, array $variables = []) { $renderOnlyOnce = 'row' === $blockNameSuffix || 'widget' === $blockNameSuffix; if ($renderOnlyOnce && $view->isRendered()) { // This is not allowed, because it would result in rendering same IDs multiple times, which is not valid. @trigger_error(sprintf('You are calling "form_%s" for field "%s" which has already been rendered before, trying to render fields which were already rendered is deprecated since Symfony 4.2 and will throw an exception in 5.0.', $blockNameSuffix, $view->vars['name']), E_USER_DEPRECATED); // throw new BadMethodCallException(sprintf('Field "%s" has already been rendered. Save result of previous render call to variable and output that instead.', $view->vars['name'])); return ''; } // The cache key for storing the variables and types $viewCacheKey = $view->vars[self::CACHE_KEY_VAR]; $viewAndSuffixCacheKey = $viewCacheKey.$blockNameSuffix; // In templates, we have to deal with two kinds of block hierarchies: // // +---------+ +---------+ // | Theme B | -------> | Theme A | // +---------+ +---------+ // // form_widget -------> form_widget // ^ // | // choice_widget -----> choice_widget // // The first kind of hierarchy is the theme hierarchy. This allows to // override the block "choice_widget" from Theme A in the extending // Theme B. This kind of inheritance needs to be supported by the // template engine and, for example, offers "parent()" or similar // functions to fall back from the custom to the parent implementation. // // The second kind of hierarchy is the form type hierarchy. This allows // to implement a custom "choice_widget" block (no matter in which theme), // or to fallback to the block of the parent type, which would be // "form_widget" in this example (again, no matter in which theme). // If the designer wants to explicitly fallback to "form_widget" in their // custom "choice_widget", for example because they only want to wrap // a <div> around the original implementation, they can call the // widget() function again to render the block for the parent type. // // The second kind is implemented in the following blocks. if (!isset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey])) { // INITIAL CALL // Calculate the hierarchy of template blocks and start on // the bottom level of the hierarchy (= "_<id>_<section>" block) $blockNameHierarchy = []; foreach ($view->vars['block_prefixes'] as $blockNamePrefix) { $blockNameHierarchy[] = $blockNamePrefix.'_'.$blockNameSuffix; } $hierarchyLevel = \count($blockNameHierarchy) - 1; $hierarchyInit = true; } else { // RECURSIVE CALL // If a block recursively calls searchAndRenderBlock() again, resume rendering // using the parent type in the hierarchy. $blockNameHierarchy = $this->blockNameHierarchyMap[$viewAndSuffixCacheKey]; $hierarchyLevel = $this->hierarchyLevelMap[$viewAndSuffixCacheKey] - 1; $hierarchyInit = false; } // The variables are cached globally for a view (instead of for the // current suffix) if (!isset($this->variableStack[$viewCacheKey])) { $this->variableStack[$viewCacheKey] = []; // The default variable scope contains all view variables, merged with // the variables passed explicitly to the helper $scopeVariables = $view->vars; $varInit = true; } else { // Reuse the current scope and merge it with the explicitly passed variables $scopeVariables = end($this->variableStack[$viewCacheKey]); $varInit = false; } // Load the resource where this block can be found $resource = $this->engine->getResourceForBlockNameHierarchy($view, $blockNameHierarchy, $hierarchyLevel); // Update the current hierarchy level to the one at which the resource was // found. For example, if looking for "choice_widget", but only a resource // is found for its parent "form_widget", then the level is updated here // to the parent level. $hierarchyLevel = $this->engine->getResourceHierarchyLevel($view, $blockNameHierarchy, $hierarchyLevel); // The actually existing block name in $resource $blockName = $blockNameHierarchy[$hierarchyLevel]; // Escape if no resource exists for this block if (!$resource) { if (\count($blockNameHierarchy) !== \count(array_unique($blockNameHierarchy))) { throw new LogicException(sprintf('Unable to render the form because the block names array contains duplicates: "%s".', implode('", "', array_reverse($blockNameHierarchy)))); } throw new LogicException(sprintf('Unable to render the form as none of the following blocks exist: "%s".', implode('", "', array_reverse($blockNameHierarchy)))); } // Merge the passed with the existing attributes if (isset($variables['attr']) && isset($scopeVariables['attr'])) { $variables['attr'] = array_replace($scopeVariables['attr'], $variables['attr']); } // Merge the passed with the exist *label* attributes if (isset($variables['label_attr']) && isset($scopeVariables['label_attr'])) { $variables['label_attr'] = array_replace($scopeVariables['label_attr'], $variables['label_attr']); } // Do not use array_replace_recursive(), otherwise array variables // cannot be overwritten $variables = array_replace($scopeVariables, $variables); // In order to make recursive calls possible, we need to store the block hierarchy, // the current level of the hierarchy and the variables so that this method can // resume rendering one level higher of the hierarchy when it is called recursively. // // We need to store these values in maps (associative arrays) because within a // call to widget() another call to widget() can be made, but for a different view // object. These nested calls should not override each other. $this->blockNameHierarchyMap[$viewAndSuffixCacheKey] = $blockNameHierarchy; $this->hierarchyLevelMap[$viewAndSuffixCacheKey] = $hierarchyLevel; // We also need to store the variables for the view so that we can render other // blocks for the same view using the same variables as in the outer block. $this->variableStack[$viewCacheKey][] = $variables; // Do the rendering $html = $this->engine->renderBlock($view, $resource, $blockName, $variables); // Clear the stack array_pop($this->variableStack[$viewCacheKey]); // Clear the caches if they were filled for the first time within // this function call if ($hierarchyInit) { unset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey], $this->hierarchyLevelMap[$viewAndSuffixCacheKey]); } if ($varInit) { unset($this->variableStack[$viewCacheKey]); } if ($renderOnlyOnce) { $view->setRendered(); } return $html; }
php
public function searchAndRenderBlock(FormView $view, $blockNameSuffix, array $variables = []) { $renderOnlyOnce = 'row' === $blockNameSuffix || 'widget' === $blockNameSuffix; if ($renderOnlyOnce && $view->isRendered()) { // This is not allowed, because it would result in rendering same IDs multiple times, which is not valid. @trigger_error(sprintf('You are calling "form_%s" for field "%s" which has already been rendered before, trying to render fields which were already rendered is deprecated since Symfony 4.2 and will throw an exception in 5.0.', $blockNameSuffix, $view->vars['name']), E_USER_DEPRECATED); // throw new BadMethodCallException(sprintf('Field "%s" has already been rendered. Save result of previous render call to variable and output that instead.', $view->vars['name'])); return ''; } // The cache key for storing the variables and types $viewCacheKey = $view->vars[self::CACHE_KEY_VAR]; $viewAndSuffixCacheKey = $viewCacheKey.$blockNameSuffix; // In templates, we have to deal with two kinds of block hierarchies: // // +---------+ +---------+ // | Theme B | -------> | Theme A | // +---------+ +---------+ // // form_widget -------> form_widget // ^ // | // choice_widget -----> choice_widget // // The first kind of hierarchy is the theme hierarchy. This allows to // override the block "choice_widget" from Theme A in the extending // Theme B. This kind of inheritance needs to be supported by the // template engine and, for example, offers "parent()" or similar // functions to fall back from the custom to the parent implementation. // // The second kind of hierarchy is the form type hierarchy. This allows // to implement a custom "choice_widget" block (no matter in which theme), // or to fallback to the block of the parent type, which would be // "form_widget" in this example (again, no matter in which theme). // If the designer wants to explicitly fallback to "form_widget" in their // custom "choice_widget", for example because they only want to wrap // a <div> around the original implementation, they can call the // widget() function again to render the block for the parent type. // // The second kind is implemented in the following blocks. if (!isset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey])) { // INITIAL CALL // Calculate the hierarchy of template blocks and start on // the bottom level of the hierarchy (= "_<id>_<section>" block) $blockNameHierarchy = []; foreach ($view->vars['block_prefixes'] as $blockNamePrefix) { $blockNameHierarchy[] = $blockNamePrefix.'_'.$blockNameSuffix; } $hierarchyLevel = \count($blockNameHierarchy) - 1; $hierarchyInit = true; } else { // RECURSIVE CALL // If a block recursively calls searchAndRenderBlock() again, resume rendering // using the parent type in the hierarchy. $blockNameHierarchy = $this->blockNameHierarchyMap[$viewAndSuffixCacheKey]; $hierarchyLevel = $this->hierarchyLevelMap[$viewAndSuffixCacheKey] - 1; $hierarchyInit = false; } // The variables are cached globally for a view (instead of for the // current suffix) if (!isset($this->variableStack[$viewCacheKey])) { $this->variableStack[$viewCacheKey] = []; // The default variable scope contains all view variables, merged with // the variables passed explicitly to the helper $scopeVariables = $view->vars; $varInit = true; } else { // Reuse the current scope and merge it with the explicitly passed variables $scopeVariables = end($this->variableStack[$viewCacheKey]); $varInit = false; } // Load the resource where this block can be found $resource = $this->engine->getResourceForBlockNameHierarchy($view, $blockNameHierarchy, $hierarchyLevel); // Update the current hierarchy level to the one at which the resource was // found. For example, if looking for "choice_widget", but only a resource // is found for its parent "form_widget", then the level is updated here // to the parent level. $hierarchyLevel = $this->engine->getResourceHierarchyLevel($view, $blockNameHierarchy, $hierarchyLevel); // The actually existing block name in $resource $blockName = $blockNameHierarchy[$hierarchyLevel]; // Escape if no resource exists for this block if (!$resource) { if (\count($blockNameHierarchy) !== \count(array_unique($blockNameHierarchy))) { throw new LogicException(sprintf('Unable to render the form because the block names array contains duplicates: "%s".', implode('", "', array_reverse($blockNameHierarchy)))); } throw new LogicException(sprintf('Unable to render the form as none of the following blocks exist: "%s".', implode('", "', array_reverse($blockNameHierarchy)))); } // Merge the passed with the existing attributes if (isset($variables['attr']) && isset($scopeVariables['attr'])) { $variables['attr'] = array_replace($scopeVariables['attr'], $variables['attr']); } // Merge the passed with the exist *label* attributes if (isset($variables['label_attr']) && isset($scopeVariables['label_attr'])) { $variables['label_attr'] = array_replace($scopeVariables['label_attr'], $variables['label_attr']); } // Do not use array_replace_recursive(), otherwise array variables // cannot be overwritten $variables = array_replace($scopeVariables, $variables); // In order to make recursive calls possible, we need to store the block hierarchy, // the current level of the hierarchy and the variables so that this method can // resume rendering one level higher of the hierarchy when it is called recursively. // // We need to store these values in maps (associative arrays) because within a // call to widget() another call to widget() can be made, but for a different view // object. These nested calls should not override each other. $this->blockNameHierarchyMap[$viewAndSuffixCacheKey] = $blockNameHierarchy; $this->hierarchyLevelMap[$viewAndSuffixCacheKey] = $hierarchyLevel; // We also need to store the variables for the view so that we can render other // blocks for the same view using the same variables as in the outer block. $this->variableStack[$viewCacheKey][] = $variables; // Do the rendering $html = $this->engine->renderBlock($view, $resource, $blockName, $variables); // Clear the stack array_pop($this->variableStack[$viewCacheKey]); // Clear the caches if they were filled for the first time within // this function call if ($hierarchyInit) { unset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey], $this->hierarchyLevelMap[$viewAndSuffixCacheKey]); } if ($varInit) { unset($this->variableStack[$viewCacheKey]); } if ($renderOnlyOnce) { $view->setRendered(); } return $html; }
[ "public", "function", "searchAndRenderBlock", "(", "FormView", "$", "view", ",", "$", "blockNameSuffix", ",", "array", "$", "variables", "=", "[", "]", ")", "{", "$", "renderOnlyOnce", "=", "'row'", "===", "$", "blockNameSuffix", "||", "'widget'", "===", "$"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormRenderer.php#L130-L280
train
Returns the HTML code for the given block name suffix.
[ 30522, 2270, 3853, 3945, 5685, 7389, 4063, 23467, 1006, 2433, 8584, 1002, 3193, 1010, 1002, 3796, 18442, 6342, 26989, 2595, 1010, 9140, 1002, 10857, 1027, 1031, 1033, 1007, 1063, 1002, 17552, 2239, 2135, 2239, 3401, 1027, 1005, 5216, 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...
getgrav/grav
system/src/Grav/Common/Scheduler/Scheduler.php
Scheduler.isCrontabSetup
public function isCrontabSetup() { $process = new Process('crontab -l'); $process->run(); if ($process->isSuccessful()) { $output = $process->getOutput(); return preg_match('$bin\/grav schedule$', $output) ? 1 : 0; } $error = $process->getErrorOutput(); return Utils::startsWith($error, 'crontab: no crontab') ? 0 : 2; }
php
public function isCrontabSetup() { $process = new Process('crontab -l'); $process->run(); if ($process->isSuccessful()) { $output = $process->getOutput(); return preg_match('$bin\/grav schedule$', $output) ? 1 : 0; } $error = $process->getErrorOutput(); return Utils::startsWith($error, 'crontab: no crontab') ? 0 : 2; }
[ "public", "function", "isCrontabSetup", "(", ")", "{", "$", "process", "=", "new", "Process", "(", "'crontab -l'", ")", ";", "$", "process", "->", "run", "(", ")", ";", "if", "(", "$", "process", "->", "isSuccessful", "(", ")", ")", "{", "$", "output...
Helper to determine if cron job is setup @return int
[ "Helper", "to", "determine", "if", "cron", "job", "is", "setup" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Scheduler.php#L247-L261
train
Check if crontab is setup
[ 30522, 2270, 3853, 2003, 26775, 12162, 7875, 13462, 6279, 1006, 1007, 1063, 1002, 2832, 1027, 2047, 2832, 1006, 1005, 13675, 12162, 7875, 1011, 1048, 1005, 1007, 1025, 1002, 2832, 1011, 1028, 2448, 1006, 1007, 1025, 2065, 1006, 1002, 2832, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.isUrlExcluded
protected function isUrlExcluded() { $excludedUrls = $this->getAttributes('exclude_unknown_urls', null); $siteUrls = $this->getAttributes('urls', null); if (!empty($excludedUrls) && !empty($siteUrls)) { $url = $this->request->getParam('url'); $parsedUrl = parse_url($url); $trackingUrl = new SiteUrls(); $urls = $trackingUrl->groupUrlsByHost(array($this->idSite => $siteUrls)); $idSites = $trackingUrl->getIdSitesMatchingUrl($parsedUrl, $urls); $isUrlExcluded = !isset($idSites) || !in_array($this->idSite, $idSites); return $isUrlExcluded; } return false; }
php
protected function isUrlExcluded() { $excludedUrls = $this->getAttributes('exclude_unknown_urls', null); $siteUrls = $this->getAttributes('urls', null); if (!empty($excludedUrls) && !empty($siteUrls)) { $url = $this->request->getParam('url'); $parsedUrl = parse_url($url); $trackingUrl = new SiteUrls(); $urls = $trackingUrl->groupUrlsByHost(array($this->idSite => $siteUrls)); $idSites = $trackingUrl->getIdSitesMatchingUrl($parsedUrl, $urls); $isUrlExcluded = !isset($idSites) || !in_array($this->idSite, $idSites); return $isUrlExcluded; } return false; }
[ "protected", "function", "isUrlExcluded", "(", ")", "{", "$", "excludedUrls", "=", "$", "this", "->", "getAttributes", "(", "'exclude_unknown_urls'", ",", "null", ")", ";", "$", "siteUrls", "=", "$", "this", "->", "getAttributes", "(", "'urls'", ",", "null",...
Checks if request URL is excluded @return bool
[ "Checks", "if", "request", "URL", "is", "excluded" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/VisitExcluded.php#L312-L331
train
Is url excluded?
[ 30522, 5123, 3853, 2003, 3126, 2571, 2595, 20464, 13936, 1006, 1007, 1063, 1002, 12421, 3126, 4877, 1027, 1002, 2023, 1011, 1028, 2131, 19321, 3089, 8569, 4570, 1006, 1005, 23329, 1035, 4242, 1035, 24471, 4877, 1005, 1010, 19701, 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
core/Db/Adapter.php
Adapter.getAdapterClassName
private static function getAdapterClassName($adapterName) { $className = 'Piwik\Db\Adapter\\' . str_replace(' ', '\\', ucwords(str_replace(array('_', '\\'), ' ', strtolower($adapterName)))); if (!class_exists($className)) { throw new \Exception(sprintf("Adapter '%s' is not valid. Maybe check that your Matomo configuration files in config/*.ini.php are readable by the webserver.", $adapterName)); } return $className; }
php
private static function getAdapterClassName($adapterName) { $className = 'Piwik\Db\Adapter\\' . str_replace(' ', '\\', ucwords(str_replace(array('_', '\\'), ' ', strtolower($adapterName)))); if (!class_exists($className)) { throw new \Exception(sprintf("Adapter '%s' is not valid. Maybe check that your Matomo configuration files in config/*.ini.php are readable by the webserver.", $adapterName)); } return $className; }
[ "private", "static", "function", "getAdapterClassName", "(", "$", "adapterName", ")", "{", "$", "className", "=", "'Piwik\\Db\\Adapter\\\\'", ".", "str_replace", "(", "' '", ",", "'\\\\'", ",", "ucwords", "(", "str_replace", "(", "array", "(", "'_'", ",", "'\\...
Get adapter class name @param string $adapterName @return string @throws \Exception
[ "Get", "adapter", "class", "name" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter.php#L68-L75
train
Get adapter class name
[ 30522, 2797, 10763, 3853, 2131, 8447, 13876, 2121, 26266, 18442, 1006, 1002, 15581, 11795, 14074, 1007, 1063, 1002, 2465, 18442, 1027, 1005, 14255, 9148, 2243, 1032, 16962, 1032, 15581, 2121, 1032, 1032, 1005, 1012, 2358, 2099, 1035, 5672, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Manager.php
Manager.getThemeEnabled
public function getThemeEnabled() { $plugins = $this->getLoadedPlugins(); $theme = false; foreach ($plugins as $plugin) { /* @var $plugin Plugin */ if ($plugin->isTheme() && $this->isPluginActivated($plugin->getPluginName()) ) { if ($plugin->getPluginName() != self::DEFAULT_THEME) { return $plugin; // enabled theme (not default) } $theme = $plugin; // default theme } } return $theme; }
php
public function getThemeEnabled() { $plugins = $this->getLoadedPlugins(); $theme = false; foreach ($plugins as $plugin) { /* @var $plugin Plugin */ if ($plugin->isTheme() && $this->isPluginActivated($plugin->getPluginName()) ) { if ($plugin->getPluginName() != self::DEFAULT_THEME) { return $plugin; // enabled theme (not default) } $theme = $plugin; // default theme } } return $theme; }
[ "public", "function", "getThemeEnabled", "(", ")", "{", "$", "plugins", "=", "$", "this", "->", "getLoadedPlugins", "(", ")", ";", "$", "theme", "=", "false", ";", "foreach", "(", "$", "plugins", "as", "$", "plugin", ")", "{", "/* @var $plugin Plugin */", ...
Returns the currently enabled theme. If no theme is enabled, the **Morpheus** plugin is returned (this is the base and default theme). @return Plugin @api
[ "Returns", "the", "currently", "enabled", "theme", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L689-L706
train
Get the enabled theme
[ 30522, 2270, 3853, 2131, 10760, 4168, 8189, 23242, 1006, 1007, 1063, 1002, 13354, 7076, 1027, 1002, 2023, 1011, 1028, 2131, 17468, 24759, 15916, 7076, 1006, 1007, 1025, 1002, 4323, 1027, 6270, 1025, 18921, 6776, 1006, 1002, 13354, 7076, 200...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Form.php
Form.getNormData
public function getNormData() { if ($this->inheritData) { if (!$this->parent) { throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.'); } return $this->parent->getNormData(); } if (!$this->defaultDataSet) { if ($this->lockSetData) { throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getNormData() if the form data has not already been set.'); } $this->setData($this->config->getData()); } return $this->normData; }
php
public function getNormData() { if ($this->inheritData) { if (!$this->parent) { throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.'); } return $this->parent->getNormData(); } if (!$this->defaultDataSet) { if ($this->lockSetData) { throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getNormData() if the form data has not already been set.'); } $this->setData($this->config->getData()); } return $this->normData; }
[ "public", "function", "getNormData", "(", ")", "{", "if", "(", "$", "this", "->", "inheritData", ")", "{", "if", "(", "!", "$", "this", "->", "parent", ")", "{", "throw", "new", "RuntimeException", "(", "'The form is configured to inherit its parent\\'s data, bu...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L416-L435
train
Returns the form data
[ 30522, 2270, 3853, 2131, 12131, 26876, 6790, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 22490, 2850, 2696, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6687, 1007, 1063, 5466, 2047, 2448, 7292, 10288, 24422, 1006, 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...
matomo-org/matomo
libs/Zend/Db/Select.php
Zend_Db_Select.having
public function having($cond, $value = null, $type = null) { if ($value !== null) { $cond = $this->_adapter->quoteInto($cond, $value, $type); } if ($this->_parts[self::HAVING]) { $this->_parts[self::HAVING][] = self::SQL_AND . " ($cond)"; } else { $this->_parts[self::HAVING][] = "($cond)"; } return $this; }
php
public function having($cond, $value = null, $type = null) { if ($value !== null) { $cond = $this->_adapter->quoteInto($cond, $value, $type); } if ($this->_parts[self::HAVING]) { $this->_parts[self::HAVING][] = self::SQL_AND . " ($cond)"; } else { $this->_parts[self::HAVING][] = "($cond)"; } return $this; }
[ "public", "function", "having", "(", "$", "cond", ",", "$", "value", "=", "null", ",", "$", "type", "=", "null", ")", "{", "if", "(", "$", "value", "!==", "null", ")", "{", "$", "cond", "=", "$", "this", "->", "_adapter", "->", "quoteInto", "(", ...
Adds a HAVING condition to the query by AND. If a value is passed as the second param, it will be quoted and replaced into the condition wherever a question-mark appears. See {@link where()} for an example @param string $cond The HAVING condition. @param mixed $value OPTIONAL The value to quote into the condition. @param int $type OPTIONAL The type of the given value @return Zend_Db_Select This Zend_Db_Select object.
[ "Adds", "a", "HAVING", "condition", "to", "the", "query", "by", "AND", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L533-L546
train
Add having clause
[ 30522, 2270, 3853, 2383, 1006, 1002, 9530, 2094, 1010, 1002, 3643, 1027, 19701, 1010, 1002, 2828, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 3643, 999, 1027, 1027, 19701, 1007, 1063, 1002, 9530, 2094, 1027, 1002, 2023, 1011, 1028, 1035, 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/Validation/ValidationData.php
ValidationData.extractValuesForWildcards
protected static function extractValuesForWildcards($masterData, $data, $attribute) { $keys = []; $pattern = str_replace('\*', '[^\.]+', preg_quote($attribute)); foreach ($data as $key => $value) { if ((bool) preg_match('/^'.$pattern.'/', $key, $matches)) { $keys[] = $matches[0]; } } $keys = array_unique($keys); $data = []; foreach ($keys as $key) { $data[$key] = Arr::get($masterData, $key); } return $data; }
php
protected static function extractValuesForWildcards($masterData, $data, $attribute) { $keys = []; $pattern = str_replace('\*', '[^\.]+', preg_quote($attribute)); foreach ($data as $key => $value) { if ((bool) preg_match('/^'.$pattern.'/', $key, $matches)) { $keys[] = $matches[0]; } } $keys = array_unique($keys); $data = []; foreach ($keys as $key) { $data[$key] = Arr::get($masterData, $key); } return $data; }
[ "protected", "static", "function", "extractValuesForWildcards", "(", "$", "masterData", ",", "$", "data", ",", "$", "attribute", ")", "{", "$", "keys", "=", "[", "]", ";", "$", "pattern", "=", "str_replace", "(", "'\\*'", ",", "'[^\\.]+'", ",", "preg_quote...
Get all of the exact attribute values for a given wildcard attribute. @param array $masterData @param array $data @param string $attribute @return array
[ "Get", "all", "of", "the", "exact", "attribute", "values", "for", "a", "given", "wildcard", "attribute", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/ValidationData.php#L54-L75
train
Extract values for wildcards
[ 30522, 5123, 10763, 3853, 14817, 10175, 15808, 29278, 29602, 16409, 18117, 1006, 1002, 3040, 2850, 2696, 1010, 1002, 2951, 1010, 1002, 17961, 1007, 1063, 1002, 6309, 1027, 1031, 1033, 1025, 1002, 5418, 1027, 2358, 2099, 1035, 5672, 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...
octobercms/october
modules/cms/twig/Loader.php
Loader.getCacheKey
public function getCacheKey($name) { if (!$this->validateCmsObject($name)) { return parent::getCacheKey($name); } return $this->obj->getTwigCacheKey(); }
php
public function getCacheKey($name) { if (!$this->validateCmsObject($name)) { return parent::getCacheKey($name); } return $this->obj->getTwigCacheKey(); }
[ "public", "function", "getCacheKey", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "validateCmsObject", "(", "$", "name", ")", ")", "{", "return", "parent", "::", "getCacheKey", "(", "$", "name", ")", ";", "}", "return", "$", "this",...
Returns the Twig cache key.
[ "Returns", "the", "Twig", "cache", "key", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L69-L76
train
Returns the cache key for the given CMS object.
[ 30522, 2270, 3853, 2131, 3540, 5403, 14839, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 9398, 3686, 27487, 6499, 2497, 20614, 1006, 1002, 2171, 1007, 1007, 1063, 2709, 6687, 1024, 1024, 2131, 3540, 5403, 14839, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Router.php
Router.getBindingCallback
public function getBindingCallback($key) { if (isset($this->binders[$key = str_replace('-', '_', $key)])) { return $this->binders[$key]; } }
php
public function getBindingCallback($key) { if (isset($this->binders[$key = str_replace('-', '_', $key)])) { return $this->binders[$key]; } }
[ "public", "function", "getBindingCallback", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "binders", "[", "$", "key", "=", "str_replace", "(", "'-'", ",", "'_'", ",", "$", "key", ")", "]", ")", ")", "{", "return", "$", "t...
Get the binding callback for a given binding. @param string $key @return \Closure|null
[ "Get", "the", "binding", "callback", "for", "a", "given", "binding", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L948-L953
train
Get the binding callback for a given key
[ 30522, 2270, 3853, 2131, 8428, 4667, 9289, 20850, 8684, 1006, 1002, 3145, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 14187, 2545, 1031, 1002, 3145, 1027, 2358, 2099, 1035, 5672, 1006, 1005, 1011, 1005, 1010, 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...
matomo-org/matomo
libs/Zend/Db/Select.php
Zend_Db_Select.limitPage
public function limitPage($page, $rowCount) { $page = ($page > 0) ? $page : 1; $rowCount = ($rowCount > 0) ? $rowCount : 1; $this->_parts[self::LIMIT_COUNT] = (int) $rowCount; $this->_parts[self::LIMIT_OFFSET] = (int) $rowCount * ($page - 1); return $this; }
php
public function limitPage($page, $rowCount) { $page = ($page > 0) ? $page : 1; $rowCount = ($rowCount > 0) ? $rowCount : 1; $this->_parts[self::LIMIT_COUNT] = (int) $rowCount; $this->_parts[self::LIMIT_OFFSET] = (int) $rowCount * ($page - 1); return $this; }
[ "public", "function", "limitPage", "(", "$", "page", ",", "$", "rowCount", ")", "{", "$", "page", "=", "(", "$", "page", ">", "0", ")", "?", "$", "page", ":", "1", ";", "$", "rowCount", "=", "(", "$", "rowCount", ">", "0", ")", "?", "$", "row...
Sets the limit and count by page number. @param int $page Limit results to this page number. @param int $rowCount Use this many rows per page. @return Zend_Db_Select This Zend_Db_Select object.
[ "Sets", "the", "limit", "and", "count", "by", "page", "number", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L635-L642
train
Limit the number of rows to a certain page
[ 30522, 2270, 3853, 5787, 13704, 1006, 1002, 3931, 1010, 1002, 5216, 3597, 16671, 1007, 1063, 1002, 3931, 1027, 1006, 1002, 3931, 1028, 1014, 1007, 1029, 1002, 3931, 1024, 1015, 1025, 1002, 5216, 3597, 16671, 1027, 1006, 1002, 5216, 3597, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ArrayNodeDefinition.php
ArrayNodeDefinition.validateConcreteNode
protected function validateConcreteNode(ArrayNode $node) { $path = $node->getPath(); if (null !== $this->key) { throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path)); } if (false === $this->allowEmptyValue) { throw new InvalidDefinitionException(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s"', $path)); } if (true === $this->atLeastOne) { throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path)); } if ($this->default) { throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path)); } if (false !== $this->addDefaultChildren) { throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path)); } }
php
protected function validateConcreteNode(ArrayNode $node) { $path = $node->getPath(); if (null !== $this->key) { throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path)); } if (false === $this->allowEmptyValue) { throw new InvalidDefinitionException(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s"', $path)); } if (true === $this->atLeastOne) { throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path)); } if ($this->default) { throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path)); } if (false !== $this->addDefaultChildren) { throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path)); } }
[ "protected", "function", "validateConcreteNode", "(", "ArrayNode", "$", "node", ")", "{", "$", "path", "=", "$", "node", "->", "getPath", "(", ")", ";", "if", "(", "null", "!==", "$", "this", "->", "key", ")", "{", "throw", "new", "InvalidDefinitionExcep...
Validate the configuration of a concrete node. @throws InvalidDefinitionException
[ "Validate", "the", "configuration", "of", "a", "concrete", "node", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L466-L489
train
Validate concrete node
[ 30522, 5123, 3853, 9398, 3686, 8663, 16748, 6528, 10244, 1006, 9140, 3630, 3207, 1002, 13045, 1007, 1063, 1002, 4130, 1027, 1002, 13045, 1011, 1028, 2131, 15069, 1006, 1007, 1025, 2065, 1006, 19701, 999, 1027, 1027, 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...
matomo-org/matomo
core/Filechecks.php
Filechecks.getErrorMessageMissingPermissions
public static function getErrorMessageMissingPermissions($path) { $message = "Please check that the web server has enough permission to write to these files/directories:<br />"; if (SettingsServer::isWindows()) { $message .= "On Windows, check that the folder is not read only and is writable.\n You can try to execute:<br />"; } else { $message .= "For example, on a GNU/Linux server if your Apache httpd user is " . Common::sanitizeInputValue(self::getUser()) . ", you can try to execute:<br />\n" . "<code>chown -R ". Common::sanitizeInputValue(self::getUserAndGroup()) ." " . Common::sanitizeInputValue($path) . "</code><br />"; } $message .= self::getMakeWritableCommand($path); return $message; }
php
public static function getErrorMessageMissingPermissions($path) { $message = "Please check that the web server has enough permission to write to these files/directories:<br />"; if (SettingsServer::isWindows()) { $message .= "On Windows, check that the folder is not read only and is writable.\n You can try to execute:<br />"; } else { $message .= "For example, on a GNU/Linux server if your Apache httpd user is " . Common::sanitizeInputValue(self::getUser()) . ", you can try to execute:<br />\n" . "<code>chown -R ". Common::sanitizeInputValue(self::getUserAndGroup()) ." " . Common::sanitizeInputValue($path) . "</code><br />"; } $message .= self::getMakeWritableCommand($path); return $message; }
[ "public", "static", "function", "getErrorMessageMissingPermissions", "(", "$", "path", ")", "{", "$", "message", "=", "\"Please check that the web server has enough permission to write to these files/directories:<br />\"", ";", "if", "(", "SettingsServer", "::", "isWindows", "(...
Returns friendly error message explaining how to fix permissions @param string $path to the directory missing permissions @return string Error message
[ "Returns", "friendly", "error", "message", "explaining", "how", "to", "fix", "permissions" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Filechecks.php#L126-L143
train
Get the error message for missing permissions
[ 30522, 2270, 10763, 3853, 2131, 2121, 29165, 7834, 3736, 3351, 15630, 7741, 4842, 25481, 2015, 1006, 1002, 4130, 1007, 1063, 1002, 4471, 1027, 1000, 3531, 4638, 2008, 1996, 4773, 8241, 2038, 2438, 6656, 2000, 4339, 2000, 2122, 6764, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/classes/ListColumn.php
ListColumn.getId
public function getId($suffix = null) { $id = 'column'; $id .= '-'.$this->columnName; if ($suffix) { $id .= '-'.$suffix; } return HtmlHelper::nameToId($id); }
php
public function getId($suffix = null) { $id = 'column'; $id .= '-'.$this->columnName; if ($suffix) { $id .= '-'.$suffix; } return HtmlHelper::nameToId($id); }
[ "public", "function", "getId", "(", "$", "suffix", "=", "null", ")", "{", "$", "id", "=", "'column'", ";", "$", "id", ".=", "'-'", ".", "$", "this", "->", "columnName", ";", "if", "(", "$", "suffix", ")", "{", "$", "id", ".=", "'-'", ".", "$", ...
Returns a value suitable for the column id property. @param string $suffix Specify a suffix string @return string
[ "Returns", "a", "value", "suitable", "for", "the", "column", "id", "property", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/ListColumn.php#L192-L203
train
Returns the column id
[ 30522, 2270, 3853, 2131, 3593, 1006, 1002, 16809, 1027, 19701, 1007, 1063, 1002, 8909, 1027, 1005, 5930, 1005, 1025, 1002, 8909, 1012, 1027, 1005, 1011, 1005, 1012, 1002, 2023, 1011, 1028, 5930, 18442, 1025, 2065, 1006, 1002, 16809, 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/DependencyInjection/EnvVarProcessor.php
EnvVarProcessor.getEnv
public function getEnv($prefix, $name, \Closure $getEnv) { $i = strpos($name, ':'); if ('key' === $prefix) { if (false === $i) { throw new RuntimeException(sprintf('Invalid env "key:%s": a key specifier should be provided.', $name)); } $next = substr($name, $i + 1); $key = substr($name, 0, $i); $array = $getEnv($next); if (!\is_array($array)) { throw new RuntimeException(sprintf('Resolved value of "%s" did not result in an array value.', $next)); } if (!isset($array[$key]) && !\array_key_exists($key, $array)) { throw new EnvNotFoundException(sprintf('Key "%s" not found in "%s" (resolved from "%s").', $key, json_encode($array), $next)); } return $array[$key]; } if ('default' === $prefix) { if (false === $i) { throw new RuntimeException(sprintf('Invalid env "default:%s": a fallback parameter should be provided.', $name)); } $next = substr($name, $i + 1); $default = substr($name, 0, $i); if ('' !== $default && !$this->container->hasParameter($default)) { throw new RuntimeException(sprintf('Invalid env fallback in "default:%s": parameter "%s" not found.', $name, $default)); } try { $env = $getEnv($next); if ('' !== $env && null !== $env) { return $env; } } catch (EnvNotFoundException $e) { // no-op } return '' === $default ? null : $this->container->getParameter($default); } if ('file' === $prefix || 'require' === $prefix) { if (!is_scalar($file = $getEnv($name))) { throw new RuntimeException(sprintf('Invalid file name: env var "%s" is non-scalar.', $name)); } if (!file_exists($file)) { throw new EnvNotFoundException(sprintf('File "%s" not found (resolved from "%s").', $file, $name)); } if ('file' === $prefix) { return file_get_contents($file); } else { return require $file; } } if (false !== $i || 'string' !== $prefix) { if (null === $env = $getEnv($name)) { return; } } elseif (isset($_ENV[$name])) { $env = $_ENV[$name]; } elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) { $env = $_SERVER[$name]; } elseif (false === ($env = getenv($name)) || null === $env) { // null is a possible value because of thread safety issues if (!$this->container->hasParameter("env($name)")) { throw new EnvNotFoundException(sprintf('Environment variable not found: "%s".', $name)); } if (null === $env = $this->container->getParameter("env($name)")) { return; } } if (!is_scalar($env)) { throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to %s.', $name, $prefix)); } if ('string' === $prefix) { return (string) $env; } if ('bool' === $prefix) { return (bool) (filter_var($env, FILTER_VALIDATE_BOOLEAN) ?: filter_var($env, FILTER_VALIDATE_INT) ?: filter_var($env, FILTER_VALIDATE_FLOAT)); } if ('int' === $prefix) { if (false === $env = filter_var($env, FILTER_VALIDATE_INT) ?: filter_var($env, FILTER_VALIDATE_FLOAT)) { throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to int.', $name)); } return (int) $env; } if ('float' === $prefix) { if (false === $env = filter_var($env, FILTER_VALIDATE_FLOAT)) { throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to float.', $name)); } return (float) $env; } if ('const' === $prefix) { if (!\defined($env)) { throw new RuntimeException(sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env)); } return \constant($env); } if ('base64' === $prefix) { return base64_decode($env); } if ('json' === $prefix) { $env = json_decode($env, true); if (JSON_ERROR_NONE !== json_last_error()) { throw new RuntimeException(sprintf('Invalid JSON in env var "%s": '.json_last_error_msg(), $name)); } if (null !== $env && !\is_array($env)) { throw new RuntimeException(sprintf('Invalid JSON env var "%s": array or null expected, %s given.', $name, \gettype($env))); } return $env; } if ('url' === $prefix) { $parsedEnv = parse_url($env); if (false === $parsedEnv) { throw new RuntimeException(sprintf('Invalid URL in env var "%s"', $name)); } if (!isset($parsedEnv['scheme'], $parsedEnv['host'])) { throw new RuntimeException(sprintf('Invalid URL env var "%s": schema and host expected, %s given.', $name, $env)); } $parsedEnv += [ 'port' => null, 'user' => null, 'pass' => null, 'path' => null, 'query' => null, 'fragment' => null, ]; // remove the '/' separator $parsedEnv['path'] = '/' === $parsedEnv['path'] ? null : substr($parsedEnv['path'], 1); return $parsedEnv; } if ('query_string' === $prefix) { $queryString = parse_url($env, PHP_URL_QUERY) ?: $env; parse_str($queryString, $result); return $result; } if ('resolve' === $prefix) { return preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($name) { if (!isset($match[1])) { return '%'; } $value = $this->container->getParameter($match[1]); if (!is_scalar($value)) { throw new RuntimeException(sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, \gettype($value))); } return $value; }, $env); } if ('csv' === $prefix) { return str_getcsv($env); } if ('trim' === $prefix) { return trim($env); } throw new RuntimeException(sprintf('Unsupported env var prefix "%s".', $prefix)); }
php
public function getEnv($prefix, $name, \Closure $getEnv) { $i = strpos($name, ':'); if ('key' === $prefix) { if (false === $i) { throw new RuntimeException(sprintf('Invalid env "key:%s": a key specifier should be provided.', $name)); } $next = substr($name, $i + 1); $key = substr($name, 0, $i); $array = $getEnv($next); if (!\is_array($array)) { throw new RuntimeException(sprintf('Resolved value of "%s" did not result in an array value.', $next)); } if (!isset($array[$key]) && !\array_key_exists($key, $array)) { throw new EnvNotFoundException(sprintf('Key "%s" not found in "%s" (resolved from "%s").', $key, json_encode($array), $next)); } return $array[$key]; } if ('default' === $prefix) { if (false === $i) { throw new RuntimeException(sprintf('Invalid env "default:%s": a fallback parameter should be provided.', $name)); } $next = substr($name, $i + 1); $default = substr($name, 0, $i); if ('' !== $default && !$this->container->hasParameter($default)) { throw new RuntimeException(sprintf('Invalid env fallback in "default:%s": parameter "%s" not found.', $name, $default)); } try { $env = $getEnv($next); if ('' !== $env && null !== $env) { return $env; } } catch (EnvNotFoundException $e) { // no-op } return '' === $default ? null : $this->container->getParameter($default); } if ('file' === $prefix || 'require' === $prefix) { if (!is_scalar($file = $getEnv($name))) { throw new RuntimeException(sprintf('Invalid file name: env var "%s" is non-scalar.', $name)); } if (!file_exists($file)) { throw new EnvNotFoundException(sprintf('File "%s" not found (resolved from "%s").', $file, $name)); } if ('file' === $prefix) { return file_get_contents($file); } else { return require $file; } } if (false !== $i || 'string' !== $prefix) { if (null === $env = $getEnv($name)) { return; } } elseif (isset($_ENV[$name])) { $env = $_ENV[$name]; } elseif (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) { $env = $_SERVER[$name]; } elseif (false === ($env = getenv($name)) || null === $env) { // null is a possible value because of thread safety issues if (!$this->container->hasParameter("env($name)")) { throw new EnvNotFoundException(sprintf('Environment variable not found: "%s".', $name)); } if (null === $env = $this->container->getParameter("env($name)")) { return; } } if (!is_scalar($env)) { throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to %s.', $name, $prefix)); } if ('string' === $prefix) { return (string) $env; } if ('bool' === $prefix) { return (bool) (filter_var($env, FILTER_VALIDATE_BOOLEAN) ?: filter_var($env, FILTER_VALIDATE_INT) ?: filter_var($env, FILTER_VALIDATE_FLOAT)); } if ('int' === $prefix) { if (false === $env = filter_var($env, FILTER_VALIDATE_INT) ?: filter_var($env, FILTER_VALIDATE_FLOAT)) { throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to int.', $name)); } return (int) $env; } if ('float' === $prefix) { if (false === $env = filter_var($env, FILTER_VALIDATE_FLOAT)) { throw new RuntimeException(sprintf('Non-numeric env var "%s" cannot be cast to float.', $name)); } return (float) $env; } if ('const' === $prefix) { if (!\defined($env)) { throw new RuntimeException(sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env)); } return \constant($env); } if ('base64' === $prefix) { return base64_decode($env); } if ('json' === $prefix) { $env = json_decode($env, true); if (JSON_ERROR_NONE !== json_last_error()) { throw new RuntimeException(sprintf('Invalid JSON in env var "%s": '.json_last_error_msg(), $name)); } if (null !== $env && !\is_array($env)) { throw new RuntimeException(sprintf('Invalid JSON env var "%s": array or null expected, %s given.', $name, \gettype($env))); } return $env; } if ('url' === $prefix) { $parsedEnv = parse_url($env); if (false === $parsedEnv) { throw new RuntimeException(sprintf('Invalid URL in env var "%s"', $name)); } if (!isset($parsedEnv['scheme'], $parsedEnv['host'])) { throw new RuntimeException(sprintf('Invalid URL env var "%s": schema and host expected, %s given.', $name, $env)); } $parsedEnv += [ 'port' => null, 'user' => null, 'pass' => null, 'path' => null, 'query' => null, 'fragment' => null, ]; // remove the '/' separator $parsedEnv['path'] = '/' === $parsedEnv['path'] ? null : substr($parsedEnv['path'], 1); return $parsedEnv; } if ('query_string' === $prefix) { $queryString = parse_url($env, PHP_URL_QUERY) ?: $env; parse_str($queryString, $result); return $result; } if ('resolve' === $prefix) { return preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($name) { if (!isset($match[1])) { return '%'; } $value = $this->container->getParameter($match[1]); if (!is_scalar($value)) { throw new RuntimeException(sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, \gettype($value))); } return $value; }, $env); } if ('csv' === $prefix) { return str_getcsv($env); } if ('trim' === $prefix) { return trim($env); } throw new RuntimeException(sprintf('Unsupported env var prefix "%s".', $prefix)); }
[ "public", "function", "getEnv", "(", "$", "prefix", ",", "$", "name", ",", "\\", "Closure", "$", "getEnv", ")", "{", "$", "i", "=", "strpos", "(", "$", "name", ",", "':'", ")", ";", "if", "(", "'key'", "===", "$", "prefix", ")", "{", "if", "(",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php#L57-L247
train
Get the value of an environment variable.
[ 30522, 2270, 3853, 2131, 2368, 2615, 1006, 1002, 17576, 1010, 1002, 2171, 1010, 1032, 8503, 1002, 2131, 2368, 2615, 1007, 1063, 1002, 1045, 1027, 2358, 14536, 2891, 1006, 1002, 2171, 1010, 1005, 1024, 1005, 1007, 1025, 2065, 1006, 1005, 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/Page.php
Page.eTag
public function eTag($var = null) { if ($var !== null) { $this->etag = $var; } if (!isset($this->etag)) { $this->etag = (bool)Grav::instance()['config']->get('system.pages.etag'); } return $this->etag; }
php
public function eTag($var = null) { if ($var !== null) { $this->etag = $var; } if (!isset($this->etag)) { $this->etag = (bool)Grav::instance()['config']->get('system.pages.etag'); } return $this->etag; }
[ "public", "function", "eTag", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "etag", "=", "$", "var", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "etag", ")", ")", "...
Gets and sets the option to show the etag header for the page. @param bool $var show etag header @return bool show etag header
[ "Gets", "and", "sets", "the", "option", "to", "show", "the", "etag", "header", "for", "the", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2053-L2063
train
Get the tag flag
[ 30522, 2270, 3853, 27859, 2290, 1006, 1002, 13075, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 13075, 999, 30524, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 27859, 2290, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 27859, 2290, 1027, 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...
octobercms/october
modules/cms/classes/CodeParser.php
CodeParser.extractClassFromFile
protected function extractClassFromFile($path) { $fileContent = file_get_contents($path); $matches = []; $pattern = '/Cms\S+_\S+Class/'; preg_match($pattern, $fileContent, $matches); if (!empty($matches[0])) { return $matches[0]; } return null; }
php
protected function extractClassFromFile($path) { $fileContent = file_get_contents($path); $matches = []; $pattern = '/Cms\S+_\S+Class/'; preg_match($pattern, $fileContent, $matches); if (!empty($matches[0])) { return $matches[0]; } return null; }
[ "protected", "function", "extractClassFromFile", "(", "$", "path", ")", "{", "$", "fileContent", "=", "file_get_contents", "(", "$", "path", ")", ";", "$", "matches", "=", "[", "]", ";", "$", "pattern", "=", "'/Cms\\S+_\\S+Class/'", ";", "preg_match", "(", ...
Extracts the class name from a cache file @return string
[ "Extracts", "the", "class", "name", "from", "a", "cache", "file" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L296-L308
train
Extracts the class from a file
[ 30522, 5123, 3853, 14817, 26266, 19699, 5358, 8873, 2571, 1006, 1002, 4130, 1007, 1063, 1002, 5371, 8663, 6528, 2102, 1027, 5371, 1035, 2131, 1035, 8417, 1006, 1002, 4130, 1007, 1025, 1002, 3503, 1027, 1031, 1033, 1025, 1002, 5418, 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...
overtrue/wechat
src/OfficialAccount/Card/CodeClient.php
CodeClient.disable
public function disable(string $code, string $cardId = '') { $params = [ 'code' => $code, 'card_id' => $cardId, ]; return $this->httpPostJson('card/code/unavailable', $params); }
php
public function disable(string $code, string $cardId = '') { $params = [ 'code' => $code, 'card_id' => $cardId, ]; return $this->httpPostJson('card/code/unavailable', $params); }
[ "public", "function", "disable", "(", "string", "$", "code", ",", "string", "$", "cardId", "=", "''", ")", "{", "$", "params", "=", "[", "'code'", "=>", "$", "code", ",", "'card_id'", "=>", "$", "cardId", ",", "]", ";", "return", "$", "this", "->",...
设置卡券失效. @param string $code @param string $cardId @return mixed
[ "设置卡券失效", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Card/CodeClient.php#L123-L131
train
Disable a card code
[ 30522, 2270, 3853, 4487, 19150, 1006, 5164, 1002, 3642, 1010, 5164, 1002, 4003, 3593, 1027, 1005, 1005, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 3642, 1005, 1027, 1028, 1002, 3642, 1010, 1005, 4003, 1035, 8909, 1005, 1027, 1028, 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/DatabaseServiceProvider.php
DatabaseServiceProvider.registerConnectionServices
protected function registerConnectionServices() { // The connection factory is used to create the actual connection instances on // the database. We will inject the factory into the manager so that it may // make the connections while they are actually needed and not of before. $this->app->singleton('db.factory', function ($app) { return new ConnectionFactory($app); }); // The database manager is used to resolve various connections, since multiple // connections might be managed. It also implements the connection resolver // interface which may be used by other components requiring connections. $this->app->singleton('db', function ($app) { return new DatabaseManager($app, $app['db.factory']); }); $this->app->bind('db.connection', function ($app) { return $app['db']->connection(); }); }
php
protected function registerConnectionServices() { // The connection factory is used to create the actual connection instances on // the database. We will inject the factory into the manager so that it may // make the connections while they are actually needed and not of before. $this->app->singleton('db.factory', function ($app) { return new ConnectionFactory($app); }); // The database manager is used to resolve various connections, since multiple // connections might be managed. It also implements the connection resolver // interface which may be used by other components requiring connections. $this->app->singleton('db', function ($app) { return new DatabaseManager($app, $app['db.factory']); }); $this->app->bind('db.connection', function ($app) { return $app['db']->connection(); }); }
[ "protected", "function", "registerConnectionServices", "(", ")", "{", "// The connection factory is used to create the actual connection instances on", "// the database. We will inject the factory into the manager so that it may", "// make the connections while they are actually needed and not of be...
Register the primary database bindings. @return void
[ "Register", "the", "primary", "database", "bindings", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/DatabaseServiceProvider.php#L49-L68
train
Registers connection services
[ 30522, 5123, 3853, 4236, 8663, 2638, 22014, 2121, 7903, 2229, 1006, 1007, 1063, 1013, 1013, 1996, 4434, 4713, 2003, 2109, 2000, 3443, 1996, 5025, 4434, 12107, 2006, 1013, 1013, 1996, 7809, 1012, 2057, 2097, 1999, 20614, 1996, 4713, 2046, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Builder.php
Builder.isNestedUnder
protected function isNestedUnder($relation, $name) { return Str::contains($name, '.') && Str::startsWith($name, $relation.'.'); }
php
protected function isNestedUnder($relation, $name) { return Str::contains($name, '.') && Str::startsWith($name, $relation.'.'); }
[ "protected", "function", "isNestedUnder", "(", "$", "relation", ",", "$", "name", ")", "{", "return", "Str", "::", "contains", "(", "$", "name", ",", "'.'", ")", "&&", "Str", "::", "startsWith", "(", "$", "name", ",", "$", "relation", ".", "'.'", ")"...
Determine if the relationship is nested. @param string $relation @param string $name @return bool
[ "Determine", "if", "the", "relationship", "is", "nested", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L631-L634
train
Checks if the name of the relation is nested under the relation name
[ 30522, 5123, 3853, 3475, 17944, 20824, 1006, 1002, 7189, 1010, 1002, 2171, 1007, 1063, 2709, 2358, 2099, 1024, 1024, 3397, 1006, 1002, 2171, 1010, 1005, 1012, 1005, 1007, 1004, 1004, 2358, 2099, 1024, 1024, 4627, 24415, 1006, 1002, 2171, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Manager.php
Zend_Cache_Manager._mergeOptions
protected function _mergeOptions(array $current, array $options) { if (isset($options['frontend']['name'])) { $current['frontend']['name'] = $options['frontend']['name']; } if (isset($options['backend']['name'])) { $current['backend']['name'] = $options['backend']['name']; } if (isset($options['frontend']['options'])) { foreach ($options['frontend']['options'] as $key=>$value) { $current['frontend']['options'][$key] = $value; } } if (isset($options['backend']['options'])) { foreach ($options['backend']['options'] as $key=>$value) { $current['backend']['options'][$key] = $value; } } return $current; }
php
protected function _mergeOptions(array $current, array $options) { if (isset($options['frontend']['name'])) { $current['frontend']['name'] = $options['frontend']['name']; } if (isset($options['backend']['name'])) { $current['backend']['name'] = $options['backend']['name']; } if (isset($options['frontend']['options'])) { foreach ($options['frontend']['options'] as $key=>$value) { $current['frontend']['options'][$key] = $value; } } if (isset($options['backend']['options'])) { foreach ($options['backend']['options'] as $key=>$value) { $current['backend']['options'][$key] = $value; } } return $current; }
[ "protected", "function", "_mergeOptions", "(", "array", "$", "current", ",", "array", "$", "options", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'frontend'", "]", "[", "'name'", "]", ")", ")", "{", "$", "current", "[", "'frontend'", "]", ...
Simple method to merge two configuration arrays @param array $current @param array $options @return array
[ "Simple", "method", "to", "merge", "two", "configuration", "arrays" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Manager.php#L278-L297
train
Merge options from frontend and backend
[ 30522, 5123, 3853, 1035, 13590, 7361, 9285, 1006, 9140, 1002, 2783, 1010, 9140, 1002, 7047, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 7047, 1031, 1005, 2392, 10497, 1005, 1033, 1031, 1005, 2171, 1005, 1033, 1007, 1007, 1063, 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/HTML/QuickForm2/Factory.php
HTML_QuickForm2_Factory.createElement
public static function createElement($type, $name = null, $attributes = null, array $data = array()) { $type = strtolower($type); if (!isset(self::$elementTypes[$type])) { throw new HTML_QuickForm2_InvalidArgumentException("Element type '$type' is not known"); } list($className, $includeFile) = self::$elementTypes[$type]; if (!class_exists($className)) { HTML_QuickForm2_Loader::loadClass($className, $includeFile); } return new $className($name, $attributes, $data); }
php
public static function createElement($type, $name = null, $attributes = null, array $data = array()) { $type = strtolower($type); if (!isset(self::$elementTypes[$type])) { throw new HTML_QuickForm2_InvalidArgumentException("Element type '$type' is not known"); } list($className, $includeFile) = self::$elementTypes[$type]; if (!class_exists($className)) { HTML_QuickForm2_Loader::loadClass($className, $includeFile); } return new $className($name, $attributes, $data); }
[ "public", "static", "function", "createElement", "(", "$", "type", ",", "$", "name", "=", "null", ",", "$", "attributes", "=", "null", ",", "array", "$", "data", "=", "array", "(", ")", ")", "{", "$", "type", "=", "strtolower", "(", "$", "type", ")...
Creates a new element object of the given type @param string Type name (treated case-insensitively) @param mixed Element name (passed to element's constructor) @param mixed Element attributes (passed to element's constructor) @param array Element-specific data (passed to element's constructor) @return HTML_QuickForm2_Node A created element @throws HTML_QuickForm2_InvalidArgumentException If type name is unknown @throws HTML_QuickForm2_NotFoundException If class for the element can not be found and/or loaded from file
[ "Creates", "a", "new", "element", "object", "of", "the", "given", "type" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Factory.php#L161-L173
train
Creates an element of the given type
[ 30522, 2270, 10763, 3853, 3443, 12260, 3672, 1006, 1002, 2828, 1010, 1002, 2171, 1027, 19701, 1010, 1002, 12332, 1027, 19701, 1010, 9140, 1002, 2951, 1027, 9140, 1006, 1007, 1007, 1063, 1002, 2828, 1027, 2358, 5339, 12898, 13777, 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...
matomo-org/matomo
core/Db.php
Db.segmentedQuery
public static function segmentedQuery($sql, $first, $last, $step, $params = array()) { if ($step > 0) { for ($i = $first; $i <= $last; $i += $step) { $currentParams = array_merge($params, array($i, $i + $step)); self::query($sql, $currentParams); } } else { for ($i = $first; $i >= $last; $i += $step) { $currentParams = array_merge($params, array($i, $i + $step)); self::query($sql, $currentParams); } } }
php
public static function segmentedQuery($sql, $first, $last, $step, $params = array()) { if ($step > 0) { for ($i = $first; $i <= $last; $i += $step) { $currentParams = array_merge($params, array($i, $i + $step)); self::query($sql, $currentParams); } } else { for ($i = $first; $i >= $last; $i += $step) { $currentParams = array_merge($params, array($i, $i + $step)); self::query($sql, $currentParams); } } }
[ "public", "static", "function", "segmentedQuery", "(", "$", "sql", ",", "$", "first", ",", "$", "last", ",", "$", "step", ",", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "$", "step", ">", "0", ")", "{", "for", "(", "$", "i", ...
Performs a `UPDATE` or `DELETE` statement on a table one chunk at a time. This function will break up a query into several smaller queries by using only a limited number of rows at a time. This function should be used when executing a non-query statement will take a long time to finish. Using several smaller queries will ensure that the table will not be locked for too long. @param string $sql The SQL to perform. The last two conditions of the `WHERE` expression must be as follows: `'id >= ? AND id < ?'` where **id** is the int id of the table. @param int $first The minimum ID to loop from. @param int $last The maximum ID to loop to. @param int $step The maximum number of rows to scan in one query. @param array $params Parameters to bind in the query, `array(param1 => value1, param2 => value2)`
[ "Performs", "a", "UPDATE", "or", "DELETE", "statement", "on", "a", "table", "one", "chunk", "at", "a", "time", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db.php#L627-L640
train
Segmented query.
[ 30522, 2270, 10763, 3853, 6903, 2098, 4226, 2854, 1006, 1002, 29296, 1010, 1002, 2034, 1010, 1002, 2197, 1010, 1002, 3357, 1010, 1002, 11498, 5244, 1027, 9140, 1006, 1007, 1007, 1063, 2065, 1006, 1002, 3357, 1028, 1014, 1007, 1063, 2005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/CoreAdminHome/Model/DuplicateActionRemover.php
DuplicateActionRemover.fixDuplicateActionsInTable
public function fixDuplicateActionsInTable($table, $realIdAction, $duplicateIdActions) { $idactionColumns = $this->getIdActionTableColumnsFromMetadata(); $idactionColumns = array_values($idactionColumns[$table]); $table = Common::prefixTable($table); $inFromIdsExpression = $this->getInFromIdsExpression($duplicateIdActions); $setExpression = "%1\$s = IF(($inFromIdsExpression), $realIdAction, %1\$s)"; $sql = "UPDATE $table SET\n"; foreach ($idactionColumns as $index => $column) { if ($index != 0) { $sql .= ",\n"; } $sql .= sprintf($setExpression, $column); } $sql .= $this->getWhereToGetRowsUsingDuplicateActions($idactionColumns, $duplicateIdActions); Db::query($sql); }
php
public function fixDuplicateActionsInTable($table, $realIdAction, $duplicateIdActions) { $idactionColumns = $this->getIdActionTableColumnsFromMetadata(); $idactionColumns = array_values($idactionColumns[$table]); $table = Common::prefixTable($table); $inFromIdsExpression = $this->getInFromIdsExpression($duplicateIdActions); $setExpression = "%1\$s = IF(($inFromIdsExpression), $realIdAction, %1\$s)"; $sql = "UPDATE $table SET\n"; foreach ($idactionColumns as $index => $column) { if ($index != 0) { $sql .= ",\n"; } $sql .= sprintf($setExpression, $column); } $sql .= $this->getWhereToGetRowsUsingDuplicateActions($idactionColumns, $duplicateIdActions); Db::query($sql); }
[ "public", "function", "fixDuplicateActionsInTable", "(", "$", "table", ",", "$", "realIdAction", ",", "$", "duplicateIdActions", ")", "{", "$", "idactionColumns", "=", "$", "this", "->", "getIdActionTableColumnsFromMetadata", "(", ")", ";", "$", "idactionColumns", ...
Executes one SQL statement that sets all idaction columns in a table to a single value, if the values of those columns are in the specified set (`$duplicateIdActions`). Notes: The SQL will look like: UPDATE $table SET col1 = IF((col1 IN ($duplicateIdActions)), $realIdAction, col1), col2 = IF((col2 IN ($duplicateIdActions)), $realIdAction, col2), ... WHERE col1 IN ($duplicateIdActions) OR col2 IN ($duplicateIdActions) OR ... @param string $table @param int $realIdAction The idaction to set column values to. @param int[] $duplicateIdActions The idaction values that should be changed.
[ "Executes", "one", "SQL", "statement", "that", "sets", "all", "idaction", "columns", "in", "a", "table", "to", "a", "single", "value", "if", "the", "values", "of", "those", "columns", "are", "in", "the", "specified", "set", "(", "$duplicateIdActions", ")", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/Model/DuplicateActionRemover.php#L112-L131
train
Fix duplicate actions in a table
[ 30522, 2270, 3853, 8081, 8566, 24759, 24695, 18908, 8496, 18447, 3085, 1006, 1002, 2795, 1010, 1002, 2613, 8524, 7542, 1010, 1002, 24473, 8524, 22014, 1007, 1063, 1002, 16096, 7542, 25778, 2819, 3619, 1027, 1002, 2023, 1011, 1028, 2131, 852...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/FormErrorIterator.php
FormErrorIterator.seek
public function seek($position) { if (!isset($this->errors[$position])) { throw new OutOfBoundsException('The offset '.$position.' does not exist.'); } reset($this->errors); while ($position !== key($this->errors)) { next($this->errors); } }
php
public function seek($position) { if (!isset($this->errors[$position])) { throw new OutOfBoundsException('The offset '.$position.' does not exist.'); } reset($this->errors); while ($position !== key($this->errors)) { next($this->errors); } }
[ "public", "function", "seek", "(", "$", "position", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "errors", "[", "$", "position", "]", ")", ")", "{", "throw", "new", "OutOfBoundsException", "(", "'The offset '", ".", "$", "position", ".", ...
Sets the position of the iterator. @param int $position The new position @throws OutOfBoundsException If the position is invalid
[ "Sets", "the", "position", "of", "the", "iterator", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormErrorIterator.php#L239-L250
train
Seeks to the next error in the error array.
[ 30522, 2270, 3853, 6148, 1006, 1002, 30524, 2047, 2041, 11253, 15494, 3366, 2595, 24422, 1006, 1005, 1996, 16396, 1005, 1012, 1002, 2597, 1012, 1005, 2515, 2025, 4839, 1012, 1005, 1007, 1025, 1065, 25141, 1006, 1002, 2023, 1011, 1028, 10697...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Extension.php
Extension.createMenu
protected static function createMenu($title, $uri, $icon = 'fa-bars', $parentId = 0) { $menuModel = config('admin.database.menu_model'); $lastOrder = $menuModel::max('order'); $menuModel::create([ 'parent_id' => $parentId, 'order' => $lastOrder + 1, 'title' => $title, 'icon' => $icon, 'uri' => $uri, ]); }
php
protected static function createMenu($title, $uri, $icon = 'fa-bars', $parentId = 0) { $menuModel = config('admin.database.menu_model'); $lastOrder = $menuModel::max('order'); $menuModel::create([ 'parent_id' => $parentId, 'order' => $lastOrder + 1, 'title' => $title, 'icon' => $icon, 'uri' => $uri, ]); }
[ "protected", "static", "function", "createMenu", "(", "$", "title", ",", "$", "uri", ",", "$", "icon", "=", "'fa-bars'", ",", "$", "parentId", "=", "0", ")", "{", "$", "menuModel", "=", "config", "(", "'admin.database.menu_model'", ")", ";", "$", "lastOr...
Create a item in laravel-admin left side menu. @param string $title @param string $uri @param string $icon @param int $parentId
[ "Create", "a", "item", "in", "laravel", "-", "admin", "left", "side", "menu", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Extension.php#L303-L316
train
Create menu item
[ 30522, 5123, 10763, 3853, 3443, 3549, 2226, 1006, 1002, 2516, 1010, 1002, 24471, 2072, 1010, 1002, 12696, 1027, 1005, 6904, 1011, 6963, 1005, 1010, 30524, 9247, 1024, 1024, 3443, 1006, 1031, 1005, 6687, 1035, 8909, 1005, 1027, 1028, 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/Mail/Storage/Folder/Mbox.php
Zend_Mail_Storage_Folder_Mbox.getFolders
public function getFolders($rootFolder = null) { if (!$rootFolder) { return $this->_rootFolder; } $currentFolder = $this->_rootFolder; $subname = trim($rootFolder, DIRECTORY_SEPARATOR); while ($currentFolder) { @list($entry, $subname) = @explode(DIRECTORY_SEPARATOR, $subname, 2); $currentFolder = $currentFolder->$entry; if (!$subname) { break; } } if ($currentFolder->getGlobalName() != DIRECTORY_SEPARATOR . trim($rootFolder, DIRECTORY_SEPARATOR)) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception("folder $rootFolder not found"); } return $currentFolder; }
php
public function getFolders($rootFolder = null) { if (!$rootFolder) { return $this->_rootFolder; } $currentFolder = $this->_rootFolder; $subname = trim($rootFolder, DIRECTORY_SEPARATOR); while ($currentFolder) { @list($entry, $subname) = @explode(DIRECTORY_SEPARATOR, $subname, 2); $currentFolder = $currentFolder->$entry; if (!$subname) { break; } } if ($currentFolder->getGlobalName() != DIRECTORY_SEPARATOR . trim($rootFolder, DIRECTORY_SEPARATOR)) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception("folder $rootFolder not found"); } return $currentFolder; }
[ "public", "function", "getFolders", "(", "$", "rootFolder", "=", "null", ")", "{", "if", "(", "!", "$", "rootFolder", ")", "{", "return", "$", "this", "->", "_rootFolder", ";", "}", "$", "currentFolder", "=", "$", "this", "->", "_rootFolder", ";", "$",...
get root folder or given folder @param string $rootFolder get folder structure for given folder, else root @return Zend_Mail_Storage_Folder root or wanted folder @throws Zend_Mail_Storage_Exception
[ "get", "root", "folder", "or", "given", "folder" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Folder/Mbox.php#L165-L189
train
get all folders
[ 30522, 2270, 3853, 2131, 10371, 2545, 1006, 1002, 7117, 10371, 2121, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 7117, 10371, 2121, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 1035, 7117, 10371, 2121, 1025, 1065, 1002, 2783, 10371, 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...
z-song/laravel-admin
src/Grid/Tools/PerPageSelector.php
PerPageSelector.render
public function render() { Admin::script($this->script()); $options = $this->getOptions()->map(function ($option) { $selected = ($option == $this->perPage) ? 'selected' : ''; $url = app('request')->fullUrlWithQuery([$this->perPageName => $option]); return "<option value=\"$url\" $selected>$option</option>"; })->implode("\r\n"); $trans = [ 'show' => trans('admin.show'), 'entries' => trans('admin.entries'), ]; return <<<EOT <label class="control-label pull-right" style="margin-right: 10px; font-weight: 100;"> <small>{$trans['show']}</small>&nbsp; <select class="input-sm {$this->grid->getPerPageName()}" name="per-page"> $options </select> &nbsp;<small>{$trans['entries']}</small> </label> EOT; }
php
public function render() { Admin::script($this->script()); $options = $this->getOptions()->map(function ($option) { $selected = ($option == $this->perPage) ? 'selected' : ''; $url = app('request')->fullUrlWithQuery([$this->perPageName => $option]); return "<option value=\"$url\" $selected>$option</option>"; })->implode("\r\n"); $trans = [ 'show' => trans('admin.show'), 'entries' => trans('admin.entries'), ]; return <<<EOT <label class="control-label pull-right" style="margin-right: 10px; font-weight: 100;"> <small>{$trans['show']}</small>&nbsp; <select class="input-sm {$this->grid->getPerPageName()}" name="per-page"> $options </select> &nbsp;<small>{$trans['entries']}</small> </label> EOT; }
[ "public", "function", "render", "(", ")", "{", "Admin", "::", "script", "(", "$", "this", "->", "script", "(", ")", ")", ";", "$", "options", "=", "$", "this", "->", "getOptions", "(", ")", "->", "map", "(", "function", "(", "$", "option", ")", "...
Render PerPageSelector。 @return string
[ "Render", "PerPageSelector。" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/PerPageSelector.php#L66-L94
train
Render the page options
[ 30522, 2270, 3853, 17552, 1006, 1007, 1063, 4748, 10020, 1024, 1024, 5896, 1006, 1002, 2023, 1011, 1028, 5896, 1006, 1007, 1007, 1025, 1002, 7047, 1027, 1002, 2023, 1011, 1028, 2131, 7361, 9285, 1006, 1007, 1011, 1028, 4949, 1006, 3853, 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/Routing/Loader/PhpFileLoader.php
PhpFileLoader.load
public function load($file, $type = null) { $path = $this->locator->locate($file); $this->setCurrentDir(\dirname($path)); // the closure forbids access to the private scope in the included file $loader = $this; $load = \Closure::bind(function ($file) use ($loader) { return include $file; }, null, ProtectedPhpFileLoader::class); $result = $load($path); if (\is_object($result) && \is_callable($result)) { $collection = new RouteCollection(); $result(new RoutingConfigurator($collection, $this, $path, $file)); } else { $collection = $result; } $collection->addResource(new FileResource($path)); return $collection; }
php
public function load($file, $type = null) { $path = $this->locator->locate($file); $this->setCurrentDir(\dirname($path)); // the closure forbids access to the private scope in the included file $loader = $this; $load = \Closure::bind(function ($file) use ($loader) { return include $file; }, null, ProtectedPhpFileLoader::class); $result = $load($path); if (\is_object($result) && \is_callable($result)) { $collection = new RouteCollection(); $result(new RoutingConfigurator($collection, $this, $path, $file)); } else { $collection = $result; } $collection->addResource(new FileResource($path)); return $collection; }
[ "public", "function", "load", "(", "$", "file", ",", "$", "type", "=", "null", ")", "{", "$", "path", "=", "$", "this", "->", "locator", "->", "locate", "(", "$", "file", ")", ";", "$", "this", "->", "setCurrentDir", "(", "\\", "dirname", "(", "$...
Loads a PHP file. @param string $file A PHP file path @param string|null $type The resource type @return RouteCollection A RouteCollection instance
[ "Loads", "a", "PHP", "file", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Loader/PhpFileLoader.php#L36-L59
train
Load a file and return the RouteCollection
[ 30522, 2270, 3853, 7170, 1006, 1002, 5371, 1010, 1002, 2828, 1027, 19701, 1007, 1063, 1002, 4130, 1027, 1002, 2023, 1011, 1028, 8840, 11266, 2953, 1011, 1028, 12453, 1006, 1002, 5371, 1007, 1025, 1002, 2023, 1011, 1028, 2275, 10841, 14343, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Support/Str.php
Str.is
public static function is($pattern, $value) { $patterns = Arr::wrap($pattern); if (empty($patterns)) { return false; } foreach ($patterns as $pattern) { // If the given value is an exact match we can of course return true right // from the beginning. Otherwise, we will translate asterisks and do an // actual pattern match against the two strings to see if they match. if ($pattern == $value) { return true; } $pattern = preg_quote($pattern, '#'); // Asterisks are translated into zero-or-more regular expression wildcards // to make it convenient to check if the strings starts with the given // pattern such as "library/*", making any string check convenient. $pattern = str_replace('\*', '.*', $pattern); if (preg_match('#^'.$pattern.'\z#u', $value) === 1) { return true; } } return false; }
php
public static function is($pattern, $value) { $patterns = Arr::wrap($pattern); if (empty($patterns)) { return false; } foreach ($patterns as $pattern) { // If the given value is an exact match we can of course return true right // from the beginning. Otherwise, we will translate asterisks and do an // actual pattern match against the two strings to see if they match. if ($pattern == $value) { return true; } $pattern = preg_quote($pattern, '#'); // Asterisks are translated into zero-or-more regular expression wildcards // to make it convenient to check if the strings starts with the given // pattern such as "library/*", making any string check convenient. $pattern = str_replace('\*', '.*', $pattern); if (preg_match('#^'.$pattern.'\z#u', $value) === 1) { return true; } } return false; }
[ "public", "static", "function", "is", "(", "$", "pattern", ",", "$", "value", ")", "{", "$", "patterns", "=", "Arr", "::", "wrap", "(", "$", "pattern", ")", ";", "if", "(", "empty", "(", "$", "patterns", ")", ")", "{", "return", "false", ";", "}"...
Determine if a given string matches a given pattern. @param string|array $pattern @param string $value @return bool
[ "Determine", "if", "a", "given", "string", "matches", "a", "given", "pattern", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Str.php#L154-L183
train
Check if the given value matches the given pattern
[ 30522, 2270, 10763, 3853, 2003, 1006, 1002, 5418, 1010, 30524, 1024, 1024, 10236, 1006, 1002, 5418, 1007, 1025, 2065, 1006, 4064, 1006, 1002, 7060, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 18921, 6776, 1006, 1002, 7060, 2004, 1002, 5418, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.willBeArchived
public function willBeArchived() { if ($this->isEmpty()) { return true; } $idSites = $this->idSites; if (!is_array($idSites)) { $idSites = array($this->idSites); } return Rules::isRequestAuthorizedToArchive() || Rules::isBrowserArchivingAvailableForSegments() || Rules::isSegmentPreProcessed($idSites, $this); }
php
public function willBeArchived() { if ($this->isEmpty()) { return true; } $idSites = $this->idSites; if (!is_array($idSites)) { $idSites = array($this->idSites); } return Rules::isRequestAuthorizedToArchive() || Rules::isBrowserArchivingAvailableForSegments() || Rules::isSegmentPreProcessed($idSites, $this); }
[ "public", "function", "willBeArchived", "(", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "true", ";", "}", "$", "idSites", "=", "$", "this", "->", "idSites", ";", "if", "(", "!", "is_array", "(", "$", "idSites",...
Detects whether the Piwik instance is configured to be able to archive this segment. It checks whether the segment will be either archived via browser or cli archiving. It does not check if the segment has been archived. If you want to know whether the segment has been archived, the actual report data needs to be requested. This method does not take any date/period into consideration. Meaning a Piwik instance might be able to archive this segment in general, but not for a certain period if eg the archiving of range dates is disabled. @return bool
[ "Detects", "whether", "the", "Piwik", "instance", "is", "configured", "to", "be", "able", "to", "archive", "this", "segment", ".", "It", "checks", "whether", "the", "segment", "will", "be", "either", "archived", "via", "browser", "or", "cli", "archiving", "....
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Segment.php#L235-L249
train
Returns true if the request is authorized to archive for the website
[ 30522, 2270, 3853, 2097, 4783, 2906, 5428, 7178, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2003, 6633, 13876, 2100, 1006, 1007, 1007, 1063, 2709, 2995, 1025, 1065, 1002, 8909, 28032, 2229, 1027, 1002, 2023, 1011, 1028, 8909, 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...
z-song/laravel-admin
src/Form/Field/HasMany.php
HasMany.resetInputKey
protected function resetInputKey(array &$input, array $column) { /** * flip the column name array set. * * for example, for the DateRange, the column like as below * * ["start" => "created_at", "end" => "updated_at"] * * to: * * [ "created_at" => "start", "updated_at" => "end" ] */ $column = array_flip($column); /** * $this->column is the inputs array's node name, default is the relation name. * * So... $input[$this->column] is the data of this column's inputs data * * in the HasMany relation, has many data/field set, $set is field set in the below */ foreach ($input[$this->column] as $index => $set) { /* * foreach the field set to find the corresponding $column */ foreach ($set as $name => $value) { /* * if doesn't have column name, continue to the next loop */ if (!array_key_exists($name, $column)) { continue; } /** * example: $newKey = created_atstart. * * Σ( ° △ °|||)︴ * * I don't know why a form need range input? Only can imagine is for range search.... */ $newKey = $name.$column[$name]; /* * set new key */ Arr::set($input, "{$this->column}.$index.$newKey", $value); /* * forget the old key and value */ Arr::forget($input, "{$this->column}.$index.$name"); } } }
php
protected function resetInputKey(array &$input, array $column) { /** * flip the column name array set. * * for example, for the DateRange, the column like as below * * ["start" => "created_at", "end" => "updated_at"] * * to: * * [ "created_at" => "start", "updated_at" => "end" ] */ $column = array_flip($column); /** * $this->column is the inputs array's node name, default is the relation name. * * So... $input[$this->column] is the data of this column's inputs data * * in the HasMany relation, has many data/field set, $set is field set in the below */ foreach ($input[$this->column] as $index => $set) { /* * foreach the field set to find the corresponding $column */ foreach ($set as $name => $value) { /* * if doesn't have column name, continue to the next loop */ if (!array_key_exists($name, $column)) { continue; } /** * example: $newKey = created_atstart. * * Σ( ° △ °|||)︴ * * I don't know why a form need range input? Only can imagine is for range search.... */ $newKey = $name.$column[$name]; /* * set new key */ Arr::set($input, "{$this->column}.$index.$newKey", $value); /* * forget the old key and value */ Arr::forget($input, "{$this->column}.$index.$name"); } } }
[ "protected", "function", "resetInputKey", "(", "array", "&", "$", "input", ",", "array", "$", "column", ")", "{", "/**\n * flip the column name array set.\n *\n * for example, for the DateRange, the column like as below\n *\n * [\"start\" => \"crea...
Reset input key for validation. @param array $input @param array $column $column is the column name array set @return void.
[ "Reset", "input", "key", "for", "validation", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/HasMany.php#L208-L262
train
Reset input key
[ 30522, 5123, 3853, 25141, 2378, 18780, 14839, 1006, 9140, 1004, 1002, 7953, 1010, 9140, 1002, 5930, 1007, 1063, 1013, 1008, 1008, 1008, 11238, 1996, 5930, 2171, 9140, 2275, 1012, 1008, 1008, 2005, 2742, 1010, 2005, 1996, 3058, 24388, 2063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.getNonce
public static function getNonce($action, $previousTick = false) { // Don't regenerate this again if not needed if (isset(static::$nonces[$action][$previousTick])) { return static::$nonces[$action][$previousTick]; } $nonce = md5(self::generateNonceString($action, $previousTick)); static::$nonces[$action][$previousTick] = $nonce; return static::$nonces[$action][$previousTick]; }
php
public static function getNonce($action, $previousTick = false) { // Don't regenerate this again if not needed if (isset(static::$nonces[$action][$previousTick])) { return static::$nonces[$action][$previousTick]; } $nonce = md5(self::generateNonceString($action, $previousTick)); static::$nonces[$action][$previousTick] = $nonce; return static::$nonces[$action][$previousTick]; }
[ "public", "static", "function", "getNonce", "(", "$", "action", ",", "$", "previousTick", "=", "false", ")", "{", "// Don't regenerate this again if not needed", "if", "(", "isset", "(", "static", "::", "$", "nonces", "[", "$", "action", "]", "[", "$", "prev...
Creates a hashed nonce tied to the passed action. Tied to the current user and time. The nonce for a given action is the same for 12 hours. @param string $action the action the nonce is tied to (e.g. save-user-admin or move-page-homepage) @param bool $previousTick if true, generates the token for the previous tick (the previous 12 hours) @return string the nonce
[ "Creates", "a", "hashed", "nonce", "tied", "to", "the", "passed", "action", ".", "Tied", "to", "the", "current", "user", "and", "time", ".", "The", "nonce", "for", "a", "given", "action", "is", "the", "same", "for", "12", "hours", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1103-L1113
train
Get a nonce for an action
[ 30522, 2270, 10763, 3853, 2131, 8540, 3401, 1006, 1002, 2895, 1010, 1002, 3025, 26348, 1027, 6270, 1007, 1063, 1013, 1013, 2123, 1005, 1056, 19723, 24454, 3686, 2023, 2153, 2065, 2025, 2734, 2065, 1006, 26354, 3388, 1006, 10763, 1024, 1024,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/MiddlewareAwareTrait.php
MiddlewareAwareTrait.callMiddlewareStack
public function callMiddlewareStack(ServerRequestInterface $request, ResponseInterface $response) { if (is_null($this->tip)) { $this->seedMiddlewareStack(); } /** @var callable $start */ $start = $this->tip; $this->middlewareLock = true; $response = $start($request, $response); $this->middlewareLock = false; return $response; }
php
public function callMiddlewareStack(ServerRequestInterface $request, ResponseInterface $response) { if (is_null($this->tip)) { $this->seedMiddlewareStack(); } /** @var callable $start */ $start = $this->tip; $this->middlewareLock = true; $response = $start($request, $response); $this->middlewareLock = false; return $response; }
[ "public", "function", "callMiddlewareStack", "(", "ServerRequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "tip", ")", ")", "{", "$", "this", "->", "seedMiddlewareStack", "(", ...
Call middleware stack @param ServerRequestInterface $request A request object @param ResponseInterface $response A response object @return ResponseInterface
[ "Call", "middleware", "stack" ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/MiddlewareAwareTrait.php#L109-L120
train
Call the middleware stack
[ 30522, 2270, 3853, 2655, 4328, 20338, 8059, 9153, 3600, 1006, 8241, 2890, 15500, 18447, 2121, 12172, 1002, 5227, 1010, 3433, 18447, 2121, 12172, 1002, 3433, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 2023, 1011, 1028, 5955, 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...
laravel/framework
src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php
SqlServerGrammar.compileFrom
protected function compileFrom(Builder $query, $table) { $from = parent::compileFrom($query, $table); if (is_string($query->lock)) { return $from.' '.$query->lock; } if (! is_null($query->lock)) { return $from.' with(rowlock,'.($query->lock ? 'updlock,' : '').'holdlock)'; } return $from; }
php
protected function compileFrom(Builder $query, $table) { $from = parent::compileFrom($query, $table); if (is_string($query->lock)) { return $from.' '.$query->lock; } if (! is_null($query->lock)) { return $from.' with(rowlock,'.($query->lock ? 'updlock,' : '').'holdlock)'; } return $from; }
[ "protected", "function", "compileFrom", "(", "Builder", "$", "query", ",", "$", "table", ")", "{", "$", "from", "=", "parent", "::", "compileFrom", "(", "$", "query", ",", "$", "table", ")", ";", "if", "(", "is_string", "(", "$", "query", "->", "lock...
Compile the "from" portion of the query. @param \Illuminate\Database\Query\Builder $query @param string $table @return string
[ "Compile", "the", "from", "portion", "of", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php#L77-L90
train
Compiles a query into a string
[ 30522, 5123, 3853, 4012, 22090, 19699, 5358, 1006, 12508, 1002, 23032, 1010, 1002, 2795, 1007, 1063, 1002, 2013, 1027, 6687, 1024, 1024, 4012, 22090, 19699, 5358, 1006, 1002, 23032, 1010, 1002, 2795, 1007, 1025, 2065, 1006, 2003, 1035, 5164...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Validator/Constraints/UserPasswordValidator.php
UserPasswordValidator.validate
public function validate($password, Constraint $constraint) { if (!$constraint instanceof UserPassword) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UserPassword'); } if (null === $password || '' === $password) { $this->context->addViolation($constraint->message); return; } $user = $this->tokenStorage->getToken()->getUser(); if (!$user instanceof UserInterface) { throw new ConstraintDefinitionException('The User object must implement the UserInterface interface.'); } $encoder = $this->encoderFactory->getEncoder($user); if (!$encoder->isPasswordValid($user->getPassword(), $password, $user->getSalt())) { $this->context->addViolation($constraint->message); } }
php
public function validate($password, Constraint $constraint) { if (!$constraint instanceof UserPassword) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UserPassword'); } if (null === $password || '' === $password) { $this->context->addViolation($constraint->message); return; } $user = $this->tokenStorage->getToken()->getUser(); if (!$user instanceof UserInterface) { throw new ConstraintDefinitionException('The User object must implement the UserInterface interface.'); } $encoder = $this->encoderFactory->getEncoder($user); if (!$encoder->isPasswordValid($user->getPassword(), $password, $user->getSalt())) { $this->context->addViolation($constraint->message); } }
[ "public", "function", "validate", "(", "$", "password", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "$", "constraint", "instanceof", "UserPassword", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "constraint", ",", "__NAMESP...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Validator/Constraints/UserPasswordValidator.php#L36-L59
train
Validate the password
[ 30522, 2270, 3853, 9398, 3686, 1006, 1002, 20786, 1010, 27142, 1002, 27142, 1007, 1063, 2065, 1006, 999, 1002, 27142, 6013, 11253, 5310, 15194, 18351, 1007, 1063, 5466, 2047, 9223, 13874, 10288, 24422, 1006, 1002, 27142, 1010, 1035, 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...
z-song/laravel-admin
src/Middleware/Pjax.php
Pjax.handleErrorResponse
protected function handleErrorResponse(Response $response) { $exception = $response->exception; $error = new MessageBag([ 'type' => get_class($exception), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), ]); return back()->withInput()->withErrors($error, 'exception'); }
php
protected function handleErrorResponse(Response $response) { $exception = $response->exception; $error = new MessageBag([ 'type' => get_class($exception), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), ]); return back()->withInput()->withErrors($error, 'exception'); }
[ "protected", "function", "handleErrorResponse", "(", "Response", "$", "response", ")", "{", "$", "exception", "=", "$", "response", "->", "exception", ";", "$", "error", "=", "new", "MessageBag", "(", "[", "'type'", "=>", "get_class", "(", "$", "exception", ...
Handle Response with exceptions. @param Response $response @return \Illuminate\Http\RedirectResponse
[ "Handle", "Response", "with", "exceptions", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Middleware/Pjax.php#L66-L78
train
Handle error response
[ 30522, 5123, 3853, 5047, 2121, 29165, 6072, 26029, 3366, 1006, 3433, 1002, 3433, 1007, 1063, 1002, 6453, 1027, 1002, 3433, 1011, 1028, 6453, 1025, 1002, 7561, 1027, 2047, 4471, 16078, 1006, 1031, 1005, 2828, 1005, 1027, 1028, 2131, 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...
symfony/symfony
src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php
ImmutableEventDispatcher.dispatch
public function dispatch($event/*, string $eventName = null*/) { $eventName = 1 < \func_num_args() ? \func_get_arg(1) : null; if (\is_scalar($event)) { // deprecated $swap = $event; $event = $eventName ?? new Event(); $eventName = $swap; } return $this->dispatcher->dispatch($event, $eventName); }
php
public function dispatch($event/*, string $eventName = null*/) { $eventName = 1 < \func_num_args() ? \func_get_arg(1) : null; if (\is_scalar($event)) { // deprecated $swap = $event; $event = $eventName ?? new Event(); $eventName = $swap; } return $this->dispatcher->dispatch($event, $eventName); }
[ "public", "function", "dispatch", "(", "$", "event", "/*, string $eventName = null*/", ")", "{", "$", "eventName", "=", "1", "<", "\\", "func_num_args", "(", ")", "?", "\\", "func_get_arg", "(", "1", ")", ":", "null", ";", "if", "(", "\\", "is_scalar", "...
{@inheritdoc} @param string|null $eventName
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php#L33-L45
train
Dispatches an event to the registered handlers
[ 30522, 2270, 3853, 18365, 1006, 1002, 2724, 1013, 1008, 1010, 5164, 1002, 2724, 18442, 1027, 30524, 2213, 1035, 12098, 5620, 1006, 1007, 1029, 1032, 4569, 2278, 1035, 2131, 1035, 12098, 2290, 1006, 1015, 1007, 1024, 19701, 1025, 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...
dompdf/dompdf
src/Adapter/PDFLib.php
PDFLib.set_opacity
public function set_opacity($opacity, $mode = "Normal") { if ($mode === "Normal" && is_null($opacity) === false) { $this->_set_gstate("opacityfill=$opacity opacitystroke=$opacity"); $this->_current_opacity = $opacity; } }
php
public function set_opacity($opacity, $mode = "Normal") { if ($mode === "Normal" && is_null($opacity) === false) { $this->_set_gstate("opacityfill=$opacity opacitystroke=$opacity"); $this->_current_opacity = $opacity; } }
[ "public", "function", "set_opacity", "(", "$", "opacity", ",", "$", "mode", "=", "\"Normal\"", ")", "{", "if", "(", "$", "mode", "===", "\"Normal\"", "&&", "is_null", "(", "$", "opacity", ")", "===", "false", ")", "{", "$", "this", "->", "_set_gstate",...
Sets the opacity @param $opacity @param $mode
[ "Sets", "the", "opacity" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/PDFLib.php#L693-L699
train
Set the current opacity
[ 30522, 2270, 3853, 2275, 1035, 6728, 6305, 3012, 1006, 1002, 6728, 6305, 3012, 1010, 1002, 5549, 1027, 1000, 3671, 1000, 1007, 1063, 2065, 1006, 1002, 5549, 1027, 1027, 1027, 1000, 3671, 1000, 1004, 1004, 2003, 1035, 19701, 1006, 1002, 67...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Relation.php
Relation.render
public function render() { $relation = $this->model->{$this->name}(); $renderable = $this->getNullRenderable(); if ($relation instanceof HasOne || $relation instanceof BelongsTo || $relation instanceof MorphOne ) { $model = $this->model->{$this->name}; if (!$model instanceof Model) { $model = $relation->getRelated(); } $renderable = new Show($model, $this->builder); $renderable->panel()->title($this->title); } if ($relation instanceof HasMany || $relation instanceof MorphMany || $relation instanceof BelongsToMany || $relation instanceof HasManyThrough ) { $renderable = new Grid($relation->getRelated(), $this->builder); $renderable->setName($this->name) ->setTitle($this->title) ->setRelation($relation); } return $renderable->render(); }
php
public function render() { $relation = $this->model->{$this->name}(); $renderable = $this->getNullRenderable(); if ($relation instanceof HasOne || $relation instanceof BelongsTo || $relation instanceof MorphOne ) { $model = $this->model->{$this->name}; if (!$model instanceof Model) { $model = $relation->getRelated(); } $renderable = new Show($model, $this->builder); $renderable->panel()->title($this->title); } if ($relation instanceof HasMany || $relation instanceof MorphMany || $relation instanceof BelongsToMany || $relation instanceof HasManyThrough ) { $renderable = new Grid($relation->getRelated(), $this->builder); $renderable->setName($this->name) ->setTitle($this->title) ->setRelation($relation); } return $renderable->render(); }
[ "public", "function", "render", "(", ")", "{", "$", "relation", "=", "$", "this", "->", "model", "->", "{", "$", "this", "->", "name", "}", "(", ")", ";", "$", "renderable", "=", "$", "this", "->", "getNullRenderable", "(", ")", ";", "if", "(", "...
Render this relation panel. @return string
[ "Render", "this", "relation", "panel", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Relation.php#L94-L128
train
Render the related model
[ 30522, 2270, 3853, 17552, 1006, 1007, 1063, 1002, 7189, 1027, 1002, 2023, 1011, 1028, 2944, 1011, 1028, 1063, 1002, 2023, 1011, 1028, 2171, 1065, 1006, 1007, 1025, 1002, 17552, 3085, 1027, 1002, 2023, 1011, 1028, 2131, 11231, 3363, 7389, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/SearchEngine.php
SearchEngine.getBackLinkFromUrlAndKeyword
public function getBackLinkFromUrlAndKeyword($url, $keyword) { if ($keyword === API::LABEL_KEYWORD_NOT_DEFINED) { return 'https://matomo.org/faq/general/#faq_144'; } $keyword = urlencode($keyword); $keyword = str_replace(urlencode('+'), urlencode(' '), $keyword); $host = substr($url, strpos($url, '//') + 2); $definition = $this->getDefinitionByHost($host); if (empty($definition['backlink'])) { return false; } $path = str_replace("{k}", $keyword, $definition['backlink']); return $url . (substr($url, -1) != '/' ? '/' : '') . $path; }
php
public function getBackLinkFromUrlAndKeyword($url, $keyword) { if ($keyword === API::LABEL_KEYWORD_NOT_DEFINED) { return 'https://matomo.org/faq/general/#faq_144'; } $keyword = urlencode($keyword); $keyword = str_replace(urlencode('+'), urlencode(' '), $keyword); $host = substr($url, strpos($url, '//') + 2); $definition = $this->getDefinitionByHost($host); if (empty($definition['backlink'])) { return false; } $path = str_replace("{k}", $keyword, $definition['backlink']); return $url . (substr($url, -1) != '/' ? '/' : '') . $path; }
[ "public", "function", "getBackLinkFromUrlAndKeyword", "(", "$", "url", ",", "$", "keyword", ")", "{", "if", "(", "$", "keyword", "===", "API", "::", "LABEL_KEYWORD_NOT_DEFINED", ")", "{", "return", "'https://matomo.org/faq/general/#faq_144'", ";", "}", "$", "keywo...
Return search engine URL for URL and keyword @see core/DataFiles/SearchEnginges.php @param string $url Domain name, e.g., search.piwik.org @param string $keyword Keyword, e.g., web+analytics @return string URL, e.g., http://search.piwik.org/q=web+analytics
[ "Return", "search", "engine", "URL", "for", "URL", "and", "keyword" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/SearchEngine.php#L485-L499
train
Get the back link for a given URL and keyword
[ 30522, 2270, 3853, 2131, 5963, 13767, 19699, 5358, 3126, 3122, 14839, 18351, 1006, 1002, 24471, 2140, 1010, 1002, 3145, 18351, 1007, 1063, 2065, 1006, 1002, 3145, 18351, 1027, 1027, 1027, 17928, 1024, 1024, 3830, 1035, 3145, 18351, 1035, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Validator/RecursiveContextualValidator.php
RecursiveContextualValidator.validateObject
private function validateObject($object, $propertyPath, array $groups, $traversalStrategy, ExecutionContextInterface $context) { try { $classMetadata = $this->metadataFactory->getMetadataFor($object); if (!$classMetadata instanceof ClassMetadataInterface) { throw new UnsupportedMetadataException(sprintf('The metadata factory should return instances of "Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata))); } $this->validateClassNode( $object, spl_object_hash($object), $classMetadata, $propertyPath, $groups, null, $traversalStrategy, $context ); } catch (NoSuchMetadataException $e) { // Rethrow if not Traversable if (!$object instanceof \Traversable) { throw $e; } // Rethrow unless IMPLICIT or TRAVERSE if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { throw $e; } $this->validateEachObjectIn( $object, $propertyPath, $groups, $context ); } }
php
private function validateObject($object, $propertyPath, array $groups, $traversalStrategy, ExecutionContextInterface $context) { try { $classMetadata = $this->metadataFactory->getMetadataFor($object); if (!$classMetadata instanceof ClassMetadataInterface) { throw new UnsupportedMetadataException(sprintf('The metadata factory should return instances of "Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata))); } $this->validateClassNode( $object, spl_object_hash($object), $classMetadata, $propertyPath, $groups, null, $traversalStrategy, $context ); } catch (NoSuchMetadataException $e) { // Rethrow if not Traversable if (!$object instanceof \Traversable) { throw $e; } // Rethrow unless IMPLICIT or TRAVERSE if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { throw $e; } $this->validateEachObjectIn( $object, $propertyPath, $groups, $context ); } }
[ "private", "function", "validateObject", "(", "$", "object", ",", "$", "propertyPath", ",", "array", "$", "groups", ",", "$", "traversalStrategy", ",", "ExecutionContextInterface", "$", "context", ")", "{", "try", "{", "$", "classMetadata", "=", "$", "this", ...
Validates an object against the constraints defined for its class. If no metadata is available for the class, but the class is an instance of {@link \Traversable} and the selected traversal strategy allows traversal, the object will be iterated and each nested object will be validated instead. @param object $object The object to cascade @param string $propertyPath The current property path @param (string|GroupSequence)[] $groups The validated groups @param int $traversalStrategy The strategy for traversing the cascaded object @param ExecutionContextInterface $context The current execution context @throws NoSuchMetadataException If the object has no associated metadata and does not implement {@link \Traversable} or if traversal is disabled via the $traversalStrategy argument @throws UnsupportedMetadataException If the metadata returned by the metadata factory does not implement {@link ClassMetadataInterface}
[ "Validates", "an", "object", "against", "the", "constraints", "defined", "for", "its", "class", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php#L313-L350
train
Validate each object in the chain
[ 30522, 2797, 3853, 9398, 3686, 16429, 20614, 1006, 1002, 4874, 1010, 1002, 3200, 15069, 1010, 9140, 1002, 2967, 1010, 1002, 29053, 9777, 6494, 2618, 6292, 1010, 7781, 8663, 18209, 18447, 2121, 12172, 1002, 6123, 1007, 1063, 3046, 1063, 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/Component/Validator/Constraints/AllValidator.php
AllValidator.validate
public function validate($value, Constraint $constraint) { if (!$constraint instanceof All) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\All'); } if (null === $value) { return; } if (!\is_array($value) && !$value instanceof \Traversable) { throw new UnexpectedValueException($value, 'iterable'); } $context = $this->context; $validator = $context->getValidator()->inContext($context); foreach ($value as $key => $element) { $validator->atPath('['.$key.']')->validate($element, $constraint->constraints); } }
php
public function validate($value, Constraint $constraint) { if (!$constraint instanceof All) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\All'); } if (null === $value) { return; } if (!\is_array($value) && !$value instanceof \Traversable) { throw new UnexpectedValueException($value, 'iterable'); } $context = $this->context; $validator = $context->getValidator()->inContext($context); foreach ($value as $key => $element) { $validator->atPath('['.$key.']')->validate($element, $constraint->constraints); } }
[ "public", "function", "validate", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "$", "constraint", "instanceof", "All", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "constraint", ",", "__NAMESPACE__", "....
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/AllValidator.php#L27-L48
train
Validate a value against all validators
[ 30522, 2270, 3853, 9398, 3686, 1006, 1002, 3643, 1010, 27142, 1002, 27142, 1007, 1063, 2065, 1006, 999, 1002, 27142, 6013, 11253, 2035, 1007, 1063, 5466, 2047, 9223, 13874, 10288, 24422, 1006, 1002, 27142, 1010, 1035, 1035, 3415, 15327, 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...
laravel/framework
src/Illuminate/Mail/Transport/SesTransport.php
SesTransport.send
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) { $this->beforeSendPerformed($message); $result = $this->ses->sendRawEmail( array_merge( $this->options, [ 'Source' => key($message->getSender() ?: $message->getFrom()), 'RawMessage' => [ 'Data' => $message->toString(), ], ] ) ); $message->getHeaders()->addTextHeader('X-SES-Message-ID', $result->get('MessageId')); $this->sendPerformed($message); return $this->numberOfRecipients($message); }
php
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) { $this->beforeSendPerformed($message); $result = $this->ses->sendRawEmail( array_merge( $this->options, [ 'Source' => key($message->getSender() ?: $message->getFrom()), 'RawMessage' => [ 'Data' => $message->toString(), ], ] ) ); $message->getHeaders()->addTextHeader('X-SES-Message-ID', $result->get('MessageId')); $this->sendPerformed($message); return $this->numberOfRecipients($message); }
[ "public", "function", "send", "(", "Swift_Mime_SimpleMessage", "$", "message", ",", "&", "$", "failedRecipients", "=", "null", ")", "{", "$", "this", "->", "beforeSendPerformed", "(", "$", "message", ")", ";", "$", "result", "=", "$", "this", "->", "ses", ...
{@inheritdoc}
[ "{" ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Transport/SesTransport.php#L40-L60
train
Sends a Swift_Mime_SimpleMessage to the Sms system
[ 30522, 2270, 3853, 4604, 1006, 9170, 1035, 2771, 4168, 1035, 3722, 7834, 3736, 3351, 1002, 4471, 1010, 1004, 1002, 3478, 2890, 6895, 14756, 7666, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 2077, 5054, 18927, 2121, 29021, 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...
matomo-org/matomo
plugins/Actions/API.php
API.get
public function get($idSite, $period, $date, $segment = false, $columns = false) { Piwik::checkUserHasViewAccess($idSite); $report = ReportsProvider::factory("Actions", "get"); $archive = Archive::build($idSite, $period, $date, $segment); $requestedColumns = Piwik::getArrayFromApiParameter($columns); $columns = $report->getMetricsRequiredForReport($allColumns = null, $requestedColumns); $inDbColumnNames = array_map(function ($value) { return 'Actions_' . $value; }, $columns); $dataTable = $archive->getDataTableFromNumeric($inDbColumnNames); $dataTable->deleteColumns(array_diff($requestedColumns, $columns)); $newNameMapping = array_combine($inDbColumnNames, $columns); $dataTable->filter('ReplaceColumnNames', array($newNameMapping)); $columnsToShow = $requestedColumns ?: $report->getAllMetrics(); $dataTable->queueFilter('ColumnDelete', array($columnsToRemove = array(), $columnsToShow)); return $dataTable; }
php
public function get($idSite, $period, $date, $segment = false, $columns = false) { Piwik::checkUserHasViewAccess($idSite); $report = ReportsProvider::factory("Actions", "get"); $archive = Archive::build($idSite, $period, $date, $segment); $requestedColumns = Piwik::getArrayFromApiParameter($columns); $columns = $report->getMetricsRequiredForReport($allColumns = null, $requestedColumns); $inDbColumnNames = array_map(function ($value) { return 'Actions_' . $value; }, $columns); $dataTable = $archive->getDataTableFromNumeric($inDbColumnNames); $dataTable->deleteColumns(array_diff($requestedColumns, $columns)); $newNameMapping = array_combine($inDbColumnNames, $columns); $dataTable->filter('ReplaceColumnNames', array($newNameMapping)); $columnsToShow = $requestedColumns ?: $report->getAllMetrics(); $dataTable->queueFilter('ColumnDelete', array($columnsToRemove = array(), $columnsToShow)); return $dataTable; }
[ "public", "function", "get", "(", "$", "idSite", ",", "$", "period", ",", "$", "date", ",", "$", "segment", "=", "false", ",", "$", "columns", "=", "false", ")", "{", "Piwik", "::", "checkUserHasViewAccess", "(", "$", "idSite", ")", ";", "$", "report...
Returns the list of metrics (pages, downloads, outlinks) @param int $idSite @param string $period @param string $date @param bool|string $segment @param bool|array $columns @return DataTable
[ "Returns", "the", "list", "of", "metrics", "(", "pages", "downloads", "outlinks", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/API.php#L55-L77
train
Get the datatable for the given site period date and segment
[ 30522, 2270, 3853, 2131, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 1010, 1002, 3058, 1010, 1002, 6903, 1027, 6270, 1010, 1002, 7753, 1027, 6270, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 8584, 6305, 9623, 2015, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/cms/twig/Extension.php
Extension.pageFilter
public function pageFilter($name, $parameters = [], $routePersistence = true) { return $this->controller->pageUrl($name, $parameters, $routePersistence); }
php
public function pageFilter($name, $parameters = [], $routePersistence = true) { return $this->controller->pageUrl($name, $parameters, $routePersistence); }
[ "public", "function", "pageFilter", "(", "$", "name", ",", "$", "parameters", "=", "[", "]", ",", "$", "routePersistence", "=", "true", ")", "{", "return", "$", "this", "->", "controller", "->", "pageUrl", "(", "$", "name", ",", "$", "parameters", ",",...
Looks up the URL for a supplied page and returns it relative to the website root. @param mixed $name Specifies the Cms Page file name. @param array $parameters Route parameters to consider in the URL. @param bool $routePersistence By default the existing routing parameters will be included when creating the URL, set to false to disable this feature. @return string
[ "Looks", "up", "the", "URL", "for", "a", "supplied", "page", "and", "returns", "it", "relative", "to", "the", "website", "root", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Extension.php#L159-L162
train
Page Url Filter
[ 30522, 2270, 3853, 3931, 8873, 21928, 1006, 1002, 2171, 1010, 1002, 11709, 1027, 1031, 1033, 1010, 1002, 2799, 7347, 27870, 5897, 1027, 2995, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 11486, 1011, 1028, 3931, 3126, 2140, 1006, 1002, 2171, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...