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
laravel/framework
src/Illuminate/Database/Eloquent/Relations/MorphTo.php
MorphTo.buildDictionary
protected function buildDictionary(Collection $models) { foreach ($models as $model) { if ($model->{$this->morphType}) { $this->dictionary[$model->{$this->morphType}][$model->{$this->foreignKey}][] = $model; } } }
php
protected function buildDictionary(Collection $models) { foreach ($models as $model) { if ($model->{$this->morphType}) { $this->dictionary[$model->{$this->morphType}][$model->{$this->foreignKey}][] = $model; } } }
[ "protected", "function", "buildDictionary", "(", "Collection", "$", "models", ")", "{", "foreach", "(", "$", "models", "as", "$", "model", ")", "{", "if", "(", "$", "model", "->", "{", "$", "this", "->", "morphType", "}", ")", "{", "$", "this", "->",...
Build a dictionary with the models. @param \Illuminate\Database\Eloquent\Collection $models @return void
[ "Build", "a", "dictionary", "with", "the", "models", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php#L75-L82
train
Build the dictionary for the given models
[ 30522, 5123, 3853, 3857, 29201, 3258, 5649, 1006, 3074, 1002, 4275, 1007, 1063, 18921, 6776, 30524, 1011, 1028, 9206, 1031, 1002, 2944, 1011, 1028, 1063, 1002, 2023, 1011, 1028, 22822, 8458, 13874, 1065, 1033, 1031, 1002, 2944, 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/Foundation/Console/PackageDiscoverCommand.php
PackageDiscoverCommand.handle
public function handle(PackageManifest $manifest) { $manifest->build(); foreach (array_keys($manifest->manifest) as $package) { $this->line("Discovered Package: <info>{$package}</info>"); } $this->info('Package manifest generated successfully.'); }
php
public function handle(PackageManifest $manifest) { $manifest->build(); foreach (array_keys($manifest->manifest) as $package) { $this->line("Discovered Package: <info>{$package}</info>"); } $this->info('Package manifest generated successfully.'); }
[ "public", "function", "handle", "(", "PackageManifest", "$", "manifest", ")", "{", "$", "manifest", "->", "build", "(", ")", ";", "foreach", "(", "array_keys", "(", "$", "manifest", "->", "manifest", ")", "as", "$", "package", ")", "{", "$", "this", "-...
Execute the console command. @param \Illuminate\Foundation\PackageManifest $manifest @return void
[ "Execute", "the", "console", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php#L30-L39
train
Handle the package manifest
[ 30522, 2270, 3853, 5047, 1006, 7427, 20799, 14081, 1002, 19676, 1007, 1063, 1002, 19676, 1011, 1028, 3857, 1006, 1007, 1025, 18921, 6776, 1006, 9140, 1035, 6309, 1006, 1002, 19676, 1011, 1028, 19676, 1007, 2004, 1002, 7427, 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...
symfony/symfony
src/Symfony/Component/HttpClient/NativeHttpClient.php
NativeHttpClient.request
public function request(string $method, string $url, array $options = []): ResponseInterface { [$url, $options] = self::prepareRequest($method, $url, $options, $this->defaultOptions); if ($options['bindto'] && file_exists($options['bindto'])) { throw new TransportException(__CLASS__.' cannot bind to local Unix sockets, use e.g. CurlHttpClient instead.'); } $options['body'] = self::getBodyAsString($options['body']); if ('' !== $options['body'] && 'POST' === $method && !isset($options['headers']['content-type'])) { $options['request_headers'][] = 'content-type: application/x-www-form-urlencoded'; } if ($gzipEnabled = \extension_loaded('zlib') && !isset($options['headers']['accept-encoding'])) { // gzip is the most widely available algo, no need to deal with deflate $options['request_headers'][] = 'accept-encoding: gzip'; } if ($options['peer_fingerprint']) { if (isset($options['peer_fingerprint']['pin-sha256']) && 1 === \count($options['peer_fingerprint'])) { throw new TransportException(__CLASS__.' cannot verify "pin-sha256" fingerprints, please provide a "sha256" one.'); } unset($options['peer_fingerprint']['pin-sha256']); } $info = [ 'response_headers' => [], 'url' => $url, 'error' => null, 'http_method' => $method, 'http_code' => 0, 'redirect_count' => 0, 'start_time' => 0.0, 'fopen_time' => 0.0, 'connect_time' => 0.0, 'redirect_time' => 0.0, 'starttransfer_time' => 0.0, 'total_time' => 0.0, 'namelookup_time' => 0.0, 'size_upload' => 0, 'size_download' => 0, 'size_body' => \strlen($options['body']), 'primary_ip' => '', 'primary_port' => 'http:' === $url['scheme'] ? 80 : 443, ]; if ($onProgress = $options['on_progress']) { // Memoize the last progress to ease calling the callback periodically when no network transfer happens $lastProgress = [0, 0]; $onProgress = static function (...$progress) use ($onProgress, &$lastProgress, &$info) { $progressInfo = $info; $progressInfo['url'] = implode('', $info['url']); unset($progressInfo['fopen_time'], $progressInfo['size_body']); if ($progress && -1 === $progress[0]) { // Response completed $lastProgress[0] = max($lastProgress); } else { $lastProgress = $progress ?: $lastProgress; } $onProgress($lastProgress[0], $lastProgress[1], $progressInfo); }; } // Always register a notification callback to compute live stats about the response $notification = static function (int $code, int $severity, ?string $msg, int $msgCode, int $dlNow, int $dlSize) use ($onProgress, &$info) { $now = microtime(true); $info['total_time'] = $now - $info['start_time']; if (STREAM_NOTIFY_PROGRESS === $code) { $info['size_upload'] += $dlNow ? 0 : $info['size_body']; $info['size_download'] = $dlNow; } elseif (STREAM_NOTIFY_CONNECT === $code) { $info['connect_time'] += $now - $info['fopen_time']; } else { return; } if ($onProgress) { $onProgress($dlNow, $dlSize); } }; if ($options['resolve']) { $this->multi->dnsCache = $options['resolve'] + $this->multi->dnsCache; } $this->logger && $this->logger->info(sprintf('Request: %s %s', $method, implode('', $url))); [$host, $port, $url['authority']] = self::dnsResolve($url, $this->multi, $info, $onProgress); if (!isset($options['headers']['host'])) { $options['request_headers'][] = 'host: '.$host.$port; } $context = [ 'http' => [ 'protocol_version' => $options['http_version'] ?: '1.1', 'method' => $method, 'content' => $options['body'], 'ignore_errors' => true, 'user_agent' => 'Symfony HttpClient/Native', 'curl_verify_ssl_peer' => $options['verify_peer'], 'curl_verify_ssl_host' => $options['verify_host'], 'auto_decode' => false, // Disable dechunk filter, it's incompatible with stream_select() 'timeout' => $options['timeout'], 'follow_location' => false, // We follow redirects ourselves - the native logic is too limited ], 'ssl' => array_filter([ 'peer_name' => $host, 'verify_peer' => $options['verify_peer'], 'verify_peer_name' => $options['verify_host'], 'cafile' => $options['cafile'], 'capath' => $options['capath'], 'local_cert' => $options['local_cert'], 'local_pk' => $options['local_pk'], 'passphrase' => $options['passphrase'], 'ciphers' => $options['ciphers'], 'peer_fingerprint' => $options['peer_fingerprint'], 'capture_peer_cert_chain' => $options['capture_peer_cert_chain'], 'allow_self_signed' => (bool) $options['peer_fingerprint'], 'SNI_enabled' => true, 'disable_compression' => true, ], static function ($v) { return null !== $v; }), 'socket' => [ 'bindto' => $options['bindto'], 'tcp_nodelay' => true, ], ]; $proxy = self::getProxy($options['proxy'], $url); $noProxy = $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? ''; $noProxy = $noProxy ? preg_split('/[\s,]+/', $noProxy) : []; $resolveRedirect = self::createRedirectResolver($options, $host, $proxy, $noProxy, $info, $onProgress); $context = stream_context_create($context, ['notification' => $notification]); self::configureHeadersAndProxy($context, $host, $options['request_headers'], $proxy, $noProxy); return new NativeResponse($this->multi, $context, implode('', $url), $options, $gzipEnabled, $info, $resolveRedirect, $onProgress, $this->logger); }
php
public function request(string $method, string $url, array $options = []): ResponseInterface { [$url, $options] = self::prepareRequest($method, $url, $options, $this->defaultOptions); if ($options['bindto'] && file_exists($options['bindto'])) { throw new TransportException(__CLASS__.' cannot bind to local Unix sockets, use e.g. CurlHttpClient instead.'); } $options['body'] = self::getBodyAsString($options['body']); if ('' !== $options['body'] && 'POST' === $method && !isset($options['headers']['content-type'])) { $options['request_headers'][] = 'content-type: application/x-www-form-urlencoded'; } if ($gzipEnabled = \extension_loaded('zlib') && !isset($options['headers']['accept-encoding'])) { // gzip is the most widely available algo, no need to deal with deflate $options['request_headers'][] = 'accept-encoding: gzip'; } if ($options['peer_fingerprint']) { if (isset($options['peer_fingerprint']['pin-sha256']) && 1 === \count($options['peer_fingerprint'])) { throw new TransportException(__CLASS__.' cannot verify "pin-sha256" fingerprints, please provide a "sha256" one.'); } unset($options['peer_fingerprint']['pin-sha256']); } $info = [ 'response_headers' => [], 'url' => $url, 'error' => null, 'http_method' => $method, 'http_code' => 0, 'redirect_count' => 0, 'start_time' => 0.0, 'fopen_time' => 0.0, 'connect_time' => 0.0, 'redirect_time' => 0.0, 'starttransfer_time' => 0.0, 'total_time' => 0.0, 'namelookup_time' => 0.0, 'size_upload' => 0, 'size_download' => 0, 'size_body' => \strlen($options['body']), 'primary_ip' => '', 'primary_port' => 'http:' === $url['scheme'] ? 80 : 443, ]; if ($onProgress = $options['on_progress']) { // Memoize the last progress to ease calling the callback periodically when no network transfer happens $lastProgress = [0, 0]; $onProgress = static function (...$progress) use ($onProgress, &$lastProgress, &$info) { $progressInfo = $info; $progressInfo['url'] = implode('', $info['url']); unset($progressInfo['fopen_time'], $progressInfo['size_body']); if ($progress && -1 === $progress[0]) { // Response completed $lastProgress[0] = max($lastProgress); } else { $lastProgress = $progress ?: $lastProgress; } $onProgress($lastProgress[0], $lastProgress[1], $progressInfo); }; } // Always register a notification callback to compute live stats about the response $notification = static function (int $code, int $severity, ?string $msg, int $msgCode, int $dlNow, int $dlSize) use ($onProgress, &$info) { $now = microtime(true); $info['total_time'] = $now - $info['start_time']; if (STREAM_NOTIFY_PROGRESS === $code) { $info['size_upload'] += $dlNow ? 0 : $info['size_body']; $info['size_download'] = $dlNow; } elseif (STREAM_NOTIFY_CONNECT === $code) { $info['connect_time'] += $now - $info['fopen_time']; } else { return; } if ($onProgress) { $onProgress($dlNow, $dlSize); } }; if ($options['resolve']) { $this->multi->dnsCache = $options['resolve'] + $this->multi->dnsCache; } $this->logger && $this->logger->info(sprintf('Request: %s %s', $method, implode('', $url))); [$host, $port, $url['authority']] = self::dnsResolve($url, $this->multi, $info, $onProgress); if (!isset($options['headers']['host'])) { $options['request_headers'][] = 'host: '.$host.$port; } $context = [ 'http' => [ 'protocol_version' => $options['http_version'] ?: '1.1', 'method' => $method, 'content' => $options['body'], 'ignore_errors' => true, 'user_agent' => 'Symfony HttpClient/Native', 'curl_verify_ssl_peer' => $options['verify_peer'], 'curl_verify_ssl_host' => $options['verify_host'], 'auto_decode' => false, // Disable dechunk filter, it's incompatible with stream_select() 'timeout' => $options['timeout'], 'follow_location' => false, // We follow redirects ourselves - the native logic is too limited ], 'ssl' => array_filter([ 'peer_name' => $host, 'verify_peer' => $options['verify_peer'], 'verify_peer_name' => $options['verify_host'], 'cafile' => $options['cafile'], 'capath' => $options['capath'], 'local_cert' => $options['local_cert'], 'local_pk' => $options['local_pk'], 'passphrase' => $options['passphrase'], 'ciphers' => $options['ciphers'], 'peer_fingerprint' => $options['peer_fingerprint'], 'capture_peer_cert_chain' => $options['capture_peer_cert_chain'], 'allow_self_signed' => (bool) $options['peer_fingerprint'], 'SNI_enabled' => true, 'disable_compression' => true, ], static function ($v) { return null !== $v; }), 'socket' => [ 'bindto' => $options['bindto'], 'tcp_nodelay' => true, ], ]; $proxy = self::getProxy($options['proxy'], $url); $noProxy = $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? ''; $noProxy = $noProxy ? preg_split('/[\s,]+/', $noProxy) : []; $resolveRedirect = self::createRedirectResolver($options, $host, $proxy, $noProxy, $info, $onProgress); $context = stream_context_create($context, ['notification' => $notification]); self::configureHeadersAndProxy($context, $host, $options['request_headers'], $proxy, $noProxy); return new NativeResponse($this->multi, $context, implode('', $url), $options, $gzipEnabled, $info, $resolveRedirect, $onProgress, $this->logger); }
[ "public", "function", "request", "(", "string", "$", "method", ",", "string", "$", "url", ",", "array", "$", "options", "=", "[", "]", ")", ":", "ResponseInterface", "{", "[", "$", "url", ",", "$", "options", "]", "=", "self", "::", "prepareRequest", ...
@see HttpClientInterface::OPTIONS_DEFAULTS for available options {@inheritdoc}
[ "@see", "HttpClientInterface", "::", "OPTIONS_DEFAULTS", "for", "available", "options" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/NativeHttpClient.php#L65-L207
train
Makes a request to the remote server.
[ 30522, 2270, 3853, 5227, 1006, 5164, 1002, 4118, 1010, 5164, 1002, 24471, 2140, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1024, 3433, 18447, 2121, 12172, 1063, 1031, 1002, 24471, 2140, 1010, 1002, 7047, 1033, 1027, 2969, 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...
laravel/framework
src/Illuminate/Foundation/Console/AppNameCommand.php
AppNameCommand.setDatabaseFactoryNamespaces
protected function setDatabaseFactoryNamespaces() { $files = Finder::create() ->in(database_path('factories')) ->contains($this->currentRoot) ->name('*.php'); foreach ($files as $file) { $this->replaceIn( $file->getRealPath(), $this->currentRoot, $this->argument('name') ); } }
php
protected function setDatabaseFactoryNamespaces() { $files = Finder::create() ->in(database_path('factories')) ->contains($this->currentRoot) ->name('*.php'); foreach ($files as $file) { $this->replaceIn( $file->getRealPath(), $this->currentRoot, $this->argument('name') ); } }
[ "protected", "function", "setDatabaseFactoryNamespaces", "(", ")", "{", "$", "files", "=", "Finder", "::", "create", "(", ")", "->", "in", "(", "database_path", "(", "'factories'", ")", ")", "->", "contains", "(", "$", "this", "->", "currentRoot", ")", "->...
Set the namespace in database factory files. @return void
[ "Set", "the", "namespace", "in", "database", "factory", "files", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/AppNameCommand.php#L224-L237
train
Set namespaces in database factory namespaces
[ 30522, 5123, 3853, 2275, 2850, 2696, 15058, 21450, 18442, 23058, 2015, 1006, 1007, 1063, 1002, 6764, 1027, 2424, 2121, 1024, 1024, 3443, 1006, 1007, 1011, 1028, 1999, 1006, 7809, 1035, 4130, 1006, 1005, 11123, 1005, 1007, 1007, 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...
symfony/symfony
src/Symfony/Component/HttpFoundation/Response.php
Response.setLastModified
public function setLastModified(\DateTimeInterface $date = null) { if (null === $date) { $this->headers->remove('Last-Modified'); return $this; } if ($date instanceof \DateTime) { $date = \DateTimeImmutable::createFromMutable($date); } $date = $date->setTimezone(new \DateTimeZone('UTC')); $this->headers->set('Last-Modified', $date->format('D, d M Y H:i:s').' GMT'); return $this; }
php
public function setLastModified(\DateTimeInterface $date = null) { if (null === $date) { $this->headers->remove('Last-Modified'); return $this; } if ($date instanceof \DateTime) { $date = \DateTimeImmutable::createFromMutable($date); } $date = $date->setTimezone(new \DateTimeZone('UTC')); $this->headers->set('Last-Modified', $date->format('D, d M Y H:i:s').' GMT'); return $this; }
[ "public", "function", "setLastModified", "(", "\\", "DateTimeInterface", "$", "date", "=", "null", ")", "{", "if", "(", "null", "===", "$", "date", ")", "{", "$", "this", "->", "headers", "->", "remove", "(", "'Last-Modified'", ")", ";", "return", "$", ...
Sets the Last-Modified HTTP header with a DateTime instance. Passing null as value will remove the header. @return $this @final
[ "Sets", "the", "Last", "-", "Modified", "HTTP", "header", "with", "a", "DateTime", "instance", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Response.php#L876-L892
train
Set Last - Modified
[ 30522, 2270, 3853, 2275, 8523, 21246, 7716, 7810, 1006, 1032, 3058, 7292, 18447, 2121, 12172, 1002, 3058, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 3058, 1007, 1063, 1002, 2023, 1011, 1028, 20346, 2015, 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...
symfony/symfony
src/Symfony/Component/Validator/DataCollector/ValidatorDataCollector.php
ValidatorDataCollector.lateCollect
public function lateCollect() { $collected = $this->validator->getCollectedData(); $this->data['calls'] = $this->cloneVar($collected); $this->data['violations_count'] = array_reduce($collected, function ($previous, $item) { return $previous + \count($item['violations']); }, 0); }
php
public function lateCollect() { $collected = $this->validator->getCollectedData(); $this->data['calls'] = $this->cloneVar($collected); $this->data['violations_count'] = array_reduce($collected, function ($previous, $item) { return $previous + \count($item['violations']); }, 0); }
[ "public", "function", "lateCollect", "(", ")", "{", "$", "collected", "=", "$", "this", "->", "validator", "->", "getCollectedData", "(", ")", ";", "$", "this", "->", "data", "[", "'calls'", "]", "=", "$", "this", "->", "cloneVar", "(", "$", "collected...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/DataCollector/ValidatorDataCollector.php#L57-L64
train
Late collect the calls and violations count
[ 30522, 2270, 3853, 2397, 26895, 22471, 1006, 1007, 1063, 1002, 5067, 1027, 1002, 2023, 1011, 1028, 9398, 8844, 1011, 1028, 2131, 26895, 22471, 22367, 6790, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 2951, 1031, 1005, 4455, 1005, 1033, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Auth/Access/Gate.php
Gate.define
public function define($ability, $callback) { if (is_callable($callback)) { $this->abilities[$ability] = $callback; } elseif (is_string($callback)) { $this->stringCallbacks[$ability] = $callback; $this->abilities[$ability] = $this->buildAbilityCallback($ability, $callback); } else { throw new InvalidArgumentException("Callback must be a callable or a 'Class@method' string."); } return $this; }
php
public function define($ability, $callback) { if (is_callable($callback)) { $this->abilities[$ability] = $callback; } elseif (is_string($callback)) { $this->stringCallbacks[$ability] = $callback; $this->abilities[$ability] = $this->buildAbilityCallback($ability, $callback); } else { throw new InvalidArgumentException("Callback must be a callable or a 'Class@method' string."); } return $this; }
[ "public", "function", "define", "(", "$", "ability", ",", "$", "callback", ")", "{", "if", "(", "is_callable", "(", "$", "callback", ")", ")", "{", "$", "this", "->", "abilities", "[", "$", "ability", "]", "=", "$", "callback", ";", "}", "elseif", ...
Define a new ability. @param string $ability @param callable|string $callback @return $this @throws \InvalidArgumentException
[ "Define", "a", "new", "ability", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L127-L140
train
Define an ability callback
[ 30522, 2270, 3853, 9375, 1006, 1002, 3754, 1010, 1002, 2655, 5963, 1007, 1063, 2065, 1006, 2003, 1035, 2655, 3085, 1006, 1002, 2655, 5963, 30524, 1033, 1027, 1002, 2655, 5963, 1025, 1065, 2842, 10128, 1006, 2003, 1035, 5164, 1006, 1002, 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...
octobercms/october
modules/backend/classes/WidgetManager.php
WidgetManager.registerFormWidget
public function registerFormWidget($className, $widgetInfo = null) { if (!is_array($widgetInfo)) { $widgetInfo = ['code' => $widgetInfo]; } $widgetCode = $widgetInfo['code'] ?? null; if (!$widgetCode) { $widgetCode = Str::getClassId($className); } $this->formWidgets[$className] = $widgetInfo; $this->formWidgetHints[$widgetCode] = $className; }
php
public function registerFormWidget($className, $widgetInfo = null) { if (!is_array($widgetInfo)) { $widgetInfo = ['code' => $widgetInfo]; } $widgetCode = $widgetInfo['code'] ?? null; if (!$widgetCode) { $widgetCode = Str::getClassId($className); } $this->formWidgets[$className] = $widgetInfo; $this->formWidgetHints[$widgetCode] = $className; }
[ "public", "function", "registerFormWidget", "(", "$", "className", ",", "$", "widgetInfo", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "widgetInfo", ")", ")", "{", "$", "widgetInfo", "=", "[", "'code'", "=>", "$", "widgetInfo", "]", ";...
Registers a single form widget. @param string $className Widget class name. @param array $widgetInfo Registration information, can contain a `code` key. @return void
[ "Registers", "a", "single", "form", "widget", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/WidgetManager.php#L100-L114
train
Registers a form widget
[ 30522, 2270, 3853, 4236, 14192, 9148, 24291, 1006, 1002, 2465, 18442, 1010, 1002, 15536, 24291, 2378, 14876, 1027, 19701, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 15536, 24291, 2378, 14876, 1007, 1007, 1063, 1002, 15536, 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/Bridge/Monolog/Processor/DebugProcessor.php
DebugProcessor.getLogs
public function getLogs(/* Request $request = null */) { if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } if (1 <= \func_num_args() && null !== $request = \func_get_arg(0)) { return $this->records[spl_object_hash($request)] ?? []; } if (0 === \count($this->records)) { return []; } return array_merge(...array_values($this->records)); }
php
public function getLogs(/* Request $request = null */) { if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } if (1 <= \func_num_args() && null !== $request = \func_get_arg(0)) { return $this->records[spl_object_hash($request)] ?? []; } if (0 === \count($this->records)) { return []; } return array_merge(...array_values($this->records)); }
[ "public", "function", "getLogs", "(", "/* Request $request = null */", ")", "{", "if", "(", "\\", "func_num_args", "(", ")", "<", "1", "&&", "__CLASS__", "!==", "\\", "get_class", "(", "$", "this", ")", "&&", "__CLASS__", "!==", "(", "new", "\\", "Reflecti...
{@inheritdoc} @param Request|null $request
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php#L64-L79
train
Returns the log records.
[ 30522, 2270, 3853, 2131, 21197, 2015, 1006, 1013, 1008, 5227, 1002, 5227, 1027, 19701, 1008, 1013, 1007, 1063, 2065, 1006, 1032, 4569, 2278, 1035, 16371, 2213, 1035, 12098, 5620, 1006, 1007, 1026, 1015, 1004, 1004, 1035, 1035, 2465, 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...
matomo-org/matomo
libs/Zend/Cache/Backend/Sqlite.php
Zend_Cache_Backend_Sqlite._clean
private function _clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array()) { switch ($mode) { case Zend_Cache::CLEANING_MODE_ALL: $res1 = $this->_query('DELETE FROM cache'); $res2 = $this->_query('DELETE FROM tag'); return $res1 && $res2; break; case Zend_Cache::CLEANING_MODE_OLD: $mktime = time(); $res1 = $this->_query("DELETE FROM tag WHERE id IN (SELECT id FROM cache WHERE expire>0 AND expire<=$mktime)"); $res2 = $this->_query("DELETE FROM cache WHERE expire>0 AND expire<=$mktime"); return $res1 && $res2; break; case Zend_Cache::CLEANING_MODE_MATCHING_TAG: $ids = $this->getIdsMatchingTags($tags); $result = true; foreach ($ids as $id) { $result = $this->remove($id) && $result; } return $result; break; case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG: $ids = $this->getIdsNotMatchingTags($tags); $result = true; foreach ($ids as $id) { $result = $this->remove($id) && $result; } return $result; break; case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG: $ids = $this->getIdsMatchingAnyTags($tags); $result = true; foreach ($ids as $id) { $result = $this->remove($id) && $result; } return $result; break; default: break; } return false; }
php
private function _clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array()) { switch ($mode) { case Zend_Cache::CLEANING_MODE_ALL: $res1 = $this->_query('DELETE FROM cache'); $res2 = $this->_query('DELETE FROM tag'); return $res1 && $res2; break; case Zend_Cache::CLEANING_MODE_OLD: $mktime = time(); $res1 = $this->_query("DELETE FROM tag WHERE id IN (SELECT id FROM cache WHERE expire>0 AND expire<=$mktime)"); $res2 = $this->_query("DELETE FROM cache WHERE expire>0 AND expire<=$mktime"); return $res1 && $res2; break; case Zend_Cache::CLEANING_MODE_MATCHING_TAG: $ids = $this->getIdsMatchingTags($tags); $result = true; foreach ($ids as $id) { $result = $this->remove($id) && $result; } return $result; break; case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG: $ids = $this->getIdsNotMatchingTags($tags); $result = true; foreach ($ids as $id) { $result = $this->remove($id) && $result; } return $result; break; case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG: $ids = $this->getIdsMatchingAnyTags($tags); $result = true; foreach ($ids as $id) { $result = $this->remove($id) && $result; } return $result; break; default: break; } return false; }
[ "private", "function", "_clean", "(", "$", "mode", "=", "Zend_Cache", "::", "CLEANING_MODE_ALL", ",", "$", "tags", "=", "array", "(", ")", ")", "{", "switch", "(", "$", "mode", ")", "{", "case", "Zend_Cache", "::", "CLEANING_MODE_ALL", ":", "$", "res1", ...
Clean some cache records Available modes are : Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags ($tags can be an array of strings or a single string) Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} ($tags can be an array of strings or a single string) Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags ($tags can be an array of strings or a single string) @param string $mode Clean mode @param array $tags Array of tags @return boolean True if no problem
[ "Clean", "some", "cache", "records" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Sqlite.php#L614-L656
train
Remove all cache entries matching given tags
[ 30522, 2797, 3853, 1035, 4550, 1006, 1002, 5549, 1027, 16729, 2094, 1035, 17053, 1024, 1024, 9344, 1035, 5549, 1035, 2035, 1010, 1002, 22073, 1027, 9140, 1006, 1007, 1007, 1063, 6942, 1006, 1002, 5549, 1007, 1063, 2553, 16729, 2094, 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...
octobercms/october
modules/cms/models/ThemeImport.php
ThemeImport.copyDirectory
protected function copyDirectory($directory, $destination) { // Preference is to overwrite existing files if ($this->overwrite) { return File::copyDirectory($directory, $destination); } if (!File::isDirectory($directory)) { return false; } $options = FilesystemIterator::SKIP_DOTS; if (!File::isDirectory($destination)) { File::makeDirectory($destination, 0777, true); } $items = new FilesystemIterator($directory, $options); foreach ($items as $item) { $target = $destination.'/'.$item->getBasename(); if ($item->isDir()) { $path = $item->getPathname(); if (!$this->copyDirectory($path, $target)) { return false; } } else { // Do not overwrite existing files if (File::isFile($target)) { continue; } if (!File::copy($item->getPathname(), $target)) { return false; } } } return true; }
php
protected function copyDirectory($directory, $destination) { // Preference is to overwrite existing files if ($this->overwrite) { return File::copyDirectory($directory, $destination); } if (!File::isDirectory($directory)) { return false; } $options = FilesystemIterator::SKIP_DOTS; if (!File::isDirectory($destination)) { File::makeDirectory($destination, 0777, true); } $items = new FilesystemIterator($directory, $options); foreach ($items as $item) { $target = $destination.'/'.$item->getBasename(); if ($item->isDir()) { $path = $item->getPathname(); if (!$this->copyDirectory($path, $target)) { return false; } } else { // Do not overwrite existing files if (File::isFile($target)) { continue; } if (!File::copy($item->getPathname(), $target)) { return false; } } } return true; }
[ "protected", "function", "copyDirectory", "(", "$", "directory", ",", "$", "destination", ")", "{", "// Preference is to overwrite existing files", "if", "(", "$", "this", "->", "overwrite", ")", "{", "return", "File", "::", "copyDirectory", "(", "$", "directory",...
Helper for copying directories that supports the ability to not overwrite existing files. Inherited from File::copyDirectory @param string $directory @param string $destination @return bool
[ "Helper", "for", "copying", "directories", "that", "supports", "the", "ability", "to", "not", "overwrite", "existing", "files", ".", "Inherited", "from", "File", "::", "copyDirectory" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/models/ThemeImport.php#L149-L191
train
Copy directory to destination
[ 30522, 5123, 3853, 6100, 4305, 2890, 16761, 2100, 1006, 1002, 14176, 1010, 1002, 7688, 1007, 1063, 1013, 1013, 12157, 2003, 2000, 2058, 26373, 4493, 6764, 2065, 1006, 1002, 2023, 1011, 1028, 2058, 26373, 1007, 1063, 2709, 5371, 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...
matomo-org/matomo
plugins/UserCountry/Controller.php
Controller.setUpdaterManageVars
private function setUpdaterManageVars($view) { $view->isGeoIp2Available = $this->isGeoIp2Enabled(); if ($this->isGeoIp2Enabled()) { // Get GeoIPLegacy Update information to show them $urls = GeoIPAutoUpdater::getConfiguredUrls(); $view->geoIPLegacyLocUrl = $urls['loc']; $view->geoIPLegacyIspUrl = $urls['isp']; $view->geoIPLegacyOrgUrl = $urls['org']; $view->geoIPLegacyUpdatePeriod = GeoIPAutoUpdater::getSchedulePeriod(); $urls = GeoIP2AutoUpdater::getConfiguredUrls(); $view->geoIPLocUrl = $urls['loc']; $view->geoIPIspUrl = $urls['isp']; $view->geoIPUpdatePeriod = GeoIP2AutoUpdater::getSchedulePeriod(); $view->geoLiteUrl = GeoIp2::GEO_LITE_URL; $view->geoLiteFilename = 'GeoLite2-City.mmdb'; $view->nextRunTime = GeoIP2AutoUpdater::getNextRunTime(); $lastRunTime = GeoIP2AutoUpdater::getLastRunTime(); } else { $urls = GeoIPAutoUpdater::getConfiguredUrls(); $view->geoIPLocUrl = $urls['loc']; $view->geoIPIspUrl = $urls['isp']; $view->geoIPOrgUrl = $urls['org']; $view->geoIPUpdatePeriod = GeoIPAutoUpdater::getSchedulePeriod(); $view->geoLiteUrl = GeoIp::GEO_LITE_URL; $view->geoLiteFilename = 'GeoLiteCity.dat'; $view->nextRunTime = GeoIPAutoUpdater::getNextRunTime(); $lastRunTime = GeoIPAutoUpdater::getLastRunTime(); } if ($lastRunTime !== false) { $view->lastTimeUpdaterRun = '<strong>' . $lastRunTime->toString() . '</strong>'; } }
php
private function setUpdaterManageVars($view) { $view->isGeoIp2Available = $this->isGeoIp2Enabled(); if ($this->isGeoIp2Enabled()) { // Get GeoIPLegacy Update information to show them $urls = GeoIPAutoUpdater::getConfiguredUrls(); $view->geoIPLegacyLocUrl = $urls['loc']; $view->geoIPLegacyIspUrl = $urls['isp']; $view->geoIPLegacyOrgUrl = $urls['org']; $view->geoIPLegacyUpdatePeriod = GeoIPAutoUpdater::getSchedulePeriod(); $urls = GeoIP2AutoUpdater::getConfiguredUrls(); $view->geoIPLocUrl = $urls['loc']; $view->geoIPIspUrl = $urls['isp']; $view->geoIPUpdatePeriod = GeoIP2AutoUpdater::getSchedulePeriod(); $view->geoLiteUrl = GeoIp2::GEO_LITE_URL; $view->geoLiteFilename = 'GeoLite2-City.mmdb'; $view->nextRunTime = GeoIP2AutoUpdater::getNextRunTime(); $lastRunTime = GeoIP2AutoUpdater::getLastRunTime(); } else { $urls = GeoIPAutoUpdater::getConfiguredUrls(); $view->geoIPLocUrl = $urls['loc']; $view->geoIPIspUrl = $urls['isp']; $view->geoIPOrgUrl = $urls['org']; $view->geoIPUpdatePeriod = GeoIPAutoUpdater::getSchedulePeriod(); $view->geoLiteUrl = GeoIp::GEO_LITE_URL; $view->geoLiteFilename = 'GeoLiteCity.dat'; $view->nextRunTime = GeoIPAutoUpdater::getNextRunTime(); $lastRunTime = GeoIPAutoUpdater::getLastRunTime(); } if ($lastRunTime !== false) { $view->lastTimeUpdaterRun = '<strong>' . $lastRunTime->toString() . '</strong>'; } }
[ "private", "function", "setUpdaterManageVars", "(", "$", "view", ")", "{", "$", "view", "->", "isGeoIp2Available", "=", "$", "this", "->", "isGeoIp2Enabled", "(", ")", ";", "if", "(", "$", "this", "->", "isGeoIp2Enabled", "(", ")", ")", "{", "// Get GeoIPL...
Sets some variables needed by the _updaterManage.twig template. @param View $view
[ "Sets", "some", "variables", "needed", "by", "the", "_updaterManage", ".", "twig", "template", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/Controller.php#L221-L263
train
Set the variables for the update manager
[ 30522, 2797, 3853, 16437, 13701, 14515, 4270, 10755, 2015, 1006, 1002, 3193, 1007, 1063, 1002, 3193, 1011, 1028, 2003, 3351, 10448, 2361, 2475, 12462, 11733, 3468, 1027, 1002, 2023, 1011, 1028, 2003, 3351, 10448, 2361, 2475, 8189, 23242, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Broadcasting/BroadcastEvent.php
BroadcastEvent.handle
public function handle(Broadcaster $broadcaster) { $name = method_exists($this->event, 'broadcastAs') ? $this->event->broadcastAs() : get_class($this->event); $broadcaster->broadcast( Arr::wrap($this->event->broadcastOn()), $name, $this->getPayloadFromEvent($this->event) ); }
php
public function handle(Broadcaster $broadcaster) { $name = method_exists($this->event, 'broadcastAs') ? $this->event->broadcastAs() : get_class($this->event); $broadcaster->broadcast( Arr::wrap($this->event->broadcastOn()), $name, $this->getPayloadFromEvent($this->event) ); }
[ "public", "function", "handle", "(", "Broadcaster", "$", "broadcaster", ")", "{", "$", "name", "=", "method_exists", "(", "$", "this", "->", "event", ",", "'broadcastAs'", ")", "?", "$", "this", "->", "event", "->", "broadcastAs", "(", ")", ":", "get_cla...
Handle the queued job. @param \Illuminate\Contracts\Broadcasting\Broadcaster $broadcaster @return void
[ "Handle", "the", "queued", "job", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Broadcasting/BroadcastEvent.php#L41-L50
train
Handle the broadcast
[ 30522, 2270, 3853, 5047, 1006, 11995, 1002, 11995, 1007, 1063, 1002, 2171, 1027, 4118, 1035, 6526, 1006, 1002, 2023, 1011, 1028, 2724, 1010, 1005, 3743, 3022, 1005, 1007, 1029, 1002, 2023, 1011, 1028, 2724, 1011, 1028, 3743, 3022, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/SqlServerBuilder.php
SqlServerBuilder.dropAllTables
public function dropAllTables() { $this->disableForeignKeyConstraints(); $this->connection->statement($this->grammar->compileDropAllTables()); $this->enableForeignKeyConstraints(); }
php
public function dropAllTables() { $this->disableForeignKeyConstraints(); $this->connection->statement($this->grammar->compileDropAllTables()); $this->enableForeignKeyConstraints(); }
[ "public", "function", "dropAllTables", "(", ")", "{", "$", "this", "->", "disableForeignKeyConstraints", "(", ")", ";", "$", "this", "->", "connection", "->", "statement", "(", "$", "this", "->", "grammar", "->", "compileDropAllTables", "(", ")", ")", ";", ...
Drop all tables from the database. @return void
[ "Drop", "all", "tables", "from", "the", "database", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/SqlServerBuilder.php#L12-L19
train
Drops all tables in the database.
[ 30522, 2270, 3853, 4530, 8095, 10880, 2015, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 4487, 19150, 29278, 7416, 16206, 14839, 8663, 20528, 18447, 2015, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 4434, 1011, 1028, 4861, 1006, 1002, 2023, 1011...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php
TraceableControllerResolver.getController
public function getController(Request $request) { $e = $this->stopwatch->start('controller.get_callable'); $ret = $this->resolver->getController($request); $e->stop(); return $ret; }
php
public function getController(Request $request) { $e = $this->stopwatch->start('controller.get_callable'); $ret = $this->resolver->getController($request); $e->stop(); return $ret; }
[ "public", "function", "getController", "(", "Request", "$", "request", ")", "{", "$", "e", "=", "$", "this", "->", "stopwatch", "->", "start", "(", "'controller.get_callable'", ")", ";", "$", "ret", "=", "$", "this", "->", "resolver", "->", "getController"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php#L34-L43
train
Get Controller for Request
[ 30522, 2270, 3853, 2131, 8663, 13181, 10820, 1006, 5227, 1002, 5227, 1007, 1063, 1002, 1041, 1027, 1002, 2023, 1011, 1028, 2644, 18866, 1011, 1028, 2707, 1006, 1005, 11486, 1012, 2131, 1035, 2655, 3085, 1005, 1007, 1025, 1002, 2128, 2102, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Maildir.php
Zend_Mail_Storage_Folder_Maildir._buildFolderTree
protected function _buildFolderTree() { $this->_rootFolder = new Zend_Mail_Storage_Folder('/', '/', false); $this->_rootFolder->INBOX = new Zend_Mail_Storage_Folder('INBOX', 'INBOX', true); $dh = @opendir($this->_rootdir); if (!$dh) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception("can't read folders in maildir"); } $dirs = array(); while (($entry = readdir($dh)) !== false) { // maildir++ defines folders must start with . if ($entry[0] != '.' || $entry == '.' || $entry == '..') { continue; } if ($this->_isMaildir($this->_rootdir . $entry)) { $dirs[] = $entry; } } closedir($dh); sort($dirs); $stack = array(null); $folderStack = array(null); $parentFolder = $this->_rootFolder; $parent = '.'; foreach ($dirs as $dir) { do { if (strpos($dir, $parent) === 0) { $local = substr($dir, strlen($parent)); if (strpos($local, $this->_delim) !== false) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('error while reading maildir'); } array_push($stack, $parent); $parent = $dir . $this->_delim; $folder = new Zend_Mail_Storage_Folder($local, substr($dir, 1), true); $parentFolder->$local = $folder; array_push($folderStack, $parentFolder); $parentFolder = $folder; break; } else if ($stack) { $parent = array_pop($stack); $parentFolder = array_pop($folderStack); } } while ($stack); if (!$stack) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('error while reading maildir'); } } }
php
protected function _buildFolderTree() { $this->_rootFolder = new Zend_Mail_Storage_Folder('/', '/', false); $this->_rootFolder->INBOX = new Zend_Mail_Storage_Folder('INBOX', 'INBOX', true); $dh = @opendir($this->_rootdir); if (!$dh) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception("can't read folders in maildir"); } $dirs = array(); while (($entry = readdir($dh)) !== false) { // maildir++ defines folders must start with . if ($entry[0] != '.' || $entry == '.' || $entry == '..') { continue; } if ($this->_isMaildir($this->_rootdir . $entry)) { $dirs[] = $entry; } } closedir($dh); sort($dirs); $stack = array(null); $folderStack = array(null); $parentFolder = $this->_rootFolder; $parent = '.'; foreach ($dirs as $dir) { do { if (strpos($dir, $parent) === 0) { $local = substr($dir, strlen($parent)); if (strpos($local, $this->_delim) !== false) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('error while reading maildir'); } array_push($stack, $parent); $parent = $dir . $this->_delim; $folder = new Zend_Mail_Storage_Folder($local, substr($dir, 1), true); $parentFolder->$local = $folder; array_push($folderStack, $parentFolder); $parentFolder = $folder; break; } else if ($stack) { $parent = array_pop($stack); $parentFolder = array_pop($folderStack); } } while ($stack); if (!$stack) { /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('error while reading maildir'); } } }
[ "protected", "function", "_buildFolderTree", "(", ")", "{", "$", "this", "->", "_rootFolder", "=", "new", "Zend_Mail_Storage_Folder", "(", "'/'", ",", "'/'", ",", "false", ")", ";", "$", "this", "->", "_rootFolder", "->", "INBOX", "=", "new", "Zend_Mail_Stor...
find all subfolders and mbox files for folder structure Result is save in Zend_Mail_Storage_Folder instances with the root in $this->_rootFolder. $parentFolder and $parentGlobalName are only used internally for recursion. @return null @throws Zend_Mail_Storage_Exception
[ "find", "all", "subfolders", "and", "mbox", "files", "for", "folder", "structure" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Folder/Maildir.php#L116-L178
train
Build the folder tree
[ 30522, 5123, 3853, 1035, 3857, 10371, 8743, 9910, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 7117, 10371, 2121, 1027, 2047, 16729, 2094, 1035, 5653, 1035, 5527, 1035, 19622, 1006, 1005, 1013, 1005, 1010, 1005, 1013, 1005, 1010, 6270, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
PostgresGrammar.compileSpatialIndex
public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) { $command->algorithm = 'gist'; return $this->compileIndex($blueprint, $command); }
php
public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) { $command->algorithm = 'gist'; return $this->compileIndex($blueprint, $command); }
[ "public", "function", "compileSpatialIndex", "(", "Blueprint", "$", "blueprint", ",", "Fluent", "$", "command", ")", "{", "$", "command", "->", "algorithm", "=", "'gist'", ";", "return", "$", "this", "->", "compileIndex", "(", "$", "blueprint", ",", "$", "...
Compile a spatial index key command. @param \Illuminate\Database\Schema\Blueprint $blueprint @param \Illuminate\Support\Fluent $command @return string
[ "Compile", "a", "spatial", "index", "key", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php#L143-L148
train
Compiles a spatial index
[ 30522, 2270, 3853, 4012, 22090, 13102, 10450, 11475, 13629, 2595, 1006, 2630, 16550, 1002, 2630, 16550, 1010, 19376, 1002, 3094, 1007, 1063, 1002, 3094, 1011, 1028, 9896, 1027, 1005, 21025, 3367, 1005, 1025, 2709, 1002, 2023, 1011, 1028, 40...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Auth/Access/Gate.php
Gate.buildAbilityCallback
protected function buildAbilityCallback($ability, $callback) { return function () use ($ability, $callback) { if (Str::contains($callback, '@')) { [$class, $method] = Str::parseCallback($callback); } else { $class = $callback; } $policy = $this->resolvePolicy($class); $arguments = func_get_args(); $user = array_shift($arguments); $result = $this->callPolicyBefore( $policy, $user, $ability, $arguments ); if (! is_null($result)) { return $result; } return isset($method) ? $policy->{$method}(...func_get_args()) : $policy(...func_get_args()); }; }
php
protected function buildAbilityCallback($ability, $callback) { return function () use ($ability, $callback) { if (Str::contains($callback, '@')) { [$class, $method] = Str::parseCallback($callback); } else { $class = $callback; } $policy = $this->resolvePolicy($class); $arguments = func_get_args(); $user = array_shift($arguments); $result = $this->callPolicyBefore( $policy, $user, $ability, $arguments ); if (! is_null($result)) { return $result; } return isset($method) ? $policy->{$method}(...func_get_args()) : $policy(...func_get_args()); }; }
[ "protected", "function", "buildAbilityCallback", "(", "$", "ability", ",", "$", "callback", ")", "{", "return", "function", "(", ")", "use", "(", "$", "ability", ",", "$", "callback", ")", "{", "if", "(", "Str", "::", "contains", "(", "$", "callback", ...
Create the ability callback for a callback string. @param string $ability @param string $callback @return \Closure
[ "Create", "the", "ability", "callback", "for", "a", "callback", "string", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L173-L200
train
Build Ability Callback
[ 30522, 5123, 3853, 3857, 8010, 9289, 20850, 8684, 1006, 1002, 3754, 1010, 1002, 2655, 5963, 1007, 1063, 2709, 3853, 1006, 1007, 2224, 1006, 1002, 3754, 1010, 1002, 2655, 5963, 1007, 1063, 2065, 1006, 2358, 2099, 1024, 1024, 3397, 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...
matomo-org/matomo
plugins/PrivacyManager/ReportsPurger.php
ReportsPurger.getPurgeEstimate
public function getPurgeEstimate() { $result = array(); // get archive tables that will be purged list($oldNumericTables, $oldBlobTables) = $this->getArchiveTablesToPurge(); // process blob tables first, since archive status is stored in the numeric archives if (empty($this->reportPeriodsToKeep) && !$this->keepSegmentReports) { // not keeping any reports, so drop all tables foreach ($oldBlobTables as $table) { $result[$table] = self::DROP_TABLE; } } else { // figure out which rows will be deleted foreach ($oldBlobTables as $table) { $rowCount = $this->getBlobTableDeleteCount($oldNumericTables, $table); if ($rowCount > 0) { $result[$table] = $rowCount; } } } // deal w/ numeric tables if ($this->keepBasicMetrics) { // figure out which rows will be deleted foreach ($oldNumericTables as $table) { $rowCount = $this->getNumericTableDeleteCount($table); if ($rowCount > 0) { $result[$table] = $rowCount; } } } else { // not keeping any metrics, so drop the entire table foreach ($oldNumericTables as $table) { $result[$table] = self::DROP_TABLE; } } return $result; }
php
public function getPurgeEstimate() { $result = array(); // get archive tables that will be purged list($oldNumericTables, $oldBlobTables) = $this->getArchiveTablesToPurge(); // process blob tables first, since archive status is stored in the numeric archives if (empty($this->reportPeriodsToKeep) && !$this->keepSegmentReports) { // not keeping any reports, so drop all tables foreach ($oldBlobTables as $table) { $result[$table] = self::DROP_TABLE; } } else { // figure out which rows will be deleted foreach ($oldBlobTables as $table) { $rowCount = $this->getBlobTableDeleteCount($oldNumericTables, $table); if ($rowCount > 0) { $result[$table] = $rowCount; } } } // deal w/ numeric tables if ($this->keepBasicMetrics) { // figure out which rows will be deleted foreach ($oldNumericTables as $table) { $rowCount = $this->getNumericTableDeleteCount($table); if ($rowCount > 0) { $result[$table] = $rowCount; } } } else { // not keeping any metrics, so drop the entire table foreach ($oldNumericTables as $table) { $result[$table] = self::DROP_TABLE; } } return $result; }
[ "public", "function", "getPurgeEstimate", "(", ")", "{", "$", "result", "=", "array", "(", ")", ";", "// get archive tables that will be purged", "list", "(", "$", "oldNumericTables", ",", "$", "oldBlobTables", ")", "=", "$", "this", "->", "getArchiveTablesToPurge...
Returns an array describing what data would be purged if purging were invoked. This function returns an array that maps table names with the number of rows that will be deleted. If a table name is mapped with self::DROP_TABLE, the table will be dropped. @return array
[ "Returns", "an", "array", "describing", "what", "data", "would", "be", "purged", "if", "purging", "were", "invoked", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/ReportsPurger.php#L163-L203
train
Get Purge Estimate
[ 30522, 2270, 3853, 2131, 5311, 18372, 16643, 8585, 1006, 1007, 1063, 1002, 2765, 1027, 9140, 1006, 1007, 1025, 1013, 1013, 2131, 8756, 7251, 2008, 2097, 2022, 24694, 2094, 2862, 1006, 1002, 2214, 19172, 22420, 10880, 2015, 1010, 1002, 2214,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Theme.php
Theme.getFormConfig
public function getFormConfig() { $config = $this->getConfigArray('form'); /** * @event cms.theme.extendFormConfig * Extend form field configuration supplied by the theme by returning an array. * * Note if you are planning on using `assetVar` to inject CSS variables from a * plugin registration file, make sure the plugin has elevated permissions. * * Example usage: * * Event::listen('cms.theme.extendFormConfig', function ($themeCode, &$config) { * array_set($config, 'tabs.fields.header_color', [ * 'label' => 'Header Colour', * 'type' => 'colorpicker', * 'availableColors' => [#34495e, #708598, #3498db], * 'assetVar' => 'header-bg', * 'tab' => 'Global' * ]); * }); * */ Event::fire('cms.theme.extendFormConfig', [$this->getDirName(), &$config]); return $config; }
php
public function getFormConfig() { $config = $this->getConfigArray('form'); /** * @event cms.theme.extendFormConfig * Extend form field configuration supplied by the theme by returning an array. * * Note if you are planning on using `assetVar` to inject CSS variables from a * plugin registration file, make sure the plugin has elevated permissions. * * Example usage: * * Event::listen('cms.theme.extendFormConfig', function ($themeCode, &$config) { * array_set($config, 'tabs.fields.header_color', [ * 'label' => 'Header Colour', * 'type' => 'colorpicker', * 'availableColors' => [#34495e, #708598, #3498db], * 'assetVar' => 'header-bg', * 'tab' => 'Global' * ]); * }); * */ Event::fire('cms.theme.extendFormConfig', [$this->getDirName(), &$config]); return $config; }
[ "public", "function", "getFormConfig", "(", ")", "{", "$", "config", "=", "$", "this", "->", "getConfigArray", "(", "'form'", ")", ";", "/**\n * @event cms.theme.extendFormConfig\n * Extend form field configuration supplied by the theme by returning an array.\n ...
Themes have a dedicated `form` option that provide form fields for customization, this is an immutable accessor for that and also an solid anchor point for extension. @return array
[ "Themes", "have", "a", "dedicated", "form", "option", "that", "provide", "form", "fields", "for", "customization", "this", "is", "an", "immutable", "accessor", "for", "that", "and", "also", "an", "solid", "anchor", "point", "for", "extension", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L367-L394
train
Returns the form field configuration
[ 30522, 2270, 3853, 2131, 14192, 8663, 8873, 2290, 1006, 1007, 1063, 1002, 9530, 8873, 2290, 1027, 1002, 2023, 1011, 1028, 2131, 8663, 8873, 6843, 9447, 1006, 1005, 2433, 1005, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 2724, 4642, 2015, 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/DomCrawler/Form.php
Form.setValues
public function setValues(array $values) { foreach ($values as $name => $value) { $this->fields->set($name, $value); } return $this; }
php
public function setValues(array $values) { foreach ($values as $name => $value) { $this->fields->set($name, $value); } return $this; }
[ "public", "function", "setValues", "(", "array", "$", "values", ")", "{", "foreach", "(", "$", "values", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "this", "->", "fields", "->", "set", "(", "$", "name", ",", "$", "value", ")", ";", "}"...
Sets the value of the fields. @param array $values An array of field values @return $this
[ "Sets", "the", "value", "of", "the", "fields", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Form.php#L72-L79
train
Set values of the fields
[ 30522, 2270, 3853, 2275, 10175, 15808, 1006, 9140, 1002, 5300, 1007, 1063, 18921, 6776, 1006, 1002, 5300, 2004, 1002, 2171, 1027, 1028, 1002, 3643, 1007, 1063, 1002, 2023, 1011, 1028, 4249, 1011, 1028, 2275, 1006, 1002, 2171, 1010, 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/ExpressionLanguage/ExpressionLanguage.php
ExpressionLanguage.register
public function register($name, callable $compiler, callable $evaluator) { if (null !== $this->parser) { throw new \LogicException('Registering functions after calling evaluate(), compile() or parse() is not supported.'); } $this->functions[$name] = ['compiler' => $compiler, 'evaluator' => $evaluator]; }
php
public function register($name, callable $compiler, callable $evaluator) { if (null !== $this->parser) { throw new \LogicException('Registering functions after calling evaluate(), compile() or parse() is not supported.'); } $this->functions[$name] = ['compiler' => $compiler, 'evaluator' => $evaluator]; }
[ "public", "function", "register", "(", "$", "name", ",", "callable", "$", "compiler", ",", "callable", "$", "evaluator", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "parser", ")", "{", "throw", "new", "\\", "LogicException", "(", "'Registering...
Registers a function. @param string $name The function name @param callable $compiler A callable able to compile the function @param callable $evaluator A callable able to evaluate the function @throws \LogicException when registering a function after calling evaluate(), compile() or parse() @see ExpressionFunction
[ "Registers", "a", "function", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php#L115-L122
train
Registers a function to the stack
[ 30522, 2270, 3853, 4236, 1006, 1002, 2171, 1010, 2655, 3085, 1002, 21624, 1010, 2655, 3085, 1002, 9345, 7630, 8844, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 11968, 8043, 1007, 1063, 5466, 2047, 1032, 7961, 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/Auth/Access/Gate.php
Gate.getPolicyFor
public function getPolicyFor($class) { if (is_object($class)) { $class = get_class($class); } if (! is_string($class)) { return; } if (isset($this->policies[$class])) { return $this->resolvePolicy($this->policies[$class]); } foreach ($this->guessPolicyName($class) as $guessedPolicy) { if (class_exists($guessedPolicy)) { return $this->resolvePolicy($guessedPolicy); } } foreach ($this->policies as $expected => $policy) { if (is_subclass_of($class, $expected)) { return $this->resolvePolicy($policy); } } }
php
public function getPolicyFor($class) { if (is_object($class)) { $class = get_class($class); } if (! is_string($class)) { return; } if (isset($this->policies[$class])) { return $this->resolvePolicy($this->policies[$class]); } foreach ($this->guessPolicyName($class) as $guessedPolicy) { if (class_exists($guessedPolicy)) { return $this->resolvePolicy($guessedPolicy); } } foreach ($this->policies as $expected => $policy) { if (is_subclass_of($class, $expected)) { return $this->resolvePolicy($policy); } } }
[ "public", "function", "getPolicyFor", "(", "$", "class", ")", "{", "if", "(", "is_object", "(", "$", "class", ")", ")", "{", "$", "class", "=", "get_class", "(", "$", "class", ")", ";", "}", "if", "(", "!", "is_string", "(", "$", "class", ")", ")...
Get a policy instance for a given class. @param object|string $class @return mixed
[ "Get", "a", "policy", "instance", "for", "a", "given", "class", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L539-L564
train
Get the policy for a given class.
[ 30522, 2270, 3853, 2131, 18155, 2594, 2100, 29278, 1006, 1002, 2465, 1007, 1063, 2065, 1006, 2003, 1035, 4874, 1006, 1002, 2465, 1007, 1007, 1063, 1002, 2465, 1027, 2131, 1035, 2465, 1006, 1002, 2465, 1007, 1025, 1065, 2065, 1006, 999, 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...
matomo-org/matomo
libs/Zend/Db/Adapter/Abstract.php
Zend_Db_Adapter_Abstract.fetchCol
public function fetchCol($sql, $bind = array()) { $stmt = $this->query($sql, $bind); $result = $stmt->fetchAll(Zend_Db::FETCH_COLUMN, 0); return $result; }
php
public function fetchCol($sql, $bind = array()) { $stmt = $this->query($sql, $bind); $result = $stmt->fetchAll(Zend_Db::FETCH_COLUMN, 0); return $result; }
[ "public", "function", "fetchCol", "(", "$", "sql", ",", "$", "bind", "=", "array", "(", ")", ")", "{", "$", "stmt", "=", "$", "this", "->", "query", "(", "$", "sql", ",", "$", "bind", ")", ";", "$", "result", "=", "$", "stmt", "->", "fetchAll",...
Fetches the first column of all SQL result rows as an array. @param string|Zend_Db_Select $sql An SQL SELECT statement. @param mixed $bind Data to bind into SELECT placeholders. @return array
[ "Fetches", "the", "first", "column", "of", "all", "SQL", "result", "rows", "as", "an", "array", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Abstract.php#L791-L796
train
Fetch column from result of query
[ 30522, 2270, 3853, 18584, 25778, 1006, 1002, 29296, 1010, 1002, 14187, 1027, 9140, 1006, 1007, 1007, 1063, 1002, 2358, 20492, 1027, 1002, 2023, 1011, 1028, 23032, 1006, 1002, 29296, 1010, 1002, 14187, 1007, 1025, 1002, 2765, 1027, 1002, 235...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
slimphp/Slim
Slim/MiddlewareAwareTrait.php
MiddlewareAwareTrait.seedMiddlewareStack
protected function seedMiddlewareStack(callable $kernel = null) { if (!is_null($this->tip)) { throw new RuntimeException('MiddlewareStack can only be seeded once.'); } if ($kernel === null) { $kernel = $this; } $this->tip = $kernel; }
php
protected function seedMiddlewareStack(callable $kernel = null) { if (!is_null($this->tip)) { throw new RuntimeException('MiddlewareStack can only be seeded once.'); } if ($kernel === null) { $kernel = $this; } $this->tip = $kernel; }
[ "protected", "function", "seedMiddlewareStack", "(", "callable", "$", "kernel", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "tip", ")", ")", "{", "throw", "new", "RuntimeException", "(", "'MiddlewareStack can only be seeded once.'",...
Seed middleware stack with first callable @param callable $kernel The last item to run as middleware @throws RuntimeException if the stack is seeded more than once
[ "Seed", "middleware", "stack", "with", "first", "callable" ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/MiddlewareAwareTrait.php#L90-L99
train
Seed the middleware stack with the current kernel
[ 30522, 5123, 3853, 6534, 30524, 1007, 1007, 1063, 5466, 2047, 2448, 7292, 10288, 24422, 1006, 1005, 2690, 8059, 9153, 3600, 2064, 2069, 2022, 13916, 2320, 1012, 1005, 1007, 1025, 1065, 2065, 1006, 1002, 16293, 1027, 1027, 1027, 19701, 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/Eloquent/Relations/HasManyThrough.php
HasManyThrough.get
public function get($columns = ['*']) { $builder = $this->prepareQueryBuilder($columns); $models = $builder->getModels(); // If we actually found models we will also eager load any relationships that // have been specified as needing to be eager loaded. This will solve the // n + 1 query problem for the developer and also increase performance. if (count($models) > 0) { $models = $builder->eagerLoadRelations($models); } return $this->related->newCollection($models); }
php
public function get($columns = ['*']) { $builder = $this->prepareQueryBuilder($columns); $models = $builder->getModels(); // If we actually found models we will also eager load any relationships that // have been specified as needing to be eager loaded. This will solve the // n + 1 query problem for the developer and also increase performance. if (count($models) > 0) { $models = $builder->eagerLoadRelations($models); } return $this->related->newCollection($models); }
[ "public", "function", "get", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "builder", "=", "$", "this", "->", "prepareQueryBuilder", "(", "$", "columns", ")", ";", "$", "models", "=", "$", "builder", "->", "getModels", "(", ")", ";", "/...
Execute the query as a "select" statement. @param array $columns @return \Illuminate\Database\Eloquent\Collection
[ "Execute", "the", "query", "as", "a", "select", "statement", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php#L357-L371
train
Get the models from the database
[ 30522, 2270, 3853, 2131, 1006, 1002, 7753, 1027, 1031, 1005, 1008, 1005, 1033, 1007, 1063, 1002, 12508, 1027, 1002, 2023, 1011, 1028, 7374, 4226, 2854, 8569, 23891, 2099, 1006, 1002, 7753, 1007, 1025, 1002, 4275, 1027, 1002, 12508, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Referrers/SearchEngine.php
SearchEngine.convertCharset
protected function convertCharset($string, $charsets) { if (function_exists('iconv') && !empty($charsets) ) { $charset = $charsets[0]; if (count($charsets) > 1 && function_exists('mb_detect_encoding') ) { $charset = mb_detect_encoding($string, $charsets); if ($charset === false) { $charset = $charsets[0]; } } $newKey = @iconv($charset, 'UTF-8//IGNORE', $string); if (!empty($newKey)) { $string = $newKey; } } return $string; }
php
protected function convertCharset($string, $charsets) { if (function_exists('iconv') && !empty($charsets) ) { $charset = $charsets[0]; if (count($charsets) > 1 && function_exists('mb_detect_encoding') ) { $charset = mb_detect_encoding($string, $charsets); if ($charset === false) { $charset = $charsets[0]; } } $newKey = @iconv($charset, 'UTF-8//IGNORE', $string); if (!empty($newKey)) { $string = $newKey; } } return $string; }
[ "protected", "function", "convertCharset", "(", "$", "string", ",", "$", "charsets", ")", "{", "if", "(", "function_exists", "(", "'iconv'", ")", "&&", "!", "empty", "(", "$", "charsets", ")", ")", "{", "$", "charset", "=", "$", "charsets", "[", "0", ...
Tries to convert the given string from one of the given charsets to UTF-8 @param string $string @param array $charsets @return string
[ "Tries", "to", "convert", "the", "given", "string", "from", "one", "of", "the", "given", "charsets", "to", "UTF", "-", "8" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/SearchEngine.php#L397-L419
train
Convert charset from string to UTF - 8
[ 30522, 5123, 3853, 10463, 7507, 22573, 2102, 1006, 1002, 5164, 1010, 1002, 25869, 13462, 2015, 1007, 1063, 2065, 1006, 3853, 1035, 6526, 1006, 1005, 12696, 2615, 1005, 1007, 1004, 1004, 999, 4064, 1006, 1002, 25869, 13462, 2015, 1007, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Widgets/Tab.php
Tab.add
public function add($title, $content, $active = false) { $this->data['tabs'][] = [ 'id' => mt_rand(), 'title' => $title, 'content' => $content, 'type' => static::TYPE_CONTENT, ]; if ($active) { $this->data['active'] = count($this->data['tabs']) - 1; } return $this; }
php
public function add($title, $content, $active = false) { $this->data['tabs'][] = [ 'id' => mt_rand(), 'title' => $title, 'content' => $content, 'type' => static::TYPE_CONTENT, ]; if ($active) { $this->data['active'] = count($this->data['tabs']) - 1; } return $this; }
[ "public", "function", "add", "(", "$", "title", ",", "$", "content", ",", "$", "active", "=", "false", ")", "{", "$", "this", "->", "data", "[", "'tabs'", "]", "[", "]", "=", "[", "'id'", "=>", "mt_rand", "(", ")", ",", "'title'", "=>", "$", "t...
Add a tab and its contents. @param string $title @param string|Renderable $content @param bool $active @return $this
[ "Add", "a", "tab", "and", "its", "contents", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Tab.php#L42-L56
train
Add tab to list
[ 30522, 2270, 3853, 5587, 1006, 1002, 2516, 1010, 1002, 4180, 1010, 1002, 3161, 1027, 6270, 1007, 1063, 1002, 2023, 1011, 1028, 2951, 1031, 1005, 21628, 2015, 1005, 1033, 1031, 1033, 1027, 1031, 1005, 8909, 1005, 1027, 1028, 11047, 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/Database/Query/Grammars/Grammar.php
Grammar.compileWheresToArray
protected function compileWheresToArray($query) { return collect($query->wheres)->map(function ($where) use ($query) { return $where['boolean'].' '.$this->{"where{$where['type']}"}($query, $where); })->all(); }
php
protected function compileWheresToArray($query) { return collect($query->wheres)->map(function ($where) use ($query) { return $where['boolean'].' '.$this->{"where{$where['type']}"}($query, $where); })->all(); }
[ "protected", "function", "compileWheresToArray", "(", "$", "query", ")", "{", "return", "collect", "(", "$", "query", "->", "wheres", ")", "->", "map", "(", "function", "(", "$", "where", ")", "use", "(", "$", "query", ")", "{", "return", "$", "where",...
Get an array of all the where clauses for the query. @param \Illuminate\Database\Query\Builder $query @return array
[ "Get", "an", "array", "of", "all", "the", "where", "clauses", "for", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L203-L208
train
Compile the where clauses into an array.
[ 30522, 5123, 3853, 4012, 22090, 2860, 5886, 4355, 10441, 11335, 2100, 1006, 1002, 23032, 1007, 1063, 2709, 8145, 1006, 1002, 23032, 1011, 1028, 2073, 2015, 1007, 1011, 1028, 4949, 1006, 3853, 1006, 1002, 2073, 1007, 2224, 1006, 1002, 23032,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/GoalManager.php
GoalManager.getEcommerceItemsFromRequest
private function getEcommerceItemsFromRequest(Request $request) { $items = $request->getParam('ec_items'); if (empty($items)) { Common::printDebug("There are no Ecommerce items in the request"); // we still record an Ecommerce order without any item in it return array(); } if (!is_array($items)) { Common::printDebug("Error while json_decode the Ecommerce items = " . var_export($items, true)); return false; } $items = Common::unsanitizeInputValues($items); $cleanedItems = $this->getCleanedEcommerceItems($items); return $cleanedItems; }
php
private function getEcommerceItemsFromRequest(Request $request) { $items = $request->getParam('ec_items'); if (empty($items)) { Common::printDebug("There are no Ecommerce items in the request"); // we still record an Ecommerce order without any item in it return array(); } if (!is_array($items)) { Common::printDebug("Error while json_decode the Ecommerce items = " . var_export($items, true)); return false; } $items = Common::unsanitizeInputValues($items); $cleanedItems = $this->getCleanedEcommerceItems($items); return $cleanedItems; }
[ "private", "function", "getEcommerceItemsFromRequest", "(", "Request", "$", "request", ")", "{", "$", "items", "=", "$", "request", "->", "getParam", "(", "'ec_items'", ")", ";", "if", "(", "empty", "(", "$", "items", ")", ")", "{", "Common", "::", "prin...
Returns Items read from the request string @return array|bool
[ "Returns", "Items", "read", "from", "the", "request", "string" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/GoalManager.php#L354-L373
train
Returns the Ecommerce items from the request
[ 30522, 30524, 5227, 1007, 1063, 1002, 5167, 1027, 1002, 5227, 1011, 1028, 2131, 28689, 2213, 1006, 1005, 14925, 1035, 5167, 1005, 1007, 1025, 2065, 1006, 4064, 1006, 1002, 5167, 1007, 1007, 1063, 2691, 1024, 1024, 6140, 3207, 8569, 2290, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Protocol/Abstract.php
Zend_Mail_Protocol_Abstract._send
protected function _send($request) { if (!is_resource($this->_socket)) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('No connection has been established to ' . $this->_host); } $this->_request = $request; $result = fwrite($this->_socket, $request . self::EOL); // Save request to internal log $this->_addLog($request . self::EOL); if ($result === false) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('Could not send request to ' . $this->_host); } return $result; }
php
protected function _send($request) { if (!is_resource($this->_socket)) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('No connection has been established to ' . $this->_host); } $this->_request = $request; $result = fwrite($this->_socket, $request . self::EOL); // Save request to internal log $this->_addLog($request . self::EOL); if ($result === false) { /** * @see Zend_Mail_Protocol_Exception */ // require_once 'Zend/Mail/Protocol/Exception.php'; throw new Zend_Mail_Protocol_Exception('Could not send request to ' . $this->_host); } return $result; }
[ "protected", "function", "_send", "(", "$", "request", ")", "{", "if", "(", "!", "is_resource", "(", "$", "this", "->", "_socket", ")", ")", "{", "/**\n * @see Zend_Mail_Protocol_Exception\n */", "// require_once 'Zend/Mail/Protocol/Exception.php';",...
Send the given request followed by a LINEEND to the server. @param string $request @throws Zend_Mail_Protocol_Exception @return integer|boolean Number of bytes written to remote host
[ "Send", "the", "given", "request", "followed", "by", "a", "LINEEND", "to", "the", "server", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Abstract.php#L312-L338
train
Send request to server
[ 30522, 5123, 3853, 1035, 4604, 1006, 1002, 5227, 1007, 1063, 2065, 1006, 999, 2003, 1035, 7692, 1006, 1002, 2023, 1011, 1028, 1035, 22278, 1007, 1007, 1063, 1013, 1008, 1008, 1008, 1030, 2156, 16729, 2094, 1035, 5653, 1035, 8778, 1035, 64...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Rule/Callback.php
HTML_QuickForm2_Rule_Callback.setConfig
public function setConfig($config) { if (!is_array($config) || !isset($config['callback'])) { $config = array('callback' => $config); } if (!is_callable($config['callback'], false, $callbackName)) { throw new HTML_QuickForm2_InvalidArgumentException( 'Callback Rule requires a valid callback, \'' . $callbackName . '\' was given' ); } return parent::setConfig($config + array('arguments' => array())); }
php
public function setConfig($config) { if (!is_array($config) || !isset($config['callback'])) { $config = array('callback' => $config); } if (!is_callable($config['callback'], false, $callbackName)) { throw new HTML_QuickForm2_InvalidArgumentException( 'Callback Rule requires a valid callback, \'' . $callbackName . '\' was given' ); } return parent::setConfig($config + array('arguments' => array())); }
[ "public", "function", "setConfig", "(", "$", "config", ")", "{", "if", "(", "!", "is_array", "(", "$", "config", ")", "||", "!", "isset", "(", "$", "config", "[", "'callback'", "]", ")", ")", "{", "$", "config", "=", "array", "(", "'callback'", "=>...
Sets the callback to use for validation and its additional arguments @param callback|array Callback or array ('callback' => validation callback, 'arguments' => additional arguments) @return HTML_QuickForm2_Rule @throws HTML_QuickForm2_InvalidArgumentException if callback is missing or invalid
[ "Sets", "the", "callback", "to", "use", "for", "validation", "and", "its", "additional", "arguments" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule/Callback.php#L158-L170
train
Sets the config for the callback rule
[ 30522, 2270, 3853, 2275, 8663, 8873, 2290, 1006, 1002, 9530, 8873, 2290, 1007, 1063, 2065, 1006, 999, 30524, 2290, 1031, 1005, 2655, 5963, 1005, 1033, 1007, 1007, 1063, 1002, 9530, 8873, 2290, 1027, 9140, 1006, 1005, 2655, 5963, 1005, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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/Console/InstallCommand.php
InstallCommand.createRoutesFile
protected function createRoutesFile() { $file = $this->directory.'/routes.php'; $contents = $this->getStub('routes'); $this->laravel['files']->put($file, str_replace('DummyNamespace', config('admin.route.namespace'), $contents)); $this->line('<info>Routes file was created:</info> '.str_replace(base_path(), '', $file)); }
php
protected function createRoutesFile() { $file = $this->directory.'/routes.php'; $contents = $this->getStub('routes'); $this->laravel['files']->put($file, str_replace('DummyNamespace', config('admin.route.namespace'), $contents)); $this->line('<info>Routes file was created:</info> '.str_replace(base_path(), '', $file)); }
[ "protected", "function", "createRoutesFile", "(", ")", "{", "$", "file", "=", "$", "this", "->", "directory", ".", "'/routes.php'", ";", "$", "contents", "=", "$", "this", "->", "getStub", "(", "'routes'", ")", ";", "$", "this", "->", "laravel", "[", "...
Create routes file. @return void
[ "Create", "routes", "file", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/InstallCommand.php#L156-L163
train
Create routes file
[ 30522, 5123, 3853, 3443, 22494, 4570, 8873, 2571, 1006, 1007, 1063, 1002, 5371, 1027, 1002, 2023, 1011, 1028, 14176, 1012, 1005, 1013, 5847, 1012, 25718, 1005, 1025, 1002, 8417, 1027, 1002, 2023, 1011, 1028, 4152, 28251, 1006, 1005, 5847, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php
JsonBundleWriter.write
public function write($path, $locale, $data) { if ($data instanceof \Traversable) { $data = iterator_to_array($data); } array_walk_recursive($data, function (&$value) { if ($value instanceof \Traversable) { $value = iterator_to_array($value); } }); $contents = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n"; file_put_contents($path.'/'.$locale.'.json', $contents); }
php
public function write($path, $locale, $data) { if ($data instanceof \Traversable) { $data = iterator_to_array($data); } array_walk_recursive($data, function (&$value) { if ($value instanceof \Traversable) { $value = iterator_to_array($value); } }); $contents = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n"; file_put_contents($path.'/'.$locale.'.json', $contents); }
[ "public", "function", "write", "(", "$", "path", ",", "$", "locale", ",", "$", "data", ")", "{", "if", "(", "$", "data", "instanceof", "\\", "Traversable", ")", "{", "$", "data", "=", "iterator_to_array", "(", "$", "data", ")", ";", "}", "array_walk_...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php#L26-L41
train
Write the locale data to the file
[ 30522, 2270, 3853, 4339, 1006, 1002, 4130, 1010, 1002, 2334, 2063, 1010, 1002, 2951, 1007, 1063, 2065, 1006, 1002, 2951, 6013, 11253, 1032, 30524, 1002, 2951, 1007, 1025, 1065, 9140, 1035, 3328, 1035, 28667, 9236, 3512, 1006, 1002, 2951, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Comment/Client.php
Client.open
public function open(string $msgId, int $index = null) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, ]; return $this->httpPostJson('cgi-bin/comment/open', $params); }
php
public function open(string $msgId, int $index = null) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, ]; return $this->httpPostJson('cgi-bin/comment/open', $params); }
[ "public", "function", "open", "(", "string", "$", "msgId", ",", "int", "$", "index", "=", "null", ")", "{", "$", "params", "=", "[", "'msg_data_id'", "=>", "$", "msgId", ",", "'index'", "=>", "$", "index", ",", "]", ";", "return", "$", "this", "->"...
Open article comment. @param string $msgId @param int|null $index @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Open", "article", "comment", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Comment/Client.php#L31-L39
train
Open a comment
[ 30522, 2270, 3853, 2330, 1006, 5164, 1002, 5796, 5856, 2094, 1010, 20014, 1002, 5950, 1027, 19701, 1007, 1063, 1002, 30524, 1013, 2330, 1005, 1010, 1002, 11498, 5244, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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/OptionsResolver/OptionsResolver.php
OptionsResolver.setDeprecated
public function setDeprecated(string $option, $deprecationMessage = 'The option "%name%" is deprecated.'): self { if ($this->locked) { throw new AccessException('Options cannot be deprecated from a lazy option or normalizer.'); } if (!isset($this->defined[$option])) { throw new UndefinedOptionsException(sprintf('The option "%s" does not exist, defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } if (!\is_string($deprecationMessage) && !$deprecationMessage instanceof \Closure) { throw new InvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', \gettype($deprecationMessage))); } // ignore if empty string if ('' === $deprecationMessage) { return $this; } $this->deprecated[$option] = $deprecationMessage; // Make sure the option is processed unset($this->resolved[$option]); return $this; }
php
public function setDeprecated(string $option, $deprecationMessage = 'The option "%name%" is deprecated.'): self { if ($this->locked) { throw new AccessException('Options cannot be deprecated from a lazy option or normalizer.'); } if (!isset($this->defined[$option])) { throw new UndefinedOptionsException(sprintf('The option "%s" does not exist, defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } if (!\is_string($deprecationMessage) && !$deprecationMessage instanceof \Closure) { throw new InvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', \gettype($deprecationMessage))); } // ignore if empty string if ('' === $deprecationMessage) { return $this; } $this->deprecated[$option] = $deprecationMessage; // Make sure the option is processed unset($this->resolved[$option]); return $this; }
[ "public", "function", "setDeprecated", "(", "string", "$", "option", ",", "$", "deprecationMessage", "=", "'The option \"%name%\" is deprecated.'", ")", ":", "self", "{", "if", "(", "$", "this", "->", "locked", ")", "{", "throw", "new", "AccessException", "(", ...
Deprecates an option, allowed types or values. Instead of passing the message, you may also pass a closure with the following signature: function (Options $options, $value): string { // ... } The closure receives the value as argument and should return a string. Return an empty string to ignore the option deprecation. The closure is invoked when {@link resolve()} is called. The parameter passed to the closure is the value of the option after validating it and before normalizing it. @param string|\Closure $deprecationMessage
[ "Deprecates", "an", "option", "allowed", "types", "or", "values", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/OptionsResolver/OptionsResolver.php#L419-L444
train
Sets a deprecation message for an option.
[ 30522, 2270, 3853, 2275, 3207, 28139, 12921, 1006, 5164, 1002, 5724, 1010, 1002, 2139, 28139, 10719, 7834, 3736, 3351, 1027, 1005, 1996, 5724, 1000, 1003, 2171, 1003, 1000, 2003, 2139, 28139, 12921, 1012, 1005, 1007, 1024, 2969, 1063, 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...
matomo-org/matomo
plugins/Annotations/AnnotationList.php
AnnotationList.add
public function add($idSite, $date, $note, $starred = 0) { $this->checkIdSiteIsLoaded($idSite); $date = Date::factory($date)->toString('Y-m-d'); $this->annotations[$idSite][] = self::makeAnnotation($date, $note, $starred); // get the id of the new annotation end($this->annotations[$idSite]); $newNoteId = key($this->annotations[$idSite]); return $this->get($idSite, $newNoteId); }
php
public function add($idSite, $date, $note, $starred = 0) { $this->checkIdSiteIsLoaded($idSite); $date = Date::factory($date)->toString('Y-m-d'); $this->annotations[$idSite][] = self::makeAnnotation($date, $note, $starred); // get the id of the new annotation end($this->annotations[$idSite]); $newNoteId = key($this->annotations[$idSite]); return $this->get($idSite, $newNoteId); }
[ "public", "function", "add", "(", "$", "idSite", ",", "$", "date", ",", "$", "note", ",", "$", "starred", "=", "0", ")", "{", "$", "this", "->", "checkIdSiteIsLoaded", "(", "$", "idSite", ")", ";", "$", "date", "=", "Date", "::", "factory", "(", ...
Creates a new annotation for a site. This method does not perist the result. To save the new annotation in the database, call $this->save. @param int $idSite The ID of the site to add an annotation to. @param string $date The date the annotation is in reference to. @param string $note The text of the new annotation. @param int $starred Either 1 or 0. If 1, the new annotation has been starred, otherwise it will start out unstarred. @return array The added annotation. @throws Exception if $idSite is not an ID that was supplied upon construction.
[ "Creates", "a", "new", "annotation", "for", "a", "site", ".", "This", "method", "does", "not", "perist", "the", "result", ".", "To", "save", "the", "new", "annotation", "in", "the", "database", "call", "$this", "-", ">", "save", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Annotations/AnnotationList.php#L85-L97
train
Add a new annotation to the list of annotations
[ 30522, 2270, 3853, 5587, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 3058, 1010, 1002, 3602, 1010, 1002, 5652, 1027, 1014, 1007, 1063, 1002, 2023, 1011, 1028, 4638, 9821, 4221, 2483, 17468, 1006, 1002, 8909, 28032, 2063, 1007, 1025, 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/LanguagesManager/Controller.php
Controller.saveLanguage
public function saveLanguage() { $language = Common::getRequestVar('language'); // Prevent CSRF only when piwik is not installed yet (During install user can change language) if (DbHelper::isInstalled()) { $this->checkTokenInUrl(); } LanguagesManager::setLanguageForSession($language); Url::redirectToReferrer(); }
php
public function saveLanguage() { $language = Common::getRequestVar('language'); // Prevent CSRF only when piwik is not installed yet (During install user can change language) if (DbHelper::isInstalled()) { $this->checkTokenInUrl(); } LanguagesManager::setLanguageForSession($language); Url::redirectToReferrer(); }
[ "public", "function", "saveLanguage", "(", ")", "{", "$", "language", "=", "Common", "::", "getRequestVar", "(", "'language'", ")", ";", "// Prevent CSRF only when piwik is not installed yet (During install user can change language)", "if", "(", "DbHelper", "::", "isInstall...
anonymous = in the session authenticated user = in the session
[ "anonymous", "=", "in", "the", "session", "authenticated", "user", "=", "in", "the", "session" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/LanguagesManager/Controller.php#L26-L37
train
Saves the language in the session
[ 30522, 2270, 3853, 3828, 25023, 6692, 3351, 1006, 1007, 1063, 1002, 2653, 1027, 2691, 1024, 1024, 2131, 2890, 15500, 10755, 1006, 1005, 2653, 1005, 1007, 1025, 1013, 1013, 4652, 20116, 12881, 2069, 2043, 14255, 9148, 2243, 2003, 2025, 5361,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Validator.php
Validator.addDependentExtensions
public function addDependentExtensions(array $extensions) { $this->addExtensions($extensions); foreach ($extensions as $rule => $extension) { $this->dependentRules[] = Str::studly($rule); } }
php
public function addDependentExtensions(array $extensions) { $this->addExtensions($extensions); foreach ($extensions as $rule => $extension) { $this->dependentRules[] = Str::studly($rule); } }
[ "public", "function", "addDependentExtensions", "(", "array", "$", "extensions", ")", "{", "$", "this", "->", "addExtensions", "(", "$", "extensions", ")", ";", "foreach", "(", "$", "extensions", "as", "$", "rule", "=>", "$", "extension", ")", "{", "$", ...
Register an array of custom implicit validator extensions. @param array $extensions @return void
[ "Register", "an", "array", "of", "custom", "implicit", "validator", "extensions", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L910-L917
train
Adds dependent extensions to the list of rules that should be included in the tree.
[ 30522, 2270, 3853, 5587, 3207, 11837, 16454, 10288, 29048, 2015, 1006, 9140, 1002, 14305, 1007, 1063, 1002, 2023, 1011, 1028, 5587, 10288, 29048, 2015, 1006, 1002, 14305, 1007, 1025, 18921, 6776, 1006, 1002, 14305, 2004, 1002, 3627, 1027, 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...
guzzle/guzzle
build/Burgomaster.php
Burgomaster.exec
public function exec($command) { $this->debug("Executing: $command"); $output = $returnValue = null; exec($command, $output, $returnValue); if ($returnValue != 0) { throw new \RuntimeException('Error executing command: ' . $command . ' : ' . implode("\n", $output)); } return implode("\n", $output); }
php
public function exec($command) { $this->debug("Executing: $command"); $output = $returnValue = null; exec($command, $output, $returnValue); if ($returnValue != 0) { throw new \RuntimeException('Error executing command: ' . $command . ' : ' . implode("\n", $output)); } return implode("\n", $output); }
[ "public", "function", "exec", "(", "$", "command", ")", "{", "$", "this", "->", "debug", "(", "\"Executing: $command\"", ")", ";", "$", "output", "=", "$", "returnValue", "=", "null", ";", "exec", "(", "$", "command", ",", "$", "output", ",", "$", "r...
Execute a command and throw an exception if the return code is not 0. @param string $command Command to execute @return string Returns the output of the command as a string @throws \RuntimeException on error.
[ "Execute", "a", "command", "and", "throw", "an", "exception", "if", "the", "return", "code", "is", "not", "0", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/build/Burgomaster.php#L207-L219
train
Execute a command and return the output
[ 30522, 2270, 3853, 4654, 8586, 1006, 1002, 3094, 1007, 1063, 1002, 2023, 1011, 1028, 2139, 8569, 2290, 1006, 1000, 23448, 1024, 1002, 3094, 30524, 19701, 1025, 4654, 8586, 1006, 1002, 3094, 1010, 1002, 6434, 1010, 1002, 2709, 10175, 5657, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.adjacentSibling
public function adjacentSibling($direction = 1) { $parent = $this->parent(); $collection = $parent ? $parent->collection('content', false) : null; if ($collection instanceof Collection) { return $collection->adjacentSibling($this->path(), $direction); } return false; }
php
public function adjacentSibling($direction = 1) { $parent = $this->parent(); $collection = $parent ? $parent->collection('content', false) : null; if ($collection instanceof Collection) { return $collection->adjacentSibling($this->path(), $direction); } return false; }
[ "public", "function", "adjacentSibling", "(", "$", "direction", "=", "1", ")", "{", "$", "parent", "=", "$", "this", "->", "parent", "(", ")", ";", "$", "collection", "=", "$", "parent", "?", "$", "parent", "->", "collection", "(", "'content'", ",", ...
Returns the adjacent sibling based on a direction. @param int $direction either -1 or +1 @return PageInterface|bool the sibling page
[ "Returns", "the", "adjacent", "sibling", "based", "on", "a", "direction", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2478-L2487
train
Get the sibling of this node
[ 30522, 2270, 3853, 5516, 5332, 9709, 1006, 1002, 3257, 1027, 1015, 1007, 1063, 1002, 6687, 1027, 1002, 2023, 1011, 1028, 6687, 1006, 1007, 1025, 1002, 3074, 1027, 1002, 6687, 1029, 1002, 6687, 1011, 1028, 3074, 1006, 1005, 4180, 1005, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Filter.php
Filter.getScopeNameFrom
public function getScopeNameFrom($scope) { if (is_string($scope)) { $scope = $this->getScope($scope); } return $scope->nameFrom; }
php
public function getScopeNameFrom($scope) { if (is_string($scope)) { $scope = $this->getScope($scope); } return $scope->nameFrom; }
[ "public", "function", "getScopeNameFrom", "(", "$", "scope", ")", "{", "if", "(", "is_string", "(", "$", "scope", ")", ")", "{", "$", "scope", "=", "$", "this", "->", "getScope", "(", "$", "scope", ")", ";", "}", "return", "$", "scope", "->", "name...
Returns the display name column for a scope. @param string $scope @return string
[ "Returns", "the", "display", "name", "column", "for", "a", "scope", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Filter.php#L906-L913
train
Get Scope Name From
[ 30522, 2270, 3853, 4152, 16186, 18442, 19699, 5358, 1006, 1002, 9531, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 9531, 1007, 1007, 1063, 1002, 9531, 1027, 1002, 2023, 1011, 1028, 4152, 16186, 1006, 1002, 9531, 1007, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Rule.php
HTML_QuickForm2_Rule.getJavascript
public function getJavascript() { $js = "{\n\tcallback: " . $this->getJavascriptCallback() . ",\n" . "\telementId: '" . $this->owner->getId() . "',\n" . "\terrorMessage: '" . strtr($this->getMessage(), array( "\r" => '\r', "\n" => '\n', "\t" => '\t', "'" => "\\'", '"' => '\"', '\\' => '\\\\' )) . "',\n\tchained: ["; $chained = array(); foreach ($this->chainedRules as $item) { $multipliers = array(); foreach ($item as $multiplier) { $multipliers[] = $multiplier->getJavascript(); } $chained[] = '[' . implode(",\n", $multipliers) . ']'; } $js .= implode(",\n", $chained) . "]\n}"; return $js; }
php
public function getJavascript() { $js = "{\n\tcallback: " . $this->getJavascriptCallback() . ",\n" . "\telementId: '" . $this->owner->getId() . "',\n" . "\terrorMessage: '" . strtr($this->getMessage(), array( "\r" => '\r', "\n" => '\n', "\t" => '\t', "'" => "\\'", '"' => '\"', '\\' => '\\\\' )) . "',\n\tchained: ["; $chained = array(); foreach ($this->chainedRules as $item) { $multipliers = array(); foreach ($item as $multiplier) { $multipliers[] = $multiplier->getJavascript(); } $chained[] = '[' . implode(",\n", $multipliers) . ']'; } $js .= implode(",\n", $chained) . "]\n}"; return $js; }
[ "public", "function", "getJavascript", "(", ")", "{", "$", "js", "=", "\"{\\n\\tcallback: \"", ".", "$", "this", "->", "getJavascriptCallback", "(", ")", ".", "\",\\n\"", ".", "\"\\telementId: '\"", ".", "$", "this", "->", "owner", "->", "getId", "(", ")", ...
Returns the client-side representation of the Rule The Javascript object returned contains the following fields: - callback: {@see getJavascriptCallback()} - elementId: element ID to set error for if validation fails - errorMessage: error message to set if validation fails - chained: chained rules, array of arrays like in $chainedRules property @return string @throws HTML_QuickForm2_Exception if Rule or its chained Rules can only be run server-side
[ "Returns", "the", "client", "-", "side", "representation", "of", "the", "Rule" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule.php#L309-L331
train
Returns the javascript code for the error
[ 30522, 2270, 3853, 2131, 3900, 12044, 23235, 1006, 1007, 1063, 1002, 1046, 2015, 1027, 1000, 1063, 1032, 1050, 1032, 22975, 8095, 5963, 1024, 1000, 1012, 1002, 2023, 1011, 1028, 2131, 3900, 12044, 23235, 9289, 20850, 8684, 1006, 1007, 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...
laravel/framework
src/Illuminate/Support/Collection.php
Collection.whereNotBetween
public function whereNotBetween($key, $values) { return $this->filter(function ($item) use ($key, $values) { return data_get($item, $key) < reset($values) || data_get($item, $key) > end($values); }); }
php
public function whereNotBetween($key, $values) { return $this->filter(function ($item) use ($key, $values) { return data_get($item, $key) < reset($values) || data_get($item, $key) > end($values); }); }
[ "public", "function", "whereNotBetween", "(", "$", "key", ",", "$", "values", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "item", ")", "use", "(", "$", "key", ",", "$", "values", ")", "{", "return", "data_get", "(", ...
Filter items such that the value of the given key is not between the given values. @param string $key @param array $values @return static
[ "Filter", "items", "such", "that", "the", "value", "of", "the", "given", "key", "is", "not", "between", "the", "given", "values", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L757-L762
train
Filter items where not between
[ 30522, 2270, 3853, 2073, 17048, 20915, 28394, 2078, 1006, 1002, 3145, 1010, 1002, 5300, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 11307, 1006, 3853, 1006, 1002, 8875, 1007, 2224, 1006, 1002, 3145, 1010, 1002, 5300, 1007, 1063, 2709, 2951, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Statement/Pdo.php
Zend_Db_Statement_Pdo.setFetchMode
public function setFetchMode($mode) { $this->_fetchMode = $mode; try { return $this->_stmt->setFetchMode($mode); } catch (PDOException $e) { // require_once 'Zend/Db/Statement/Exception.php'; throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e); } }
php
public function setFetchMode($mode) { $this->_fetchMode = $mode; try { return $this->_stmt->setFetchMode($mode); } catch (PDOException $e) { // require_once 'Zend/Db/Statement/Exception.php'; throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e); } }
[ "public", "function", "setFetchMode", "(", "$", "mode", ")", "{", "$", "this", "->", "_fetchMode", "=", "$", "mode", ";", "try", "{", "return", "$", "this", "->", "_stmt", "->", "setFetchMode", "(", "$", "mode", ")", ";", "}", "catch", "(", "PDOExcep...
Set the default fetch mode for this statement. @param int $mode The fetch mode. @return bool @throws Zend_Db_Statement_Exception
[ "Set", "the", "default", "fetch", "mode", "for", "this", "statement", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Pdo.php#L428-L437
train
Set the fetch mode for the statement
[ 30522, 2270, 3853, 2275, 7959, 10649, 5302, 3207, 1006, 1002, 5549, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 18584, 5302, 3207, 1027, 1002, 5549, 1025, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1011, 1028, 2275, 7959, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Blueprints.php
Blueprints.types
public function types() { if ($this->types === null) { $this->types = []; $grav = Grav::instance(); /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; // Get stream / directory iterator. if ($locator->isStream($this->search)) { $iterator = $locator->getIterator($this->search); } else { $iterator = new \DirectoryIterator($this->search); } /** @var \DirectoryIterator $file */ foreach ($iterator as $file) { if (!$file->isFile() || '.' . $file->getExtension() !== YAML_EXT) { continue; } $name = $file->getBasename(YAML_EXT); $this->types[$name] = ucfirst(str_replace('_', ' ', $name)); } } return $this->types; }
php
public function types() { if ($this->types === null) { $this->types = []; $grav = Grav::instance(); /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; // Get stream / directory iterator. if ($locator->isStream($this->search)) { $iterator = $locator->getIterator($this->search); } else { $iterator = new \DirectoryIterator($this->search); } /** @var \DirectoryIterator $file */ foreach ($iterator as $file) { if (!$file->isFile() || '.' . $file->getExtension() !== YAML_EXT) { continue; } $name = $file->getBasename(YAML_EXT); $this->types[$name] = ucfirst(str_replace('_', ' ', $name)); } } return $this->types; }
[ "public", "function", "types", "(", ")", "{", "if", "(", "$", "this", "->", "types", "===", "null", ")", "{", "$", "this", "->", "types", "=", "[", "]", ";", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "/** @var UniformResourceLocator ...
Get all available blueprint types. @return array List of type=>name
[ "Get", "all", "available", "blueprint", "types", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprints.php#L53-L81
train
Return all types in the search string
[ 30522, 2270, 3853, 4127, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 4127, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 4127, 1027, 1031, 1033, 1025, 1002, 24665, 11431, 1027, 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...
matomo-org/matomo
core/Tracker/Db/Pdo/Mysql.php
Mysql.connect
public function connect() { if (self::$profiling) { $timer = $this->initProfiler(); } // Make sure MySQL returns all matched rows on update queries including // rows that actually didn't have to be updated because the values didn't // change. This matches common behaviour among other database systems. // See #6296 why this is important in tracker $this->mysqlOptions[PDO::MYSQL_ATTR_FOUND_ROWS] = true; $this->mysqlOptions[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; $this->connection = @new PDO($this->dsn, $this->username, $this->password, $this->mysqlOptions); // we may want to setAttribute(PDO::ATTR_TIMEOUT ) to a few seconds (default is 60) in case the DB is locked // the matomo.php would stay waiting for the database... bad! // we delete the password from this object "just in case" it could be printed $this->password = ''; /* * Lazy initialization via MYSQL_ATTR_INIT_COMMAND depends * on mysqlnd support, PHP version, and OS. * see ZF-7428 and http://bugs.php.net/bug.php?id=47224 */ if (!empty($this->charset)) { $sql = "SET NAMES '" . $this->charset . "'"; $this->connection->exec($sql); } if (self::$profiling && isset($timer)) { $this->recordQueryProfile('connect', $timer); } }
php
public function connect() { if (self::$profiling) { $timer = $this->initProfiler(); } // Make sure MySQL returns all matched rows on update queries including // rows that actually didn't have to be updated because the values didn't // change. This matches common behaviour among other database systems. // See #6296 why this is important in tracker $this->mysqlOptions[PDO::MYSQL_ATTR_FOUND_ROWS] = true; $this->mysqlOptions[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; $this->connection = @new PDO($this->dsn, $this->username, $this->password, $this->mysqlOptions); // we may want to setAttribute(PDO::ATTR_TIMEOUT ) to a few seconds (default is 60) in case the DB is locked // the matomo.php would stay waiting for the database... bad! // we delete the password from this object "just in case" it could be printed $this->password = ''; /* * Lazy initialization via MYSQL_ATTR_INIT_COMMAND depends * on mysqlnd support, PHP version, and OS. * see ZF-7428 and http://bugs.php.net/bug.php?id=47224 */ if (!empty($this->charset)) { $sql = "SET NAMES '" . $this->charset . "'"; $this->connection->exec($sql); } if (self::$profiling && isset($timer)) { $this->recordQueryProfile('connect', $timer); } }
[ "public", "function", "connect", "(", ")", "{", "if", "(", "self", "::", "$", "profiling", ")", "{", "$", "timer", "=", "$", "this", "->", "initProfiler", "(", ")", ";", "}", "// Make sure MySQL returns all matched rows on update queries including", "// rows that ...
Connects to the DB @throws Exception if there was an error connecting the DB
[ "Connects", "to", "the", "DB" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Db/Pdo/Mysql.php#L97-L132
train
Connects to the database and sets the default values
[ 30522, 2270, 3853, 7532, 1006, 1007, 1063, 2065, 1006, 2969, 1024, 1024, 1002, 11268, 16281, 1007, 1063, 1002, 25309, 1027, 1002, 2023, 1011, 1028, 1999, 4183, 21572, 8873, 3917, 1006, 1007, 1025, 1065, 1013, 1013, 2191, 2469, 2026, 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...
matomo-org/matomo
core/UpdateCheck.php
UpdateCheck.check
public static function check($force = false, $interval = null) { if (!SettingsPiwik::isAutoUpdateEnabled()) { return; } if ($interval === null) { $interval = self::CHECK_INTERVAL; } $lastTimeChecked = Option::get(self::LAST_TIME_CHECKED); if ($force || $lastTimeChecked === false || time() - $interval > $lastTimeChecked ) { // set the time checked first, so that parallel Piwik requests don't all trigger the http requests Option::set(self::LAST_TIME_CHECKED, time(), $autoLoad = 1); $latestVersion = self::getLatestAvailableVersionNumber(); $latestVersion = trim((string) $latestVersion); if (!preg_match('~^[0-9][0-9a-zA-Z_.-]*$~D', $latestVersion)) { $latestVersion = ''; } Option::set(self::LATEST_VERSION, $latestVersion); } }
php
public static function check($force = false, $interval = null) { if (!SettingsPiwik::isAutoUpdateEnabled()) { return; } if ($interval === null) { $interval = self::CHECK_INTERVAL; } $lastTimeChecked = Option::get(self::LAST_TIME_CHECKED); if ($force || $lastTimeChecked === false || time() - $interval > $lastTimeChecked ) { // set the time checked first, so that parallel Piwik requests don't all trigger the http requests Option::set(self::LAST_TIME_CHECKED, time(), $autoLoad = 1); $latestVersion = self::getLatestAvailableVersionNumber(); $latestVersion = trim((string) $latestVersion); if (!preg_match('~^[0-9][0-9a-zA-Z_.-]*$~D', $latestVersion)) { $latestVersion = ''; } Option::set(self::LATEST_VERSION, $latestVersion); } }
[ "public", "static", "function", "check", "(", "$", "force", "=", "false", ",", "$", "interval", "=", "null", ")", "{", "if", "(", "!", "SettingsPiwik", "::", "isAutoUpdateEnabled", "(", ")", ")", "{", "return", ";", "}", "if", "(", "$", "interval", "...
Check for a newer version @param bool $force Force check @param int $interval Interval used for update checks
[ "Check", "for", "a", "newer", "version" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/UpdateCheck.php#L30-L56
train
Check the version number of Piwik
[ 30522, 2270, 10763, 3853, 4638, 1006, 1002, 2486, 1027, 6270, 1010, 1002, 13483, 1027, 19701, 1007, 1063, 2065, 1006, 999, 10906, 8197, 9148, 2243, 1024, 1024, 18061, 16161, 6279, 13701, 8189, 23242, 1006, 1007, 1007, 1063, 2709, 1025, 1065...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/controllers/Index.php
Index.onDelete
public function onDelete() { $this->validateRequestTheme(); $type = Request::input('templateType'); $this->loadTemplate($type, trim(Request::input('templatePath')))->delete(); /* * Extensibility - documented above */ $this->fireSystemEvent('cms.template.delete', [$type]); }
php
public function onDelete() { $this->validateRequestTheme(); $type = Request::input('templateType'); $this->loadTemplate($type, trim(Request::input('templatePath')))->delete(); /* * Extensibility - documented above */ $this->fireSystemEvent('cms.template.delete', [$type]); }
[ "public", "function", "onDelete", "(", ")", "{", "$", "this", "->", "validateRequestTheme", "(", ")", ";", "$", "type", "=", "Request", "::", "input", "(", "'templateType'", ")", ";", "$", "this", "->", "loadTemplate", "(", "$", "type", ",", "trim", "(...
Deletes a template @return void
[ "Deletes", "a", "template" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L336-L348
train
Action for deleting a template
[ 30522, 2270, 3853, 2006, 9247, 12870, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 9398, 24932, 2063, 15500, 10760, 4168, 1006, 1007, 1025, 1002, 2828, 1027, 5227, 1024, 1024, 7953, 1006, 1005, 23561, 13874, 1005, 1007, 1025, 1002, 2023, 1011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Input/ArgvInput.php
ArgvInput.parseLongOption
private function parseLongOption($token) { $name = substr($token, 2); if (false !== $pos = strpos($name, '=')) { if (0 === \strlen($value = substr($name, $pos + 1))) { array_unshift($this->parsed, $value); } $this->addLongOption(substr($name, 0, $pos), $value); } else { $this->addLongOption($name, null); } }
php
private function parseLongOption($token) { $name = substr($token, 2); if (false !== $pos = strpos($name, '=')) { if (0 === \strlen($value = substr($name, $pos + 1))) { array_unshift($this->parsed, $value); } $this->addLongOption(substr($name, 0, $pos), $value); } else { $this->addLongOption($name, null); } }
[ "private", "function", "parseLongOption", "(", "$", "token", ")", "{", "$", "name", "=", "substr", "(", "$", "token", ",", "2", ")", ";", "if", "(", "false", "!==", "$", "pos", "=", "strpos", "(", "$", "name", ",", "'='", ")", ")", "{", "if", "...
Parses a long option. @param string $token The current token
[ "Parses", "a", "long", "option", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Input/ArgvInput.php#L144-L156
train
Parse Long Option
[ 30522, 2797, 3853, 11968, 11246, 5063, 7361, 3508, 1006, 1002, 19204, 1007, 1063, 1002, 2171, 1027, 4942, 3367, 2099, 1006, 1002, 19204, 1010, 1016, 1007, 1025, 2065, 1006, 6270, 999, 1027, 1027, 1002, 13433, 2015, 1027, 2358, 14536, 2891, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Renderer/Default.php
HTML_QuickForm2_Renderer_Default.setElementTemplateForGroupId
public function setElementTemplateForGroupId($groupId, $elementClass, $template) { $this->elementTemplatesForGroupId[$groupId][strtolower($elementClass)] = $template; return $this; }
php
public function setElementTemplateForGroupId($groupId, $elementClass, $template) { $this->elementTemplatesForGroupId[$groupId][strtolower($elementClass)] = $template; return $this; }
[ "public", "function", "setElementTemplateForGroupId", "(", "$", "groupId", ",", "$", "elementClass", ",", "$", "template", ")", "{", "$", "this", "->", "elementTemplatesForGroupId", "[", "$", "groupId", "]", "[", "strtolower", "(", "$", "elementClass", ")", "]...
Sets grouped elements templates using group id Templates set via {@link setTemplateForClass()} will not be used for grouped form elements. When searching for a template to use, the renderer will first consider template set for a specific group id, then the group templates set by group class. @param string Group id @param string Element class name @param mixed Template @return HTML_QuickForm2_Renderer_Default
[ "Sets", "grouped", "elements", "templates", "using", "group", "id" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer/Default.php#L246-L250
train
Set Element Template for Group
[ 30522, 2270, 3853, 2275, 12260, 3672, 18532, 15725, 29278, 17058, 3593, 1006, 1002, 2177, 3593, 1010, 1002, 5783, 26266, 1010, 1002, 23561, 1007, 1063, 1002, 2023, 1011, 1028, 5783, 18532, 15725, 22747, 21759, 22107, 3593, 1031, 1002, 2177, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/controllers/Updates.php
Updates.listInjectRowClass
public function listInjectRowClass($record, $definition = null) { if ($record->disabledByConfig) { return 'hidden'; } if ($record->orphaned || $record->is_disabled) { return 'safe disabled'; } if ($definition != 'manage') { return; } if ($record->disabledBySystem) { return 'negative'; } if ($record->is_frozen) { return 'frozen'; } return 'positive'; }
php
public function listInjectRowClass($record, $definition = null) { if ($record->disabledByConfig) { return 'hidden'; } if ($record->orphaned || $record->is_disabled) { return 'safe disabled'; } if ($definition != 'manage') { return; } if ($record->disabledBySystem) { return 'negative'; } if ($record->is_frozen) { return 'frozen'; } return 'positive'; }
[ "public", "function", "listInjectRowClass", "(", "$", "record", ",", "$", "definition", "=", "null", ")", "{", "if", "(", "$", "record", "->", "disabledByConfig", ")", "{", "return", "'hidden'", ";", "}", "if", "(", "$", "record", "->", "orphaned", "||",...
Override for ListController behavior. Modifies the CSS class for each row in the list to - hidden - Disabled by configuration - safe disabled - Orphaned or disabled - negative - Disabled by system - frozen - Frozen by the user - positive - Default CSS class @see Backend\Behaviors\ListController @return string
[ "Override", "for", "ListController", "behavior", ".", "Modifies", "the", "CSS", "class", "for", "each", "row", "in", "the", "list", "to" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/controllers/Updates.php#L230-L253
train
List Inject Row Class
[ 30522, 2270, 3853, 2862, 2378, 20614, 10524, 26266, 1006, 1002, 2501, 1010, 1002, 6210, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2501, 1011, 1028, 9776, 3762, 8663, 8873, 2290, 1007, 1063, 2709, 1005, 5023, 1005, 1025, 1065, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php
ExceptionController.showAction
public function showAction($token) { if (null === $this->profiler) { throw new NotFoundHttpException('The profiler must be enabled.'); } $this->profiler->disable(); $exception = $this->profiler->loadProfile($token)->getCollector('exception')->getException(); $template = $this->getTemplate(); if (!$this->twig->getLoader()->exists($template)) { $handler = new ExceptionHandler($this->debug, $this->twig->getCharset(), $this->fileLinkFormat); return new Response($handler->getContent($exception), 200, ['Content-Type' => 'text/html']); } $code = $exception->getStatusCode(); return new Response($this->twig->render( $template, [ 'status_code' => $code, 'status_text' => Response::$statusTexts[$code], 'exception' => $exception, 'logger' => null, 'currentContent' => '', ] ), 200, ['Content-Type' => 'text/html']); }
php
public function showAction($token) { if (null === $this->profiler) { throw new NotFoundHttpException('The profiler must be enabled.'); } $this->profiler->disable(); $exception = $this->profiler->loadProfile($token)->getCollector('exception')->getException(); $template = $this->getTemplate(); if (!$this->twig->getLoader()->exists($template)) { $handler = new ExceptionHandler($this->debug, $this->twig->getCharset(), $this->fileLinkFormat); return new Response($handler->getContent($exception), 200, ['Content-Type' => 'text/html']); } $code = $exception->getStatusCode(); return new Response($this->twig->render( $template, [ 'status_code' => $code, 'status_text' => Response::$statusTexts[$code], 'exception' => $exception, 'logger' => null, 'currentContent' => '', ] ), 200, ['Content-Type' => 'text/html']); }
[ "public", "function", "showAction", "(", "$", "token", ")", "{", "if", "(", "null", "===", "$", "this", "->", "profiler", ")", "{", "throw", "new", "NotFoundHttpException", "(", "'The profiler must be enabled.'", ")", ";", "}", "$", "this", "->", "profiler",...
Renders the exception panel for the given token. @param string $token The profiler token @return Response A Response instance @throws NotFoundHttpException
[ "Renders", "the", "exception", "panel", "for", "the", "given", "token", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php#L52-L81
train
Show the exception of a profile
[ 30522, 2270, 3853, 2265, 18908, 3258, 1006, 1002, 19204, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 6337, 2099, 1007, 1063, 5466, 2047, 2025, 14876, 8630, 11039, 25856, 10288, 24422, 1006, 1005, 1996, 6337, 209...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Protocol/Smtp.php
Zend_Mail_Protocol_Smtp.rset
public function rset() { $this->_send('RSET'); // MS ESMTP doesn't follow RFC, see [ZF-1377] $this->_expect(array(250, 220)); $this->_mail = false; $this->_rcpt = false; $this->_data = false; }
php
public function rset() { $this->_send('RSET'); // MS ESMTP doesn't follow RFC, see [ZF-1377] $this->_expect(array(250, 220)); $this->_mail = false; $this->_rcpt = false; $this->_data = false; }
[ "public", "function", "rset", "(", ")", "{", "$", "this", "->", "_send", "(", "'RSET'", ")", ";", "// MS ESMTP doesn't follow RFC, see [ZF-1377]", "$", "this", "->", "_expect", "(", "array", "(", "250", ",", "220", ")", ")", ";", "$", "this", "->", "_mai...
Issues the RSET command and validates answer Can be used to restore a clean smtp communication state when a transaction has been cancelled or commencing a new transaction. @return void
[ "Issues", "the", "RSET", "command", "and", "validates", "answer" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Smtp.php#L336-L345
train
Sends RSET to the server
[ 30522, 2270, 3853, 12667, 3388, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 4604, 1006, 1005, 12667, 3388, 1005, 1007, 1025, 1013, 1013, 5796, 9686, 20492, 2361, 2987, 1005, 1056, 3582, 14645, 1010, 2156, 1031, 1062, 2546, 1011, 14989, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Relations/BelongsToMany.php
BelongsToMany.find
public function find($id, $columns = ['*']) { return is_array($id) ? $this->findMany($id, $columns) : $this->where( $this->getRelated()->getQualifiedKeyName(), '=', $id )->first($columns); }
php
public function find($id, $columns = ['*']) { return is_array($id) ? $this->findMany($id, $columns) : $this->where( $this->getRelated()->getQualifiedKeyName(), '=', $id )->first($columns); }
[ "public", "function", "find", "(", "$", "id", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "return", "is_array", "(", "$", "id", ")", "?", "$", "this", "->", "findMany", "(", "$", "id", ",", "$", "columns", ")", ":", "$", "this", "->", ...
Find a related model by its primary key. @param mixed $id @param array $columns @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null
[ "Find", "a", "related", "model", "by", "its", "primary", "key", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php#L505-L510
train
Find a record in the recordset by ID.
[ 30522, 2270, 3853, 2424, 1006, 1002, 8909, 1010, 1002, 7753, 1027, 1031, 1005, 1008, 1005, 1033, 1007, 1063, 2709, 2003, 1035, 9140, 1006, 1002, 8909, 1007, 1029, 1002, 2023, 1011, 1028, 2424, 2386, 2100, 1006, 1002, 8909, 1010, 1002, 775...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Show/Field.php
Field.render
public function render() { if ($this->showAs->isNotEmpty()) { $this->showAs->each(function ($callable) { $this->value = $callable->call( $this->parent->getModel(), $this->value ); }); } return view($this->view, $this->variables()); }
php
public function render() { if ($this->showAs->isNotEmpty()) { $this->showAs->each(function ($callable) { $this->value = $callable->call( $this->parent->getModel(), $this->value ); }); } return view($this->view, $this->variables()); }
[ "public", "function", "render", "(", ")", "{", "if", "(", "$", "this", "->", "showAs", "->", "isNotEmpty", "(", ")", ")", "{", "$", "this", "->", "showAs", "->", "each", "(", "function", "(", "$", "callable", ")", "{", "$", "this", "->", "value", ...
Render this field. @return string
[ "Render", "this", "field", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Field.php#L561-L573
train
Render the field
[ 30522, 2270, 3853, 17552, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2265, 3022, 1011, 1028, 3475, 12184, 27718, 2100, 1006, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 2265, 3022, 1011, 1028, 2169, 1006, 3853, 1006, 1002, 2655, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Cache.php
Cache.init
public function init(Grav $grav) { /** @var Config $config */ $this->config = $grav['config']; $this->now = time(); if (null === $this->enabled) { $this->enabled = (bool)$this->config->get('system.cache.enabled'); } /** @var Uri $uri */ $uri = $grav['uri']; $prefix = $this->config->get('system.cache.prefix'); $uniqueness = substr(md5($uri->rootUrl(true) . $this->config->key() . GRAV_VERSION), 2, 8); // Cache key allows us to invalidate all cache on configuration changes. $this->key = ($prefix ? $prefix : 'g') . '-' . $uniqueness; $this->cache_dir = $grav['locator']->findResource('cache://doctrine/' . $uniqueness, true, true); $this->driver_setting = $this->config->get('system.cache.driver'); $this->driver = $this->getCacheDriver(); $this->driver->setNamespace($this->key); /** @var EventDispatcher $dispatcher */ $dispatcher = Grav::instance()['events']; $dispatcher->addListener('onSchedulerInitialized', [$this, 'onSchedulerInitialized']); }
php
public function init(Grav $grav) { /** @var Config $config */ $this->config = $grav['config']; $this->now = time(); if (null === $this->enabled) { $this->enabled = (bool)$this->config->get('system.cache.enabled'); } /** @var Uri $uri */ $uri = $grav['uri']; $prefix = $this->config->get('system.cache.prefix'); $uniqueness = substr(md5($uri->rootUrl(true) . $this->config->key() . GRAV_VERSION), 2, 8); // Cache key allows us to invalidate all cache on configuration changes. $this->key = ($prefix ? $prefix : 'g') . '-' . $uniqueness; $this->cache_dir = $grav['locator']->findResource('cache://doctrine/' . $uniqueness, true, true); $this->driver_setting = $this->config->get('system.cache.driver'); $this->driver = $this->getCacheDriver(); $this->driver->setNamespace($this->key); /** @var EventDispatcher $dispatcher */ $dispatcher = Grav::instance()['events']; $dispatcher->addListener('onSchedulerInitialized', [$this, 'onSchedulerInitialized']); }
[ "public", "function", "init", "(", "Grav", "$", "grav", ")", "{", "/** @var Config $config */", "$", "this", "->", "config", "=", "$", "grav", "[", "'config'", "]", ";", "$", "this", "->", "now", "=", "time", "(", ")", ";", "if", "(", "null", "===", ...
Initialization that sets a base key and the driver based on configuration settings @param Grav $grav @return void
[ "Initialization", "that", "sets", "a", "base", "key", "and", "the", "driver", "based", "on", "configuration", "settings" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Cache.php#L121-L147
train
Initialize the cache
[ 30522, 2270, 3853, 1999, 4183, 1006, 24665, 11431, 1002, 24665, 11431, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 9530, 8873, 2290, 1002, 9530, 8873, 2290, 1008, 1013, 1002, 2023, 1011, 1028, 9530, 8873, 2290, 1027, 1002, 24665, 11431, 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/Bundle/FrameworkBundle/Command/AboutCommand.php
AboutCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); /** @var KernelInterface $kernel */ $kernel = $this->getApplication()->getKernel(); $rows = [ ['<info>Symfony</>'], new TableSeparator(), ['Version', Kernel::VERSION], ['End of maintenance', Kernel::END_OF_MAINTENANCE.(self::isExpired(Kernel::END_OF_MAINTENANCE) ? ' <error>Expired</>' : '')], ['End of life', Kernel::END_OF_LIFE.(self::isExpired(Kernel::END_OF_LIFE) ? ' <error>Expired</>' : '')], new TableSeparator(), ['<info>Kernel</>'], new TableSeparator(), ['Type', \get_class($kernel)], ['Environment', $kernel->getEnvironment()], ['Debug', $kernel->isDebug() ? 'true' : 'false'], ['Charset', $kernel->getCharset()], ['Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'], ['Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'], new TableSeparator(), ['<info>PHP</>'], new TableSeparator(), ['Version', PHP_VERSION], ['Architecture', (PHP_INT_SIZE * 8).' bits'], ['Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'], ['Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'], ['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'], ['APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'], ['Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'], ]; if ($dotenv = self::getDotenvVars()) { $rows = array_merge($rows, [ new TableSeparator(), ['<info>Environment (.env)</>'], new TableSeparator(), ], array_map(function ($value, $name) { return [$name, $value]; }, $dotenv, array_keys($dotenv))); } $io->table([], $rows); }
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); /** @var KernelInterface $kernel */ $kernel = $this->getApplication()->getKernel(); $rows = [ ['<info>Symfony</>'], new TableSeparator(), ['Version', Kernel::VERSION], ['End of maintenance', Kernel::END_OF_MAINTENANCE.(self::isExpired(Kernel::END_OF_MAINTENANCE) ? ' <error>Expired</>' : '')], ['End of life', Kernel::END_OF_LIFE.(self::isExpired(Kernel::END_OF_LIFE) ? ' <error>Expired</>' : '')], new TableSeparator(), ['<info>Kernel</>'], new TableSeparator(), ['Type', \get_class($kernel)], ['Environment', $kernel->getEnvironment()], ['Debug', $kernel->isDebug() ? 'true' : 'false'], ['Charset', $kernel->getCharset()], ['Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'], ['Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'], new TableSeparator(), ['<info>PHP</>'], new TableSeparator(), ['Version', PHP_VERSION], ['Architecture', (PHP_INT_SIZE * 8).' bits'], ['Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'], ['Timezone', date_default_timezone_get().' (<comment>'.(new \DateTime())->format(\DateTime::W3C).'</>)'], ['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'], ['APCu', \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'], ['Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'], ]; if ($dotenv = self::getDotenvVars()) { $rows = array_merge($rows, [ new TableSeparator(), ['<info>Environment (.env)</>'], new TableSeparator(), ], array_map(function ($value, $name) { return [$name, $value]; }, $dotenv, array_keys($dotenv))); } $io->table([], $rows); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "/** @var KernelInterface $kernel */", "$", "kerne...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php#L57-L102
train
Execute the command
[ 30522, 5123, 3853, 15389, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1002, 22834, 1027, 2047, 25353, 2213, 14876, 4890, 21756, 2571, 1006, 1002, 7953, 1010, 1002, 6434, 1007, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/traits/ConfigMaker.php
ConfigMaker.getConfigPath
public function getConfigPath($fileName, $configPath = null) { if (!isset($this->configPath)) { $this->configPath = $this->guessConfigPath(); } if (!$configPath) { $configPath = $this->configPath; } $fileName = File::symbolizePath($fileName); if (File::isLocalPath($fileName) || (!Config::get('cms.restrictBaseDir', true) && realpath($fileName) !== false) ) { return $fileName; } if (!is_array($configPath)) { $configPath = [$configPath]; } foreach ($configPath as $path) { $_fileName = $path . '/' . $fileName; if (File::isFile($_fileName)) { return $_fileName; } } return $fileName; }
php
public function getConfigPath($fileName, $configPath = null) { if (!isset($this->configPath)) { $this->configPath = $this->guessConfigPath(); } if (!$configPath) { $configPath = $this->configPath; } $fileName = File::symbolizePath($fileName); if (File::isLocalPath($fileName) || (!Config::get('cms.restrictBaseDir', true) && realpath($fileName) !== false) ) { return $fileName; } if (!is_array($configPath)) { $configPath = [$configPath]; } foreach ($configPath as $path) { $_fileName = $path . '/' . $fileName; if (File::isFile($_fileName)) { return $_fileName; } } return $fileName; }
[ "public", "function", "getConfigPath", "(", "$", "fileName", ",", "$", "configPath", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "configPath", ")", ")", "{", "$", "this", "->", "configPath", "=", "$", "this", "->", "guessC...
Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path. @param string $fileName File to load. @param mixed $configPath Explicitly define a config path. @return string Full path to the config file.
[ "Locates", "a", "file", "based", "on", "it", "s", "definition", ".", "If", "the", "file", "starts", "with", "the", "~", "symbol", "it", "will", "be", "returned", "in", "context", "of", "the", "application", "base", "path", "otherwise", "it", "will", "be"...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/ConfigMaker.php#L132-L162
train
Returns the path to a file in the config folder
[ 30522, 2270, 3853, 2131, 8663, 8873, 21600, 8988, 1006, 1002, 5371, 18442, 1010, 1002, 9530, 8873, 21600, 8988, 1027, 19701, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 9530, 8873, 21600, 8988, 1007, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/ArchiveProcessor/Rules.php
Rules.getDoneStringFlagFor
public static function getDoneStringFlagFor(array $idSites, $segment, $periodLabel, $plugin) { if (!self::shouldProcessReportsAllPlugins($idSites, $segment, $periodLabel)) { return self::getDoneFlagArchiveContainsOnePlugin($segment, $plugin); } return self::getDoneFlagArchiveContainsAllPlugins($segment); }
php
public static function getDoneStringFlagFor(array $idSites, $segment, $periodLabel, $plugin) { if (!self::shouldProcessReportsAllPlugins($idSites, $segment, $periodLabel)) { return self::getDoneFlagArchiveContainsOnePlugin($segment, $plugin); } return self::getDoneFlagArchiveContainsAllPlugins($segment); }
[ "public", "static", "function", "getDoneStringFlagFor", "(", "array", "$", "idSites", ",", "$", "segment", ",", "$", "periodLabel", ",", "$", "plugin", ")", "{", "if", "(", "!", "self", "::", "shouldProcessReportsAllPlugins", "(", "$", "idSites", ",", "$", ...
Returns the name of the archive field used to tell the status of an archive, (ie, whether the archive was created successfully or not). @param array $idSites @param Segment $segment @param string $periodLabel @param string $plugin @return string
[ "Returns", "the", "name", "of", "the", "archive", "field", "used", "to", "tell", "the", "status", "of", "an", "archive", "(", "ie", "whether", "the", "archive", "was", "created", "successfully", "or", "not", ")", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor/Rules.php#L50-L56
train
Get done string flag for a specific site segment and plugin
[ 30522, 2270, 10763, 3853, 2131, 5280, 4355, 4892, 10258, 8490, 29278, 1006, 9140, 1002, 8909, 28032, 2229, 1010, 1002, 6903, 1010, 1002, 2558, 20470, 2884, 1010, 1002, 13354, 2378, 1007, 1063, 2065, 1006, 999, 2969, 1024, 1024, 2323, 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/HttpKernel/HttpCache/HttpCache.php
HttpCache.forward
protected function forward(Request $request, $catch = false, Response $entry = null) { if ($this->surrogate) { $this->surrogate->addSurrogateCapability($request); } // always a "master" request (as the real master request can be in cache) $response = SubRequestHandler::handle($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $catch); // we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC if (null !== $entry && \in_array($response->getStatusCode(), [500, 502, 503, 504])) { if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) { $age = $this->options['stale_if_error']; } if (abs($entry->getTtl()) < $age) { $this->record($request, 'stale-if-error'); return $entry; } } /* RFC 7231 Sect. 7.1.1.2 says that a server that does not have a reasonably accurate clock MUST NOT send a "Date" header, although it MUST send one in most other cases except for 1xx or 5xx responses where it MAY do so. Anyway, a client that received a message without a "Date" header MUST add it. */ if (!$response->headers->has('Date')) { $response->setDate(\DateTime::createFromFormat('U', time())); } $this->processResponseBody($request, $response); if ($this->isPrivateRequest($request) && !$response->headers->hasCacheControlDirective('public')) { $response->setPrivate(); } elseif ($this->options['default_ttl'] > 0 && null === $response->getTtl() && !$response->headers->getCacheControlDirective('must-revalidate')) { $response->setTtl($this->options['default_ttl']); } return $response; }
php
protected function forward(Request $request, $catch = false, Response $entry = null) { if ($this->surrogate) { $this->surrogate->addSurrogateCapability($request); } // always a "master" request (as the real master request can be in cache) $response = SubRequestHandler::handle($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $catch); // we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC if (null !== $entry && \in_array($response->getStatusCode(), [500, 502, 503, 504])) { if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) { $age = $this->options['stale_if_error']; } if (abs($entry->getTtl()) < $age) { $this->record($request, 'stale-if-error'); return $entry; } } /* RFC 7231 Sect. 7.1.1.2 says that a server that does not have a reasonably accurate clock MUST NOT send a "Date" header, although it MUST send one in most other cases except for 1xx or 5xx responses where it MAY do so. Anyway, a client that received a message without a "Date" header MUST add it. */ if (!$response->headers->has('Date')) { $response->setDate(\DateTime::createFromFormat('U', time())); } $this->processResponseBody($request, $response); if ($this->isPrivateRequest($request) && !$response->headers->hasCacheControlDirective('public')) { $response->setPrivate(); } elseif ($this->options['default_ttl'] > 0 && null === $response->getTtl() && !$response->headers->getCacheControlDirective('must-revalidate')) { $response->setTtl($this->options['default_ttl']); } return $response; }
[ "protected", "function", "forward", "(", "Request", "$", "request", ",", "$", "catch", "=", "false", ",", "Response", "$", "entry", "=", "null", ")", "{", "if", "(", "$", "this", "->", "surrogate", ")", "{", "$", "this", "->", "surrogate", "->", "add...
Forwards the Request to the backend and returns the Response. All backend requests (cache passes, fetches, cache validations) run through this method. @param Request $request A Request instance @param bool $catch Whether to catch exceptions or not @param Response $entry A Response instance (the stale entry if present, null otherwise) @return Response A Response instance
[ "Forwards", "the", "Request", "to", "the", "backend", "and", "returns", "the", "Response", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L471-L513
train
Forward the request to the next handler
[ 30522, 5123, 3853, 2830, 1006, 5227, 1002, 5227, 1010, 1002, 4608, 1027, 6270, 1010, 3433, 1002, 4443, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 7505, 21799, 1007, 1063, 1002, 2023, 1011, 1028, 7505, 21799, 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...
php-ai/php-ml
src/Tokenization/NGramWordTokenizer.php
NGramWordTokenizer.tokenize
public function tokenize(string $text): array { preg_match_all('/\w\w+/u', $text, $words); $words = $words[0]; $nGrams = []; for ($j = $this->minGram; $j <= $this->maxGram; $j++) { $nGrams = array_merge($nGrams, $this->getNgrams($words, $j)); } return $nGrams; }
php
public function tokenize(string $text): array { preg_match_all('/\w\w+/u', $text, $words); $words = $words[0]; $nGrams = []; for ($j = $this->minGram; $j <= $this->maxGram; $j++) { $nGrams = array_merge($nGrams, $this->getNgrams($words, $j)); } return $nGrams; }
[ "public", "function", "tokenize", "(", "string", "$", "text", ")", ":", "array", "{", "preg_match_all", "(", "'/\\w\\w+/u'", ",", "$", "text", ",", "$", "words", ")", ";", "$", "words", "=", "$", "words", "[", "0", "]", ";", "$", "nGrams", "=", "["...
{@inheritdoc}
[ "{" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Tokenization/NGramWordTokenizer.php#L34-L46
train
Tokenize text into an array of ngrams
[ 30522, 2270, 3853, 19204, 4697, 1006, 5164, 1002, 3793, 1007, 1024, 9140, 1063, 3653, 2290, 1035, 2674, 1035, 2035, 1006, 1005, 1013, 1032, 1059, 1032, 1059, 1009, 1013, 1057, 1005, 1010, 1002, 3793, 1010, 1002, 2616, 1007, 1025, 1002, 26...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Contents/Archiver.php
Archiver.insertDayReports
private function insertDayReports() { foreach ($this->arrays as $recordName => $dataArray) { $dataTable = $dataArray->asDataTable(); foreach ($dataTable->getRows() as $row) { $label = $row->getColumn('label'); if (!empty($this->metadata[$label])) { foreach ($this->metadata[$label] as $name => $value) { $row->addMetadata($name, $value); } } } $blob = $dataTable->getSerialized( $this->maximumRowsInDataTable, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation); $this->getProcessor()->insertBlobRecord($recordName, $blob); } }
php
private function insertDayReports() { foreach ($this->arrays as $recordName => $dataArray) { $dataTable = $dataArray->asDataTable(); foreach ($dataTable->getRows() as $row) { $label = $row->getColumn('label'); if (!empty($this->metadata[$label])) { foreach ($this->metadata[$label] as $name => $value) { $row->addMetadata($name, $value); } } } $blob = $dataTable->getSerialized( $this->maximumRowsInDataTable, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation); $this->getProcessor()->insertBlobRecord($recordName, $blob); } }
[ "private", "function", "insertDayReports", "(", ")", "{", "foreach", "(", "$", "this", "->", "arrays", "as", "$", "recordName", "=>", "$", "dataArray", ")", "{", "$", "dataTable", "=", "$", "dataArray", "->", "asDataTable", "(", ")", ";", "foreach", "(",...
Records the daily datatables
[ "Records", "the", "daily", "datatables" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Contents/Archiver.php#L211-L233
train
Insert day reports
[ 30522, 2797, 3853, 19274, 10259, 2890, 25378, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 27448, 2004, 1002, 2501, 18442, 1027, 1028, 1002, 2951, 2906, 9447, 1007, 1063, 1002, 2951, 10880, 1027, 1002, 2951, 2906, 9447, 1011...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Collection.php
Collection.batch
public function batch($size) { $chunks = array_chunk($this->items, $size, true); $list = []; foreach ($chunks as $chunk) { $list[] = new static($chunk, $this->params, $this->pages); } return $list; }
php
public function batch($size) { $chunks = array_chunk($this->items, $size, true); $list = []; foreach ($chunks as $chunk) { $list[] = new static($chunk, $this->params, $this->pages); } return $list; }
[ "public", "function", "batch", "(", "$", "size", ")", "{", "$", "chunks", "=", "array_chunk", "(", "$", "this", "->", "items", ",", "$", "size", ",", "true", ")", ";", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "chunks", "as", "$", "...
Split collection into array of smaller collections. @param int $size @return array|Collection[]
[ "Split", "collection", "into", "array", "of", "smaller", "collections", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L183-L193
train
Batch the items into a list of taxonomies
[ 30522, 2270, 3853, 14108, 1006, 1002, 2946, 1007, 1063, 1002, 24839, 1027, 9140, 1035, 20000, 1006, 1002, 2023, 1011, 1028, 5167, 1010, 1002, 2946, 1010, 2995, 1007, 1025, 1002, 2862, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 24839, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
guzzle/guzzle
build/Burgomaster.php
Burgomaster.deepCopy
public function deepCopy($from, $to) { if (!is_file($from)) { throw new \InvalidArgumentException("File not found: {$from}"); } $to = str_replace('//', '/', $this->stageDir . '/' . $to); $dir = dirname($to); if (!is_dir($dir)) { if (!mkdir($dir, 0777, true)) { throw new \RuntimeException("Unable to create directory: $dir"); } } if (!copy($from, $to)) { throw new \RuntimeException("Unable to copy $from to $to"); } }
php
public function deepCopy($from, $to) { if (!is_file($from)) { throw new \InvalidArgumentException("File not found: {$from}"); } $to = str_replace('//', '/', $this->stageDir . '/' . $to); $dir = dirname($to); if (!is_dir($dir)) { if (!mkdir($dir, 0777, true)) { throw new \RuntimeException("Unable to create directory: $dir"); } } if (!copy($from, $to)) { throw new \RuntimeException("Unable to copy $from to $to"); } }
[ "public", "function", "deepCopy", "(", "$", "from", ",", "$", "to", ")", "{", "if", "(", "!", "is_file", "(", "$", "from", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"File not found: {$from}\"", ")", ";", "}", "$", "to", "=...
Copies a file and creates the destination directory if needed. @param string $from File to copy @param string $to Destination to copy the file to, relative to the base staging directory. @throws \InvalidArgumentException if the file cannot be found @throws \RuntimeException if the directory cannot be created. @throws \RuntimeException if the file cannot be copied.
[ "Copies", "a", "file", "and", "creates", "the", "destination", "directory", "if", "needed", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/build/Burgomaster.php#L128-L146
train
Copy file from one stage to another
[ 30522, 2270, 3853, 2784, 3597, 7685, 1006, 1002, 2013, 1010, 1002, 2000, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5371, 1006, 1002, 2013, 1007, 1007, 1063, 5466, 2047, 1032, 19528, 2906, 22850, 15781, 2595, 24422, 1006, 1000, 5371, 2025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Exception/TransformationFailedException.php
TransformationFailedException.setInvalidMessage
public function setInvalidMessage(string $invalidMessage = null, array $invalidMessageParameters = []): void { $this->invalidMessage = $invalidMessage; $this->invalidMessageParameters = $invalidMessageParameters; }
php
public function setInvalidMessage(string $invalidMessage = null, array $invalidMessageParameters = []): void { $this->invalidMessage = $invalidMessage; $this->invalidMessageParameters = $invalidMessageParameters; }
[ "public", "function", "setInvalidMessage", "(", "string", "$", "invalidMessage", "=", "null", ",", "array", "$", "invalidMessageParameters", "=", "[", "]", ")", ":", "void", "{", "$", "this", "->", "invalidMessage", "=", "$", "invalidMessage", ";", "$", "thi...
Sets the message that will be shown to the user. @param string|null $invalidMessage The message or message key @param array $invalidMessageParameters Data to be passed into the translator
[ "Sets", "the", "message", "that", "will", "be", "shown", "to", "the", "user", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Exception/TransformationFailedException.php#L37-L41
train
Set invalid message
[ 30522, 2270, 3853, 2275, 2378, 10175, 3593, 7834, 3736, 3351, 1006, 5164, 1002, 19528, 7834, 3736, 3351, 1027, 19701, 1010, 9140, 1002, 19528, 7834, 3736, 3351, 28689, 22828, 2015, 1027, 1031, 1033, 1007, 1024, 11675, 1063, 1002, 2023, 1011...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Constraints/EmailValidator.php
EmailValidator.checkHost
private function checkHost(string $host): bool { return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'))); }
php
private function checkHost(string $host): bool { return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'))); }
[ "private", "function", "checkHost", "(", "string", "$", "host", ")", ":", "bool", "{", "return", "''", "!==", "$", "host", "&&", "(", "$", "this", "->", "checkMX", "(", "$", "host", ")", "||", "(", "checkdnsrr", "(", "$", "host", ",", "'A'", ")", ...
Check if one of MX, A or AAAA DNS RR exists.
[ "Check", "if", "one", "of", "MX", "A", "or", "AAAA", "DNS", "RR", "exists", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/EmailValidator.php#L170-L173
train
Check if host is a domain name A or AAAA
[ 30522, 2797, 3853, 4638, 15006, 2102, 1006, 5164, 1002, 3677, 1007, 1024, 22017, 2140, 1063, 2709, 1005, 1005, 999, 1027, 1027, 1002, 3677, 1004, 1004, 1006, 1002, 2023, 1011, 1028, 4638, 22984, 1006, 1002, 3677, 1007, 1064, 1064, 1006, 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/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php
PriorityTaggedServiceTrait.findAndSortTaggedServices
private function findAndSortTaggedServices($tagName, ContainerBuilder $container) { $indexAttribute = $defaultIndexMethod = $useFqcnAsFallback = null; if ($tagName instanceof TaggedIteratorArgument) { $indexAttribute = $tagName->getIndexAttribute(); $defaultIndexMethod = $tagName->getDefaultIndexMethod(); $useFqcnAsFallback = $tagName->useFqcnAsFallback(); $tagName = $tagName->getTag(); } $services = []; foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) { $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; if (null === $indexAttribute && !$useFqcnAsFallback) { $services[$priority][] = new Reference($serviceId); continue; } $class = $container->getDefinition($serviceId)->getClass(); $class = $container->getParameterBag()->resolveValue($class) ?: null; if (null !== $indexAttribute && isset($attributes[0][$indexAttribute])) { $services[$priority][$attributes[0][$indexAttribute]] = new TypedReference($serviceId, $class, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $attributes[0][$indexAttribute]); continue; } if (!$r = $container->getReflectionClass($class)) { throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $serviceId)); } $class = $r->name; if (!$r->hasMethod($defaultIndexMethod)) { if ($useFqcnAsFallback) { $services[$priority][$class] = new TypedReference($serviceId, $class); continue; } throw new InvalidArgumentException(sprintf('Method "%s::%s()" not found: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute)); } if (!($rm = $r->getMethod($defaultIndexMethod))->isStatic()) { throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be static: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute)); } if (!$rm->isPublic()) { throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be public: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute)); } $key = $rm->invoke(null); if (!\is_string($key)) { throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return a string, got %s: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, \gettype($key), $tagName, $serviceId, $indexAttribute)); } $services[$priority][$key] = new TypedReference($serviceId, $class, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $key); } if ($services) { krsort($services); $services = array_merge(...$services); } return $services; }
php
private function findAndSortTaggedServices($tagName, ContainerBuilder $container) { $indexAttribute = $defaultIndexMethod = $useFqcnAsFallback = null; if ($tagName instanceof TaggedIteratorArgument) { $indexAttribute = $tagName->getIndexAttribute(); $defaultIndexMethod = $tagName->getDefaultIndexMethod(); $useFqcnAsFallback = $tagName->useFqcnAsFallback(); $tagName = $tagName->getTag(); } $services = []; foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) { $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; if (null === $indexAttribute && !$useFqcnAsFallback) { $services[$priority][] = new Reference($serviceId); continue; } $class = $container->getDefinition($serviceId)->getClass(); $class = $container->getParameterBag()->resolveValue($class) ?: null; if (null !== $indexAttribute && isset($attributes[0][$indexAttribute])) { $services[$priority][$attributes[0][$indexAttribute]] = new TypedReference($serviceId, $class, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $attributes[0][$indexAttribute]); continue; } if (!$r = $container->getReflectionClass($class)) { throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $serviceId)); } $class = $r->name; if (!$r->hasMethod($defaultIndexMethod)) { if ($useFqcnAsFallback) { $services[$priority][$class] = new TypedReference($serviceId, $class); continue; } throw new InvalidArgumentException(sprintf('Method "%s::%s()" not found: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute)); } if (!($rm = $r->getMethod($defaultIndexMethod))->isStatic()) { throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be static: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute)); } if (!$rm->isPublic()) { throw new InvalidArgumentException(sprintf('Method "%s::%s()" should be public: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute)); } $key = $rm->invoke(null); if (!\is_string($key)) { throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return a string, got %s: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, \gettype($key), $tagName, $serviceId, $indexAttribute)); } $services[$priority][$key] = new TypedReference($serviceId, $class, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $key); } if ($services) { krsort($services); $services = array_merge(...$services); } return $services; }
[ "private", "function", "findAndSortTaggedServices", "(", "$", "tagName", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "indexAttribute", "=", "$", "defaultIndexMethod", "=", "$", "useFqcnAsFallback", "=", "null", ";", "if", "(", "$", "tagName", "inst...
Finds all services with the given tag name and order them by their priority. The order of additions must be respected for services having the same priority, and knowing that the \SplPriorityQueue class does not respect the FIFO method, we should not use that class. @see https://bugs.php.net/bug.php?id=53710 @see https://bugs.php.net/bug.php?id=60926 @param string|TaggedIteratorArgument $tagName @param ContainerBuilder $container @return Reference[]
[ "Finds", "all", "services", "with", "the", "given", "tag", "name", "and", "order", "them", "by", "their", "priority", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php#L42-L112
train
Searches and sorts tagged services by tag name.
[ 30522, 2797, 3853, 2424, 29560, 11589, 15900, 5999, 8043, 7903, 2229, 1006, 1002, 6415, 18442, 1010, 11661, 8569, 23891, 2099, 1002, 11661, 1007, 1063, 1002, 5950, 19321, 3089, 8569, 2618, 1027, 1002, 12398, 22254, 10288, 11368, 6806, 2094, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/View/Compilers/BladeCompiler.php
BladeCompiler.component
public function component($path, $alias = null) { $alias = $alias ?: Arr::last(explode('.', $path)); $this->directive($alias, function ($expression) use ($path) { return $expression ? "<?php \$__env->startComponent('{$path}', {$expression}); ?>" : "<?php \$__env->startComponent('{$path}'); ?>"; }); $this->directive('end'.$alias, function ($expression) { return '<?php echo $__env->renderComponent(); ?>'; }); }
php
public function component($path, $alias = null) { $alias = $alias ?: Arr::last(explode('.', $path)); $this->directive($alias, function ($expression) use ($path) { return $expression ? "<?php \$__env->startComponent('{$path}', {$expression}); ?>" : "<?php \$__env->startComponent('{$path}'); ?>"; }); $this->directive('end'.$alias, function ($expression) { return '<?php echo $__env->renderComponent(); ?>'; }); }
[ "public", "function", "component", "(", "$", "path", ",", "$", "alias", "=", "null", ")", "{", "$", "alias", "=", "$", "alias", "?", ":", "Arr", "::", "last", "(", "explode", "(", "'.'", ",", "$", "path", ")", ")", ";", "$", "this", "->", "dire...
Register a component alias directive. @param string $path @param string $alias @return void
[ "Register", "a", "component", "alias", "directive", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Compilers/BladeCompiler.php#L468-L481
train
Registers a component directive
[ 30522, 2270, 3853, 6922, 1006, 1002, 4130, 1010, 1002, 14593, 1027, 19701, 1007, 1063, 1002, 14593, 1027, 1002, 14593, 1029, 1024, 12098, 2099, 1024, 1024, 2197, 1006, 15044, 1006, 1005, 1012, 1005, 1010, 1002, 4130, 1007, 1007, 1025, 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/Auth/Access/Gate.php
Gate.check
public function check($abilities, $arguments = []) { return collect($abilities)->every(function ($ability) use ($arguments) { try { return (bool) $this->raw($ability, $arguments); } catch (AuthorizationException $e) { return false; } }); }
php
public function check($abilities, $arguments = []) { return collect($abilities)->every(function ($ability) use ($arguments) { try { return (bool) $this->raw($ability, $arguments); } catch (AuthorizationException $e) { return false; } }); }
[ "public", "function", "check", "(", "$", "abilities", ",", "$", "arguments", "=", "[", "]", ")", "{", "return", "collect", "(", "$", "abilities", ")", "->", "every", "(", "function", "(", "$", "ability", ")", "use", "(", "$", "arguments", ")", "{", ...
Determine if all of the given abilities should be granted for the current user. @param iterable|string $abilities @param array|mixed $arguments @return bool
[ "Determine", "if", "all", "of", "the", "given", "abilities", "should", "be", "granted", "for", "the", "current", "user", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L273-L282
train
Checks if the current user has the required permissions.
[ 30522, 2270, 3853, 4638, 1006, 1002, 7590, 1010, 1002, 9918, 1027, 1031, 1033, 1007, 1063, 2709, 8145, 1006, 1002, 7590, 1007, 1011, 1028, 2296, 1006, 3853, 1006, 1002, 3754, 1007, 2224, 1006, 1002, 9918, 1007, 1063, 3046, 1063, 2709, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php
PropertyPathBuilder.remove
public function remove($offset, $length = 1) { if (!isset($this->elements[$offset])) { throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset)); } $this->resize($offset, $length, 0); }
php
public function remove($offset, $length = 1) { if (!isset($this->elements[$offset])) { throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset)); } $this->resize($offset, $length, 0); }
[ "public", "function", "remove", "(", "$", "offset", ",", "$", "length", "=", "1", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "elements", "[", "$", "offset", "]", ")", ")", "{", "throw", "new", "OutOfBoundsException", "(", "sprintf", ...
Removes elements from the current path. @param int $offset The offset at which to remove @param int $length The length of the removed piece @throws OutOfBoundsException if offset is invalid
[ "Removes", "elements", "from", "the", "current", "path", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php#L94-L101
train
Remove an element from the property path
[ 30522, 2270, 3853, 6366, 1006, 1002, 16396, 1010, 1002, 3091, 1027, 1015, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 3787, 1031, 1002, 16396, 1033, 1007, 1007, 1063, 5466, 2047, 2041, 11253, 15494, 3366, 2595, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
Worker.php
Worker.setUserAndGroup
public function setUserAndGroup() { // Get uid. $user_info = posix_getpwnam($this->user); if (!$user_info) { static::log("Warning: User {$this->user} not exsits"); return; } $uid = $user_info['uid']; // Get gid. if ($this->group) { $group_info = posix_getgrnam($this->group); if (!$group_info) { static::log("Warning: Group {$this->group} not exsits"); return; } $gid = $group_info['gid']; } else { $gid = $user_info['gid']; } // Set uid and gid. if ($uid != posix_getuid() || $gid != posix_getgid()) { if (!posix_setgid($gid) || !posix_initgroups($user_info['name'], $gid) || !posix_setuid($uid)) { static::log("Warning: change gid or uid fail."); } } }
php
public function setUserAndGroup() { // Get uid. $user_info = posix_getpwnam($this->user); if (!$user_info) { static::log("Warning: User {$this->user} not exsits"); return; } $uid = $user_info['uid']; // Get gid. if ($this->group) { $group_info = posix_getgrnam($this->group); if (!$group_info) { static::log("Warning: Group {$this->group} not exsits"); return; } $gid = $group_info['gid']; } else { $gid = $user_info['gid']; } // Set uid and gid. if ($uid != posix_getuid() || $gid != posix_getgid()) { if (!posix_setgid($gid) || !posix_initgroups($user_info['name'], $gid) || !posix_setuid($uid)) { static::log("Warning: change gid or uid fail."); } } }
[ "public", "function", "setUserAndGroup", "(", ")", "{", "// Get uid.", "$", "user_info", "=", "posix_getpwnam", "(", "$", "this", "->", "user", ")", ";", "if", "(", "!", "$", "user_info", ")", "{", "static", "::", "log", "(", "\"Warning: User {$this->user} n...
Set unix user and group for current process. @return void
[ "Set", "unix", "user", "and", "group", "for", "current", "process", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1515-L1542
train
Set uid and group
[ 30522, 2270, 3853, 2275, 20330, 5685, 17058, 1006, 1007, 1063, 1013, 1013, 2131, 21318, 2094, 1012, 1002, 5310, 1035, 18558, 1027, 13433, 5332, 2595, 1035, 2131, 28400, 13129, 1006, 1002, 2023, 1011, 1028, 5310, 1007, 1025, 2065, 1006, 999,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Nonce.php
Nonce.checkNonce
public static function checkNonce($nonceName, $nonce = null) { if ($nonce === null) { $nonce = Common::getRequestVar('nonce', null, 'string'); } if (!self::verifyNonce($nonceName, $nonce)) { throw new \Exception(Piwik::translate('General_ExceptionNonceMismatch')); } self::discardNonce($nonceName); }
php
public static function checkNonce($nonceName, $nonce = null) { if ($nonce === null) { $nonce = Common::getRequestVar('nonce', null, 'string'); } if (!self::verifyNonce($nonceName, $nonce)) { throw new \Exception(Piwik::translate('General_ExceptionNonceMismatch')); } self::discardNonce($nonceName); }
[ "public", "static", "function", "checkNonce", "(", "$", "nonceName", ",", "$", "nonce", "=", "null", ")", "{", "if", "(", "$", "nonce", "===", "null", ")", "{", "$", "nonce", "=", "Common", "::", "getRequestVar", "(", "'nonce'", ",", "null", ",", "'s...
Verifies and discards a nonce. @param string $nonceName The nonce's unique ID. See {@link getNonce()}. @param string|null $nonce The nonce from the client. If `null`, the value from the **nonce** query parameter is used. @throws \Exception if the nonce is invalid. See {@link verifyNonce()}.
[ "Verifies", "and", "discards", "a", "nonce", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Nonce.php#L165-L176
train
Check nonce name
[ 30522, 2270, 10763, 3853, 4638, 8540, 3401, 1006, 1002, 2512, 27524, 14074, 1010, 1002, 2512, 3401, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2512, 3401, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 2512, 3401, 30524, 5466, 2047, 1032, 6453,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Installation/Controller.php
Controller.databaseSetup
function databaseSetup() { $this->checkPiwikIsNotInstalled(); $view = new View( '@Installation/databaseSetup', $this->getInstallationSteps(), __FUNCTION__ ); $view->showNextStep = false; $form = new FormDatabaseSetup(); if ($form->validate()) { try { $dbInfos = $form->createDatabaseObject(); DbHelper::checkDatabaseVersion(); Db::get()->checkClientVersion(); $this->createConfigFile($dbInfos); $this->redirectToNextStep(__FUNCTION__); } catch (Exception $e) { $view->errorMessage = Common::sanitizeInputValue($e->getMessage()); } } $view->addForm($form); return $view->render(); }
php
function databaseSetup() { $this->checkPiwikIsNotInstalled(); $view = new View( '@Installation/databaseSetup', $this->getInstallationSteps(), __FUNCTION__ ); $view->showNextStep = false; $form = new FormDatabaseSetup(); if ($form->validate()) { try { $dbInfos = $form->createDatabaseObject(); DbHelper::checkDatabaseVersion(); Db::get()->checkClientVersion(); $this->createConfigFile($dbInfos); $this->redirectToNextStep(__FUNCTION__); } catch (Exception $e) { $view->errorMessage = Common::sanitizeInputValue($e->getMessage()); } } $view->addForm($form); return $view->render(); }
[ "function", "databaseSetup", "(", ")", "{", "$", "this", "->", "checkPiwikIsNotInstalled", "(", ")", ";", "$", "view", "=", "new", "View", "(", "'@Installation/databaseSetup'", ",", "$", "this", "->", "getInstallationSteps", "(", ")", ",", "__FUNCTION__", ")",...
Installation Step 3: Database Set-up @throws Exception|Zend_Db_Adapter_Exception
[ "Installation", "Step", "3", ":", "Database", "Set", "-", "up" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Installation/Controller.php#L131-L163
train
This method is called to display the database setup screen.
[ 30522, 3853, 17881, 3388, 6279, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 4638, 8197, 9148, 14270, 17048, 7076, 9080, 3709, 1006, 1007, 1025, 1002, 3193, 1027, 2047, 3193, 1006, 1005, 1030, 8272, 1013, 17881, 3388, 6279, 1005, 1010, 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/Messenger/Transport/AmqpExt/Connection.php
Connection.get
public function get(string $queueName): ?\AMQPEnvelope { if ($this->shouldSetup()) { $this->setup(); } try { if (false !== $message = $this->queue($queueName)->get()) { return $message; } } catch (\AMQPQueueException $e) { if (404 === $e->getCode() && $this->shouldSetup()) { // If we get a 404 for the queue, it means we need to setup the exchange & queue. $this->setup(); return $this->get(); } throw $e; } return null; }
php
public function get(string $queueName): ?\AMQPEnvelope { if ($this->shouldSetup()) { $this->setup(); } try { if (false !== $message = $this->queue($queueName)->get()) { return $message; } } catch (\AMQPQueueException $e) { if (404 === $e->getCode() && $this->shouldSetup()) { // If we get a 404 for the queue, it means we need to setup the exchange & queue. $this->setup(); return $this->get(); } throw $e; } return null; }
[ "public", "function", "get", "(", "string", "$", "queueName", ")", ":", "?", "\\", "AMQPEnvelope", "{", "if", "(", "$", "this", "->", "shouldSetup", "(", ")", ")", "{", "$", "this", "->", "setup", "(", ")", ";", "}", "try", "{", "if", "(", "false...
Gets a message from the specified queue. @throws \AMQPException
[ "Gets", "a", "message", "from", "the", "specified", "queue", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php#L299-L321
train
Get a message from the queue
[ 30522, 2270, 3853, 2131, 1006, 5164, 1002, 24240, 18442, 1007, 1024, 1029, 1032, 2572, 4160, 11837, 15985, 17635, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2323, 13462, 6279, 1006, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 16437, 1006, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Lock/Store/RedisStore.php
RedisStore.exists
public function exists(Key $key) { return $this->redis->get((string) $key) === $this->getUniqueToken($key); }
php
public function exists(Key $key) { return $this->redis->get((string) $key) === $this->getUniqueToken($key); }
[ "public", "function", "exists", "(", "Key", "$", "key", ")", "{", "return", "$", "this", "->", "redis", "->", "get", "(", "(", "string", ")", "$", "key", ")", "===", "$", "this", "->", "getUniqueToken", "(", "$", "key", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Lock/Store/RedisStore.php#L122-L125
train
Checks if a key exists in the cache
[ 30522, 2270, 3853, 6526, 1006, 3145, 1002, 3145, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2417, 2483, 1011, 1028, 2131, 1006, 1006, 5164, 1007, 1002, 3145, 1007, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 2131, 19496, 12647, 11045, 2078, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Session/Middleware/AuthenticateSession.php
AuthenticateSession.storePasswordHashInSession
protected function storePasswordHashInSession($request) { if (! $request->user()) { return; } $request->session()->put([ 'password_hash' => $request->user()->getAuthPassword(), ]); }
php
protected function storePasswordHashInSession($request) { if (! $request->user()) { return; } $request->session()->put([ 'password_hash' => $request->user()->getAuthPassword(), ]); }
[ "protected", "function", "storePasswordHashInSession", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "->", "user", "(", ")", ")", "{", "return", ";", "}", "$", "request", "->", "session", "(", ")", "->", "put", "(", "[", "'password_has...
Store the user's current password hash in the session. @param \Illuminate\Http\Request $request @return void
[ "Store", "the", "user", "s", "current", "password", "hash", "in", "the", "session", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Middleware/AuthenticateSession.php#L69-L78
train
Stores the password hash in the session
[ 30522, 5123, 3853, 3573, 15194, 18351, 14949, 10606, 8583, 10992, 1006, 1002, 5227, 1007, 1063, 2065, 1006, 999, 1002, 5227, 1011, 1028, 5310, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 1002, 5227, 1011, 1028, 5219, 1006, 1007, 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/Cache/RedisLock.php
RedisLock.acquire
public function acquire() { $result = $this->redis->setnx($this->name, $this->owner); if ($result === 1 && $this->seconds > 0) { $this->redis->expire($this->name, $this->seconds); } return $result === 1; }
php
public function acquire() { $result = $this->redis->setnx($this->name, $this->owner); if ($result === 1 && $this->seconds > 0) { $this->redis->expire($this->name, $this->seconds); } return $result === 1; }
[ "public", "function", "acquire", "(", ")", "{", "$", "result", "=", "$", "this", "->", "redis", "->", "setnx", "(", "$", "this", "->", "name", ",", "$", "this", "->", "owner", ")", ";", "if", "(", "$", "result", "===", "1", "&&", "$", "this", "...
Attempt to acquire the lock. @return bool
[ "Attempt", "to", "acquire", "the", "lock", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RedisLock.php#L35-L44
train
Acquires a new cache entry
[ 30522, 2270, 3853, 9878, 1006, 1007, 1063, 1002, 2765, 1027, 1002, 2023, 1011, 1028, 2417, 2483, 1011, 1028, 2275, 26807, 1006, 1002, 2023, 1011, 1028, 2171, 1010, 1002, 2023, 1011, 1028, 3954, 1007, 1025, 2065, 1006, 1002, 2765, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Console/Scheduling/Event.php
Event.runCommandInBackground
protected function runCommandInBackground(Container $container) { $this->callBeforeCallbacks($container); Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run(); }
php
protected function runCommandInBackground(Container $container) { $this->callBeforeCallbacks($container); Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run(); }
[ "protected", "function", "runCommandInBackground", "(", "Container", "$", "container", ")", "{", "$", "this", "->", "callBeforeCallbacks", "(", "$", "container", ")", ";", "Process", "::", "fromShellCommandline", "(", "$", "this", "->", "buildCommand", "(", ")",...
Run the command in the background. @param \Illuminate\Contracts\Container\Container $container @return void
[ "Run", "the", "command", "in", "the", "background", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/Event.php#L229-L234
train
Runs the command in the background.
[ 30522, 5123, 3853, 2448, 9006, 2386, 8718, 5963, 16365, 1006, 11661, 1002, 11661, 1007, 1063, 1002, 2023, 1011, 1028, 2655, 4783, 29278, 19281, 3363, 12221, 1006, 1002, 11661, 1007, 1025, 2832, 1024, 1024, 2013, 4095, 5349, 9006, 2386, 1942...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php
HidesAttributes.addHidden
public function addHidden($attributes = null) { $this->hidden = array_merge( $this->hidden, is_array($attributes) ? $attributes : func_get_args() ); }
php
public function addHidden($attributes = null) { $this->hidden = array_merge( $this->hidden, is_array($attributes) ? $attributes : func_get_args() ); }
[ "public", "function", "addHidden", "(", "$", "attributes", "=", "null", ")", "{", "$", "this", "->", "hidden", "=", "array_merge", "(", "$", "this", "->", "hidden", ",", "is_array", "(", "$", "attributes", ")", "?", "$", "attributes", ":", "func_get_args...
Add hidden attributes for the model. @param array|string|null $attributes @return void
[ "Add", "hidden", "attributes", "for", "the", "model", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php#L50-L55
train
Add hidden attributes to the hidden list
[ 30522, 2270, 3853, 5587, 27511, 4181, 1006, 1002, 12332, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 5023, 1027, 9140, 1035, 13590, 1006, 1002, 2023, 1011, 1028, 5023, 1010, 2003, 1035, 9140, 1006, 1002, 12332, 1007, 1029, 1002, 12332,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Console/Scheduling/Event.php
Event.ensureOutputIsBeingCaptured
protected function ensureOutputIsBeingCaptured() { if (is_null($this->output) || $this->output == $this->getDefaultOutput()) { $this->sendOutputTo(storage_path('logs/schedule-'.sha1($this->mutexName()).'.log')); } }
php
protected function ensureOutputIsBeingCaptured() { if (is_null($this->output) || $this->output == $this->getDefaultOutput()) { $this->sendOutputTo(storage_path('logs/schedule-'.sha1($this->mutexName()).'.log')); } }
[ "protected", "function", "ensureOutputIsBeingCaptured", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "output", ")", "||", "$", "this", "->", "output", "==", "$", "this", "->", "getDefaultOutput", "(", ")", ")", "{", "$", "this", "->", "...
Ensure that the command output is being captured. @return void
[ "Ensure", "that", "the", "command", "output", "is", "being", "captured", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/Event.php#L442-L447
train
Ensures that the output is being captured.
[ 30522, 5123, 3853, 5676, 5833, 18780, 2483, 19205, 3070, 17695, 11244, 2094, 1006, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 2023, 1011, 1028, 6434, 1007, 1064, 1064, 1002, 2023, 1011, 1028, 6434, 1027, 1027, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Queue/DatabaseQueue.php
DatabaseQueue.isAvailable
protected function isAvailable($query) { $query->where(function ($query) { $query->whereNull('reserved_at') ->where('available_at', '<=', $this->currentTime()); }); }
php
protected function isAvailable($query) { $query->where(function ($query) { $query->whereNull('reserved_at') ->where('available_at', '<=', $this->currentTime()); }); }
[ "protected", "function", "isAvailable", "(", "$", "query", ")", "{", "$", "query", "->", "where", "(", "function", "(", "$", "query", ")", "{", "$", "query", "->", "whereNull", "(", "'reserved_at'", ")", "->", "where", "(", "'available_at'", ",", "'<='",...
Modify the query to check for available jobs. @param \Illuminate\Database\Query\Builder $query @return void
[ "Modify", "the", "query", "to", "check", "for", "available", "jobs", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/DatabaseQueue.php#L232-L238
train
This method is used to filter the records by availability
[ 30522, 5123, 3853, 18061, 3567, 11733, 3468, 1006, 1002, 23032, 1007, 1063, 1002, 23032, 1011, 1028, 2073, 1006, 3853, 1006, 1002, 23032, 1007, 1063, 1002, 23032, 1011, 1028, 2073, 11231, 3363, 1006, 1005, 9235, 1035, 2012, 1005, 1007, 1011...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable.php
DataTable.getRowFromId
public function getRowFromId($id) { if (!isset($this->rows[$id])) { if ($id == self::ID_SUMMARY_ROW && !is_null($this->summaryRow) ) { return $this->summaryRow; } return false; } return $this->rows[$id]; }
php
public function getRowFromId($id) { if (!isset($this->rows[$id])) { if ($id == self::ID_SUMMARY_ROW && !is_null($this->summaryRow) ) { return $this->summaryRow; } return false; } return $this->rows[$id]; }
[ "public", "function", "getRowFromId", "(", "$", "id", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "rows", "[", "$", "id", "]", ")", ")", "{", "if", "(", "$", "id", "==", "self", "::", "ID_SUMMARY_ROW", "&&", "!", "is_null", "(", ...
Returns a row by ID. The ID is either the index of the row or {@link ID_SUMMARY_ROW}. @param int $id The row ID. @return Row|false The Row or false if not found.
[ "Returns", "a", "row", "by", "ID", ".", "The", "ID", "is", "either", "the", "index", "of", "the", "row", "or", "{", "@link", "ID_SUMMARY_ROW", "}", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L750-L761
train
Get Row from ID
[ 30522, 2270, 3853, 2131, 10524, 19699, 20936, 2094, 1006, 1002, 8909, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 10281, 1031, 30524, 1024, 8909, 1035, 12654, 1035, 5216, 1004, 1004, 999, 2003, 1035, 19701, 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...
laravel/framework
src/Illuminate/Queue/DatabaseQueue.php
DatabaseQueue.buildDatabaseRecord
protected function buildDatabaseRecord($queue, $payload, $availableAt, $attempts = 0) { return [ 'queue' => $queue, 'attempts' => $attempts, 'reserved_at' => null, 'available_at' => $availableAt, 'created_at' => $this->currentTime(), 'payload' => $payload, ]; }
php
protected function buildDatabaseRecord($queue, $payload, $availableAt, $attempts = 0) { return [ 'queue' => $queue, 'attempts' => $attempts, 'reserved_at' => null, 'available_at' => $availableAt, 'created_at' => $this->currentTime(), 'payload' => $payload, ]; }
[ "protected", "function", "buildDatabaseRecord", "(", "$", "queue", ",", "$", "payload", ",", "$", "availableAt", ",", "$", "attempts", "=", "0", ")", "{", "return", "[", "'queue'", "=>", "$", "queue", ",", "'attempts'", "=>", "$", "attempts", ",", "'rese...
Create an array to insert for the given job. @param string|null $queue @param string $payload @param int $availableAt @param int $attempts @return array
[ "Create", "an", "array", "to", "insert", "for", "the", "given", "job", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/DatabaseQueue.php#L174-L184
train
Build the database record array
[ 30522, 5123, 3853, 3857, 2850, 2696, 15058, 2890, 27108, 2094, 1006, 1002, 24240, 1010, 1002, 18093, 1010, 1002, 2800, 4017, 1010, 1002, 4740, 1027, 1014, 1007, 1063, 2709, 1031, 1005, 24240, 1005, 1027, 1028, 1002, 24240, 1010, 1005, 4740,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.removeToken
public function removeToken($tokenId) { if (!$this->session->isStarted()) { $this->session->start(); } return $this->session->remove($this->namespace.'/'.$tokenId); }
php
public function removeToken($tokenId) { if (!$this->session->isStarted()) { $this->session->start(); } return $this->session->remove($this->namespace.'/'.$tokenId); }
[ "public", "function", "removeToken", "(", "$", "tokenId", ")", "{", "if", "(", "!", "$", "this", "->", "session", "->", "isStarted", "(", ")", ")", "{", "$", "this", "->", "session", "->", "start", "(", ")", ";", "}", "return", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php#L87-L94
train
Remove a token from the session
[ 30522, 2270, 3853, 6366, 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
libs/Zend/Session/SaveHandler/DbTable.php
Zend_Session_SaveHandler_DbTable._setupTableName
protected function _setupTableName() { if (empty($this->_name) && basename(($this->_name = session_save_path())) != $this->_name) { /** * @see Zend_Session_SaveHandler_Exception */ // require_once 'Zend/Session/SaveHandler/Exception.php'; throw new Zend_Session_SaveHandler_Exception('session.save_path is a path and not a table name.'); } if (strpos($this->_name, '.')) { list($this->_schema, $this->_name) = explode('.', $this->_name); } }
php
protected function _setupTableName() { if (empty($this->_name) && basename(($this->_name = session_save_path())) != $this->_name) { /** * @see Zend_Session_SaveHandler_Exception */ // require_once 'Zend/Session/SaveHandler/Exception.php'; throw new Zend_Session_SaveHandler_Exception('session.save_path is a path and not a table name.'); } if (strpos($this->_name, '.')) { list($this->_schema, $this->_name) = explode('.', $this->_name); } }
[ "protected", "function", "_setupTableName", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "_name", ")", "&&", "basename", "(", "(", "$", "this", "->", "_name", "=", "session_save_path", "(", ")", ")", ")", "!=", "$", "this", "->", "_name...
Initialize table and schema names @return void @throws Zend_Session_SaveHandler_Exception
[ "Initialize", "table", "and", "schema", "names" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Session/SaveHandler/DbTable.php#L417-L431
train
Setup table name
[ 30522, 5123, 3853, 1035, 16437, 10880, 18442, 1006, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 2023, 1011, 1028, 1035, 2171, 1007, 1004, 1004, 2918, 18442, 1006, 1006, 1002, 2023, 1011, 1028, 1035, 2171, 1027, 5219, 1035, 3828, 1035, 4130, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.php
Grid.resource
public function resource($path = null) { if (!empty($path)) { $this->resourcePath = $path; return $this; } if (!empty($this->resourcePath)) { return $this->resourcePath; } return app('request')->getPathInfo(); }
php
public function resource($path = null) { if (!empty($path)) { $this->resourcePath = $path; return $this; } if (!empty($this->resourcePath)) { return $this->resourcePath; } return app('request')->getPathInfo(); }
[ "public", "function", "resource", "(", "$", "path", "=", "null", ")", "{", "if", "(", "!", "empty", "(", "$", "path", ")", ")", "{", "$", "this", "->", "resourcePath", "=", "$", "path", ";", "return", "$", "this", ";", "}", "if", "(", "!", "emp...
Get current resource uri. @param string $path @return string
[ "Get", "current", "resource", "uri", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L788-L801
train
Get Resource Path
[ 30522, 2270, 3853, 7692, 1006, 1002, 4130, 1027, 19701, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 4130, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 7692, 15069, 1027, 1002, 4130, 1025, 2709, 1002, 2023, 1025, 1065, 2065, 1006, 999, 406...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.tryAgainIfCausedByLostConnection
protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback) { if ($this->causedByLostConnection($e->getPrevious())) { $this->reconnect(); return $this->runQueryCallback($query, $bindings, $callback); } throw $e; }
php
protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback) { if ($this->causedByLostConnection($e->getPrevious())) { $this->reconnect(); return $this->runQueryCallback($query, $bindings, $callback); } throw $e; }
[ "protected", "function", "tryAgainIfCausedByLostConnection", "(", "QueryException", "$", "e", ",", "$", "query", ",", "$", "bindings", ",", "Closure", "$", "callback", ")", "{", "if", "(", "$", "this", "->", "causedByLostConnection", "(", "$", "e", "->", "ge...
Handle a query exception that occurred during query execution. @param \Illuminate\Database\QueryException $e @param string $query @param array $bindings @param \Closure $callback @return mixed @throws \Illuminate\Database\QueryException
[ "Handle", "a", "query", "exception", "that", "occurred", "during", "query", "execution", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connection.php#L733-L742
train
Try again if caused by lost connection
[ 30522, 5123, 3853, 3046, 16098, 5498, 11329, 20559, 2098, 3762, 10483, 13535, 18256, 7542, 1006, 23032, 10288, 24422, 1002, 1041, 1010, 1002, 23032, 1010, 1002, 8031, 2015, 1010, 8503, 1002, 2655, 5963, 1007, 1063, 2065, 1006, 1002, 2023, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Plugin/Visualization.php
Visualization.assignTemplateVar
public function assignTemplateVar($vars, $value = null) { if (is_string($vars)) { $this->templateVars[$vars] = $value; } elseif (is_array($vars)) { foreach ($vars as $key => $value) { $this->templateVars[$key] = $value; } } }
php
public function assignTemplateVar($vars, $value = null) { if (is_string($vars)) { $this->templateVars[$vars] = $value; } elseif (is_array($vars)) { foreach ($vars as $key => $value) { $this->templateVars[$key] = $value; } } }
[ "public", "function", "assignTemplateVar", "(", "$", "vars", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_string", "(", "$", "vars", ")", ")", "{", "$", "this", "->", "templateVars", "[", "$", "vars", "]", "=", "$", "value", ";", "}", ...
Assigns a template variable making it available in the Twig template specified by {@link TEMPLATE_FILE}. @param array|string $vars One or more variable names to set. @param mixed $value The value to set each variable to. @api
[ "Assigns", "a", "template", "variable", "making", "it", "available", "in", "the", "Twig", "template", "specified", "by", "{", "@link", "TEMPLATE_FILE", "}", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Visualization.php#L349-L358
train
Assign a template variable to the current context
[ 30522, 2270, 3853, 23911, 18532, 15725, 10755, 1006, 1002, 13075, 2015, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 13075, 2015, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 23561, 10755, 2015, 1031, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Optional.php
Optional.offsetSet
public function offsetSet($key, $value) { if (Arr::accessible($this->value)) { $this->value[$key] = $value; } }
php
public function offsetSet($key, $value) { if (Arr::accessible($this->value)) { $this->value[$key] = $value; } }
[ "public", "function", "offsetSet", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "Arr", "::", "accessible", "(", "$", "this", "->", "value", ")", ")", "{", "$", "this", "->", "value", "[", "$", "key", "]", "=", "$", "value", ";", "}"...
Set the item at a given offset. @param mixed $key @param mixed $value @return void
[ "Set", "the", "item", "at", "a", "given", "offset", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Optional.php#L93-L98
train
Set the value of the key
[ 30522, 2270, 3853, 16396, 13462, 1006, 1002, 3145, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 12098, 2099, 1024, 1024, 7801, 1006, 1002, 2023, 1011, 1028, 3643, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 3643, 1031, 1002, 3145, 1033, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/Repository.php
Repository.put
public function put($key, $value, $ttl = null) { if (is_array($key)) { return $this->putMany($key, $value); } if ($ttl === null) { return $this->forever($key, $value); } $seconds = $this->getSeconds($ttl); if ($seconds <= 0) { return $this->delete($key); } $result = $this->store->put($this->itemKey($key), $value, $seconds); if ($result) { $this->event(new KeyWritten($key, $value, $seconds)); } return $result; }
php
public function put($key, $value, $ttl = null) { if (is_array($key)) { return $this->putMany($key, $value); } if ($ttl === null) { return $this->forever($key, $value); } $seconds = $this->getSeconds($ttl); if ($seconds <= 0) { return $this->delete($key); } $result = $this->store->put($this->itemKey($key), $value, $seconds); if ($result) { $this->event(new KeyWritten($key, $value, $seconds)); } return $result; }
[ "public", "function", "put", "(", "$", "key", ",", "$", "value", ",", "$", "ttl", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "return", "$", "this", "->", "putMany", "(", "$", "key", ",", "$", "value", ")", "...
Store an item in the cache. @param string $key @param mixed $value @param \DateTimeInterface|\DateInterval|int|null $ttl @return bool
[ "Store", "an", "item", "in", "the", "cache", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/Repository.php#L199-L222
train
Put an item into the cache
[ 30522, 2270, 3853, 2404, 1006, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 23746, 2140, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 3145, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2404, 2386, 2100, 1006, 1002, 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...
symfony/symfony
src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php
ViolationPath.mapsForm
public function mapsForm($index) { if (!isset($this->mapsForm[$index])) { throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index)); } return $this->mapsForm[$index]; }
php
public function mapsForm($index) { if (!isset($this->mapsForm[$index])) { throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index)); } return $this->mapsForm[$index]; }
[ "public", "function", "mapsForm", "(", "$", "index", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "mapsForm", "[", "$", "index", "]", ")", ")", "{", "throw", "new", "OutOfBoundsException", "(", "sprintf", "(", "'The index %s is not within the...
Returns whether an element maps directly to a form. Consider the following violation path: children[address].children[office].data.street In this example, "address" and "office" map to forms, while "street does not. @param int $index The element index @return bool Whether the element maps to a form @throws OutOfBoundsException if the offset is invalid
[ "Returns", "whether", "an", "element", "maps", "directly", "to", "a", "form", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php#L212-L219
train
Returns the form for the mapping of the violation path
[ 30522, 2270, 3853, 7341, 14192, 1006, 1002, 5950, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 7341, 14192, 1031, 1002, 5950, 1033, 1007, 1007, 1063, 5466, 2047, 2041, 11253, 15494, 3366, 2595, 24422, 1006, 9043, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
PostgresGrammar.compilePrimary
public function compilePrimary(Blueprint $blueprint, Fluent $command) { $columns = $this->columnize($command->columns); return 'alter table '.$this->wrapTable($blueprint)." add primary key ({$columns})"; }
php
public function compilePrimary(Blueprint $blueprint, Fluent $command) { $columns = $this->columnize($command->columns); return 'alter table '.$this->wrapTable($blueprint)." add primary key ({$columns})"; }
[ "public", "function", "compilePrimary", "(", "Blueprint", "$", "blueprint", ",", "Fluent", "$", "command", ")", "{", "$", "columns", "=", "$", "this", "->", "columnize", "(", "$", "command", "->", "columns", ")", ";", "return", "'alter table '", ".", "$", ...
Compile a primary key command. @param \Illuminate\Database\Schema\Blueprint $blueprint @param \Illuminate\Support\Fluent $command @return string
[ "Compile", "a", "primary", "key", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php#L96-L101
train
Compiles a primary key statement into SQL.
[ 30522, 2270, 3853, 4012, 22090, 18098, 9581, 2854, 1006, 2630, 16550, 1002, 2630, 16550, 1010, 19376, 1002, 3094, 1007, 1063, 1002, 7753, 1027, 1002, 2023, 1011, 1028, 5930, 4697, 1006, 1002, 3094, 1011, 1028, 7753, 1007, 1025, 2709, 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
plugins/Dashboard/API.php
API.getDefaultDashboard
private function getDefaultDashboard() { $defaultLayout = $this->dashboard->getDefaultLayout(); $defaultLayout = $this->dashboard->decodeLayout($defaultLayout); $defaultDashboard = array('name' => Piwik::translate('Dashboard_Dashboard'), 'layout' => $defaultLayout, 'iddashboard' => 1); $widgets = $this->getVisibleWidgetsWithinDashboard($defaultDashboard); return $this->buildDashboard($defaultDashboard, $widgets); }
php
private function getDefaultDashboard() { $defaultLayout = $this->dashboard->getDefaultLayout(); $defaultLayout = $this->dashboard->decodeLayout($defaultLayout); $defaultDashboard = array('name' => Piwik::translate('Dashboard_Dashboard'), 'layout' => $defaultLayout, 'iddashboard' => 1); $widgets = $this->getVisibleWidgetsWithinDashboard($defaultDashboard); return $this->buildDashboard($defaultDashboard, $widgets); }
[ "private", "function", "getDefaultDashboard", "(", ")", "{", "$", "defaultLayout", "=", "$", "this", "->", "dashboard", "->", "getDefaultLayout", "(", ")", ";", "$", "defaultLayout", "=", "$", "this", "->", "dashboard", "->", "decodeLayout", "(", "$", "defau...
Get the default dashboard. @return \array[]
[ "Get", "the", "default", "dashboard", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Dashboard/API.php#L166-L175
train
Get default dashboard
[ 30522, 2797, 3853, 2131, 3207, 7011, 11314, 8883, 2232, 6277, 1006, 1007, 1063, 1002, 12398, 8485, 5833, 1027, 1002, 2023, 1011, 1028, 24923, 1011, 1028, 2131, 3207, 7011, 11314, 8485, 5833, 1006, 1007, 1025, 1002, 12398, 8485, 5833, 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...
symfony/symfony
src/Symfony/Component/HttpFoundation/HeaderUtils.php
HeaderUtils.makeDisposition
public static function makeDisposition(string $disposition, string $filename, string $filenameFallback = ''): string { if (!\in_array($disposition, [self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE])) { throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); } if ('' === $filenameFallback) { $filenameFallback = $filename; } // filenameFallback is not ASCII. if (!preg_match('/^[\x20-\x7e]*$/', $filenameFallback)) { throw new \InvalidArgumentException('The filename fallback must only contain ASCII characters.'); } // percent characters aren't safe in fallback. if (false !== strpos($filenameFallback, '%')) { throw new \InvalidArgumentException('The filename fallback cannot contain the "%" character.'); } // path separators aren't allowed in either. if (false !== strpos($filename, '/') || false !== strpos($filename, '\\') || false !== strpos($filenameFallback, '/') || false !== strpos($filenameFallback, '\\')) { throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.'); } $params = ['filename' => $filenameFallback]; if ($filename !== $filenameFallback) { $params['filename*'] = "utf-8''".rawurlencode($filename); } return $disposition.'; '.self::toString($params, ';'); }
php
public static function makeDisposition(string $disposition, string $filename, string $filenameFallback = ''): string { if (!\in_array($disposition, [self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE])) { throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); } if ('' === $filenameFallback) { $filenameFallback = $filename; } // filenameFallback is not ASCII. if (!preg_match('/^[\x20-\x7e]*$/', $filenameFallback)) { throw new \InvalidArgumentException('The filename fallback must only contain ASCII characters.'); } // percent characters aren't safe in fallback. if (false !== strpos($filenameFallback, '%')) { throw new \InvalidArgumentException('The filename fallback cannot contain the "%" character.'); } // path separators aren't allowed in either. if (false !== strpos($filename, '/') || false !== strpos($filename, '\\') || false !== strpos($filenameFallback, '/') || false !== strpos($filenameFallback, '\\')) { throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.'); } $params = ['filename' => $filenameFallback]; if ($filename !== $filenameFallback) { $params['filename*'] = "utf-8''".rawurlencode($filename); } return $disposition.'; '.self::toString($params, ';'); }
[ "public", "static", "function", "makeDisposition", "(", "string", "$", "disposition", ",", "string", "$", "filename", ",", "string", "$", "filenameFallback", "=", "''", ")", ":", "string", "{", "if", "(", "!", "\\", "in_array", "(", "$", "disposition", ","...
Generates a HTTP Content-Disposition field-value. @param string $disposition One of "inline" or "attachment" @param string $filename A unicode string @param string $filenameFallback A string containing only ASCII characters that is semantically equivalent to $filename. If the filename is already ASCII, it can be omitted, or just copied from $filename @return string A string suitable for use as a Content-Disposition field-value @throws \InvalidArgumentException @see RFC 6266
[ "Generates", "a", "HTTP", "Content", "-", "Disposition", "field", "-", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/HeaderUtils.php#L164-L195
train
Returns the disposition string
[ 30522, 2270, 10763, 3853, 2191, 10521, 26994, 1006, 5164, 1002, 22137, 1010, 5164, 1002, 5371, 18442, 1010, 5164, 1002, 5371, 18442, 13976, 5963, 1027, 1005, 1005, 1007, 1024, 5164, 1063, 2065, 1006, 999, 1032, 1999, 1035, 9140, 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/system/classes/PluginManager.php
PluginManager.isDisabled
public function isDisabled($id) { $code = $this->getIdentifier($id); if (array_key_exists($code, $this->disabledPlugins)) { return true; } return false; }
php
public function isDisabled($id) { $code = $this->getIdentifier($id); if (array_key_exists($code, $this->disabledPlugins)) { return true; } return false; }
[ "public", "function", "isDisabled", "(", "$", "id", ")", "{", "$", "code", "=", "$", "this", "->", "getIdentifier", "(", "$", "id", ")", ";", "if", "(", "array_key_exists", "(", "$", "code", ",", "$", "this", "->", "disabledPlugins", ")", ")", "{", ...
Determines if a plugin is disabled by looking at the meta information or the application configuration. @return boolean
[ "Determines", "if", "a", "plugin", "is", "disabled", "by", "looking", "at", "the", "meta", "information", "or", "the", "application", "configuration", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L517-L526
train
Check if a plugin is disabled
[ 30522, 2270, 3853, 2003, 10521, 3085, 2094, 1006, 1002, 8909, 1007, 1063, 1002, 3642, 1027, 1002, 2023, 1011, 1028, 2131, 5178, 16778, 8873, 2121, 1006, 1002, 8909, 1007, 1025, 2065, 1006, 9140, 1035, 3145, 1035, 6526, 1006, 1002, 3642, 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/MobileMessaging/API.php
API.validatePhoneNumber
public function validatePhoneNumber($phoneNumber, $verificationCode) { Piwik::checkUserIsNotAnonymous(); $phoneNumbers = $this->retrievePhoneNumbers(); if (isset($phoneNumbers[$phoneNumber])) { if ($verificationCode == $phoneNumbers[$phoneNumber]) { $phoneNumbers[$phoneNumber] = null; $this->savePhoneNumbers($phoneNumbers); return true; } } return false; }
php
public function validatePhoneNumber($phoneNumber, $verificationCode) { Piwik::checkUserIsNotAnonymous(); $phoneNumbers = $this->retrievePhoneNumbers(); if (isset($phoneNumbers[$phoneNumber])) { if ($verificationCode == $phoneNumbers[$phoneNumber]) { $phoneNumbers[$phoneNumber] = null; $this->savePhoneNumbers($phoneNumbers); return true; } } return false; }
[ "public", "function", "validatePhoneNumber", "(", "$", "phoneNumber", ",", "$", "verificationCode", ")", "{", "Piwik", "::", "checkUserIsNotAnonymous", "(", ")", ";", "$", "phoneNumbers", "=", "$", "this", "->", "retrievePhoneNumbers", "(", ")", ";", "if", "("...
validate phone number @param string $phoneNumber @param string $verificationCode @return bool true if validation code is correct, false otherwise
[ "validate", "phone", "number" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/MobileMessaging/API.php#L276-L292
train
Checks if the phone number is valid and if it is not invalid.
[ 30522, 2270, 3853, 9398, 3686, 9864, 19172, 5677, 1006, 1002, 3042, 19172, 5677, 1010, 1002, 22616, 16044, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 2483, 17048, 6761, 4890, 27711, 1006, 1007, 1025, 1002, 3042, 19172, 17198, 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/PropertyAccess/PropertyAccessor.php
PropertyAccessor.getPropertyPath
private function getPropertyPath($propertyPath): PropertyPath { if ($propertyPath instanceof PropertyPathInterface) { // Don't call the copy constructor has it is not needed here return $propertyPath; } if (isset($this->propertyPathCache[$propertyPath])) { return $this->propertyPathCache[$propertyPath]; } if ($this->cacheItemPool) { $item = $this->cacheItemPool->getItem(self::CACHE_PREFIX_PROPERTY_PATH.rawurlencode($propertyPath)); if ($item->isHit()) { return $this->propertyPathCache[$propertyPath] = $item->get(); } } $propertyPathInstance = new PropertyPath($propertyPath); if (isset($item)) { $item->set($propertyPathInstance); $this->cacheItemPool->save($item); } return $this->propertyPathCache[$propertyPath] = $propertyPathInstance; }
php
private function getPropertyPath($propertyPath): PropertyPath { if ($propertyPath instanceof PropertyPathInterface) { // Don't call the copy constructor has it is not needed here return $propertyPath; } if (isset($this->propertyPathCache[$propertyPath])) { return $this->propertyPathCache[$propertyPath]; } if ($this->cacheItemPool) { $item = $this->cacheItemPool->getItem(self::CACHE_PREFIX_PROPERTY_PATH.rawurlencode($propertyPath)); if ($item->isHit()) { return $this->propertyPathCache[$propertyPath] = $item->get(); } } $propertyPathInstance = new PropertyPath($propertyPath); if (isset($item)) { $item->set($propertyPathInstance); $this->cacheItemPool->save($item); } return $this->propertyPathCache[$propertyPath] = $propertyPathInstance; }
[ "private", "function", "getPropertyPath", "(", "$", "propertyPath", ")", ":", "PropertyPath", "{", "if", "(", "$", "propertyPath", "instanceof", "PropertyPathInterface", ")", "{", "// Don't call the copy constructor has it is not needed here", "return", "$", "propertyPath",...
Gets a PropertyPath instance and caches it. @param string|PropertyPath $propertyPath
[ "Gets", "a", "PropertyPath", "instance", "and", "caches", "it", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyAccess/PropertyAccessor.php#L789-L814
train
Get PropertyPath instance
[ 30522, 2797, 3853, 2131, 21572, 4842, 3723, 15069, 1006, 1002, 3200, 15069, 1007, 1024, 3200, 15069, 1063, 2065, 1006, 1002, 3200, 15069, 6013, 11253, 3200, 15069, 18447, 2121, 12172, 1007, 1063, 1013, 1013, 2123, 1005, 1056, 2655, 1996, 61...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Plugin/UserSetting.php
UserSetting.isWritableByCurrentUser
public function isWritableByCurrentUser() { if (isset($this->hasWritePermission)) { return $this->hasWritePermission; } // performance improvement, do not detect this in __construct otherwise likely rather "big" query to DB. $this->hasWritePermission = Piwik::isUserHasSomeViewAccess(); return $this->hasWritePermission; }
php
public function isWritableByCurrentUser() { if (isset($this->hasWritePermission)) { return $this->hasWritePermission; } // performance improvement, do not detect this in __construct otherwise likely rather "big" query to DB. $this->hasWritePermission = Piwik::isUserHasSomeViewAccess(); return $this->hasWritePermission; }
[ "public", "function", "isWritableByCurrentUser", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "hasWritePermission", ")", ")", "{", "return", "$", "this", "->", "hasWritePermission", ";", "}", "// performance improvement, do not detect this in __construct...
Returns `true` if this setting can be displayed for the current user, `false` if otherwise. @return bool
[ "Returns", "true", "if", "this", "setting", "can", "be", "displayed", "for", "the", "current", "user", "false", "if", "otherwise", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Settings/Plugin/UserSetting.php#L61-L71
train
Returns true if the user has write access to the record
[ 30522, 2270, 3853, 2003, 13088, 6590, 3468, 3762, 10841, 14343, 3372, 20330, 1006, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 2038, 26373, 4842, 25481, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2038, 26373, 484...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Media/Traits/MediaTrait.php
MediaTrait.getMedia
public function getMedia() { if ($this->media === null) { $cache = $this->getMediaCache(); // Use cached media if possible. $cacheKey = md5('media' . $this->getCacheKey()); if (!$media = $cache->get($cacheKey)) { $media = new Media($this->getMediaFolder(), $this->getMediaOrder()); $cache->set($cacheKey, $media); } $this->media = $media; } return $this->media; }
php
public function getMedia() { if ($this->media === null) { $cache = $this->getMediaCache(); // Use cached media if possible. $cacheKey = md5('media' . $this->getCacheKey()); if (!$media = $cache->get($cacheKey)) { $media = new Media($this->getMediaFolder(), $this->getMediaOrder()); $cache->set($cacheKey, $media); } $this->media = $media; } return $this->media; }
[ "public", "function", "getMedia", "(", ")", "{", "if", "(", "$", "this", "->", "media", "===", "null", ")", "{", "$", "cache", "=", "$", "this", "->", "getMediaCache", "(", ")", ";", "// Use cached media if possible.", "$", "cacheKey", "=", "md5", "(", ...
Gets the associated media collection. @return MediaCollectionInterface Representation of associated media.
[ "Gets", "the", "associated", "media", "collection", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Media/Traits/MediaTrait.php#L68-L83
train
Get media from cache
[ 30522, 2270, 3853, 2131, 16969, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2865, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 17053, 1027, 1002, 2023, 1011, 1028, 2131, 16969, 3540, 5403, 1006, 1007, 1025, 1013, 1013, 2224, 17053, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...