repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
ErickTamayo/laravel-scout-elastic
src/ElasticsearchEngine.php
ElasticsearchEngine.sort
protected function sort($builder) { if (count($builder->orders) == 0) { return null; } return collect($builder->orders)->map(function($order) { return [$order['column'] => $order['direction']]; })->toArray(); }
php
protected function sort($builder) { if (count($builder->orders) == 0) { return null; } return collect($builder->orders)->map(function($order) { return [$order['column'] => $order['direction']]; })->toArray(); }
[ "protected", "function", "sort", "(", "$", "builder", ")", "{", "if", "(", "count", "(", "$", "builder", "->", "orders", ")", "==", "0", ")", "{", "return", "null", ";", "}", "return", "collect", "(", "$", "builder", "->", "orders", ")", "->", "map...
Generates the sort if theres any. @param Builder $builder @return array|null
[ "Generates", "the", "sort", "if", "theres", "any", "." ]
train
https://github.com/ErickTamayo/laravel-scout-elastic/blob/fb5b843c0091972153cf36e009d53a631b2ec9da/src/ElasticsearchEngine.php#L249-L258
antonioribeiro/google2fa
src/Google2FA.php
Google2FA.findValidOTP
public function findValidOTP( $secret, $key, $window, $startingTimestamp, $timestamp, $oldTimestamp = Constants::ARGUMENT_NOT_SET ) { for ( ; $startingTimestamp <= $timestamp + $this->getWindow($window); $startingTimestamp++...
php
public function findValidOTP( $secret, $key, $window, $startingTimestamp, $timestamp, $oldTimestamp = Constants::ARGUMENT_NOT_SET ) { for ( ; $startingTimestamp <= $timestamp + $this->getWindow($window); $startingTimestamp++...
[ "public", "function", "findValidOTP", "(", "$", "secret", ",", "$", "key", ",", "$", "window", ",", "$", "startingTimestamp", ",", "$", "timestamp", ",", "$", "oldTimestamp", "=", "Constants", "::", "ARGUMENT_NOT_SET", ")", "{", "for", "(", ";", "$", "st...
Find a valid One Time Password. @param $secret @param $key @param $window @param $startingTimestamp @param $timestamp @param string $oldTimestamp @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException @throws \PragmaRX\Google2FA\Exceptions\I...
[ "Find", "a", "valid", "One", "Time", "Password", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Google2FA.php#L50-L73
antonioribeiro/google2fa
src/Google2FA.php
Google2FA.makeStartingTimestamp
private function makeStartingTimestamp($window, $timestamp, $oldTimestamp) { return $oldTimestamp === Constants::ARGUMENT_NOT_SET ? $timestamp - $this->getWindow($window) : max($timestamp - $this->getWindow($window), $oldTimestamp + 1); }
php
private function makeStartingTimestamp($window, $timestamp, $oldTimestamp) { return $oldTimestamp === Constants::ARGUMENT_NOT_SET ? $timestamp - $this->getWindow($window) : max($timestamp - $this->getWindow($window), $oldTimestamp + 1); }
[ "private", "function", "makeStartingTimestamp", "(", "$", "window", ",", "$", "timestamp", ",", "$", "oldTimestamp", ")", "{", "return", "$", "oldTimestamp", "===", "Constants", "::", "ARGUMENT_NOT_SET", "?", "$", "timestamp", "-", "$", "this", "->", "getWindo...
Make a window based starting timestamp. @param $window @param $timestamp @param $oldTimestamp @return mixed
[ "Make", "a", "window", "based", "starting", "timestamp", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Google2FA.php#L171-L176
antonioribeiro/google2fa
src/Google2FA.php
Google2FA.oathHotp
public function oathHotp($secret, $counter) { $secret = $this->base32Decode($this->getSecret($secret)); if (strlen($secret) < 8) { throw new SecretKeyTooShortException(); } // Counter must be 64-bit int $bin_counter = pack('N*', 0, $counter); $hash = ha...
php
public function oathHotp($secret, $counter) { $secret = $this->base32Decode($this->getSecret($secret)); if (strlen($secret) < 8) { throw new SecretKeyTooShortException(); } // Counter must be 64-bit int $bin_counter = pack('N*', 0, $counter); $hash = ha...
[ "public", "function", "oathHotp", "(", "$", "secret", ",", "$", "counter", ")", "{", "$", "secret", "=", "$", "this", "->", "base32Decode", "(", "$", "this", "->", "getSecret", "(", "$", "secret", ")", ")", ";", "if", "(", "strlen", "(", "$", "secr...
Takes the secret key and the timestamp and returns the one time password. @param string $secret - Secret key in binary form. @param int $counter - Timestamp as returned by getTimestamp. @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersExcept...
[ "Takes", "the", "secret", "key", "and", "the", "timestamp", "and", "returns", "the", "one", "time", "password", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Google2FA.php#L207-L226
antonioribeiro/google2fa
src/Google2FA.php
Google2FA.oathTruncate
public function oathTruncate($hash) { $offset = ord($hash[19]) & 0xf; $temp = unpack('N', substr($hash, $offset, 4)); return substr( $temp[1] & 0x7fffffff, -$this->getOneTimePasswordLength() ); }
php
public function oathTruncate($hash) { $offset = ord($hash[19]) & 0xf; $temp = unpack('N', substr($hash, $offset, 4)); return substr( $temp[1] & 0x7fffffff, -$this->getOneTimePasswordLength() ); }
[ "public", "function", "oathTruncate", "(", "$", "hash", ")", "{", "$", "offset", "=", "ord", "(", "$", "hash", "[", "19", "]", ")", "&", "0xf", ";", "$", "temp", "=", "unpack", "(", "'N'", ",", "substr", "(", "$", "hash", ",", "$", "offset", ",...
Extracts the OTP from the SHA1 hash. @param string $hash @return int
[ "Extracts", "the", "OTP", "from", "the", "SHA1", "hash", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Google2FA.php#L235-L245
antonioribeiro/google2fa
src/Google2FA.php
Google2FA.verify
public function verify( $key, $secret = null, $window = null, $timestamp = null, $oldTimestamp = Constants::ARGUMENT_NOT_SET ) { return $this->verifyKey( $secret, $key, $window, $timestamp, $oldTimestamp ...
php
public function verify( $key, $secret = null, $window = null, $timestamp = null, $oldTimestamp = Constants::ARGUMENT_NOT_SET ) { return $this->verifyKey( $secret, $key, $window, $timestamp, $oldTimestamp ...
[ "public", "function", "verify", "(", "$", "key", ",", "$", "secret", "=", "null", ",", "$", "window", "=", "null", ",", "$", "timestamp", "=", "null", ",", "$", "oldTimestamp", "=", "Constants", "::", "ARGUMENT_NOT_SET", ")", "{", "return", "$", "this"...
Verifies a user inputted key against the current timestamp. Checks $window keys either side of the timestamp. @param string $key - User specified key @param null|string $secret @param null|int $window @param null|int $timestamp @param null|string|int $oldTimestamp @throws \PragmaRX...
[ "Verifies", "a", "user", "inputted", "key", "against", "the", "current", "timestamp", ".", "Checks", "$window", "keys", "either", "side", "of", "the", "timestamp", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Google2FA.php#L334-L348
antonioribeiro/google2fa
src/Google2FA.php
Google2FA.verifyKey
public function verifyKey( $secret, $key, $window = null, $timestamp = null, $oldTimestamp = Constants::ARGUMENT_NOT_SET ) { $timestamp = $this->makeTimestamp($timestamp); return $this->findValidOTP( $secret, $key, $window,...
php
public function verifyKey( $secret, $key, $window = null, $timestamp = null, $oldTimestamp = Constants::ARGUMENT_NOT_SET ) { $timestamp = $this->makeTimestamp($timestamp); return $this->findValidOTP( $secret, $key, $window,...
[ "public", "function", "verifyKey", "(", "$", "secret", ",", "$", "key", ",", "$", "window", "=", "null", ",", "$", "timestamp", "=", "null", ",", "$", "oldTimestamp", "=", "Constants", "::", "ARGUMENT_NOT_SET", ")", "{", "$", "timestamp", "=", "$", "th...
Verifies a user inputted key against the current timestamp. Checks $window keys either side of the timestamp. @param string $secret @param string $key - User specified key @param null|int $window @param null|int $timestamp @param null|string|int $oldTimestamp @throws \PragmaRX...
[ "Verifies", "a", "user", "inputted", "key", "against", "the", "current", "timestamp", ".", "Checks", "$window", "keys", "either", "side", "of", "the", "timestamp", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Google2FA.php#L366-L383
antonioribeiro/google2fa
src/Google2FA.php
Google2FA.verifyKeyNewer
public function verifyKeyNewer( $secret, $key, $oldTimestamp, $window = null, $timestamp = null ) { return $this->verifyKey( $secret, $key, $window, $timestamp, $oldTimestamp ); }
php
public function verifyKeyNewer( $secret, $key, $oldTimestamp, $window = null, $timestamp = null ) { return $this->verifyKey( $secret, $key, $window, $timestamp, $oldTimestamp ); }
[ "public", "function", "verifyKeyNewer", "(", "$", "secret", ",", "$", "key", ",", "$", "oldTimestamp", ",", "$", "window", "=", "null", ",", "$", "timestamp", "=", "null", ")", "{", "return", "$", "this", "->", "verifyKey", "(", "$", "secret", ",", "...
Verifies a user inputted key against the current timestamp. Checks $window keys either side of the timestamp, but ensures that the given key is newer than the given oldTimestamp. Useful if you need to ensure that a single key cannot be used twice. @param string $secret @param string $key - User specified ...
[ "Verifies", "a", "user", "inputted", "key", "against", "the", "current", "timestamp", ".", "Checks", "$window", "keys", "either", "side", "of", "the", "timestamp", "but", "ensures", "that", "the", "given", "key", "is", "newer", "than", "the", "given", "oldTi...
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Google2FA.php#L403-L417
antonioribeiro/google2fa
src/Support/QRCode.php
QRCode.getQRCodeUrl
public function getQRCodeUrl($company, $holder, $secret) { return 'otpauth://totp/' . rawurlencode($company) . ':' . rawurlencode($holder) . '?secret=' . $secret . '&issuer=' . rawurlencode($company) . ''; }
php
public function getQRCodeUrl($company, $holder, $secret) { return 'otpauth://totp/' . rawurlencode($company) . ':' . rawurlencode($holder) . '?secret=' . $secret . '&issuer=' . rawurlencode($company) . ''; }
[ "public", "function", "getQRCodeUrl", "(", "$", "company", ",", "$", "holder", ",", "$", "secret", ")", "{", "return", "'otpauth://totp/'", ".", "rawurlencode", "(", "$", "company", ")", ".", "':'", ".", "rawurlencode", "(", "$", "holder", ")", ".", "'?s...
Creates a QR code url. @param $company @param $holder @param $secret @return string
[ "Creates", "a", "QR", "code", "url", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Support/QRCode.php#L16-L27
antonioribeiro/google2fa
src/Support/Base32.php
Base32.generateBase32RandomKey
public function generateBase32RandomKey($length = 16, $prefix = '') { $secret = $prefix ? $this->toBase32($prefix) : ''; $secret = $this->strPadBase32($secret, $length); $this->validateSecret($secret); return $secret; }
php
public function generateBase32RandomKey($length = 16, $prefix = '') { $secret = $prefix ? $this->toBase32($prefix) : ''; $secret = $this->strPadBase32($secret, $length); $this->validateSecret($secret); return $secret; }
[ "public", "function", "generateBase32RandomKey", "(", "$", "length", "=", "16", ",", "$", "prefix", "=", "''", ")", "{", "$", "secret", "=", "$", "prefix", "?", "$", "this", "->", "toBase32", "(", "$", "prefix", ")", ":", "''", ";", "$", "secret", ...
Generate a digit secret key in base32 format. @param int $length @param string $prefix @throws IncompatibleWithGoogleAuthenticatorException @throws InvalidCharactersException @return string
[ "Generate", "a", "digit", "secret", "key", "in", "base32", "format", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Support/Base32.php#L27-L36
antonioribeiro/google2fa
src/Support/Base32.php
Base32.base32Decode
public function base32Decode($b32) { $b32 = strtoupper($b32); $this->validateSecret($b32); return ParagonieBase32::decodeUpper($b32); }
php
public function base32Decode($b32) { $b32 = strtoupper($b32); $this->validateSecret($b32); return ParagonieBase32::decodeUpper($b32); }
[ "public", "function", "base32Decode", "(", "$", "b32", ")", "{", "$", "b32", "=", "strtoupper", "(", "$", "b32", ")", ";", "$", "this", "->", "validateSecret", "(", "$", "b32", ")", ";", "return", "ParagonieBase32", "::", "decodeUpper", "(", "$", "b32"...
Decodes a base32 string into a binary string. @param string $b32 @throws InvalidCharactersException @throws IncompatibleWithGoogleAuthenticatorException @return int
[ "Decodes", "a", "base32", "string", "into", "a", "binary", "string", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Support/Base32.php#L48-L55
antonioribeiro/google2fa
src/Support/Base32.php
Base32.strPadBase32
private function strPadBase32($string, $length) { for ($i = 0; $i < $length; $i++) { $string .= substr( Constants::VALID_FOR_B32_SCRAMBLED, $this->getRandomNumber(), 1 ); } return $string; }
php
private function strPadBase32($string, $length) { for ($i = 0; $i < $length; $i++) { $string .= substr( Constants::VALID_FOR_B32_SCRAMBLED, $this->getRandomNumber(), 1 ); } return $string; }
[ "private", "function", "strPadBase32", "(", "$", "string", ",", "$", "length", ")", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "length", ";", "$", "i", "++", ")", "{", "$", "string", ".=", "substr", "(", "Constants", "::", "V...
Pad string with random base 32 chars. @param $string @param $length @throws \Exception @return string
[ "Pad", "string", "with", "random", "base", "32", "chars", "." ]
train
https://github.com/antonioribeiro/google2fa/blob/7d526619f06bd3e0687e0e5242ccd65ae6b1d8c7/src/Support/Base32.php#L67-L78
baopham/laravel-dynamodb
src/RawDynamoDbQuery.php
RawDynamoDbQuery.finalize
public function finalize() { $this->query = array_filter($this->query, function ($value) { return !empty($value) || is_bool($value) || is_numeric($value); }); return $this; }
php
public function finalize() { $this->query = array_filter($this->query, function ($value) { return !empty($value) || is_bool($value) || is_numeric($value); }); return $this; }
[ "public", "function", "finalize", "(", ")", "{", "$", "this", "->", "query", "=", "array_filter", "(", "$", "this", "->", "query", ",", "function", "(", "$", "value", ")", "{", "return", "!", "empty", "(", "$", "value", ")", "||", "is_bool", "(", "...
Perform any final clean up. Remove any empty values to avoid errors. @return $this
[ "Perform", "any", "final", "clean", "up", ".", "Remove", "any", "empty", "values", "to", "avoid", "errors", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/RawDynamoDbQuery.php#L38-L45
baopham/laravel-dynamodb
src/Parsers/ConditionExpression.php
ConditionExpression.parse
public function parse($where) { if (empty($where)) { return ''; } $parsed = []; foreach ($where as $condition) { $boolean = array_get($condition, 'boolean'); $value = array_get($condition, 'value'); $type = array_get($condition, 'type...
php
public function parse($where) { if (empty($where)) { return ''; } $parsed = []; foreach ($where as $condition) { $boolean = array_get($condition, 'boolean'); $value = array_get($condition, 'value'); $type = array_get($condition, 'type...
[ "public", "function", "parse", "(", "$", "where", ")", "{", "if", "(", "empty", "(", "$", "where", ")", ")", "{", "return", "''", ";", "}", "$", "parsed", "=", "[", "]", ";", "foreach", "(", "$", "where", "as", "$", "condition", ")", "{", "$", ...
@param array $where [ 'column' => 'name', 'type' => 'EQ', 'value' => 'foo', 'boolean' => 'and', ] @return string @throws NotSupportedException
[ "@param", "array", "$where", "[", "column", "=", ">", "name", "type", "=", ">", "EQ", "value", "=", ">", "foo", "boolean", "=", ">", "and", "]" ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/Parsers/ConditionExpression.php#L64-L96
baopham/laravel-dynamodb
src/ConditionAnalyzer/Analyzer.php
Analyzer.getCondition
private function getCondition($column) { return H::array_first($this->conditions, function ($condition) use ($column) { return $condition['column'] === $column; }); }
php
private function getCondition($column) { return H::array_first($this->conditions, function ($condition) use ($column) { return $condition['column'] === $column; }); }
[ "private", "function", "getCondition", "(", "$", "column", ")", "{", "return", "H", "::", "array_first", "(", "$", "this", "->", "conditions", ",", "function", "(", "$", "condition", ")", "use", "(", "$", "column", ")", "{", "return", "$", "condition", ...
@param $column @return array
[ "@param", "$column" ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/ConditionAnalyzer/Analyzer.php#L145-L150
baopham/laravel-dynamodb
src/ConditionAnalyzer/Analyzer.php
Analyzer.getConditions
private function getConditions($columns) { return array_filter($this->conditions, function ($condition) use ($columns) { return in_array($condition['column'], $columns); }); }
php
private function getConditions($columns) { return array_filter($this->conditions, function ($condition) use ($columns) { return in_array($condition['column'], $columns); }); }
[ "private", "function", "getConditions", "(", "$", "columns", ")", "{", "return", "array_filter", "(", "$", "this", "->", "conditions", ",", "function", "(", "$", "condition", ")", "use", "(", "$", "columns", ")", "{", "return", "in_array", "(", "$", "con...
@param $columns @return array
[ "@param", "$columns" ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/ConditionAnalyzer/Analyzer.php#L157-L162
baopham/laravel-dynamodb
src/EmptyAttributeFilter.php
EmptyAttributeFilter.filter
public function filter(&$store) { foreach ($store as $key => &$value) { $value = is_string($value) ? trim($value) : $value; $empty = $value === null || (is_array($value) && empty($value)); $empty = $empty || (is_scalar($value) && $value !== false && (string) $value === '...
php
public function filter(&$store) { foreach ($store as $key => &$value) { $value = is_string($value) ? trim($value) : $value; $empty = $value === null || (is_array($value) && empty($value)); $empty = $empty || (is_scalar($value) && $value !== false && (string) $value === '...
[ "public", "function", "filter", "(", "&", "$", "store", ")", "{", "foreach", "(", "$", "store", "as", "$", "key", "=>", "&", "$", "value", ")", "{", "$", "value", "=", "is_string", "(", "$", "value", ")", "?", "trim", "(", "$", "value", ")", ":...
Set empty values to NULL since DynamoDB does not like empty values.
[ "Set", "empty", "values", "to", "NULL", "since", "DynamoDB", "does", "not", "like", "empty", "values", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/EmptyAttributeFilter.php#L15-L34
baopham/laravel-dynamodb
src/DynamoDbServiceProvider.php
DynamoDbServiceProvider.boot
public function boot() { DynamoDbModel::setDynamoDbClientService($this->app->make(DynamoDbClientInterface::class)); $this->publishes([ __DIR__.'/../config/dynamodb.php' => app()->basePath('config/dynamodb.php'), ]); }
php
public function boot() { DynamoDbModel::setDynamoDbClientService($this->app->make(DynamoDbClientInterface::class)); $this->publishes([ __DIR__.'/../config/dynamodb.php' => app()->basePath('config/dynamodb.php'), ]); }
[ "public", "function", "boot", "(", ")", "{", "DynamoDbModel", "::", "setDynamoDbClientService", "(", "$", "this", "->", "app", "->", "make", "(", "DynamoDbClientInterface", "::", "class", ")", ")", ";", "$", "this", "->", "publishes", "(", "[", "__DIR__", ...
Bootstrap the application events. @return void
[ "Bootstrap", "the", "application", "events", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbServiceProvider.php#L16-L23
baopham/laravel-dynamodb
src/DynamoDbServiceProvider.php
DynamoDbServiceProvider.register
public function register() { $marshalerOptions = [ 'nullify_invalid' => true, ]; $this->app->singleton(DynamoDbClientInterface::class, function () use ($marshalerOptions) { $client = new DynamoDbClientService(new Marshaler($marshalerOptions), new EmptyAttributeFilter...
php
public function register() { $marshalerOptions = [ 'nullify_invalid' => true, ]; $this->app->singleton(DynamoDbClientInterface::class, function () use ($marshalerOptions) { $client = new DynamoDbClientService(new Marshaler($marshalerOptions), new EmptyAttributeFilter...
[ "public", "function", "register", "(", ")", "{", "$", "marshalerOptions", "=", "[", "'nullify_invalid'", "=>", "true", ",", "]", ";", "$", "this", "->", "app", "->", "singleton", "(", "DynamoDbClientInterface", "::", "class", ",", "function", "(", ")", "us...
Register the service provider.
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbServiceProvider.php#L28-L43
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.after
public function after(DynamoDbModel $after = null) { if (empty($after)) { $this->lastEvaluatedKey = null; return $this; } $afterKey = $after->getKeys(); $analyzer = $this->getConditionAnalyzer(); if ($index = $analyzer->index()) { forea...
php
public function after(DynamoDbModel $after = null) { if (empty($after)) { $this->lastEvaluatedKey = null; return $this; } $afterKey = $after->getKeys(); $analyzer = $this->getConditionAnalyzer(); if ($index = $analyzer->index()) { forea...
[ "public", "function", "after", "(", "DynamoDbModel", "$", "after", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "after", ")", ")", "{", "$", "this", "->", "lastEvaluatedKey", "=", "null", ";", "return", "$", "this", ";", "}", "$", "afterKey",...
Determine the starting point (exclusively) of the query. Unfortunately, offset of how many records to skip does not make sense for DynamoDb. Instead, provide the last result of the previous query as the starting point for the next query. @param DynamoDbModel|null $after Examples: For query such as $query = $model->...
[ "Determine", "the", "starting", "point", "(", "exclusively", ")", "of", "the", "query", ".", "Unfortunately", "offset", "of", "how", "many", "records", "to", "skip", "does", "not", "make", "sense", "for", "DynamoDb", ".", "Instead", "provide", "the", "last",...
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L149-L170
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.afterKey
public function afterKey($key = null) { $this->lastEvaluatedKey = empty($key) ? null : DynamoDb::marshalItem($key); return $this; }
php
public function afterKey($key = null) { $this->lastEvaluatedKey = empty($key) ? null : DynamoDb::marshalItem($key); return $this; }
[ "public", "function", "afterKey", "(", "$", "key", "=", "null", ")", "{", "$", "this", "->", "lastEvaluatedKey", "=", "empty", "(", "$", "key", ")", "?", "null", ":", "DynamoDb", "::", "marshalItem", "(", "$", "key", ")", ";", "return", "$", "this", ...
Similar to after(), but instead of using the model instance, the model's keys are used. Use $collection->lastKey() or $model->getKeys() to retrieve the value. @param Array $key Examples: For query such as $query = $model->where('count', 10)->limit(2); $items = $query->all(); Take the last item of this query result ...
[ "Similar", "to", "after", "()", "but", "instead", "of", "using", "the", "model", "instance", "the", "model", "s", "keys", "are", "used", ".", "Use", "$collection", "-", ">", "lastKey", "()", "or", "$model", "-", ">", "getKeys", "()", "to", "retrieve", ...
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L189-L193
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.addNestedWhereQuery
public function addNestedWhereQuery($query, $boolean = 'and') { if (count($query->wheres)) { $type = 'Nested'; $column = null; $value = $query->wheres; $this->wheres[] = compact('column', 'type', 'value', 'boolean'); } return $this; }
php
public function addNestedWhereQuery($query, $boolean = 'and') { if (count($query->wheres)) { $type = 'Nested'; $column = null; $value = $query->wheres; $this->wheres[] = compact('column', 'type', 'value', 'boolean'); } return $this; }
[ "public", "function", "addNestedWhereQuery", "(", "$", "query", ",", "$", "boolean", "=", "'and'", ")", "{", "if", "(", "count", "(", "$", "query", "->", "wheres", ")", ")", "{", "$", "type", "=", "'Nested'", ";", "$", "column", "=", "null", ";", "...
Add another query builder as a nested where to the query builder. @param DynamoDbQueryBuilder $query @param string $boolean @return $this
[ "Add", "another", "query", "builder", "as", "a", "nested", "where", "to", "the", "query", "builder", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L289-L299
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.orWhere
public function orWhere($column, $operator = null, $value = null) { return $this->where($column, $operator, $value, 'or'); }
php
public function orWhere($column, $operator = null, $value = null) { return $this->where($column, $operator, $value, 'or'); }
[ "public", "function", "orWhere", "(", "$", "column", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "return", "$", "this", "->", "where", "(", "$", "column", ",", "$", "operator", ",", "$", "value", ",", "'or'", ")", ...
Add an "or where" clause to the query. @param string $column @param string $operator @param mixed $value @return $this
[ "Add", "an", "or", "where", "clause", "to", "the", "query", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L309-L312
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.whereIn
public function whereIn($column, $values, $boolean = 'and', $not = false) { if ($not) { throw new NotSupportedException('"not in" is not a valid DynamoDB comparison operator'); } // If the value is a query builder instance, not supported if ($values instanceof static) { ...
php
public function whereIn($column, $values, $boolean = 'and', $not = false) { if ($not) { throw new NotSupportedException('"not in" is not a valid DynamoDB comparison operator'); } // If the value is a query builder instance, not supported if ($values instanceof static) { ...
[ "public", "function", "whereIn", "(", "$", "column", ",", "$", "values", ",", "$", "boolean", "=", "'and'", ",", "$", "not", "=", "false", ")", "{", "if", "(", "$", "not", ")", "{", "throw", "new", "NotSupportedException", "(", "'\"not in\" is not a vali...
Add a "where in" clause to the query. @param string $column @param mixed $values @param string $boolean @param bool $not @return $this @throws NotSupportedException
[ "Add", "a", "where", "in", "clause", "to", "the", "query", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L324-L346
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.whereNull
public function whereNull($column, $boolean = 'and', $not = false) { $type = $not ? ComparisonOperator::NOT_NULL : ComparisonOperator::NULL; $this->wheres[] = compact('column', 'type', 'boolean'); return $this; }
php
public function whereNull($column, $boolean = 'and', $not = false) { $type = $not ? ComparisonOperator::NOT_NULL : ComparisonOperator::NULL; $this->wheres[] = compact('column', 'type', 'boolean'); return $this; }
[ "public", "function", "whereNull", "(", "$", "column", ",", "$", "boolean", "=", "'and'", ",", "$", "not", "=", "false", ")", "{", "$", "type", "=", "$", "not", "?", "ComparisonOperator", "::", "NOT_NULL", ":", "ComparisonOperator", "::", "NULL", ";", ...
Add a "where null" clause to the query. @param string $column @param string $boolean @param bool $not @return $this
[ "Add", "a", "where", "null", "clause", "to", "the", "query", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L368-L375
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.chunk
public function chunk($chunkSize, callable $callback) { while (true) { $results = $this->getAll([], $chunkSize, false); if (!$results->isEmpty()) { if (call_user_func($callback, $results) === false) { return false; } } ...
php
public function chunk($chunkSize, callable $callback) { while (true) { $results = $this->getAll([], $chunkSize, false); if (!$results->isEmpty()) { if (call_user_func($callback, $results) === false) { return false; } } ...
[ "public", "function", "chunk", "(", "$", "chunkSize", ",", "callable", "$", "callback", ")", "{", "while", "(", "true", ")", "{", "$", "results", "=", "$", "this", "->", "getAll", "(", "[", "]", ",", "$", "chunkSize", ",", "false", ")", ";", "if", ...
Implements the Query Chunk method @param int $chunkSize @param callable $callback
[ "Implements", "the", "Query", "Chunk", "method" ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L427-L444
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.removeAttribute
public function removeAttribute(...$attributes) { $keySet = !empty(array_filter($this->model->getKeys())); if (!$keySet) { $analyzer = $this->getConditionAnalyzer(); if (!$analyzer->isExactSearch()) { throw new InvalidQuery('Need to provide the key in your q...
php
public function removeAttribute(...$attributes) { $keySet = !empty(array_filter($this->model->getKeys())); if (!$keySet) { $analyzer = $this->getConditionAnalyzer(); if (!$analyzer->isExactSearch()) { throw new InvalidQuery('Need to provide the key in your q...
[ "public", "function", "removeAttribute", "(", "...", "$", "attributes", ")", "{", "$", "keySet", "=", "!", "empty", "(", "array_filter", "(", "$", "this", "->", "model", "->", "getKeys", "(", ")", ")", ")", ";", "if", "(", "!", "$", "keySet", ")", ...
Remove attributes from an existing item @param array ...$attributes @return bool @throws InvalidQuery
[ "Remove", "attributes", "from", "an", "existing", "item" ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L576-L612
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.toDynamoDbQuery
public function toDynamoDbQuery( $columns = [], $limit = DynamoDbQueryBuilder::MAX_LIMIT ) { $this->applyScopes(); $this->resetExpressions(); $op = 'Scan'; $queryBuilder = DynamoDb::table($this->model->getTable()); if (! empty($this->wheres)) { ...
php
public function toDynamoDbQuery( $columns = [], $limit = DynamoDbQueryBuilder::MAX_LIMIT ) { $this->applyScopes(); $this->resetExpressions(); $op = 'Scan'; $queryBuilder = DynamoDb::table($this->model->getTable()); if (! empty($this->wheres)) { ...
[ "public", "function", "toDynamoDbQuery", "(", "$", "columns", "=", "[", "]", ",", "$", "limit", "=", "DynamoDbQueryBuilder", "::", "MAX_LIMIT", ")", "{", "$", "this", "->", "applyScopes", "(", ")", ";", "$", "this", "->", "resetExpressions", "(", ")", ";...
Return the raw DynamoDb query @param array $columns @param int $limit @return RawDynamoDbQuery
[ "Return", "the", "raw", "DynamoDb", "query" ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L736-L797
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.applyScopes
public function applyScopes() { if (! $this->scopes) { return $this; } $builder = $this; foreach ($builder->scopes as $identifier => $scope) { if (! isset($builder->scopes[$identifier])) { continue; } $builder->callSc...
php
public function applyScopes() { if (! $this->scopes) { return $this; } $builder = $this; foreach ($builder->scopes as $identifier => $scope) { if (! isset($builder->scopes[$identifier])) { continue; } $builder->callSc...
[ "public", "function", "applyScopes", "(", ")", "{", "if", "(", "!", "$", "this", "->", "scopes", ")", "{", "return", "$", "this", ";", "}", "$", "builder", "=", "$", "this", ";", "foreach", "(", "$", "builder", "->", "scopes", "as", "$", "identifie...
Apply the scopes to the Eloquent builder instance and return it. @return DynamoDbQueryBuilder
[ "Apply", "the", "scopes", "to", "the", "Eloquent", "builder", "instance", "and", "return", "it", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L914-L947
baopham/laravel-dynamodb
src/DynamoDbQueryBuilder.php
DynamoDbQueryBuilder.callScope
protected function callScope(callable $scope, $parameters = []) { array_unshift($parameters, $this); // $query = $this->getQuery(); // // We will keep track of how many wheres are on the query before running the // // scope so that we can properly group the added scope constraints ...
php
protected function callScope(callable $scope, $parameters = []) { array_unshift($parameters, $this); // $query = $this->getQuery(); // // We will keep track of how many wheres are on the query before running the // // scope so that we can properly group the added scope constraints ...
[ "protected", "function", "callScope", "(", "callable", "$", "scope", ",", "$", "parameters", "=", "[", "]", ")", "{", "array_unshift", "(", "$", "parameters", ",", "$", "this", ")", ";", "// $query = $this->getQuery();", "// // We will keep track of how many wheres ...
Apply the given scope on the current builder instance. @param callable $scope @param array $parameters @return mixed
[ "Apply", "the", "given", "scope", "on", "the", "current", "builder", "instance", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbQueryBuilder.php#L956-L975
baopham/laravel-dynamodb
src/DynamoDbModel.php
DynamoDbModel.saveAsync
public function saveAsync(array $options = []) { $create = !$this->exists; if ($this->fireModelEvent('saving') === false) { return false; } if ($create && $this->fireModelEvent('creating') === false) { return false; } if (!$create && $this-...
php
public function saveAsync(array $options = []) { $create = !$this->exists; if ($this->fireModelEvent('saving') === false) { return false; } if ($create && $this->fireModelEvent('creating') === false) { return false; } if (!$create && $this-...
[ "public", "function", "saveAsync", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "create", "=", "!", "$", "this", "->", "exists", ";", "if", "(", "$", "this", "->", "fireModelEvent", "(", "'saving'", ")", "===", "false", ")", "{", "re...
Saves the model to DynamoDb asynchronously and returns a promise @param array $options @return bool|\GuzzleHttp\Promise\Promise
[ "Saves", "the", "model", "to", "DynamoDb", "asynchronously", "and", "returns", "a", "promise" ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbModel.php#L163-L196
baopham/laravel-dynamodb
src/DynamoDbModel.php
DynamoDbModel.getKeys
public function getKeys() { if ($this->hasCompositeKey()) { $key = []; foreach ($this->compositeKey as $name) { $key[$name] = $this->getAttribute($name); } return $key; } $name = $this->getKeyName(); return [$name =>...
php
public function getKeys() { if ($this->hasCompositeKey()) { $key = []; foreach ($this->compositeKey as $name) { $key[$name] = $this->getAttribute($name); } return $key; } $name = $this->getKeyName(); return [$name =>...
[ "public", "function", "getKeys", "(", ")", "{", "if", "(", "$", "this", "->", "hasCompositeKey", "(", ")", ")", "{", "$", "key", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "compositeKey", "as", "$", "name", ")", "{", "$", "key", "[", ...
Get the value of the model's primary / composite key. Use this if you always want the key values in associative array form. @return array ['id' => 'foo'] or ['id' => 'foo', 'id2' => 'bar']
[ "Get", "the", "value", "of", "the", "model", "s", "primary", "/", "composite", "key", ".", "Use", "this", "if", "you", "always", "want", "the", "key", "values", "in", "associative", "array", "form", "." ]
train
https://github.com/baopham/laravel-dynamodb/blob/77239f92f04077fbbaaa2fe14151018878baa249/src/DynamoDbModel.php#L379-L394
yiisoft/yii2-debug
src/models/search/Base.php
Base.addCondition
public function addCondition(Filter $filter, $attribute, $partial = false) { $value = $this->$attribute; if (mb_strpos($value, '>') !== false) { $value = (int)str_replace('>', '', $value); $filter->addMatcher($attribute, new matchers\GreaterThan(['value' => $value])); ...
php
public function addCondition(Filter $filter, $attribute, $partial = false) { $value = $this->$attribute; if (mb_strpos($value, '>') !== false) { $value = (int)str_replace('>', '', $value); $filter->addMatcher($attribute, new matchers\GreaterThan(['value' => $value])); ...
[ "public", "function", "addCondition", "(", "Filter", "$", "filter", ",", "$", "attribute", ",", "$", "partial", "=", "false", ")", "{", "$", "value", "=", "$", "this", "->", "$", "attribute", ";", "if", "(", "mb_strpos", "(", "$", "value", ",", "'>'"...
Adds filtering condition for a given attribute @param Filter $filter filter instance @param string $attribute attribute to filter @param bool $partial if partial match should be used
[ "Adds", "filtering", "condition", "for", "a", "given", "attribute" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/search/Base.php#L29-L43
yiisoft/yii2-debug
src/panels/TimelinePanel.php
TimelinePanel.getDetail
public function getDetail() { $searchModel = new Search(); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this); return Yii::$app->view->render('panels/timeline/detail', [ 'panel' => $this, 'dataProvider' => $dataProvider, 'se...
php
public function getDetail() { $searchModel = new Search(); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this); return Yii::$app->view->render('panels/timeline/detail', [ 'panel' => $this, 'dataProvider' => $dataProvider, 'se...
[ "public", "function", "getDetail", "(", ")", "{", "$", "searchModel", "=", "new", "Search", "(", ")", ";", "$", "dataProvider", "=", "$", "searchModel", "->", "search", "(", "Yii", "::", "$", "app", "->", "request", "->", "getQueryParams", "(", ")", ",...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/TimelinePanel.php#L97-L107
yiisoft/yii2-debug
src/panels/TimelinePanel.php
TimelinePanel.load
public function load($data) { if (!isset($data['start']) || empty($data['start'])) { throw new \RuntimeException('Unable to determine request start time'); } $this->_start = $data['start'] * 1000; if (!isset($data['end']) || empty($data['end'])) { throw new \...
php
public function load($data) { if (!isset($data['start']) || empty($data['start'])) { throw new \RuntimeException('Unable to determine request start time'); } $this->_start = $data['start'] * 1000; if (!isset($data['end']) || empty($data['end'])) { throw new \...
[ "public", "function", "load", "(", "$", "data", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "'start'", "]", ")", "||", "empty", "(", "$", "data", "[", "'start'", "]", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'U...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/TimelinePanel.php#L112-L138
yiisoft/yii2-debug
src/panels/TimelinePanel.php
TimelinePanel.getModels
protected function getModels($refresh = false) { if ($this->_models === null || $refresh) { $this->_models = []; if (isset($this->module->panels['profiling']->data['messages'])) { $this->_models = Yii::getLogger()->calculateTimings($this->module->panels['profiling']->...
php
protected function getModels($refresh = false) { if ($this->_models === null || $refresh) { $this->_models = []; if (isset($this->module->panels['profiling']->data['messages'])) { $this->_models = Yii::getLogger()->calculateTimings($this->module->panels['profiling']->...
[ "protected", "function", "getModels", "(", "$", "refresh", "=", "false", ")", "{", "if", "(", "$", "this", "->", "_models", "===", "null", "||", "$", "refresh", ")", "{", "$", "this", "->", "_models", "=", "[", "]", ";", "if", "(", "isset", "(", ...
Returns an array of models that represents logs of the current request. Can be used with data providers, such as \yii\data\ArrayDataProvider. @param bool $refresh if need to build models from log messages and refresh them. @return array models
[ "Returns", "an", "array", "of", "models", "that", "represents", "logs", "of", "the", "current", "request", ".", "Can", "be", "used", "with", "data", "providers", "such", "as", "\\", "yii", "\\", "data", "\\", "ArrayDataProvider", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/TimelinePanel.php#L240-L249
yiisoft/yii2-debug
src/panels/UserPanel.php
UserPanel.init
public function init() { if (!$this->isEnabled() || $this->getUser()->isGuest) { return; } $this->userSwitch = new UserSwitch(['userComponent' => $this->userComponent]); $this->addAccessRules(); if (!is_object($this->filterModel) && class_exists($thi...
php
public function init() { if (!$this->isEnabled() || $this->getUser()->isGuest) { return; } $this->userSwitch = new UserSwitch(['userComponent' => $this->userComponent]); $this->addAccessRules(); if (!is_object($this->filterModel) && class_exists($thi...
[ "public", "function", "init", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isEnabled", "(", ")", "||", "$", "this", "->", "getUser", "(", ")", "->", "isGuest", ")", "{", "return", ";", "}", "$", "this", "->", "userSwitch", "=", "new", "User...
{@inheritdoc} @throws InvalidConfigException
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/UserPanel.php#L76-L95
yiisoft/yii2-debug
src/panels/UserPanel.php
UserPanel.addAccessRules
private function addAccessRules() { $this->ruleUserSwitch['controllers'] = [$this->module->id . '/user']; $this->module->attachBehavior( 'access_debug', [ 'class' => 'yii\filters\AccessControl', 'only' => [$this->module->id . '/user', $this->m...
php
private function addAccessRules() { $this->ruleUserSwitch['controllers'] = [$this->module->id . '/user']; $this->module->attachBehavior( 'access_debug', [ 'class' => 'yii\filters\AccessControl', 'only' => [$this->module->id . '/user', $this->m...
[ "private", "function", "addAccessRules", "(", ")", "{", "$", "this", "->", "ruleUserSwitch", "[", "'controllers'", "]", "=", "[", "$", "this", "->", "module", "->", "id", ".", "'/user'", "]", ";", "$", "this", "->", "module", "->", "attachBehavior", "(",...
Add ACF rule. AccessControl attach to debug module. Access rule for main user. @throws InvalidConfigException
[ "Add", "ACF", "rule", ".", "AccessControl", "attach", "to", "debug", "module", ".", "Access", "rule", "for", "main", "user", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/UserPanel.php#L113-L128
yiisoft/yii2-debug
src/panels/UserPanel.php
UserPanel.canSearchUsers
public function canSearchUsers() { return (isset($this->filterModel) && $this->filterModel instanceof Model && $this->filterModel->hasMethod('search') ); }
php
public function canSearchUsers() { return (isset($this->filterModel) && $this->filterModel instanceof Model && $this->filterModel->hasMethod('search') ); }
[ "public", "function", "canSearchUsers", "(", ")", "{", "return", "(", "isset", "(", "$", "this", "->", "filterModel", ")", "&&", "$", "this", "->", "filterModel", "instanceof", "Model", "&&", "$", "this", "->", "filterModel", "->", "hasMethod", "(", "'sear...
Check is available search of users @return bool
[ "Check", "is", "available", "search", "of", "users" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/UserPanel.php#L152-L158
yiisoft/yii2-debug
src/panels/UserPanel.php
UserPanel.canSwitchUser
public function canSwitchUser() { if ($this->getUser()->isGuest) { return false; } $allowSwitchUser = false; $rule = new AccessRule($this->ruleUserSwitch); /** @var Controller $userController */ $userController = null; $controller = $this->modul...
php
public function canSwitchUser() { if ($this->getUser()->isGuest) { return false; } $allowSwitchUser = false; $rule = new AccessRule($this->ruleUserSwitch); /** @var Controller $userController */ $userController = null; $controller = $this->modul...
[ "public", "function", "canSwitchUser", "(", ")", "{", "if", "(", "$", "this", "->", "getUser", "(", ")", "->", "isGuest", ")", "{", "return", "false", ";", "}", "$", "allowSwitchUser", "=", "false", ";", "$", "rule", "=", "new", "AccessRule", "(", "$...
Check can main user switch identity. @return bool @throws InvalidConfigException
[ "Check", "can", "main", "user", "switch", "identity", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/UserPanel.php#L165-L192
yiisoft/yii2-debug
src/panels/UserPanel.php
UserPanel.save
public function save() { $identity = Yii::$app->user->identity; if (!isset($identity)) { return null; } $rolesProvider = null; $permissionsProvider = null; try { $authManager = Yii::$app->getAuthManager(); if ($authManager insta...
php
public function save() { $identity = Yii::$app->user->identity; if (!isset($identity)) { return null; } $rolesProvider = null; $permissionsProvider = null; try { $authManager = Yii::$app->getAuthManager(); if ($authManager insta...
[ "public", "function", "save", "(", ")", "{", "$", "identity", "=", "Yii", "::", "$", "app", "->", "user", "->", "identity", ";", "if", "(", "!", "isset", "(", "$", "identity", ")", ")", "{", "return", "null", ";", "}", "$", "rolesProvider", "=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/UserPanel.php#L221-L286
yiisoft/yii2-debug
src/panels/AssetPanel.php
AssetPanel.save
public function save() { $bundles = Yii::$app->view->assetManager->bundles; if (empty($bundles)) { // bundles can be false return []; } $data = []; foreach ($bundles as $name => $bundle) { if ($bundle instanceof AssetBundle) { $bundleDa...
php
public function save() { $bundles = Yii::$app->view->assetManager->bundles; if (empty($bundles)) { // bundles can be false return []; } $data = []; foreach ($bundles as $name => $bundle) { if ($bundle instanceof AssetBundle) { $bundleDa...
[ "public", "function", "save", "(", ")", "{", "$", "bundles", "=", "Yii", "::", "$", "app", "->", "view", "->", "assetManager", "->", "bundles", ";", "if", "(", "empty", "(", "$", "bundles", ")", ")", "{", "// bundles can be false", "return", "[", "]", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/AssetPanel.php#L51-L71
yiisoft/yii2-debug
src/panels/AssetPanel.php
AssetPanel.isEnabled
public function isEnabled() { try { isset(Yii::$app->view->assetManager) && Yii::$app->view->assetManager; } catch (InvalidConfigException $exception) { return false; } return true; }
php
public function isEnabled() { try { isset(Yii::$app->view->assetManager) && Yii::$app->view->assetManager; } catch (InvalidConfigException $exception) { return false; } return true; }
[ "public", "function", "isEnabled", "(", ")", "{", "try", "{", "isset", "(", "Yii", "::", "$", "app", "->", "view", "->", "assetManager", ")", "&&", "Yii", "::", "$", "app", "->", "view", "->", "assetManager", ";", "}", "catch", "(", "InvalidConfigExcep...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/AssetPanel.php#L76-L84
yiisoft/yii2-debug
src/panels/AssetPanel.php
AssetPanel.format
protected function format(array $bundles) { // @todo remove foreach ($bundles as $bundle) { array_walk($bundle->css, function (&$file, $key, $userData) { $file = Html::a($file, $userData->baseUrl . '/' . $file, ['target' => '_blank']); }, $bundle); ...
php
protected function format(array $bundles) { // @todo remove foreach ($bundles as $bundle) { array_walk($bundle->css, function (&$file, $key, $userData) { $file = Html::a($file, $userData->baseUrl . '/' . $file, ['target' => '_blank']); }, $bundle); ...
[ "protected", "function", "format", "(", "array", "$", "bundles", ")", "{", "// @todo remove", "foreach", "(", "$", "bundles", "as", "$", "bundle", ")", "{", "array_walk", "(", "$", "bundle", "->", "css", ",", "function", "(", "&", "$", "file", ",", "$"...
Additional formatting for view. @param AssetBundle[] $bundles Array of bundles to formatting. @return AssetBundle[]
[ "Additional", "formatting", "for", "view", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/AssetPanel.php#L93-L115
yiisoft/yii2-debug
src/panels/AssetPanel.php
AssetPanel.formatOptions
protected function formatOptions(array &$params) { if (!is_array($params)) { return $params; } foreach ($params as $param => $value) { $params[$param] = Html::tag('strong', '\'' . $param . '\' => ') . (string)$value; } return $params; }
php
protected function formatOptions(array &$params) { if (!is_array($params)) { return $params; } foreach ($params as $param => $value) { $params[$param] = Html::tag('strong', '\'' . $param . '\' => ') . (string)$value; } return $params; }
[ "protected", "function", "formatOptions", "(", "array", "&", "$", "params", ")", "{", "if", "(", "!", "is_array", "(", "$", "params", ")", ")", "{", "return", "$", "params", ";", "}", "foreach", "(", "$", "params", "as", "$", "param", "=>", "$", "v...
Format associative array of params to simple value. @param array $params @return array
[ "Format", "associative", "array", "of", "params", "to", "simple", "value", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/AssetPanel.php#L124-L135
yiisoft/yii2-debug
src/controllers/UserController.php
UserController.beforeAction
public function beforeAction($action) { Yii::$app->response->format = Response::FORMAT_JSON; if (!Yii::$app->session->hasSessionId) { throw new BadRequestHttpException('Need an active session'); } return parent::beforeAction($action); }
php
public function beforeAction($action) { Yii::$app->response->format = Response::FORMAT_JSON; if (!Yii::$app->session->hasSessionId) { throw new BadRequestHttpException('Need an active session'); } return parent::beforeAction($action); }
[ "public", "function", "beforeAction", "(", "$", "action", ")", "{", "Yii", "::", "$", "app", "->", "response", "->", "format", "=", "Response", "::", "FORMAT_JSON", ";", "if", "(", "!", "Yii", "::", "$", "app", "->", "session", "->", "hasSessionId", ")...
{@inheritdoc} @throws BadRequestHttpException
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/controllers/UserController.php#L28-L35
yiisoft/yii2-debug
src/controllers/UserController.php
UserController.actionSetIdentity
public function actionSetIdentity() { $user_id = Yii::$app->request->post('user_id'); $userSwitch = new UserSwitch(); $newIdentity = Yii::$app->user->identity->findIdentity($user_id); $userSwitch->setUserByIdentity($newIdentity); return Yii::$app->user; }
php
public function actionSetIdentity() { $user_id = Yii::$app->request->post('user_id'); $userSwitch = new UserSwitch(); $newIdentity = Yii::$app->user->identity->findIdentity($user_id); $userSwitch->setUserByIdentity($newIdentity); return Yii::$app->user; }
[ "public", "function", "actionSetIdentity", "(", ")", "{", "$", "user_id", "=", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", "'user_id'", ")", ";", "$", "userSwitch", "=", "new", "UserSwitch", "(", ")", ";", "$", "newIdentity", "=", "Yii...
Set new identity, switch user @return \yii\web\User @throws \yii\base\InvalidConfigException
[ "Set", "new", "identity", "switch", "user" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/controllers/UserController.php#L42-L50
yiisoft/yii2-debug
src/panels/EventPanel.php
EventPanel.init
public function init() { parent::init(); Event::on('*', '*', function ($event) { /* @var $event Event */ $eventData = [ 'time' => microtime(true), 'name' => $event->name, 'class' => get_class($event), 'isStatic'...
php
public function init() { parent::init(); Event::on('*', '*', function ($event) { /* @var $event Event */ $eventData = [ 'time' => microtime(true), 'name' => $event->name, 'class' => get_class($event), 'isStatic'...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "Event", "::", "on", "(", "'*'", ",", "'*'", ",", "function", "(", "$", "event", ")", "{", "/* @var $event Event */", "$", "eventData", "=", "[", "'time'", "=>", "mic...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/EventPanel.php#L34-L50
yiisoft/yii2-debug
src/panels/EventPanel.php
EventPanel.getDetail
public function getDetail() { $searchModel = new \yii\debug\models\search\Event(); $dataProvider = $searchModel->search(Yii::$app->request->get(), $this->data); return Yii::$app->view->render('panels/event/detail', [ 'panel' => $this, 'dataProvider' => $dataProvider,...
php
public function getDetail() { $searchModel = new \yii\debug\models\search\Event(); $dataProvider = $searchModel->search(Yii::$app->request->get(), $this->data); return Yii::$app->view->render('panels/event/detail', [ 'panel' => $this, 'dataProvider' => $dataProvider,...
[ "public", "function", "getDetail", "(", ")", "{", "$", "searchModel", "=", "new", "\\", "yii", "\\", "debug", "\\", "models", "\\", "search", "\\", "Event", "(", ")", ";", "$", "dataProvider", "=", "$", "searchModel", "->", "search", "(", "Yii", "::", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/EventPanel.php#L74-L84
yiisoft/yii2-debug
src/panels/EventPanel.php
EventPanel.isEnabled
public function isEnabled() { $yiiVersion = Yii::getVersion(); if (!version_compare($yiiVersion, '2.0.14', '>=') && strpos($yiiVersion, '-dev') === false) { return false; } return parent::isEnabled(); }
php
public function isEnabled() { $yiiVersion = Yii::getVersion(); if (!version_compare($yiiVersion, '2.0.14', '>=') && strpos($yiiVersion, '-dev') === false) { return false; } return parent::isEnabled(); }
[ "public", "function", "isEnabled", "(", ")", "{", "$", "yiiVersion", "=", "Yii", "::", "getVersion", "(", ")", ";", "if", "(", "!", "version_compare", "(", "$", "yiiVersion", ",", "'2.0.14'", ",", "'>='", ")", "&&", "strpos", "(", "$", "yiiVersion", ",...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/EventPanel.php#L97-L105
yiisoft/yii2-debug
src/panels/LogPanel.php
LogPanel.save
public function save() { $target = $this->module->logTarget; $except = []; if (isset($this->module->panels['router'])) { $except = $this->module->panels['router']->getCategories(); } $messages = $target->filterMessages($target->messages, Logger::LEVEL_ERR...
php
public function save() { $target = $this->module->logTarget; $except = []; if (isset($this->module->panels['router'])) { $except = $this->module->panels['router']->getCategories(); } $messages = $target->filterMessages($target->messages, Logger::LEVEL_ERR...
[ "public", "function", "save", "(", ")", "{", "$", "target", "=", "$", "this", "->", "module", "->", "logTarget", ";", "$", "except", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "this", "->", "module", "->", "panels", "[", "'router'", "]", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/LogPanel.php#L64-L85
yiisoft/yii2-debug
src/Panel.php
Panel.getTraceLine
public function getTraceLine($options) { if (!isset($options['text'])) { $options['text'] = "{$options['file']}:{$options['line']}"; } $traceLine = $this->module->traceLine; if ($traceLine === false) { return $options['text']; } $options['file...
php
public function getTraceLine($options) { if (!isset($options['text'])) { $options['text'] = "{$options['file']}:{$options['line']}"; } $traceLine = $this->module->traceLine; if ($traceLine === false) { return $options['text']; } $options['file...
[ "public", "function", "getTraceLine", "(", "$", "options", ")", "{", "if", "(", "!", "isset", "(", "$", "options", "[", "'text'", "]", ")", ")", "{", "$", "options", "[", "'text'", "]", "=", "\"{$options['file']}:{$options['line']}\"", ";", "}", "$", "tr...
Returns a trace line @param array $options The array with trace @return string the trace line @since 2.0.7
[ "Returns", "a", "trace", "line" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/Panel.php#L130-L143
yiisoft/yii2-debug
src/panels/DbPanel.php
DbPanel.calculateTimings
public function calculateTimings() { if ($this->_timings === null) { $this->_timings = Yii::getLogger()->calculateTimings(isset($this->data['messages']) ? $this->data['messages'] : []); } return $this->_timings; }
php
public function calculateTimings() { if ($this->_timings === null) { $this->_timings = Yii::getLogger()->calculateTimings(isset($this->data['messages']) ? $this->data['messages'] : []); } return $this->_timings; }
[ "public", "function", "calculateTimings", "(", ")", "{", "if", "(", "$", "this", "->", "_timings", "===", "null", ")", "{", "$", "this", "->", "_timings", "=", "Yii", "::", "getLogger", "(", ")", "->", "calculateTimings", "(", "isset", "(", "$", "this"...
Calculates given request profile timings. @return array timings [token, category, timestamp, traces, nesting level, elapsed time]
[ "Calculates", "given", "request", "profile", "timings", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/DbPanel.php#L138-L145
yiisoft/yii2-debug
src/panels/DbPanel.php
DbPanel.getModels
protected function getModels() { if ($this->_models === null) { $this->_models = []; $timings = $this->calculateTimings(); $duplicates = $this->countDuplicateQuery($timings); foreach ($timings as $seq => $dbTiming) { $this->_models[] = [ ...
php
protected function getModels() { if ($this->_models === null) { $this->_models = []; $timings = $this->calculateTimings(); $duplicates = $this->countDuplicateQuery($timings); foreach ($timings as $seq => $dbTiming) { $this->_models[] = [ ...
[ "protected", "function", "getModels", "(", ")", "{", "if", "(", "$", "this", "->", "_models", "===", "null", ")", "{", "$", "this", "->", "_models", "=", "[", "]", ";", "$", "timings", "=", "$", "this", "->", "calculateTimings", "(", ")", ";", "$",...
Returns an array of models that represents logs of the current request. Can be used with data providers such as \yii\data\ArrayDataProvider. @return array models
[ "Returns", "an", "array", "of", "models", "that", "represents", "logs", "of", "the", "current", "request", ".", "Can", "be", "used", "with", "data", "providers", "such", "as", "\\", "yii", "\\", "data", "\\", "ArrayDataProvider", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/DbPanel.php#L189-L210
yiisoft/yii2-debug
src/panels/DbPanel.php
DbPanel.sumDuplicateQueries
public function sumDuplicateQueries($modelData) { $numDuplicates = 0; $duplicates = ArrayHelper::getColumn($modelData, 'duplicate'); foreach ($duplicates as $duplicate) { if ($duplicate > 1) { $numDuplicates++; } } return $numDuplicate...
php
public function sumDuplicateQueries($modelData) { $numDuplicates = 0; $duplicates = ArrayHelper::getColumn($modelData, 'duplicate'); foreach ($duplicates as $duplicate) { if ($duplicate > 1) { $numDuplicates++; } } return $numDuplicate...
[ "public", "function", "sumDuplicateQueries", "(", "$", "modelData", ")", "{", "$", "numDuplicates", "=", "0", ";", "$", "duplicates", "=", "ArrayHelper", "::", "getColumn", "(", "$", "modelData", ",", "'duplicate'", ")", ";", "foreach", "(", "$", "duplicates...
Returns sum of all duplicated queries @param $modelData @return int @since 2.0.13
[ "Returns", "sum", "of", "all", "duplicated", "queries" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/DbPanel.php#L234-L245
yiisoft/yii2-debug
src/panels/DbPanel.php
DbPanel.getQueryType
protected function getQueryType($timing) { $timing = ltrim($timing); preg_match('/^([a-zA-z]*)/', $timing, $matches); return count($matches) ? mb_strtoupper($matches[0], 'utf8') : ''; }
php
protected function getQueryType($timing) { $timing = ltrim($timing); preg_match('/^([a-zA-z]*)/', $timing, $matches); return count($matches) ? mb_strtoupper($matches[0], 'utf8') : ''; }
[ "protected", "function", "getQueryType", "(", "$", "timing", ")", "{", "$", "timing", "=", "ltrim", "(", "$", "timing", ")", ";", "preg_match", "(", "'/^([a-zA-z]*)/'", ",", "$", "timing", ",", "$", "matches", ")", ";", "return", "count", "(", "$", "ma...
Returns database query type. @param string $timing timing procedure string @return string query type such as select, insert, delete, etc.
[ "Returns", "database", "query", "type", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/DbPanel.php#L253-L259
yiisoft/yii2-debug
src/panels/DbPanel.php
DbPanel.getTypes
public function getTypes() { return array_reduce( $this->_models, function ($result, $item) { $result[$item['type']] = $item['type']; return $result; }, [] ); }
php
public function getTypes() { return array_reduce( $this->_models, function ($result, $item) { $result[$item['type']] = $item['type']; return $result; }, [] ); }
[ "public", "function", "getTypes", "(", ")", "{", "return", "array_reduce", "(", "$", "this", "->", "_models", ",", "function", "(", "$", "result", ",", "$", "item", ")", "{", "$", "result", "[", "$", "item", "[", "'type'", "]", "]", "=", "$", "item...
Returns array query types @return array @since 2.0.3
[ "Returns", "array", "query", "types" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/DbPanel.php#L278-L288
yiisoft/yii2-debug
src/panels/DumpPanel.php
DumpPanel.getDetail
public function getDetail() { $searchModel = new Log(); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this->getModels()); return Yii::$app->view->render('panels/dump/detail', [ 'dataProvider' => $dataProvider, 'panel' => $this, ...
php
public function getDetail() { $searchModel = new Log(); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this->getModels()); return Yii::$app->view->render('panels/dump/detail', [ 'dataProvider' => $dataProvider, 'panel' => $this, ...
[ "public", "function", "getDetail", "(", ")", "{", "$", "searchModel", "=", "new", "Log", "(", ")", ";", "$", "dataProvider", "=", "$", "searchModel", "->", "search", "(", "Yii", "::", "$", "app", "->", "request", "->", "getQueryParams", "(", ")", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/DumpPanel.php#L70-L80
yiisoft/yii2-debug
src/panels/DumpPanel.php
DumpPanel.save
public function save() { $target = $this->module->logTarget; $except = []; if (isset($this->module->panels['router'])) { $except = $this->module->panels['router']->getCategories(); } $messages = $target->filterMessages($target->messages, Logger::LEVEL_TRACE, $thi...
php
public function save() { $target = $this->module->logTarget; $except = []; if (isset($this->module->panels['router'])) { $except = $this->module->panels['router']->getCategories(); } $messages = $target->filterMessages($target->messages, Logger::LEVEL_TRACE, $thi...
[ "public", "function", "save", "(", ")", "{", "$", "target", "=", "$", "this", "->", "module", "->", "logTarget", ";", "$", "except", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "this", "->", "module", "->", "panels", "[", "'router'", "]", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/DumpPanel.php#L85-L96
yiisoft/yii2-debug
src/panels/DumpPanel.php
DumpPanel.varDump
public function varDump($var) { if (is_callable($this->varDumpCallback)) { return call_user_func($this->varDumpCallback, $var, $this); } $message = VarDumper::dumpAsString($var, $this->depth, $this->highlight); //don't encode highlighted variables if (!$this->hi...
php
public function varDump($var) { if (is_callable($this->varDumpCallback)) { return call_user_func($this->varDumpCallback, $var, $this); } $message = VarDumper::dumpAsString($var, $this->depth, $this->highlight); //don't encode highlighted variables if (!$this->hi...
[ "public", "function", "varDump", "(", "$", "var", ")", "{", "if", "(", "is_callable", "(", "$", "this", "->", "varDumpCallback", ")", ")", "{", "return", "call_user_func", "(", "$", "this", "->", "varDumpCallback", ",", "$", "var", ",", "$", "this", ")...
Called by view to format the dumped variable. @since 2.1.3
[ "Called", "by", "view", "to", "format", "the", "dumped", "variable", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/DumpPanel.php#L103-L117
yiisoft/yii2-debug
src/panels/DumpPanel.php
DumpPanel.getModels
protected function getModels($refresh = false) { if ($this->_models === null || $refresh) { $this->_models = []; foreach ($this->data as $message) { $this->_models[] = [ 'message' => $message[0], 'level' => $message[1], ...
php
protected function getModels($refresh = false) { if ($this->_models === null || $refresh) { $this->_models = []; foreach ($this->data as $message) { $this->_models[] = [ 'message' => $message[0], 'level' => $message[1], ...
[ "protected", "function", "getModels", "(", "$", "refresh", "=", "false", ")", "{", "if", "(", "$", "this", "->", "_models", "===", "null", "||", "$", "refresh", ")", "{", "$", "this", "->", "_models", "=", "[", "]", ";", "foreach", "(", "$", "this"...
Returns an array of models that represents logs of the current request. Can be used with data providers, such as \yii\data\ArrayDataProvider. @param bool $refresh if need to build models from log messages and refresh them. @return array models
[ "Returns", "an", "array", "of", "models", "that", "represents", "logs", "of", "the", "current", "request", ".", "Can", "be", "used", "with", "data", "providers", "such", "as", "\\", "yii", "\\", "data", "\\", "ArrayDataProvider", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/DumpPanel.php#L126-L143
yiisoft/yii2-debug
src/components/search/matchers/SameAs.php
SameAs.match
public function match($value) { if (!is_scalar($value)) { $value = VarDumper::export($value); } if ($this->partial) { return mb_stripos($value, $this->baseValue, 0, \Yii::$app->charset) !== false; } return strcmp(mb_strtoupper($this->baseValue, \Yii::...
php
public function match($value) { if (!is_scalar($value)) { $value = VarDumper::export($value); } if ($this->partial) { return mb_stripos($value, $this->baseValue, 0, \Yii::$app->charset) !== false; } return strcmp(mb_strtoupper($this->baseValue, \Yii::...
[ "public", "function", "match", "(", "$", "value", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "value", ")", ")", "{", "$", "value", "=", "VarDumper", "::", "export", "(", "$", "value", ")", ";", "}", "if", "(", "$", "this", "->", "partial", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/components/search/matchers/SameAs.php#L29-L40
yiisoft/yii2-debug
src/panels/RequestPanel.php
RequestPanel.save
public function save() { $headers = Yii::$app->getRequest()->getHeaders(); $requestHeaders = []; foreach ($headers as $name => $value) { if (is_array($value) && count($value) == 1) { $requestHeaders[$name] = current($value); } else { $r...
php
public function save() { $headers = Yii::$app->getRequest()->getHeaders(); $requestHeaders = []; foreach ($headers as $name => $value) { if (is_array($value) && count($value) == 1) { $requestHeaders[$name] = current($value); } else { $r...
[ "public", "function", "save", "(", ")", "{", "$", "headers", "=", "Yii", "::", "$", "app", "->", "getRequest", "(", ")", "->", "getHeaders", "(", ")", ";", "$", "requestHeaders", "=", "[", "]", ";", "foreach", "(", "$", "headers", "as", "$", "name"...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/RequestPanel.php#L57-L124
yiisoft/yii2-debug
src/panels/RequestPanel.php
RequestPanel.getFlashes
protected function getFlashes() { /* @var $session \yii\web\Session */ $session = Yii::$app->has('session', true) ? Yii::$app->get('session') : null; if ($session === null || !$session->getIsActive()) { return []; } $counters = $session->get($session->flashParam,...
php
protected function getFlashes() { /* @var $session \yii\web\Session */ $session = Yii::$app->has('session', true) ? Yii::$app->get('session') : null; if ($session === null || !$session->getIsActive()) { return []; } $counters = $session->get($session->flashParam,...
[ "protected", "function", "getFlashes", "(", ")", "{", "/* @var $session \\yii\\web\\Session */", "$", "session", "=", "Yii", "::", "$", "app", "->", "has", "(", "'session'", ",", "true", ")", "?", "Yii", "::", "$", "app", "->", "get", "(", "'session'", ")"...
Getting flash messages without deleting them or touching deletion counters @return array flash messages (key => message).
[ "Getting", "flash", "messages", "without", "deleting", "them", "or", "touching", "deletion", "counters" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/RequestPanel.php#L131-L147
yiisoft/yii2-debug
src/models/Router.php
Router.init
public function init() { parent::init(); $last = null; foreach ($this->messages as $message) { if ($message[1] === Logger::LEVEL_TRACE && is_string($message[0])) { $this->message = $message[0]; } elseif (isset($message[0]['rule'], $message[0]['match'])...
php
public function init() { parent::init(); $last = null; foreach ($this->messages as $message) { if ($message[1] === Logger::LEVEL_TRACE && is_string($message[0])) { $this->message = $message[0]; } elseif (isset($message[0]['rule'], $message[0]['match'])...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "$", "last", "=", "null", ";", "foreach", "(", "$", "this", "->", "messages", "as", "$", "message", ")", "{", "if", "(", "$", "message", "[", "1", "]", "===", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/Router.php#L63-L82
yiisoft/yii2-debug
src/Module.php
Module.init
public function init() { parent::init(); $this->dataPath = Yii::getAlias($this->dataPath); if (Yii::$app instanceof \yii\web\Application) { $this->initPanels(); } }
php
public function init() { parent::init(); $this->dataPath = Yii::getAlias($this->dataPath); if (Yii::$app instanceof \yii\web\Application) { $this->initPanels(); } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "$", "this", "->", "dataPath", "=", "Yii", "::", "getAlias", "(", "$", "this", "->", "dataPath", ")", ";", "if", "(", "Yii", "::", "$", "app", "instanceof", "\\", ...
{@inheritdoc} @throws \yii\base\InvalidConfigException
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/Module.php#L191-L199
yiisoft/yii2-debug
src/Module.php
Module.bootstrap
public function bootstrap($app) { /* @var $app \yii\base\Application */ $this->logTarget = $app->getLog()->targets['debug'] = new LogTarget($this); // delay attaching event handler to the view component after it is fully configured $app->on(Application::EVENT_BEFORE_REQUEST, functio...
php
public function bootstrap($app) { /* @var $app \yii\base\Application */ $this->logTarget = $app->getLog()->targets['debug'] = new LogTarget($this); // delay attaching event handler to the view component after it is fully configured $app->on(Application::EVENT_BEFORE_REQUEST, functio...
[ "public", "function", "bootstrap", "(", "$", "app", ")", "{", "/* @var $app \\yii\\base\\Application */", "$", "this", "->", "logTarget", "=", "$", "app", "->", "getLog", "(", ")", "->", "targets", "[", "'debug'", "]", "=", "new", "LogTarget", "(", "$", "t...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/Module.php#L236-L263
yiisoft/yii2-debug
src/Module.php
Module.beforeAction
public function beforeAction($action) { if (!$this->enableDebugLogs) { foreach ($this->get('log')->targets as $target) { $target->enabled = false; } } if (!parent::beforeAction($action)) { return false; } // do not display...
php
public function beforeAction($action) { if (!$this->enableDebugLogs) { foreach ($this->get('log')->targets as $target) { $target->enabled = false; } } if (!parent::beforeAction($action)) { return false; } // do not display...
[ "public", "function", "beforeAction", "(", "$", "action", ")", "{", "if", "(", "!", "$", "this", "->", "enableDebugLogs", ")", "{", "foreach", "(", "$", "this", "->", "get", "(", "'log'", ")", "->", "targets", "as", "$", "target", ")", "{", "$", "t...
{@inheritdoc} @throws \yii\base\InvalidConfigException @throws ForbiddenHttpException
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/Module.php#L270-L297
yiisoft/yii2-debug
src/Module.php
Module.setDebugHeaders
public function setDebugHeaders($event) { if (!$this->checkAccess()) { return; } $url = Url::toRoute([ '/' . $this->id . '/default/view', 'tag' => $this->logTarget->tag, ]); $event->sender->getHeaders() ->set('X-Debug-Tag', $thi...
php
public function setDebugHeaders($event) { if (!$this->checkAccess()) { return; } $url = Url::toRoute([ '/' . $this->id . '/default/view', 'tag' => $this->logTarget->tag, ]); $event->sender->getHeaders() ->set('X-Debug-Tag', $thi...
[ "public", "function", "setDebugHeaders", "(", "$", "event", ")", "{", "if", "(", "!", "$", "this", "->", "checkAccess", "(", ")", ")", "{", "return", ";", "}", "$", "url", "=", "Url", "::", "toRoute", "(", "[", "'/'", ".", "$", "this", "->", "id"...
Setting headers to transfer debug data in AJAX requests without interfering with the request itself. @param \yii\base\Event $event @since 2.0.7
[ "Setting", "headers", "to", "transfer", "debug", "data", "in", "AJAX", "requests", "without", "interfering", "with", "the", "request", "itself", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/Module.php#L306-L319
yiisoft/yii2-debug
src/Module.php
Module.getToolbarHtml
public function getToolbarHtml() { $url = Url::toRoute([ '/' . $this->id . '/default/toolbar', 'tag' => $this->logTarget->tag, ]); return '<div id="yii-debug-toolbar" data-url="' . Html::encode($url) . '" style="display:none" class="yii-debug-toolbar-bottom"></div>'; ...
php
public function getToolbarHtml() { $url = Url::toRoute([ '/' . $this->id . '/default/toolbar', 'tag' => $this->logTarget->tag, ]); return '<div id="yii-debug-toolbar" data-url="' . Html::encode($url) . '" style="display:none" class="yii-debug-toolbar-bottom"></div>'; ...
[ "public", "function", "getToolbarHtml", "(", ")", "{", "$", "url", "=", "Url", "::", "toRoute", "(", "[", "'/'", ".", "$", "this", "->", "id", ".", "'/default/toolbar'", ",", "'tag'", "=>", "$", "this", "->", "logTarget", "->", "tag", ",", "]", ")", ...
Gets toolbar HTML @since 2.0.7
[ "Gets", "toolbar", "HTML" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/Module.php#L333-L340
yiisoft/yii2-debug
src/Module.php
Module.renderToolbar
public function renderToolbar($event) { if (!$this->checkAccess() || Yii::$app->getRequest()->getIsAjax()) { return; } /* @var $view View */ $view = $event->sender; echo $view->renderDynamic('return Yii::$app->getModule("' . $this->id . '")->getToolbarHtml();'); ...
php
public function renderToolbar($event) { if (!$this->checkAccess() || Yii::$app->getRequest()->getIsAjax()) { return; } /* @var $view View */ $view = $event->sender; echo $view->renderDynamic('return Yii::$app->getModule("' . $this->id . '")->getToolbarHtml();'); ...
[ "public", "function", "renderToolbar", "(", "$", "event", ")", "{", "if", "(", "!", "$", "this", "->", "checkAccess", "(", ")", "||", "Yii", "::", "$", "app", "->", "getRequest", "(", ")", "->", "getIsAjax", "(", ")", ")", "{", "return", ";", "}", ...
Renders mini-toolbar at the end of page body. @param \yii\base\Event $event @throws \Throwable
[ "Renders", "mini", "-", "toolbar", "at", "the", "end", "of", "page", "body", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/Module.php#L348-L361
yiisoft/yii2-debug
src/Module.php
Module.checkAccess
protected function checkAccess($action = null) { $allowed = false; $ip = Yii::$app->getRequest()->getUserIP(); foreach ($this->allowedIPs as $filter) { if ($filter === '*' || $filter === $ip || (($pos = strpos($filter, '*')) !== false && !strncmp($ip, $filter, $pos))) { ...
php
protected function checkAccess($action = null) { $allowed = false; $ip = Yii::$app->getRequest()->getUserIP(); foreach ($this->allowedIPs as $filter) { if ($filter === '*' || $filter === $ip || (($pos = strpos($filter, '*')) !== false && !strncmp($ip, $filter, $pos))) { ...
[ "protected", "function", "checkAccess", "(", "$", "action", "=", "null", ")", "{", "$", "allowed", "=", "false", ";", "$", "ip", "=", "Yii", "::", "$", "app", "->", "getRequest", "(", ")", "->", "getUserIP", "(", ")", ";", "foreach", "(", "$", "thi...
Checks if current user is allowed to access the module @param \yii\base\Action|null $action the action to be executed. May be `null` when called from a non action context @return bool if access is granted
[ "Checks", "if", "current", "user", "is", "allowed", "to", "access", "the", "module" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/Module.php#L369-L406
yiisoft/yii2-debug
src/Module.php
Module.defaultVersion
protected function defaultVersion() { $packageInfo = Json::decode(file_get_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'composer.json')); $extensionName = $packageInfo['name']; if (isset(Yii::$app->extensions[$extensionName])) { return Yii::$app->extensions[$extensionName][...
php
protected function defaultVersion() { $packageInfo = Json::decode(file_get_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'composer.json')); $extensionName = $packageInfo['name']; if (isset(Yii::$app->extensions[$extensionName])) { return Yii::$app->extensions[$extensionName][...
[ "protected", "function", "defaultVersion", "(", ")", "{", "$", "packageInfo", "=", "Json", "::", "decode", "(", "file_get_contents", "(", "dirname", "(", "__DIR__", ")", ".", "DIRECTORY_SEPARATOR", ".", "'composer.json'", ")", ")", ";", "$", "extensionName", "...
{@inheritdoc} @since 2.0.7
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/Module.php#L433-L441
yiisoft/yii2-debug
src/models/timeline/DataProvider.php
DataProvider.prepareModels
protected function prepareModels() { if (($models = $this->allModels) === null) { return []; } $child = []; foreach ($models as $key => &$model) { $model['timestamp'] *= 1000; $model['duration'] *= 1000; $model['child'] = 0; ...
php
protected function prepareModels() { if (($models = $this->allModels) === null) { return []; } $child = []; foreach ($models as $key => &$model) { $model['timestamp'] *= 1000; $model['duration'] *= 1000; $model['child'] = 0; ...
[ "protected", "function", "prepareModels", "(", ")", "{", "if", "(", "(", "$", "models", "=", "$", "this", "->", "allModels", ")", "===", "null", ")", "{", "return", "[", "]", ";", "}", "$", "child", "=", "[", "]", ";", "foreach", "(", "$", "model...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/timeline/DataProvider.php#L43-L66
yiisoft/yii2-debug
src/models/timeline/DataProvider.php
DataProvider.getColor
public function getColor($model) { $width = isset($model['css']['width']) ? $model['css']['width'] : $this->getWidth($model); foreach ($this->panel->colors as $percent => $color) { if ($width >= $percent) { return $color; } } return '#d6e685'; ...
php
public function getColor($model) { $width = isset($model['css']['width']) ? $model['css']['width'] : $this->getWidth($model); foreach ($this->panel->colors as $percent => $color) { if ($width >= $percent) { return $color; } } return '#d6e685'; ...
[ "public", "function", "getColor", "(", "$", "model", ")", "{", "$", "width", "=", "isset", "(", "$", "model", "[", "'css'", "]", "[", "'width'", "]", ")", "?", "$", "model", "[", "'css'", "]", "[", "'width'", "]", ":", "$", "this", "->", "getWidt...
Getting HEX color based on model duration @param array $model @return string
[ "Getting", "HEX", "color", "based", "on", "model", "duration" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/timeline/DataProvider.php#L73-L82
yiisoft/yii2-debug
src/models/timeline/DataProvider.php
DataProvider.getRulers
public function getRulers($line = 10) { if ($line == 0) { return []; } $data = [0]; $percent = ($this->panel->duration / 100); $row = $this->panel->duration / $line; $precision = $row > 100 ? -2 : -1; for ($i = 1; $i < $line; $i++) { $m...
php
public function getRulers($line = 10) { if ($line == 0) { return []; } $data = [0]; $percent = ($this->panel->duration / 100); $row = $this->panel->duration / $line; $precision = $row > 100 ? -2 : -1; for ($i = 1; $i < $line; $i++) { $m...
[ "public", "function", "getRulers", "(", "$", "line", "=", "10", ")", "{", "if", "(", "$", "line", "==", "0", ")", "{", "return", "[", "]", ";", "}", "$", "data", "=", "[", "0", "]", ";", "$", "percent", "=", "(", "$", "this", "->", "panel", ...
ruler items, key milliseconds, value offset left @param int $line number of columns @return array
[ "ruler", "items", "key", "milliseconds", "value", "offset", "left" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/timeline/DataProvider.php#L131-L145
yiisoft/yii2-debug
src/models/timeline/DataProvider.php
DataProvider.getMemory
public function getMemory($model) { if (empty($model['memory'])) { return null; } return [ sprintf('%.2f MB', $model['memory'] / 1048576), $model['memory'] / ($this->panel->memory / 100) ]; }
php
public function getMemory($model) { if (empty($model['memory'])) { return null; } return [ sprintf('%.2f MB', $model['memory'] / 1048576), $model['memory'] / ($this->panel->memory / 100) ]; }
[ "public", "function", "getMemory", "(", "$", "model", ")", "{", "if", "(", "empty", "(", "$", "model", "[", "'memory'", "]", ")", ")", "{", "return", "null", ";", "}", "return", "[", "sprintf", "(", "'%.2f MB'", ",", "$", "model", "[", "'memory'", ...
```php [ 0 => string, memory usage (MB) 1 => float, Y position (percent) ] @param array $model @return array|null
[ "php", "[", "0", "=", ">", "string", "memory", "usage", "(", "MB", ")", "1", "=", ">", "float", "Y", "position", "(", "percent", ")", "]" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/timeline/DataProvider.php#L156-L166
yiisoft/yii2-debug
src/LogTarget.php
LogTarget.export
public function export() { $path = $this->module->dataPath; FileHelper::createDirectory($path, $this->module->dirMode); $summary = $this->collectSummary(); $dataFile = "$path/{$this->tag}.data"; $data = []; $exceptions = []; foreach ($this->module->panels as ...
php
public function export() { $path = $this->module->dataPath; FileHelper::createDirectory($path, $this->module->dirMode); $summary = $this->collectSummary(); $dataFile = "$path/{$this->tag}.data"; $data = []; $exceptions = []; foreach ($this->module->panels as ...
[ "public", "function", "export", "(", ")", "{", "$", "path", "=", "$", "this", "->", "module", "->", "dataPath", ";", "FileHelper", "::", "createDirectory", "(", "$", "path", ",", "$", "this", "->", "module", "->", "dirMode", ")", ";", "$", "summary", ...
Exports log messages to a specific destination. Child classes must implement this method. @throws \yii\base\Exception
[ "Exports", "log", "messages", "to", "a", "specific", "destination", ".", "Child", "classes", "must", "implement", "this", "method", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/LogTarget.php#L49-L75
yiisoft/yii2-debug
src/LogTarget.php
LogTarget.collect
public function collect($messages, $final) { $this->messages = array_merge($this->messages, $messages); if ($final) { $this->export(); } }
php
public function collect($messages, $final) { $this->messages = array_merge($this->messages, $messages); if ($final) { $this->export(); } }
[ "public", "function", "collect", "(", "$", "messages", ",", "$", "final", ")", "{", "$", "this", "->", "messages", "=", "array_merge", "(", "$", "this", "->", "messages", ",", "$", "messages", ")", ";", "if", "(", "$", "final", ")", "{", "$", "this...
Processes the given log messages. This method will filter the given messages with [[levels]] and [[categories]]. And if requested, it will also export the filtering result to specific medium (e.g. email). @param array $messages log messages to be processed. See [[\yii\log\Logger::messages]] for the structure of each me...
[ "Processes", "the", "given", "log", "messages", ".", "This", "method", "will", "filter", "the", "given", "messages", "with", "[[", "levels", "]]", "and", "[[", "categories", "]]", ".", "And", "if", "requested", "it", "will", "also", "export", "the", "filte...
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/LogTarget.php#L126-L132
yiisoft/yii2-debug
src/LogTarget.php
LogTarget.gc
protected function gc(&$manifest) { if (count($manifest) > $this->module->historySize + 10) { $n = count($manifest) - $this->module->historySize; foreach (array_keys($manifest) as $tag) { $file = $this->module->dataPath . "/$tag.data"; @unlink($file); ...
php
protected function gc(&$manifest) { if (count($manifest) > $this->module->historySize + 10) { $n = count($manifest) - $this->module->historySize; foreach (array_keys($manifest) as $tag) { $file = $this->module->dataPath . "/$tag.data"; @unlink($file); ...
[ "protected", "function", "gc", "(", "&", "$", "manifest", ")", "{", "if", "(", "count", "(", "$", "manifest", ")", ">", "$", "this", "->", "module", "->", "historySize", "+", "10", ")", "{", "$", "n", "=", "count", "(", "$", "manifest", ")", "-",...
Removes obsolete data files @param array $manifest
[ "Removes", "obsolete", "data", "files" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/LogTarget.php#L138-L156
yiisoft/yii2-debug
src/LogTarget.php
LogTarget.collectSummary
protected function collectSummary() { if (Yii::$app === null) { return []; } $request = Yii::$app->getRequest(); $response = Yii::$app->getResponse(); $summary = [ 'tag' => $this->tag, 'url' => $request->getAbsoluteUrl(), 'ajax...
php
protected function collectSummary() { if (Yii::$app === null) { return []; } $request = Yii::$app->getRequest(); $response = Yii::$app->getResponse(); $summary = [ 'tag' => $this->tag, 'url' => $request->getAbsoluteUrl(), 'ajax...
[ "protected", "function", "collectSummary", "(", ")", "{", "if", "(", "Yii", "::", "$", "app", "===", "null", ")", "{", "return", "[", "]", ";", "}", "$", "request", "=", "Yii", "::", "$", "app", "->", "getRequest", "(", ")", ";", "$", "response", ...
Collects summary data of current request. @return array
[ "Collects", "summary", "data", "of", "current", "request", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/LogTarget.php#L162-L188
yiisoft/yii2-debug
src/LogTarget.php
LogTarget.getSqlTotalCount
protected function getSqlTotalCount() { if (!isset($this->module->panels['db'])) { return 0; } $profileLogs = $this->module->panels['db']->getProfileLogs(); # / 2 because messages are in couple (begin/end) return count($profileLogs) / 2; }
php
protected function getSqlTotalCount() { if (!isset($this->module->panels['db'])) { return 0; } $profileLogs = $this->module->panels['db']->getProfileLogs(); # / 2 because messages are in couple (begin/end) return count($profileLogs) / 2; }
[ "protected", "function", "getSqlTotalCount", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "module", "->", "panels", "[", "'db'", "]", ")", ")", "{", "return", "0", ";", "}", "$", "profileLogs", "=", "$", "this", "->", "module", "...
Returns total sql count executed in current request. If database panel is not configured returns 0. @return int
[ "Returns", "total", "sql", "count", "executed", "in", "current", "request", ".", "If", "database", "panel", "is", "not", "configured", "returns", "0", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/LogTarget.php#L195-L205
yiisoft/yii2-debug
src/models/UserSwitch.php
UserSwitch.getUser
public function getUser() { if ($this->_user === null) { /* @var $user User */ $this->_user = is_string($this->userComponent) ? Yii::$app->get($this->userComponent, false) : $this->userComponent; } return $this->_user; }
php
public function getUser() { if ($this->_user === null) { /* @var $user User */ $this->_user = is_string($this->userComponent) ? Yii::$app->get($this->userComponent, false) : $this->userComponent; } return $this->_user; }
[ "public", "function", "getUser", "(", ")", "{", "if", "(", "$", "this", "->", "_user", "===", "null", ")", "{", "/* @var $user User */", "$", "this", "->", "_user", "=", "is_string", "(", "$", "this", "->", "userComponent", ")", "?", "Yii", "::", "$", ...
Get current user @return null|User @throws \yii\base\InvalidConfigException
[ "Get", "current", "user" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/UserSwitch.php#L68-L76
yiisoft/yii2-debug
src/models/UserSwitch.php
UserSwitch.getMainUser
public function getMainUser() { $currentUser = $this->getUser(); if ($this->_mainUser === null && $currentUser->getIsGuest() === false) { $session = Yii::$app->getSession(); if ($session->has('main_user')) { $mainUserId = $session->get('main_user'); ...
php
public function getMainUser() { $currentUser = $this->getUser(); if ($this->_mainUser === null && $currentUser->getIsGuest() === false) { $session = Yii::$app->getSession(); if ($session->has('main_user')) { $mainUserId = $session->get('main_user'); ...
[ "public", "function", "getMainUser", "(", ")", "{", "$", "currentUser", "=", "$", "this", "->", "getUser", "(", ")", ";", "if", "(", "$", "this", "->", "_mainUser", "===", "null", "&&", "$", "currentUser", "->", "getIsGuest", "(", ")", "===", "false", ...
Get main user @return User @throws \yii\base\InvalidConfigException
[ "Get", "main", "user" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/UserSwitch.php#L83-L102
yiisoft/yii2-debug
src/models/UserSwitch.php
UserSwitch.setUser
public function setUser(User $user) { // Check if user is currently active one $isCurrent = ($user->getId() === $this->getMainUser()->getId()); // Switch identity $this->getUser()->switchIdentity($user->identity); if (!$isCurrent) { Yii::$app->getSession()->set('m...
php
public function setUser(User $user) { // Check if user is currently active one $isCurrent = ($user->getId() === $this->getMainUser()->getId()); // Switch identity $this->getUser()->switchIdentity($user->identity); if (!$isCurrent) { Yii::$app->getSession()->set('m...
[ "public", "function", "setUser", "(", "User", "$", "user", ")", "{", "// Check if user is currently active one", "$", "isCurrent", "=", "(", "$", "user", "->", "getId", "(", ")", "===", "$", "this", "->", "getMainUser", "(", ")", "->", "getId", "(", ")", ...
Switch user @param User $user @throws \yii\base\InvalidConfigException
[ "Switch", "user" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/UserSwitch.php#L109-L120
yiisoft/yii2-debug
src/models/UserSwitch.php
UserSwitch.setUserByIdentity
public function setUserByIdentity(IdentityInterface $identity) { $user = clone $this->getUser(); $user->setIdentity($identity); $this->setUser($user); }
php
public function setUserByIdentity(IdentityInterface $identity) { $user = clone $this->getUser(); $user->setIdentity($identity); $this->setUser($user); }
[ "public", "function", "setUserByIdentity", "(", "IdentityInterface", "$", "identity", ")", "{", "$", "user", "=", "clone", "$", "this", "->", "getUser", "(", ")", ";", "$", "user", "->", "setIdentity", "(", "$", "identity", ")", ";", "$", "this", "->", ...
Switch to user by identity @param IdentityInterface $identity @throws \yii\base\InvalidConfigException
[ "Switch", "to", "user", "by", "identity" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/UserSwitch.php#L127-L132
yiisoft/yii2-debug
src/models/UserSwitch.php
UserSwitch.isMainUser
public function isMainUser() { $user = $this->getUser(); if ($user->getIsGuest()) { return true; } return ($user->getId() === $this->getMainUser()->getId()); }
php
public function isMainUser() { $user = $this->getUser(); if ($user->getIsGuest()) { return true; } return ($user->getId() === $this->getMainUser()->getId()); }
[ "public", "function", "isMainUser", "(", ")", "{", "$", "user", "=", "$", "this", "->", "getUser", "(", ")", ";", "if", "(", "$", "user", "->", "getIsGuest", "(", ")", ")", "{", "return", "true", ";", "}", "return", "(", "$", "user", "->", "getId...
Checks if current user is main or not. @return bool @throws \yii\base\InvalidConfigException
[ "Checks", "if", "current", "user", "is", "main", "or", "not", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/UserSwitch.php#L147-L154
yiisoft/yii2-debug
src/actions/db/ExplainAction.php
ExplainAction.run
public function run($seq, $tag) { $this->controller->loadData($tag); $timings = $this->panel->calculateTimings(); if (!isset($timings[$seq])) { throw new HttpException(404, 'Log message not found.'); } $query = $timings[$seq]['info']; $results = $this-...
php
public function run($seq, $tag) { $this->controller->loadData($tag); $timings = $this->panel->calculateTimings(); if (!isset($timings[$seq])) { throw new HttpException(404, 'Log message not found.'); } $query = $timings[$seq]['info']; $results = $this-...
[ "public", "function", "run", "(", "$", "seq", ",", "$", "tag", ")", "{", "$", "this", "->", "controller", "->", "loadData", "(", "$", "tag", ")", ";", "$", "timings", "=", "$", "this", "->", "panel", "->", "calculateTimings", "(", ")", ";", "if", ...
Runs the action. @param string $seq @param string $tag @return string @throws HttpException @throws \yii\db\Exception @throws \yii\web\NotFoundHttpException if the view file cannot be found @throws \yii\base\InvalidConfigException
[ "Runs", "the", "action", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/actions/db/ExplainAction.php#L41-L66
yiisoft/yii2-debug
src/controllers/DefaultController.php
DefaultController.actions
public function actions() { $actions = []; foreach ($this->module->panels as $panel) { $actions = array_merge($actions, $panel->actions); } return $actions; }
php
public function actions() { $actions = []; foreach ($this->module->panels as $panel) { $actions = array_merge($actions, $panel->actions); } return $actions; }
[ "public", "function", "actions", "(", ")", "{", "$", "actions", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "module", "->", "panels", "as", "$", "panel", ")", "{", "$", "actions", "=", "array_merge", "(", "$", "actions", ",", "$", "panel...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/controllers/DefaultController.php#L48-L56
yiisoft/yii2-debug
src/controllers/DefaultController.php
DefaultController.beforeAction
public function beforeAction($action) { Yii::$app->response->format = Response::FORMAT_HTML; return parent::beforeAction($action); }
php
public function beforeAction($action) { Yii::$app->response->format = Response::FORMAT_HTML; return parent::beforeAction($action); }
[ "public", "function", "beforeAction", "(", "$", "action", ")", "{", "Yii", "::", "$", "app", "->", "response", "->", "format", "=", "Response", "::", "FORMAT_HTML", ";", "return", "parent", "::", "beforeAction", "(", "$", "action", ")", ";", "}" ]
{@inheritdoc} @throws \yii\web\BadRequestHttpException
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/controllers/DefaultController.php#L62-L66
yiisoft/yii2-debug
src/controllers/DefaultController.php
DefaultController.actionIndex
public function actionIndex() { $searchModel = new Debug(); $dataProvider = $searchModel->search($_GET, $this->getManifest()); // load latest request $tags = array_keys($this->getManifest()); $tag = reset($tags); $this->loadData($tag); return $this->render('...
php
public function actionIndex() { $searchModel = new Debug(); $dataProvider = $searchModel->search($_GET, $this->getManifest()); // load latest request $tags = array_keys($this->getManifest()); $tag = reset($tags); $this->loadData($tag); return $this->render('...
[ "public", "function", "actionIndex", "(", ")", "{", "$", "searchModel", "=", "new", "Debug", "(", ")", ";", "$", "dataProvider", "=", "$", "searchModel", "->", "search", "(", "$", "_GET", ",", "$", "this", "->", "getManifest", "(", ")", ")", ";", "//...
Index action @return string @throws NotFoundHttpException
[ "Index", "action" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/controllers/DefaultController.php#L74-L90
yiisoft/yii2-debug
src/controllers/DefaultController.php
DefaultController.actionToolbar
public function actionToolbar($tag) { $this->loadData($tag, 5); return $this->renderPartial('toolbar', [ 'tag' => $tag, 'panels' => $this->module->panels, 'position' => 'bottom', 'defaultHeight' => $this->module->defaultHeight, ]); }
php
public function actionToolbar($tag) { $this->loadData($tag, 5); return $this->renderPartial('toolbar', [ 'tag' => $tag, 'panels' => $this->module->panels, 'position' => 'bottom', 'defaultHeight' => $this->module->defaultHeight, ]); }
[ "public", "function", "actionToolbar", "(", "$", "tag", ")", "{", "$", "this", "->", "loadData", "(", "$", "tag", ",", "5", ")", ";", "return", "$", "this", "->", "renderPartial", "(", "'toolbar'", ",", "[", "'tag'", "=>", "$", "tag", ",", "'panels'"...
Toolbar action @param string $tag @return string @throws NotFoundHttpException
[ "Toolbar", "action" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/controllers/DefaultController.php#L132-L142
yiisoft/yii2-debug
src/controllers/DefaultController.php
DefaultController.actionDownloadMail
public function actionDownloadMail($file) { $filePath = Yii::getAlias($this->module->panels['mail']->mailPath) . '/' . basename($file); if ((mb_strpos($file, '\\') !== false || mb_strpos($file, '/') !== false) || !is_file($filePath)) { throw new NotFoundHttpException('Mail file not foun...
php
public function actionDownloadMail($file) { $filePath = Yii::getAlias($this->module->panels['mail']->mailPath) . '/' . basename($file); if ((mb_strpos($file, '\\') !== false || mb_strpos($file, '/') !== false) || !is_file($filePath)) { throw new NotFoundHttpException('Mail file not foun...
[ "public", "function", "actionDownloadMail", "(", "$", "file", ")", "{", "$", "filePath", "=", "Yii", "::", "getAlias", "(", "$", "this", "->", "module", "->", "panels", "[", "'mail'", "]", "->", "mailPath", ")", ".", "'/'", ".", "basename", "(", "$", ...
Download mail action @param string $file @return \yii\console\Response|Response @throws NotFoundHttpException
[ "Download", "mail", "action" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/controllers/DefaultController.php#L151-L160
yiisoft/yii2-debug
src/panels/RouterPanel.php
RouterPanel.save
public function save() { $target = $this->module->logTarget; if (Yii::$app->requestedAction) { if (Yii::$app->requestedAction instanceof InlineAction) { $action = get_class(Yii::$app->requestedAction->controller) . '::' . Yii::$app->requestedAction->actionMethod . '()'; ...
php
public function save() { $target = $this->module->logTarget; if (Yii::$app->requestedAction) { if (Yii::$app->requestedAction instanceof InlineAction) { $action = get_class(Yii::$app->requestedAction->controller) . '::' . Yii::$app->requestedAction->actionMethod . '()'; ...
[ "public", "function", "save", "(", ")", "{", "$", "target", "=", "$", "this", "->", "module", "->", "logTarget", ";", "if", "(", "Yii", "::", "$", "app", "->", "requestedAction", ")", "{", "if", "(", "Yii", "::", "$", "app", "->", "requestedAction", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/RouterPanel.php#L85-L102
yiisoft/yii2-debug
src/panels/MailPanel.php
MailPanel.init
public function init() { parent::init(); Event::on('yii\mail\BaseMailer', BaseMailer::EVENT_AFTER_SEND, function ($event) { /* @var $event \yii\mail\MailEvent */ $message = $event->message; /* @var $message \yii\mail\MessageInterface */ $messageData =...
php
public function init() { parent::init(); Event::on('yii\mail\BaseMailer', BaseMailer::EVENT_AFTER_SEND, function ($event) { /* @var $event \yii\mail\MailEvent */ $message = $event->message; /* @var $message \yii\mail\MessageInterface */ $messageData =...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "Event", "::", "on", "(", "'yii\\mail\\BaseMailer'", ",", "BaseMailer", "::", "EVENT_AFTER_SEND", ",", "function", "(", "$", "event", ")", "{", "/* @var $event \\yii\\mail\\Mai...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/MailPanel.php#L41-L94
yiisoft/yii2-debug
src/panels/MailPanel.php
MailPanel.getSummary
public function getSummary() { return Yii::$app->view->render('panels/mail/summary', [ 'panel' => $this, 'mailCount' => is_array($this->data) ? count($this->data) : '⚠' ]); }
php
public function getSummary() { return Yii::$app->view->render('panels/mail/summary', [ 'panel' => $this, 'mailCount' => is_array($this->data) ? count($this->data) : '⚠' ]); }
[ "public", "function", "getSummary", "(", ")", "{", "return", "Yii", "::", "$", "app", "->", "view", "->", "render", "(", "'panels/mail/summary'", ",", "[", "'panel'", "=>", "$", "this", ",", "'mailCount'", "=>", "is_array", "(", "$", "this", "->", "data"...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/MailPanel.php#L107-L113
yiisoft/yii2-debug
src/panels/MailPanel.php
MailPanel.getDetail
public function getDetail() { $searchModel = new Mail(); $dataProvider = $searchModel->search(Yii::$app->request->get(), $this->data); return Yii::$app->view->render('panels/mail/detail', [ 'panel' => $this, 'dataProvider' => $dataProvider, 'searchModel' ...
php
public function getDetail() { $searchModel = new Mail(); $dataProvider = $searchModel->search(Yii::$app->request->get(), $this->data); return Yii::$app->view->render('panels/mail/detail', [ 'panel' => $this, 'dataProvider' => $dataProvider, 'searchModel' ...
[ "public", "function", "getDetail", "(", ")", "{", "$", "searchModel", "=", "new", "Mail", "(", ")", ";", "$", "dataProvider", "=", "$", "searchModel", "->", "search", "(", "Yii", "::", "$", "app", "->", "request", "->", "get", "(", ")", ",", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/panels/MailPanel.php#L118-L128
yiisoft/yii2-debug
src/models/search/User.php
User.init
public function init() { if (\Yii::$app->user && \Yii::$app->user->identityClass) { $identityImplementation = new \Yii::$app->user->identityClass(); if ($identityImplementation instanceof Model) { $this->identityImplement = $identityImplementation; } ...
php
public function init() { if (\Yii::$app->user && \Yii::$app->user->identityClass) { $identityImplementation = new \Yii::$app->user->identityClass(); if ($identityImplementation instanceof Model) { $this->identityImplement = $identityImplementation; } ...
[ "public", "function", "init", "(", ")", "{", "if", "(", "\\", "Yii", "::", "$", "app", "->", "user", "&&", "\\", "Yii", "::", "$", "app", "->", "user", "->", "identityClass", ")", "{", "$", "identityImplementation", "=", "new", "\\", "Yii", "::", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/search/User.php#L31-L40
yiisoft/yii2-debug
src/models/search/User.php
User.searchActiveDataProvider
private function searchActiveDataProvider($params) { /** @var ActiveRecord $model */ $model = $this->identityImplement; $query = $model::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); if (!($this->load($params) && $this->validate...
php
private function searchActiveDataProvider($params) { /** @var ActiveRecord $model */ $model = $this->identityImplement; $query = $model::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); if (!($this->load($params) && $this->validate...
[ "private", "function", "searchActiveDataProvider", "(", "$", "params", ")", "{", "/** @var ActiveRecord $model */", "$", "model", "=", "$", "this", "->", "identityImplement", ";", "$", "query", "=", "$", "model", "::", "find", "(", ")", ";", "$", "dataProvider...
Search method for ActiveRecord @param array $params the data array to load model. @return ActiveDataProvider @throws \yii\base\InvalidConfigException
[ "Search", "method", "for", "ActiveRecord" ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/search/User.php#L93-L116
yiisoft/yii2-debug
src/models/timeline/Search.php
Search.search
public function search($params, $panel) { $models = $panel->models; $dataProvider = new DataProvider($panel, [ 'allModels' => $models, 'sort' => [ 'attributes' => ['category', 'timestamp'] ], ]); if (!($this->load($params) && $this...
php
public function search($params, $panel) { $models = $panel->models; $dataProvider = new DataProvider($panel, [ 'allModels' => $models, 'sort' => [ 'attributes' => ['category', 'timestamp'] ], ]); if (!($this->load($params) && $this...
[ "public", "function", "search", "(", "$", "params", ",", "$", "panel", ")", "{", "$", "models", "=", "$", "panel", "->", "models", ";", "$", "dataProvider", "=", "new", "DataProvider", "(", "$", "panel", ",", "[", "'allModels'", "=>", "$", "models", ...
Returns data provider with filled models. Filter applied if needed. @param array $params $params an array of parameter values indexed by parameter names @param TimeLinePanel $panel @return DataProvider
[ "Returns", "data", "provider", "with", "filled", "models", ".", "Filter", "applied", "if", "needed", "." ]
train
https://github.com/yiisoft/yii2-debug/blob/5d4020c5734cbfaa686afe4ddf438bd5ee51ee53/src/models/timeline/Search.php#L60-L82