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
rokde/laravel-bootstrap-formbuilder
src/BootstrapFormBuilder.php
BootstrapFormBuilder.closeGroup
public function closeGroup() { // Get the last added name from the groupStack and // remove it from the array. $name = array_pop($this->groupStack); // Get the formatted errors for this form group. $errors = $this->getFormattedErrors($name); // Append the errors to t...
php
public function closeGroup() { // Get the last added name from the groupStack and // remove it from the array. $name = array_pop($this->groupStack); // Get the formatted errors for this form group. $errors = $this->getFormattedErrors($name); // Append the errors to t...
[ "public", "function", "closeGroup", "(", ")", "{", "// Get the last added name from the groupStack and", "// remove it from the array.", "$", "name", "=", "array_pop", "(", "$", "this", "->", "groupStack", ")", ";", "// Get the formatted errors for this form group.", "$", "...
Close out the last opened form group. @return string
[ "Close", "out", "the", "last", "opened", "form", "group", "." ]
train
https://github.com/rokde/laravel-bootstrap-formbuilder/blob/f3ce43ad3d74b045176e24a03e9deffb71c17cd6/src/BootstrapFormBuilder.php#L52-L62
rokde/laravel-bootstrap-formbuilder
src/BootstrapFormBuilder.php
BootstrapFormBuilder.datetime
public function datetime($name, $value = null, $options = []) { $value = $this->getValueAttribute($name, $value); $timeValue = $dateValue = null; if($value instanceof \DateTime) { $dateValue= $value->format('Y-m-d'); $timeValue = $value->format('H:i'); ...
php
public function datetime($name, $value = null, $options = []) { $value = $this->getValueAttribute($name, $value); $timeValue = $dateValue = null; if($value instanceof \DateTime) { $dateValue= $value->format('Y-m-d'); $timeValue = $value->format('H:i'); ...
[ "public", "function", "datetime", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "options", "=", "[", "]", ")", "{", "$", "value", "=", "$", "this", "->", "getValueAttribute", "(", "$", "name", ",", "$", "value", ")", ";", "$", "time...
Create a date and a time input field. @param string $name @param string $value @param array $options @return string
[ "Create", "a", "date", "and", "a", "time", "input", "field", "." ]
train
https://github.com/rokde/laravel-bootstrap-formbuilder/blob/f3ce43ad3d74b045176e24a03e9deffb71c17cd6/src/BootstrapFormBuilder.php#L309-L321
rokde/laravel-bootstrap-formbuilder
src/BootstrapFormBuilder.php
BootstrapFormBuilder.submit
public function submit($value = null, $options = []) { $classes = explode(' ', isset($options['class']) ? $options['class'] : ''); if ( ! in_array('btn', $classes)) { $classes[] = 'btn'; } if ( ! in_array('btn-default', $classes) && ! in_array('btn-primary', ...
php
public function submit($value = null, $options = []) { $classes = explode(' ', isset($options['class']) ? $options['class'] : ''); if ( ! in_array('btn', $classes)) { $classes[] = 'btn'; } if ( ! in_array('btn-default', $classes) && ! in_array('btn-primary', ...
[ "public", "function", "submit", "(", "$", "value", "=", "null", ",", "$", "options", "=", "[", "]", ")", "{", "$", "classes", "=", "explode", "(", "' '", ",", "isset", "(", "$", "options", "[", "'class'", "]", ")", "?", "$", "options", "[", "'cla...
Create a submit button element. @param string $value @param array $options @return string
[ "Create", "a", "submit", "button", "element", "." ]
train
https://github.com/rokde/laravel-bootstrap-formbuilder/blob/f3ce43ad3d74b045176e24a03e9deffb71c17cd6/src/BootstrapFormBuilder.php#L331-L352
mimmi20/Wurfl
src/Handlers/HTCMacHandler.php
HTCMacHandler.getHTCMacModel
public static function getHTCMacModel($userAgent) { if (preg_match('/(HTC[^;\)]+)/', $userAgent, $matches)) { $model = preg_replace('#[ _\-/]#', '~', $matches[1]); return $model; } return null; }
php
public static function getHTCMacModel($userAgent) { if (preg_match('/(HTC[^;\)]+)/', $userAgent, $matches)) { $model = preg_replace('#[ _\-/]#', '~', $matches[1]); return $model; } return null; }
[ "public", "static", "function", "getHTCMacModel", "(", "$", "userAgent", ")", "{", "if", "(", "preg_match", "(", "'/(HTC[^;\\)]+)/'", ",", "$", "userAgent", ",", "$", "matches", ")", ")", "{", "$", "model", "=", "preg_replace", "(", "'#[ _\\-/]#'", ",", "'...
@param string $userAgent @return string|null
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/HTCMacHandler.php#L84-L93
boxberry-delivery/php-api-common
src/Http/Client.php
Client.send
public function send($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1') { if (is_array($body)) { $body = http_build_query($body, '', '&'); } $request = $this->createRequest($method, $uri, $headers, $body, $protocolVersion); return $this->sendRequ...
php
public function send($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1') { if (is_array($body)) { $body = http_build_query($body, '', '&'); } $request = $this->createRequest($method, $uri, $headers, $body, $protocolVersion); return $this->sendRequ...
[ "public", "function", "send", "(", "$", "method", ",", "$", "uri", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "body", "=", "null", ",", "$", "protocolVersion", "=", "'1.1'", ")", "{", "if", "(", "is_array", "(", "$", "body", ")", ")",...
Отправка запроса @param $method @param $uri @param array $headers @param string|array|resource|StreamInterface|null $body @param string $protocolVersion @return ResponseInterface
[ "Отправка", "запроса" ]
train
https://github.com/boxberry-delivery/php-api-common/blob/4fab9ad184968ead3bfcb98b491e289bfb589098/src/Http/Client.php#L70-L78
boxberry-delivery/php-api-common
src/Http/Client.php
Client.post
public function post($uri, array $headers = [], $body = null) { return $this->send('POST', $uri, $headers, $body); }
php
public function post($uri, array $headers = [], $body = null) { return $this->send('POST', $uri, $headers, $body); }
[ "public", "function", "post", "(", "$", "uri", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "body", "=", "null", ")", "{", "return", "$", "this", "->", "send", "(", "'POST'", ",", "$", "uri", ",", "$", "headers", ",", "$", "body", ")"...
Отправка POST-запроса @param UriInterface|string $uri @param array $headers @param string|array|null|resource|StreamInterface $body @return ResponseInterface
[ "Отправка", "POST", "-", "запроса" ]
train
https://github.com/boxberry-delivery/php-api-common/blob/4fab9ad184968ead3bfcb98b491e289bfb589098/src/Http/Client.php#L114-L117
jordij/sweet-captcha
src/Jordij/SweetCaptcha/SweetCaptchaValidator.php
SweetCaptchaValidator.validateSweetcaptcha
public function validateSweetcaptcha($attribute, $value, $parameters) { if (Input::has('scvalue')) { $sweetcaptcha = app()->make('SweetCaptcha'); return $sweetcaptcha->check(array('sckey' => $value, 'scvalue' => Input::get('scvalue'))) == "true"; } else r...
php
public function validateSweetcaptcha($attribute, $value, $parameters) { if (Input::has('scvalue')) { $sweetcaptcha = app()->make('SweetCaptcha'); return $sweetcaptcha->check(array('sckey' => $value, 'scvalue' => Input::get('scvalue'))) == "true"; } else r...
[ "public", "function", "validateSweetcaptcha", "(", "$", "attribute", ",", "$", "value", ",", "$", "parameters", ")", "{", "if", "(", "Input", "::", "has", "(", "'scvalue'", ")", ")", "{", "$", "sweetcaptcha", "=", "app", "(", ")", "->", "make", "(", ...
Validation method for the Sweet Captcha input values. @param [type] $attribute [description] @param [type] $value [description] @param [type] $parameters [description] @return boolean
[ "Validation", "method", "for", "the", "Sweet", "Captcha", "input", "values", "." ]
train
https://github.com/jordij/sweet-captcha/blob/7c98724bcf84a8727c99dc577e893225ee8c0eed/src/Jordij/SweetCaptcha/SweetCaptchaValidator.php#L25-L35
yidas/php-google-api-client-helper
src/Client.php
Client.setClient
public static function setClient($input=null) { // New or encapsulate self::$client = ($input instanceof Google_client) ? $input : new Google_Client(); // While new and there has the config if (is_array($input)) { foreach ($input as $key => $value) {...
php
public static function setClient($input=null) { // New or encapsulate self::$client = ($input instanceof Google_client) ? $input : new Google_Client(); // While new and there has the config if (is_array($input)) { foreach ($input as $key => $value) {...
[ "public", "static", "function", "setClient", "(", "$", "input", "=", "null", ")", "{", "// New or encapsulate\r", "self", "::", "$", "client", "=", "(", "$", "input", "instanceof", "Google_client", ")", "?", "$", "input", ":", "new", "Google_Client", "(", ...
New a Google_Client with config or set Google_Client by giving @param array|Google_Client Config array or Google_Client @return self
[ "New", "a", "Google_Client", "with", "config", "or", "set", "Google_Client", "by", "giving" ]
train
https://github.com/yidas/php-google-api-client-helper/blob/e0edfebc41fb4e55bcf4125af58304894a2863fe/src/Client.php#L31-L52
yidas/php-google-api-client-helper
src/Client.php
Client.refreshAccessToken
public static function refreshAccessToken() { // Refresh token setting trick // @see https://github.com/google/google-api-php-client/issues/263 self::getClient()->setAccessType('offline'); self::getClient()->setApprovalPrompt('force'); if (self::getClient()->i...
php
public static function refreshAccessToken() { // Refresh token setting trick // @see https://github.com/google/google-api-php-client/issues/263 self::getClient()->setAccessType('offline'); self::getClient()->setApprovalPrompt('force'); if (self::getClient()->i...
[ "public", "static", "function", "refreshAccessToken", "(", ")", "{", "// Refresh token setting trick\r", "// @see https://github.com/google/google-api-php-client/issues/263\r", "self", "::", "getClient", "(", ")", "->", "setAccessType", "(", "'offline'", ")", ";", "self", "...
Refresh AccessToken Simple way to get refreshed access token or false expired to skip @return array|false return false if AccessToken is not expired, else return new AccessToken @example if ($newAccessToken = yidas\google\apiHelper\Client::refreshAccessToken()) saveNewAccessToken($newAccessToken);
[ "Refresh", "AccessToken" ]
train
https://github.com/yidas/php-google-api-client-helper/blob/e0edfebc41fb4e55bcf4125af58304894a2863fe/src/Client.php#L79-L97
yidas/php-google-api-client-helper
src/Client.php
Client.verifyAccessToken
public static function verifyAccessToken($accessToken=null) { // Check access_token if (null === $accessToken) { $token = self::getClient()->getAccessToken(); if (!isset($token['access_token'])) { throw new Exception( 'access_token m...
php
public static function verifyAccessToken($accessToken=null) { // Check access_token if (null === $accessToken) { $token = self::getClient()->getAccessToken(); if (!isset($token['access_token'])) { throw new Exception( 'access_token m...
[ "public", "static", "function", "verifyAccessToken", "(", "$", "accessToken", "=", "null", ")", "{", "// Check access_token\r", "if", "(", "null", "===", "$", "accessToken", ")", "{", "$", "token", "=", "self", "::", "getClient", "(", ")", "->", "getAccessTo...
Verify an access_token. This method will verify the current access_token by Google API, if one isn't provided. The Google verification only allow the access_token within the expired time limit, be sure to refresh the newest access_token for verifying. @param string|null $accessToken The token (access_token) that shou...
[ "Verify", "an", "access_token", ".", "This", "method", "will", "verify", "the", "current", "access_token", "by", "Google", "API", "if", "one", "isn", "t", "provided", "." ]
train
https://github.com/yidas/php-google-api-client-helper/blob/e0edfebc41fb4e55bcf4125af58304894a2863fe/src/Client.php#L110-L139
yidas/php-google-api-client-helper
src/Client.php
Client.verifyScopes
public static function verifyScopes($scopes, $accessToken=null) { // Check access_token if (!$tokenInfo = self::verifyAccessToken($accessToken)) return false; $scopeString = $tokenInfo['scope']; // Check scope for each foreach ($scopes as $key => $scope) { ...
php
public static function verifyScopes($scopes, $accessToken=null) { // Check access_token if (!$tokenInfo = self::verifyAccessToken($accessToken)) return false; $scopeString = $tokenInfo['scope']; // Check scope for each foreach ($scopes as $key => $scope) { ...
[ "public", "static", "function", "verifyScopes", "(", "$", "scopes", ",", "$", "accessToken", "=", "null", ")", "{", "// Check access_token\r", "if", "(", "!", "$", "tokenInfo", "=", "self", "::", "verifyAccessToken", "(", "$", "accessToken", ")", ")", "retur...
Verify scopes of tokenInfo by access_token. This method will verify the current access_token by Google API, if one isn't provided. @param array $scopes Google client scope list, ex: ['https://www.googleapis.com/auth/userinfo.profile'] @param string|null $accessToken The token (access_token) that should be verified. @r...
[ "Verify", "scopes", "of", "tokenInfo", "by", "access_token", ".", "This", "method", "will", "verify", "the", "current", "access_token", "by", "Google", "API", "if", "one", "isn", "t", "provided", "." ]
train
https://github.com/yidas/php-google-api-client-helper/blob/e0edfebc41fb4e55bcf4125af58304894a2863fe/src/Client.php#L154-L168
pantera-digital/yii2-seo
traits/SlugActiveQueryTrait.php
SlugActiveQueryTrait.joinSlug
public function joinSlug($modelName, $tableName) { if ($this->_aliasIsJoined === false) { $subSql = 'SELECT ' . SeoSlug::tableName() . '.* FROM ' . SeoSlug::tableName() . ' JOIN ( SELECT ' . SeoSlug::tableName() . '.model_id, MAX(id) AS max_id FROM ' . SeoSlug::tableNa...
php
public function joinSlug($modelName, $tableName) { if ($this->_aliasIsJoined === false) { $subSql = 'SELECT ' . SeoSlug::tableName() . '.* FROM ' . SeoSlug::tableName() . ' JOIN ( SELECT ' . SeoSlug::tableName() . '.model_id, MAX(id) AS max_id FROM ' . SeoSlug::tableNa...
[ "public", "function", "joinSlug", "(", "$", "modelName", ",", "$", "tableName", ")", "{", "if", "(", "$", "this", "->", "_aliasIsJoined", "===", "false", ")", "{", "$", "subSql", "=", "'SELECT '", ".", "SeoSlug", "::", "tableName", "(", ")", ".", "'.*\...
Приджойнить последний алиас для модели @param string $modelName Название класса модели @param string $tableName Название таблицы с которой джойнимся @return $this
[ "Приджойнить", "последний", "алиас", "для", "модели" ]
train
https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/traits/SlugActiveQueryTrait.php#L28-L44
cpliakas/search-framework
src/Search/Framework/SchemaField.php
SchemaField.setId
public function setId(Schema $schema, $id) { $reset_unique_field = ($schema->getUniqueFieldId() === $this->_id); // Reset the identifier, update the hash tables by re-adding the field. $schema->removeField($this->_id); $this->_id = $id; $schema->attachField($this); ...
php
public function setId(Schema $schema, $id) { $reset_unique_field = ($schema->getUniqueFieldId() === $this->_id); // Reset the identifier, update the hash tables by re-adding the field. $schema->removeField($this->_id); $this->_id = $id; $schema->attachField($this); ...
[ "public", "function", "setId", "(", "Schema", "$", "schema", ",", "$", "id", ")", "{", "$", "reset_unique_field", "=", "(", "$", "schema", "->", "getUniqueFieldId", "(", ")", "===", "$", "this", "->", "_id", ")", ";", "// Reset the identifier, update the has...
Resets the unique identifier of the field. The schema is required so that its internal hash table can be updated to reflect the field's new identifier. @param Schema $schema The schema that this field is attached to. @param string $id The unique identifier of the field. @return SchemaField
[ "Resets", "the", "unique", "identifier", "of", "the", "field", "." ]
train
https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/SchemaField.php#L174-L189
cpliakas/search-framework
src/Search/Framework/SchemaField.php
SchemaField.setName
public function setName(Schema $schema, $name) { $schema->removeField($this->_id); $this->_name = $name; $schema->attachField($this); return $this; }
php
public function setName(Schema $schema, $name) { $schema->removeField($this->_id); $this->_name = $name; $schema->attachField($this); return $this; }
[ "public", "function", "setName", "(", "Schema", "$", "schema", ",", "$", "name", ")", "{", "$", "schema", "->", "removeField", "(", "$", "this", "->", "_id", ")", ";", "$", "this", "->", "_name", "=", "$", "name", ";", "$", "schema", "->", "attachF...
Sets the name of the field as stored in the index. The schema is required so that its internal hash table can be updated to reflect the field's new identifier. @param Schema $schema The schema that this field is attached to. @param string $name The name of the field as stored in the index. @return SchemaField
[ "Sets", "the", "name", "of", "the", "field", "as", "stored", "in", "the", "index", "." ]
train
https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/SchemaField.php#L214-L220
cpliakas/search-framework
src/Search/Framework/SchemaField.php
SchemaField.toArray
public function toArray() { $schema = array( 'name' => $this->_name, 'label' => $this->_label, 'description' => $this->_description, 'type' => $this->_type, 'store' => $this->_isStored, 'index' => $this->_isIndexd, 'multival...
php
public function toArray() { $schema = array( 'name' => $this->_name, 'label' => $this->_label, 'description' => $this->_description, 'type' => $this->_type, 'store' => $this->_isStored, 'index' => $this->_isIndexd, 'multival...
[ "public", "function", "toArray", "(", ")", "{", "$", "schema", "=", "array", "(", "'name'", "=>", "$", "this", "->", "_name", ",", "'label'", "=>", "$", "this", "->", "_label", ",", "'description'", "=>", "$", "this", "->", "_description", ",", "'type'...
Returns the array of field options. @return array
[ "Returns", "the", "array", "of", "field", "options", "." ]
train
https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/SchemaField.php#L420-L437
f3ath/appnexusclient
src/ApcTokenStorage.php
ApcTokenStorage.set
public function set($username, $token) { return apc_store($this->prefix.$username, $token, $this->ttl); }
php
public function set($username, $token) { return apc_store($this->prefix.$username, $token, $this->ttl); }
[ "public", "function", "set", "(", "$", "username", ",", "$", "token", ")", "{", "return", "apc_store", "(", "$", "this", "->", "prefix", ".", "$", "username", ",", "$", "token", ",", "$", "this", "->", "ttl", ")", ";", "}" ]
set token @param string $username @param string $token @return bool
[ "set", "token" ]
train
https://github.com/f3ath/appnexusclient/blob/cfe3f3a98a9c2883484154c8997c7459b1504742/src/ApcTokenStorage.php#L30-L33
vi-kon/laravel-parser
src/ViKon/Parser/Parser.php
Parser.addRule
public function addRule(AbstractRule $rule) { if (array_key_exists($rule->getName(), $this->rules)) { throw new ParserException('Rule with ' . $rule->getName() . ' name already exists'); } $this->rules[$rule->getName()] = $rule; return $this; }
php
public function addRule(AbstractRule $rule) { if (array_key_exists($rule->getName(), $this->rules)) { throw new ParserException('Rule with ' . $rule->getName() . ' name already exists'); } $this->rules[$rule->getName()] = $rule; return $this; }
[ "public", "function", "addRule", "(", "AbstractRule", "$", "rule", ")", "{", "if", "(", "array_key_exists", "(", "$", "rule", "->", "getName", "(", ")", ",", "$", "this", "->", "rules", ")", ")", "{", "throw", "new", "ParserException", "(", "'Rule with '...
Add rule to parser @param \ViKon\Parser\Rule\AbstractRule $rule rule instance @throws \ViKon\Parser\ParserException throws if rule already exists with same name @return $this
[ "Add", "rule", "to", "parser" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/Parser.php#L73-L81
vi-kon/laravel-parser
src/ViKon/Parser/Parser.php
Parser.parse
public function parse($text, TokenList $tokenList = null, $recursive = false) { if ($this->startRule === null) { throw new ParserException('Start rule not set'); } if ($this->lexer === null) { throw new ParserException('Lexer not set'); } uasort($this->r...
php
public function parse($text, TokenList $tokenList = null, $recursive = false) { if ($this->startRule === null) { throw new ParserException('Start rule not set'); } if ($this->lexer === null) { throw new ParserException('Lexer not set'); } uasort($this->r...
[ "public", "function", "parse", "(", "$", "text", ",", "TokenList", "$", "tokenList", "=", "null", ",", "$", "recursive", "=", "false", ")", "{", "if", "(", "$", "this", "->", "startRule", "===", "null", ")", "{", "throw", "new", "ParserException", "(",...
Parse text by provided rules @param string $text raw data @param TokenList|null $tokenList already initialized token list @param bool $recursive indicates if parse called inside rule during tokenization @return \ViKon\Parser\TokenList @throws \ViKon\Parser\LexerException @throws \ViKon\Parser\...
[ "Parse", "text", "by", "provided", "rules" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/Parser.php#L95-L117
vi-kon/laravel-parser
src/ViKon/Parser/Parser.php
Parser.render
public function render($text, $skin) { if ($this->renderer === null) { throw new ParserException('Renderer not set'); } $tokenList = $this->parse($text); return $this->renderer->render($tokenList, $skin); }
php
public function render($text, $skin) { if ($this->renderer === null) { throw new ParserException('Renderer not set'); } $tokenList = $this->parse($text); return $this->renderer->render($tokenList, $skin); }
[ "public", "function", "render", "(", "$", "text", ",", "$", "skin", ")", "{", "if", "(", "$", "this", "->", "renderer", "===", "null", ")", "{", "throw", "new", "ParserException", "(", "'Renderer not set'", ")", ";", "}", "$", "tokenList", "=", "$", ...
Parse text by provided rules and try to render token list @param string $text raw data @param string $skin used skin @throws \ViKon\Parser\ParserException @return string
[ "Parse", "text", "by", "provided", "rules", "and", "try", "to", "render", "token", "list" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/Parser.php#L129-L137
vi-kon/laravel-parser
src/ViKon/Parser/Parser.php
Parser.parseToken
public function parseToken($ruleName, $content, $position, $state, TokenList $tokenList) { if (!isset($this->rules[$ruleName])) { throw new ParserException('Rule with name "' . $ruleName . '" not found'); } $this->rules[$ruleName]->parseToken($content, $position, $state, $tokenList)...
php
public function parseToken($ruleName, $content, $position, $state, TokenList $tokenList) { if (!isset($this->rules[$ruleName])) { throw new ParserException('Rule with name "' . $ruleName . '" not found'); } $this->rules[$ruleName]->parseToken($content, $position, $state, $tokenList)...
[ "public", "function", "parseToken", "(", "$", "ruleName", ",", "$", "content", ",", "$", "position", ",", "$", "state", ",", "TokenList", "$", "tokenList", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "rules", "[", "$", "ruleName", "]",...
Parse token @param string $ruleName rule name @param string $content token content @param int $position token position in raw data @param int $state token found state @param \ViKon\Parser\TokenList $tokenList token list instance @throws...
[ "Parse", "token" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/Parser.php#L151-L157
vi-kon/laravel-parser
src/ViKon/Parser/Parser.php
Parser.connectRulesToLexer
protected function connectRulesToLexer() { foreach ($this->rules as $childRule) { $childRule->prepare($this->lexer); if ($childRule->getName() === $this->startRule->getName()) { continue; } if ($this->startRule->acceptRule($childRule->getName()))...
php
protected function connectRulesToLexer() { foreach ($this->rules as $childRule) { $childRule->prepare($this->lexer); if ($childRule->getName() === $this->startRule->getName()) { continue; } if ($this->startRule->acceptRule($childRule->getName()))...
[ "protected", "function", "connectRulesToLexer", "(", ")", "{", "foreach", "(", "$", "this", "->", "rules", "as", "$", "childRule", ")", "{", "$", "childRule", "->", "prepare", "(", "$", "this", "->", "lexer", ")", ";", "if", "(", "$", "childRule", "->"...
Add rule patterns to lexer
[ "Add", "rule", "patterns", "to", "lexer" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/Parser.php#L162-L176
vi-kon/laravel-parser
src/ViKon/Parser/Parser.php
Parser.sortRulesByOrder
protected function sortRulesByOrder(AbstractRule $a, AbstractRule $b) { if ($a->getOrder() === $b->getOrder()) { return 0; } return $a->getOrder() < $b->getOrder() ? -1 : 1; }
php
protected function sortRulesByOrder(AbstractRule $a, AbstractRule $b) { if ($a->getOrder() === $b->getOrder()) { return 0; } return $a->getOrder() < $b->getOrder() ? -1 : 1; }
[ "protected", "function", "sortRulesByOrder", "(", "AbstractRule", "$", "a", ",", "AbstractRule", "$", "b", ")", "{", "if", "(", "$", "a", "->", "getOrder", "(", ")", "===", "$", "b", "->", "getOrder", "(", ")", ")", "{", "return", "0", ";", "}", "r...
Sort rules by order ASC @param \ViKon\Parser\Rule\AbstractRule $a @param \ViKon\Parser\Rule\AbstractRule $b @return int
[ "Sort", "rules", "by", "order", "ASC" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/Parser.php#L186-L194
cpliakas/search-framework
src/Search/Framework/QueueProducer.php
QueueProducer.rewind
public function rewind() { parent::rewind(); $limit = $this->_agent->getLimit(); $this->_scheduledItems = $this->_collection->fetchScheduledItems($limit); }
php
public function rewind() { parent::rewind(); $limit = $this->_agent->getLimit(); $this->_scheduledItems = $this->_collection->fetchScheduledItems($limit); }
[ "public", "function", "rewind", "(", ")", "{", "parent", "::", "rewind", "(", ")", ";", "$", "limit", "=", "$", "this", "->", "_agent", "->", "getLimit", "(", ")", ";", "$", "this", "->", "_scheduledItems", "=", "$", "this", "->", "_collection", "->"...
Overrides SearchQueueIteratorAbstract::rewind(). Fetches a new batch of items that are scheduled for indexing. @throws \RuntimeException Thrown when the collection has not been set.
[ "Overrides", "SearchQueueIteratorAbstract", "::", "rewind", "()", "." ]
train
https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/QueueProducer.php#L70-L75
cpliakas/search-framework
src/Search/Framework/QueueProducer.php
QueueProducer.valid
public function valid() { $log = $this->_agent->getLogger(); $context = array('collection' => $this->_collection->getId()); if (!$this->timedOut()) { list(, $item) = each($this->_scheduledItems); if ($item !== null) { // Build queue message and store...
php
public function valid() { $log = $this->_agent->getLogger(); $context = array('collection' => $this->_collection->getId()); if (!$this->timedOut()) { list(, $item) = each($this->_scheduledItems); if ($item !== null) { // Build queue message and store...
[ "public", "function", "valid", "(", ")", "{", "$", "log", "=", "$", "this", "->", "_agent", "->", "getLogger", "(", ")", ";", "$", "context", "=", "array", "(", "'collection'", "=>", "$", "this", "->", "_collection", "->", "getId", "(", ")", ")", "...
Implements SearchQueueIteratorAbstract::valid(). Fetches an item that is scheduled for indexing, populates a message object that can be sent to the index queue. We only have to check the timeout because the document limit should have been taken care of in the SearchCollectionAbstract::fetchScheduledItems() method.
[ "Implements", "SearchQueueIteratorAbstract", "::", "valid", "()", "." ]
train
https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/QueueProducer.php#L87-L115
markwatkinson/luminous
src/Luminous/Utils/CssParser.php
CssParser.value
public function value($ruleName, $property, $default = null) { if (isset($this->data[$ruleName][$property])) { return $this->data[$ruleName][$property]; } else { return $default; } }
php
public function value($ruleName, $property, $default = null) { if (isset($this->data[$ruleName][$property])) { return $this->data[$ruleName][$property]; } else { return $default; } }
[ "public", "function", "value", "(", "$", "ruleName", ",", "$", "property", ",", "$", "default", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "data", "[", "$", "ruleName", "]", "[", "$", "property", "]", ")", ")", "{", "retur...
Returns the value for the given property of the given rule name, or returns $default. @param $rule_name the CSS rule name, e.g. 'a', '.luminous', etc @param $property the property to access, e.g. 'color' @param $default the value to return in the case that the rule/proeprty was not set. Default: null
[ "Returns", "the", "value", "for", "the", "given", "property", "of", "the", "given", "rule", "name", "or", "returns", "$default", "." ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/CssParser.php#L300-L307
markwatkinson/luminous
src/Luminous/Utils/CssParser.php
CssParser.convert
public function convert($string) { $css = self::parse($string); $data = self::formatCssArray($css); $this->data = $data; return $data; }
php
public function convert($string) { $css = self::parse($string); $data = self::formatCssArray($css); $this->data = $data; return $data; }
[ "public", "function", "convert", "(", "$", "string", ")", "{", "$", "css", "=", "self", "::", "parse", "(", "$", "string", ")", ";", "$", "data", "=", "self", "::", "formatCssArray", "(", "$", "css", ")", ";", "$", "this", "->", "data", "=", "$",...
Converts a CSS string into a nested map of values. See LuminousCSSParser::rules() for the structure. @param $string the CSS string @returns the rule map
[ "Converts", "a", "CSS", "string", "into", "a", "nested", "map", "of", "values", ".", "See", "LuminousCSSParser", "::", "rules", "()", "for", "the", "structure", "." ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/CssParser.php#L315-L321
ssnepenthe/soter
src/class-email-notifier.php
Email_Notifier.notify
public function notify( Vulnerabilities $vulnerabilities ) { $use_html = 'html' === $this->options->email_type; wp_mail( $this->options->email_address, 'Vulnerabilities detected on ' . get_bloginfo( 'name' ), $use_html ? $this->render_html_email( $vulnerabilities ) : $this->render_text_email( $vul...
php
public function notify( Vulnerabilities $vulnerabilities ) { $use_html = 'html' === $this->options->email_type; wp_mail( $this->options->email_address, 'Vulnerabilities detected on ' . get_bloginfo( 'name' ), $use_html ? $this->render_html_email( $vulnerabilities ) : $this->render_text_email( $vul...
[ "public", "function", "notify", "(", "Vulnerabilities", "$", "vulnerabilities", ")", "{", "$", "use_html", "=", "'html'", "===", "$", "this", "->", "options", "->", "email_type", ";", "wp_mail", "(", "$", "this", "->", "options", "->", "email_address", ",", ...
Prepare and send a notification. @param Vulnerabilities $vulnerabilities List of vulnerabilities. @return void
[ "Prepare", "and", "send", "a", "notification", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-email-notifier.php#L63-L74
ssnepenthe/soter
src/class-email-notifier.php
Email_Notifier.render_html_email
public function render_html_email( Vulnerabilities $vulnerabilities, CssToInlineStyles $inliner = null ) { $html = $this->template->render( 'emails/html/vulnerable.php', [ 'action_url' => admin_url( 'update-core.php' ), 'vulnerabilities' => $vulnerabilities, ] ); $css = $this->template->render( 'emails...
php
public function render_html_email( Vulnerabilities $vulnerabilities, CssToInlineStyles $inliner = null ) { $html = $this->template->render( 'emails/html/vulnerable.php', [ 'action_url' => admin_url( 'update-core.php' ), 'vulnerabilities' => $vulnerabilities, ] ); $css = $this->template->render( 'emails...
[ "public", "function", "render_html_email", "(", "Vulnerabilities", "$", "vulnerabilities", ",", "CssToInlineStyles", "$", "inliner", "=", "null", ")", "{", "$", "html", "=", "$", "this", "->", "template", "->", "render", "(", "'emails/html/vulnerable.php'", ",", ...
Render the contents of the HTML email notification. @param Vulnerabilities $vulnerabilities Vulnerabilities list. @param CssToInlineStyles|null $inliner Style inliner. @return string
[ "Render", "the", "contents", "of", "the", "HTML", "email", "notification", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-email-notifier.php#L84-L96
verschoof/bunq-api-bundle
src/DependencyInjection/BunqApiExtension.php
BunqApiExtension.load
public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $rootDir = realpath($container->getParameter('kernel.root_dir') . '/../'); $storageLocation = $ro...
php
public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $rootDir = realpath($container->getParameter('kernel.root_dir') . '/../'); $storageLocation = $ro...
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "configuration", "=", "new", "Configuration", "(", ")", ";", "$", "config", "=", "$", "this", "->", "processConfiguration", "(", "$", "con...
{@inheritdoc}
[ "{" ]
train
https://github.com/verschoof/bunq-api-bundle/blob/b7ff44e005b383d415a69ed95a0c14320c0bf19b/src/DependencyInjection/BunqApiExtension.php#L20-L35
eddiejaoude/zf2-logger
src/Zf2Logger/Factory/Zf2Logger.php
Zf2Logger.createService
public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('Config'); $config = $config['EddieJaoude\Zf2Logger']; $this->logger = new Logger(); $this->configuration($config); $this->writerCollection($config); $this->execut...
php
public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('Config'); $config = $config['EddieJaoude\Zf2Logger']; $this->logger = new Logger(); $this->configuration($config); $this->writerCollection($config); $this->execut...
[ "public", "function", "createService", "(", "ServiceLocatorInterface", "$", "serviceLocator", ")", "{", "$", "config", "=", "$", "serviceLocator", "->", "get", "(", "'Config'", ")", ";", "$", "config", "=", "$", "config", "[", "'EddieJaoude\\Zf2Logger'", "]", ...
Create service @param ServiceLocatorInterface $serviceLocator @return \Zend\Http\Client
[ "Create", "service" ]
train
https://github.com/eddiejaoude/zf2-logger/blob/8c7ae273e41e851fe2d525051206541cb1bf6b60/src/Zf2Logger/Factory/Zf2Logger.php#L28-L39
eddiejaoude/zf2-logger
src/Zf2Logger/Factory/Zf2Logger.php
Zf2Logger.writerCollection
private function writerCollection(array $config) { if (!empty($config['writers'])) { $writers = 0; foreach ($config['writers'] as $writer) { if ($writer['enabled']) { $this->writerAdapter( $writer ); $writers ++; ...
php
private function writerCollection(array $config) { if (!empty($config['writers'])) { $writers = 0; foreach ($config['writers'] as $writer) { if ($writer['enabled']) { $this->writerAdapter( $writer ); $writers ++; ...
[ "private", "function", "writerCollection", "(", "array", "$", "config", ")", "{", "if", "(", "!", "empty", "(", "$", "config", "[", "'writers'", "]", ")", ")", "{", "$", "writers", "=", "0", ";", "foreach", "(", "$", "config", "[", "'writers'", "]", ...
@param array $config @return int
[ "@param", "array", "$config" ]
train
https://github.com/eddiejaoude/zf2-logger/blob/8c7ae273e41e851fe2d525051206541cb1bf6b60/src/Zf2Logger/Factory/Zf2Logger.php#L46-L59
eddiejaoude/zf2-logger
src/Zf2Logger/Factory/Zf2Logger.php
Zf2Logger.writerAdapter
private function writerAdapter(array $writer) { $writerAdapter = new $writer['adapter']($writer['options']['output']); $this->logger->addWriter($writerAdapter); $writerAdapter->addFilter( new Priority( $writer['filter'] ) ); return $w...
php
private function writerAdapter(array $writer) { $writerAdapter = new $writer['adapter']($writer['options']['output']); $this->logger->addWriter($writerAdapter); $writerAdapter->addFilter( new Priority( $writer['filter'] ) ); return $w...
[ "private", "function", "writerAdapter", "(", "array", "$", "writer", ")", "{", "$", "writerAdapter", "=", "new", "$", "writer", "[", "'adapter'", "]", "(", "$", "writer", "[", "'options'", "]", "[", "'output'", "]", ")", ";", "$", "this", "->", "logger...
@param array $writer @return \Zend\Log\Writer\AbstractWriter
[ "@param", "array", "$writer" ]
train
https://github.com/eddiejaoude/zf2-logger/blob/8c7ae273e41e851fe2d525051206541cb1bf6b60/src/Zf2Logger/Factory/Zf2Logger.php#L66-L78
yosmanyga/validation
src/Yosmanyga/Validation/Resource/Compiler/ObjectCompiler.php
ObjectCompiler.compile
public function compile($definition) { $validators = []; if (isset($definition->validators)) { if (isset($definition->validators['properties'])) { foreach ($definition->validators['properties'] as $property => $validatorDefinitions) { foreach ($valida...
php
public function compile($definition) { $validators = []; if (isset($definition->validators)) { if (isset($definition->validators['properties'])) { foreach ($definition->validators['properties'] as $property => $validatorDefinitions) { foreach ($valida...
[ "public", "function", "compile", "(", "$", "definition", ")", "{", "$", "validators", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "definition", "->", "validators", ")", ")", "{", "if", "(", "isset", "(", "$", "definition", "->", "validators", "...
@param \Yosmanyga\Validation\Resource\Definition\ObjectDefinition $definition @return \Yosmanyga\Validation\Validator\ObjectValidator
[ "@param", "\\", "Yosmanyga", "\\", "Validation", "\\", "Resource", "\\", "Definition", "\\", "ObjectDefinition", "$definition" ]
train
https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Compiler/ObjectCompiler.php#L46-L61
auraphp/installer-system
src/Aura/Composer/SystemInstaller.php
SystemInstaller.install
public function install(InstalledRepositoryInterface $repo, PackageInterface $package) { // do the installation parent::install($repo, $package); list($vendor, $name) = $this->getVendorAndName($package); $new = "{$vendor}.{$name}"; // is the package already listed? ...
php
public function install(InstalledRepositoryInterface $repo, PackageInterface $package) { // do the installation parent::install($repo, $package); list($vendor, $name) = $this->getVendorAndName($package); $new = "{$vendor}.{$name}"; // is the package already listed? ...
[ "public", "function", "install", "(", "InstalledRepositoryInterface", "$", "repo", ",", "PackageInterface", "$", "package", ")", "{", "// do the installation", "parent", "::", "install", "(", "$", "repo", ",", "$", "package", ")", ";", "list", "(", "$", "vendo...
{@inheritDoc}
[ "{" ]
train
https://github.com/auraphp/installer-system/blob/40859edfb63d0f97f6e8ee761dbc5eee245233c8/src/Aura/Composer/SystemInstaller.php#L13-L32
auraphp/installer-system
src/Aura/Composer/SystemInstaller.php
SystemInstaller.uninstall
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package) { // do the installation parent::uninstall($repo, $package); list($vendor, $name) = $this->getVendorAndName($package); // remove the package from the file listing $packages = $th...
php
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package) { // do the installation parent::uninstall($repo, $package); list($vendor, $name) = $this->getVendorAndName($package); // remove the package from the file listing $packages = $th...
[ "public", "function", "uninstall", "(", "InstalledRepositoryInterface", "$", "repo", ",", "PackageInterface", "$", "package", ")", "{", "// do the installation", "parent", "::", "uninstall", "(", "$", "repo", ",", "$", "package", ")", ";", "list", "(", "$", "v...
{@inheritDoc}
[ "{" ]
train
https://github.com/auraphp/installer-system/blob/40859edfb63d0f97f6e8ee761dbc5eee245233c8/src/Aura/Composer/SystemInstaller.php#L37-L54
terdia/legato-framework
src/TwigGlobal.php
TwigGlobal.getUserDefinedGlobals
protected function getUserDefinedGlobals() { if (file_exists(realpath(__DIR__.'/../../../../config/twig.php'))) { $this->config = require realpath(__DIR__.'/../../../../config/twig.php'); } elseif (file_exists(realpath(__DIR__.'/../config/twig.php'))) { $this->config = requir...
php
protected function getUserDefinedGlobals() { if (file_exists(realpath(__DIR__.'/../../../../config/twig.php'))) { $this->config = require realpath(__DIR__.'/../../../../config/twig.php'); } elseif (file_exists(realpath(__DIR__.'/../config/twig.php'))) { $this->config = requir...
[ "protected", "function", "getUserDefinedGlobals", "(", ")", "{", "if", "(", "file_exists", "(", "realpath", "(", "__DIR__", ".", "'/../../../../config/twig.php'", ")", ")", ")", "{", "$", "this", "->", "config", "=", "require", "realpath", "(", "__DIR__", ".",...
Get the user defined global for twig templates. @return mixed
[ "Get", "the", "user", "defined", "global", "for", "twig", "templates", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/TwigGlobal.php#L47-L56
sifophp/sifo-common-instance
controllers/scripts/sendMail.php
ScriptsSendMailController.init
public function init() { $this->help_str = 'Send a mail using the instance mail configuration. '.PHP_EOL; $this->setNewParam( 'S', 'subject', 'Mail subject.', true, true ); $this->setNewParam( 'F', 'filecontent', 'Mail body. Don\'t define this params to send the stdin', true, true ); $this->setNewParam( 'H',...
php
public function init() { $this->help_str = 'Send a mail using the instance mail configuration. '.PHP_EOL; $this->setNewParam( 'S', 'subject', 'Mail subject.', true, true ); $this->setNewParam( 'F', 'filecontent', 'Mail body. Don\'t define this params to send the stdin', true, true ); $this->setNewParam( 'H',...
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "help_str", "=", "'Send a mail using the instance mail configuration. '", ".", "PHP_EOL", ";", "$", "this", "->", "setNewParam", "(", "'S'", ",", "'subject'", ",", "'Mail subject.'", ",", "true", ",...
ABSTRACTED METHODES:
[ "ABSTRACTED", "METHODES", ":" ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/scripts/sendMail.php#L37-L44
jimmyoak/utilities
src/Utility/ArrayUtils.php
ArrayUtils.flatten
public function flatten(array $toFlat, $preserveKeys = self::NO_PRESERVE_KEYS) { if ($preserveKeys === self::PRESERVE_KEYS) { $flatten = $this->flattenPreservingKeys($toFlat); } elseif ($preserveKeys === self::PRESERVE_ASSOCIATIVE_KEYS) { $flatten = $this->flattenPreservingAs...
php
public function flatten(array $toFlat, $preserveKeys = self::NO_PRESERVE_KEYS) { if ($preserveKeys === self::PRESERVE_KEYS) { $flatten = $this->flattenPreservingKeys($toFlat); } elseif ($preserveKeys === self::PRESERVE_ASSOCIATIVE_KEYS) { $flatten = $this->flattenPreservingAs...
[ "public", "function", "flatten", "(", "array", "$", "toFlat", ",", "$", "preserveKeys", "=", "self", "::", "NO_PRESERVE_KEYS", ")", "{", "if", "(", "$", "preserveKeys", "===", "self", "::", "PRESERVE_KEYS", ")", "{", "$", "flatten", "=", "$", "this", "->...
@param array $toFlat @param int $preserveKeys @return array
[ "@param", "array", "$toFlat", "@param", "int", "$preserveKeys" ]
train
https://github.com/jimmyoak/utilities/blob/ab2b4a574bd67c04784695a3c206daf5800979a4/src/Utility/ArrayUtils.php#L17-L28
ssnepenthe/soter
src/class-notifier-manager.php
Notifier_Manager.notify
public function notify( Vulnerabilities $vulnerabilities ) { if ( ! $this->should_notify( $vulnerabilities ) ) { return; } foreach ( $this->notifiers as $notifier ) { if ( $notifier->is_enabled() ) { $notifier->notify( $vulnerabilities ); } } }
php
public function notify( Vulnerabilities $vulnerabilities ) { if ( ! $this->should_notify( $vulnerabilities ) ) { return; } foreach ( $this->notifiers as $notifier ) { if ( $notifier->is_enabled() ) { $notifier->notify( $vulnerabilities ); } } }
[ "public", "function", "notify", "(", "Vulnerabilities", "$", "vulnerabilities", ")", "{", "if", "(", "!", "$", "this", "->", "should_notify", "(", "$", "vulnerabilities", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "this", "->", "notifiers", ...
Invoke the notify method on all active notifiers. @param Vulnerabilities $vulnerabilities List of vulnerabilities. @return void
[ "Invoke", "the", "notify", "method", "on", "all", "active", "notifiers", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-notifier-manager.php#L62-L72
ssnepenthe/soter
src/class-notifier-manager.php
Notifier_Manager.should_notify
protected function should_notify( Vulnerabilities $vulnerabilities ) { if ( $vulnerabilities->is_empty() ) { return false; } if ( $this->options->should_nag ) { return true; } return $vulnerabilities->hash() !== $this->options->last_scan_hash; }
php
protected function should_notify( Vulnerabilities $vulnerabilities ) { if ( $vulnerabilities->is_empty() ) { return false; } if ( $this->options->should_nag ) { return true; } return $vulnerabilities->hash() !== $this->options->last_scan_hash; }
[ "protected", "function", "should_notify", "(", "Vulnerabilities", "$", "vulnerabilities", ")", "{", "if", "(", "$", "vulnerabilities", "->", "is_empty", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "options", "->", "should...
Determine whether a notifications should be sent. @param Vulnerabilities $vulnerabilities List of vulnerabilities. @return boolean
[ "Determine", "whether", "a", "notifications", "should", "be", "sent", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-notifier-manager.php#L81-L91
msschl/monolog-http-handler
src/HttpHandler.php
HttpHandler.hasHeader
public function hasHeader(string $key = null) : bool { if ($key === null) { return false; } $array = $this->getHeaders(); return isset($array[$key]) || array_key_exists($key, $array); }
php
public function hasHeader(string $key = null) : bool { if ($key === null) { return false; } $array = $this->getHeaders(); return isset($array[$key]) || array_key_exists($key, $array); }
[ "public", "function", "hasHeader", "(", "string", "$", "key", "=", "null", ")", ":", "bool", "{", "if", "(", "$", "key", "===", "null", ")", "{", "return", "false", ";", "}", "$", "array", "=", "$", "this", "->", "getHeaders", "(", ")", ";", "ret...
Returns whether a header exists or not. @param string|null $key The header key. @return bool
[ "Returns", "whether", "a", "header", "exists", "or", "not", "." ]
train
https://github.com/msschl/monolog-http-handler/blob/3f11ea3c2c2691c2e113a9fa681236e74390c541/src/HttpHandler.php#L180-L188
msschl/monolog-http-handler
src/HttpHandler.php
HttpHandler.pushHeader
public function pushHeader(string $key, string $value = null) { $headers = $this->getHeaders(); $headers[$key] = $value; $this->setHeaders($headers); return $this; }
php
public function pushHeader(string $key, string $value = null) { $headers = $this->getHeaders(); $headers[$key] = $value; $this->setHeaders($headers); return $this; }
[ "public", "function", "pushHeader", "(", "string", "$", "key", ",", "string", "$", "value", "=", "null", ")", "{", "$", "headers", "=", "$", "this", "->", "getHeaders", "(", ")", ";", "$", "headers", "[", "$", "key", "]", "=", "$", "value", ";", ...
Pushes a header value onto the headers array. @param string $key The header key. @param string|null $value The header value. @return self
[ "Pushes", "a", "header", "value", "onto", "the", "headers", "array", "." ]
train
https://github.com/msschl/monolog-http-handler/blob/3f11ea3c2c2691c2e113a9fa681236e74390c541/src/HttpHandler.php#L197-L206
msschl/monolog-http-handler
src/HttpHandler.php
HttpHandler.popHeader
public function popHeader(string $key = null) { $value = $this->getHeader($key); if ($value !== null) { unset($this->options['headers'][$key]); } return $value; }
php
public function popHeader(string $key = null) { $value = $this->getHeader($key); if ($value !== null) { unset($this->options['headers'][$key]); } return $value; }
[ "public", "function", "popHeader", "(", "string", "$", "key", "=", "null", ")", "{", "$", "value", "=", "$", "this", "->", "getHeader", "(", "$", "key", ")", ";", "if", "(", "$", "value", "!==", "null", ")", "{", "unset", "(", "$", "this", "->", ...
Pops a header value from the headers array. @param string|null $key The header key. @return string|null
[ "Pops", "a", "header", "value", "from", "the", "headers", "array", "." ]
train
https://github.com/msschl/monolog-http-handler/blob/3f11ea3c2c2691c2e113a9fa681236e74390c541/src/HttpHandler.php#L214-L223
msschl/monolog-http-handler
src/HttpHandler.php
HttpHandler.handleBatch
public function handleBatch(array $records) { foreach ($records as $key => $record) { if ($this->isHandling($record)) { $record = $this->processRecord($record); $records['records'][] = $record; } unset($records[$key]); } $records['formatted'] = $this->getFormatter()->fo...
php
public function handleBatch(array $records) { foreach ($records as $key => $record) { if ($this->isHandling($record)) { $record = $this->processRecord($record); $records['records'][] = $record; } unset($records[$key]); } $records['formatted'] = $this->getFormatter()->fo...
[ "public", "function", "handleBatch", "(", "array", "$", "records", ")", "{", "foreach", "(", "$", "records", "as", "$", "key", "=>", "$", "record", ")", "{", "if", "(", "$", "this", "->", "isHandling", "(", "$", "record", ")", ")", "{", "$", "recor...
Handles a set of records at once. @param array $records The records to handle (an array of record arrays) @return bool
[ "Handles", "a", "set", "of", "records", "at", "once", "." ]
train
https://github.com/msschl/monolog-http-handler/blob/3f11ea3c2c2691c2e113a9fa681236e74390c541/src/HttpHandler.php#L254-L270
msschl/monolog-http-handler
src/HttpHandler.php
HttpHandler.write
protected function write(array $record) { $uri = $this->getUri(); if (empty($uri)) { return; } $request = $this->getMessageFactory()->createRequest( $this->getMethod(), $this->getUri(), $this->getHeaders(), $record['formatted'], $this->getProtocolVersion() ...
php
protected function write(array $record) { $uri = $this->getUri(); if (empty($uri)) { return; } $request = $this->getMessageFactory()->createRequest( $this->getMethod(), $this->getUri(), $this->getHeaders(), $record['formatted'], $this->getProtocolVersion() ...
[ "protected", "function", "write", "(", "array", "$", "record", ")", "{", "$", "uri", "=", "$", "this", "->", "getUri", "(", ")", ";", "if", "(", "empty", "(", "$", "uri", ")", ")", "{", "return", ";", "}", "$", "request", "=", "$", "this", "->"...
Writes the record. @param array $record @return void
[ "Writes", "the", "record", "." ]
train
https://github.com/msschl/monolog-http-handler/blob/3f11ea3c2c2691c2e113a9fa681236e74390c541/src/HttpHandler.php#L308-L332
AbuseIO/collector-snds
src/Snds.php
Snds.parse
public function parse() { if (empty($this->key) || strlen($this->key) < 10) { return $this->failed("Invalid SNDS key: {$this->key}"); } if (!filter_var($this->url, FILTER_VALIDATE_URL) === true) { return $this->failed("Invalid URL configured: {$this->url}"); ...
php
public function parse() { if (empty($this->key) || strlen($this->key) < 10) { return $this->failed("Invalid SNDS key: {$this->key}"); } if (!filter_var($this->url, FILTER_VALIDATE_URL) === true) { return $this->failed("Invalid URL configured: {$this->url}"); ...
[ "public", "function", "parse", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "key", ")", "||", "strlen", "(", "$", "this", "->", "key", ")", "<", "10", ")", "{", "return", "$", "this", "->", "failed", "(", "\"Invalid SNDS key: {$this->ke...
Parse attachments @return array Returns array with failed or success data (See collector-common/src/Collector.php) for more info.
[ "Parse", "attachments" ]
train
https://github.com/AbuseIO/collector-snds/blob/9a4b17c1f7f0fcd1329dec95ded8eb7c7dec46a7/src/Snds.php#L49-L139
dekuan/delib
src/CMobileDetector.php
CMobileDetector.setHttpHeaders
public function setHttpHeaders($httpHeaders = null) { // use global _SERVER if $httpHeaders aren't defined if (!is_array($httpHeaders) || !count($httpHeaders)) { $httpHeaders = $_SERVER; } // clear existing headers $this->httpHeaders = array(); // Only save HTTP headers. In PHP land, that means only _...
php
public function setHttpHeaders($httpHeaders = null) { // use global _SERVER if $httpHeaders aren't defined if (!is_array($httpHeaders) || !count($httpHeaders)) { $httpHeaders = $_SERVER; } // clear existing headers $this->httpHeaders = array(); // Only save HTTP headers. In PHP land, that means only _...
[ "public", "function", "setHttpHeaders", "(", "$", "httpHeaders", "=", "null", ")", "{", "// use global _SERVER if $httpHeaders aren't defined", "if", "(", "!", "is_array", "(", "$", "httpHeaders", ")", "||", "!", "count", "(", "$", "httpHeaders", ")", ")", "{", ...
Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers. @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract the headers. The default null is left for backwards compatibility.
[ "Set", "the", "HTTP", "Headers", ".", "Must", "be", "PHP", "-", "flavored", ".", "This", "method", "will", "reset", "existing", "headers", "." ]
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CMobileDetector.php#L699-L719
dekuan/delib
src/CMobileDetector.php
CMobileDetector.getHttpHeader
public function getHttpHeader($header) { // are we using PHP-flavored headers? if (strpos($header, '_') === false) { $header = str_replace('-', '_', $header); $header = strtoupper($header); } // test the alternate, too $altHeader = 'HTTP_' . $header; //Test both the regular and the HTTP_ prefix i...
php
public function getHttpHeader($header) { // are we using PHP-flavored headers? if (strpos($header, '_') === false) { $header = str_replace('-', '_', $header); $header = strtoupper($header); } // test the alternate, too $altHeader = 'HTTP_' . $header; //Test both the regular and the HTTP_ prefix i...
[ "public", "function", "getHttpHeader", "(", "$", "header", ")", "{", "// are we using PHP-flavored headers?", "if", "(", "strpos", "(", "$", "header", ",", "'_'", ")", "===", "false", ")", "{", "$", "header", "=", "str_replace", "(", "'-'", ",", "'_'", ","...
Retrieves a particular header. If it doesn't exist, no exception/error is caused. Simply null is returned. @param string $header The name of the header to retrieve. Can be HTTP compliant such as "User-Agent" or "X-Device-User-Agent" or can be php-esque with the all-caps, HTTP_ prefixed, underscore seperated awesomenes...
[ "Retrieves", "a", "particular", "header", ".", "If", "it", "doesn", "t", "exist", "no", "exception", "/", "error", "is", "caused", ".", "Simply", "null", "is", "returned", "." ]
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CMobileDetector.php#L741-L760
dekuan/delib
src/CMobileDetector.php
CMobileDetector.setCfHeaders
public function setCfHeaders($cfHeaders = null) { // use global _SERVER if $cfHeaders aren't defined if (!is_array($cfHeaders) || !count($cfHeaders)) { $cfHeaders = $_SERVER; } // clear existing headers $this->cloudfrontHeaders = array(); // Only save CLOUDFRONT headers. In PHP land, that means only _S...
php
public function setCfHeaders($cfHeaders = null) { // use global _SERVER if $cfHeaders aren't defined if (!is_array($cfHeaders) || !count($cfHeaders)) { $cfHeaders = $_SERVER; } // clear existing headers $this->cloudfrontHeaders = array(); // Only save CLOUDFRONT headers. In PHP land, that means only _S...
[ "public", "function", "setCfHeaders", "(", "$", "cfHeaders", "=", "null", ")", "{", "// use global _SERVER if $cfHeaders aren't defined", "if", "(", "!", "is_array", "(", "$", "cfHeaders", ")", "||", "!", "count", "(", "$", "cfHeaders", ")", ")", "{", "$", "...
Set CloudFront headers http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html#header-caching-web-device @param array $cfHeaders List of HTTP headers @return boolean If there were CloudFront headers to be set
[ "Set", "CloudFront", "headers", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "AmazonCloudFront", "/", "latest", "/", "DeveloperGuide", "/", "header", "-", "caching", ".", "html#header", "-", "caching", "-", "web", "-", "device" ]
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CMobileDetector.php#L787-L807
dekuan/delib
src/CMobileDetector.php
CMobileDetector.getMobileDetectionRules
public static function getMobileDetectionRules() { static $rules; if (!$rules) { $rules = array_merge( self::$phoneDevices, self::$tabletDevices, self::$operatingSystems, self::$browsers ); } return $rules; }
php
public static function getMobileDetectionRules() { static $rules; if (!$rules) { $rules = array_merge( self::$phoneDevices, self::$tabletDevices, self::$operatingSystems, self::$browsers ); } return $rules; }
[ "public", "static", "function", "getMobileDetectionRules", "(", ")", "{", "static", "$", "rules", ";", "if", "(", "!", "$", "rules", ")", "{", "$", "rules", "=", "array_merge", "(", "self", "::", "$", "phoneDevices", ",", "self", "::", "$", "tabletDevice...
Method gets the mobile detection rules. This method is used for the magic methods $detect->is*(). @deprecated since version 2.6.9 @return array All the rules (but not extended).
[ "Method", "gets", "the", "mobile", "detection", "rules", ".", "This", "method", "is", "used", "for", "the", "magic", "methods", "$detect", "-", ">", "is", "*", "()", "." ]
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CMobileDetector.php#L951-L966
dekuan/delib
src/CMobileDetector.php
CMobileDetector.getMobileDetectionRulesExtended
public function getMobileDetectionRulesExtended() { static $rules; if (!$rules) { // Merge all rules together. $rules = array_merge( self::$phoneDevices, self::$tabletDevices, self::$operatingSystems, self::$browsers, self::$utilities ); } return $rules; }
php
public function getMobileDetectionRulesExtended() { static $rules; if (!$rules) { // Merge all rules together. $rules = array_merge( self::$phoneDevices, self::$tabletDevices, self::$operatingSystems, self::$browsers, self::$utilities ); } return $rules; }
[ "public", "function", "getMobileDetectionRulesExtended", "(", ")", "{", "static", "$", "rules", ";", "if", "(", "!", "$", "rules", ")", "{", "// Merge all rules together.", "$", "rules", "=", "array_merge", "(", "self", "::", "$", "phoneDevices", ",", "self", ...
Method gets the mobile detection rules + utilities. The reason this is separate is because utilities rules don't necessary imply mobile. This method is used inside the new $detect->is('stuff') method. @deprecated since version 2.6.9 @return array All the rules + extended.
[ "Method", "gets", "the", "mobile", "detection", "rules", "+", "utilities", ".", "The", "reason", "this", "is", "separate", "is", "because", "utilities", "rules", "don", "t", "necessary", "imply", "mobile", ".", "This", "method", "is", "used", "inside", "the"...
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CMobileDetector.php#L978-L994
dekuan/delib
src/CMobileDetector.php
CMobileDetector.is
public function is($key, $userAgent = null, $httpHeaders = null) { // Set the UA and HTTP headers only if needed (eg. batch mode). if ($httpHeaders) { $this->setHttpHeaders($httpHeaders); } if ($userAgent) { $this->setUserAgent($userAgent); } $this->setDetectionType(self::DETECTION_TYPE_EXTENDED); ...
php
public function is($key, $userAgent = null, $httpHeaders = null) { // Set the UA and HTTP headers only if needed (eg. batch mode). if ($httpHeaders) { $this->setHttpHeaders($httpHeaders); } if ($userAgent) { $this->setUserAgent($userAgent); } $this->setDetectionType(self::DETECTION_TYPE_EXTENDED); ...
[ "public", "function", "is", "(", "$", "key", ",", "$", "userAgent", "=", "null", ",", "$", "httpHeaders", "=", "null", ")", "{", "// Set the UA and HTTP headers only if needed (eg. batch mode).", "if", "(", "$", "httpHeaders", ")", "{", "$", "this", "->", "set...
This method checks for a certain property in the userAgent. @todo: The httpHeaders part is not yet used. @param string $key @param string $userAgent deprecated @param string $httpHeaders deprecated @return bool|int|null
[ "This", "method", "checks", "for", "a", "certain", "property", "in", "the", "userAgent", ".", "@todo", ":", "The", "httpHeaders", "part", "is", "not", "yet", "used", "." ]
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CMobileDetector.php#L1202-L1216
dekuan/delib
src/CMobileDetector.php
CMobileDetector.match
public function match($regex, $userAgent = null) { $match = (bool) preg_match(sprintf('#%s#is', $regex), (false === empty($userAgent) ? $userAgent : $this->userAgent), $matches); // If positive match is found, store the results for debug. if ($match) { $this->matchingRegex = $regex; $this->matchesArray = $...
php
public function match($regex, $userAgent = null) { $match = (bool) preg_match(sprintf('#%s#is', $regex), (false === empty($userAgent) ? $userAgent : $this->userAgent), $matches); // If positive match is found, store the results for debug. if ($match) { $this->matchingRegex = $regex; $this->matchesArray = $...
[ "public", "function", "match", "(", "$", "regex", ",", "$", "userAgent", "=", "null", ")", "{", "$", "match", "=", "(", "bool", ")", "preg_match", "(", "sprintf", "(", "'#%s#is'", ",", "$", "regex", ")", ",", "(", "false", "===", "empty", "(", "$",...
Some detection rules are relative (not standard), because of the diversity of devices, vendors and their conventions in representing the User-Agent or the HTTP headers. This method will be used to check custom regexes against the User-Agent string. @param $regex @param string $userAgent @return bool @todo: search i...
[ "Some", "detection", "rules", "are", "relative", "(", "not", "standard", ")", "because", "of", "the", "diversity", "of", "devices", "vendors", "and", "their", "conventions", "in", "representing", "the", "User", "-", "Agent", "or", "the", "HTTP", "headers", "...
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CMobileDetector.php#L1233-L1243
mimmi20/Wurfl
src/Device/ModelDevice.php
ModelDevice.getGroupIdCapabilitiesMap
public function getGroupIdCapabilitiesMap() { $groupIdCapabilitiesMap = array(); foreach ($this->groupIdCapabilitiesNameMap as $groupId => $capabilitiesName) { foreach ($capabilitiesName as $capabilityName) { $groupIdCapabilitiesMap[$groupId][$capabilityName] = $this->cap...
php
public function getGroupIdCapabilitiesMap() { $groupIdCapabilitiesMap = array(); foreach ($this->groupIdCapabilitiesNameMap as $groupId => $capabilitiesName) { foreach ($capabilitiesName as $capabilityName) { $groupIdCapabilitiesMap[$groupId][$capabilityName] = $this->cap...
[ "public", "function", "getGroupIdCapabilitiesMap", "(", ")", "{", "$", "groupIdCapabilitiesMap", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "groupIdCapabilitiesNameMap", "as", "$", "groupId", "=>", "$", "capabilitiesName", ")", "{", "foreach...
Returns the capabilities by group name @return array capabilities
[ "Returns", "the", "capabilities", "by", "group", "name" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/ModelDevice.php#L173-L183
inpsyde/wp-db-tools
src/Action/MySqlTableCopier.php
MySqlTableCopier.copy
public function copy( Table $src, Table $dest ) { $this->copy_structure( $src, $dest ); $src_table = $this->database->quote_identifier( $src->name() ); $dest_table = $this->database->quote_identifier( $dest->name() ); $query = "INSERT INTO {$dest_table} SELECT * FROM {$src_table}"; return (bool) $this...
php
public function copy( Table $src, Table $dest ) { $this->copy_structure( $src, $dest ); $src_table = $this->database->quote_identifier( $src->name() ); $dest_table = $this->database->quote_identifier( $dest->name() ); $query = "INSERT INTO {$dest_table} SELECT * FROM {$src_table}"; return (bool) $this...
[ "public", "function", "copy", "(", "Table", "$", "src", ",", "Table", "$", "dest", ")", "{", "$", "this", "->", "copy_structure", "(", "$", "src", ",", "$", "dest", ")", ";", "$", "src_table", "=", "$", "this", "->", "database", "->", "quote_identifi...
Duplicates a table structure with the complete content @param Table $src @param Table $dest @return bool
[ "Duplicates", "a", "table", "structure", "with", "the", "complete", "content" ]
train
https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Action/MySqlTableCopier.php#L36-L44
inpsyde/wp-db-tools
src/Action/MySqlTableCopier.php
MySqlTableCopier.copy_structure
public function copy_structure( Table $src, Table $dest ) { $src_table = $this->database->quote_identifier( $src->name() ); $dest_table = $this->database->quote_identifier( $dest->name() ); $statement = new \WpDbTools\Type\GenericStatement( "CREATE TABLE {$dest_table} LIKE {$src_table}" ); // this will...
php
public function copy_structure( Table $src, Table $dest ) { $src_table = $this->database->quote_identifier( $src->name() ); $dest_table = $this->database->quote_identifier( $dest->name() ); $statement = new \WpDbTools\Type\GenericStatement( "CREATE TABLE {$dest_table} LIKE {$src_table}" ); // this will...
[ "public", "function", "copy_structure", "(", "Table", "$", "src", ",", "Table", "$", "dest", ")", "{", "$", "src_table", "=", "$", "this", "->", "database", "->", "quote_identifier", "(", "$", "src", "->", "name", "(", ")", ")", ";", "$", "dest_table",...
Creates a new, empty table with the same structure of the $src table @param Table $src @param Table $dest @return bool
[ "Creates", "a", "new", "empty", "table", "with", "the", "same", "structure", "of", "the", "$src", "table" ]
train
https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Action/MySqlTableCopier.php#L54-L66
cauditor/php-analyzer
src/Analyzers/PDepend/JsonGenerator.php
JsonGenerator.log
public function log(PDependAnalyzer $analyzer) { $accept = true; if ($analyzer instanceof AnalyzerProjectAware) { $this->projectAnalyzers[] = $analyzer; // don't return just yet, it may also be a node analyzer ;) $accept = true; } if ($analyzer i...
php
public function log(PDependAnalyzer $analyzer) { $accept = true; if ($analyzer instanceof AnalyzerProjectAware) { $this->projectAnalyzers[] = $analyzer; // don't return just yet, it may also be a node analyzer ;) $accept = true; } if ($analyzer i...
[ "public", "function", "log", "(", "PDependAnalyzer", "$", "analyzer", ")", "{", "$", "accept", "=", "true", ";", "if", "(", "$", "analyzer", "instanceof", "AnalyzerProjectAware", ")", "{", "$", "this", "->", "projectAnalyzers", "[", "]", "=", "$", "analyze...
{@inheritdoc}
[ "{" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/JsonGenerator.php#L83-L99
cauditor/php-analyzer
src/Analyzers/PDepend/JsonGenerator.php
JsonGenerator.close
public function close() { foreach ($this->artifacts as $artifact) { $artifact->accept($this); } $data = $this->getProjectMetrics(); $data += array('children' => $this->data); $json = json_encode($data); file_put_contents($this->logFile, $json); }
php
public function close() { foreach ($this->artifacts as $artifact) { $artifact->accept($this); } $data = $this->getProjectMetrics(); $data += array('children' => $this->data); $json = json_encode($data); file_put_contents($this->logFile, $json); }
[ "public", "function", "close", "(", ")", "{", "foreach", "(", "$", "this", "->", "artifacts", "as", "$", "artifact", ")", "{", "$", "artifact", "->", "accept", "(", "$", "this", ")", ";", "}", "$", "data", "=", "$", "this", "->", "getProjectMetrics",...
{@inheritdoc}
[ "{" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/JsonGenerator.php#L104-L115
cauditor/php-analyzer
src/Analyzers/PDepend/JsonGenerator.php
JsonGenerator.visitNamespace
public function visitNamespace(ASTNamespace $node) { $data = array(); $data['name'] = $node->getName(); $data += $this->getNodeMetrics($node, 'namespace'); $data['children'] = array(); $this->data[] = $data; // process classes, traits, interfaces in this namespace ...
php
public function visitNamespace(ASTNamespace $node) { $data = array(); $data['name'] = $node->getName(); $data += $this->getNodeMetrics($node, 'namespace'); $data['children'] = array(); $this->data[] = $data; // process classes, traits, interfaces in this namespace ...
[ "public", "function", "visitNamespace", "(", "ASTNamespace", "$", "node", ")", "{", "$", "data", "=", "array", "(", ")", ";", "$", "data", "[", "'name'", "]", "=", "$", "node", "->", "getName", "(", ")", ";", "$", "data", "+=", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/JsonGenerator.php#L153-L171
cauditor/php-analyzer
src/Analyzers/PDepend/JsonGenerator.php
JsonGenerator.visitFunction
public function visitFunction(ASTFunction $node) { $data = array(); $data['name'] = $node->getName(); $data += $this->getNodeMetrics($node, 'function'); $namespace = count($this->data) - 1; $this->data[$namespace]['children'][] = $data; }
php
public function visitFunction(ASTFunction $node) { $data = array(); $data['name'] = $node->getName(); $data += $this->getNodeMetrics($node, 'function'); $namespace = count($this->data) - 1; $this->data[$namespace]['children'][] = $data; }
[ "public", "function", "visitFunction", "(", "ASTFunction", "$", "node", ")", "{", "$", "data", "=", "array", "(", ")", ";", "$", "data", "[", "'name'", "]", "=", "$", "node", "->", "getName", "(", ")", ";", "$", "data", "+=", "$", "this", "->", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/JsonGenerator.php#L219-L227
cauditor/php-analyzer
src/Analyzers/PDepend/JsonGenerator.php
JsonGenerator.visitMethod
public function visitMethod(ASTMethod $node) { $data = array(); $data['name'] = $node->getName(); $data += $this->getNodeMetrics($node, 'function'); $namespace = count($this->data) - 1; $class = count($this->data[$namespace]['children']) - 1; $this->data[$namespace][...
php
public function visitMethod(ASTMethod $node) { $data = array(); $data['name'] = $node->getName(); $data += $this->getNodeMetrics($node, 'function'); $namespace = count($this->data) - 1; $class = count($this->data[$namespace]['children']) - 1; $this->data[$namespace][...
[ "public", "function", "visitMethod", "(", "ASTMethod", "$", "node", ")", "{", "$", "data", "=", "array", "(", ")", ";", "$", "data", "[", "'name'", "]", "=", "$", "node", "->", "getName", "(", ")", ";", "$", "data", "+=", "$", "this", "->", "getN...
{@inheritdoc}
[ "{" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/JsonGenerator.php#L232-L241
cauditor/php-analyzer
src/Analyzers/PDepend/JsonGenerator.php
JsonGenerator.getNodeMetrics
protected function getNodeMetrics(ASTArtifact $node, $type) { $metrics = array(); foreach ($this->nodeAnalyzers as $analyzer) { $metrics += $analyzer->getNodeMetrics($node); } return $this->normalizeMetrics($metrics, $type); }
php
protected function getNodeMetrics(ASTArtifact $node, $type) { $metrics = array(); foreach ($this->nodeAnalyzers as $analyzer) { $metrics += $analyzer->getNodeMetrics($node); } return $this->normalizeMetrics($metrics, $type); }
[ "protected", "function", "getNodeMetrics", "(", "ASTArtifact", "$", "node", ",", "$", "type", ")", "{", "$", "metrics", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "nodeAnalyzers", "as", "$", "analyzer", ")", "{", "$", "metrics", "+...
@param ASTArtifact $node @param string $type @return int[]
[ "@param", "ASTArtifact", "$node", "@param", "string", "$type" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/JsonGenerator.php#L262-L270
cauditor/php-analyzer
src/Analyzers/PDepend/JsonGenerator.php
JsonGenerator.normalizeMetrics
protected function normalizeMetrics(array $metrics, $type) { $result = array(); foreach ($this->metrics[$type] as $metric => $replacement) { $result[$replacement] = isset($metrics[$metric]) ? $metrics[$metric] : 0; } $result = $this->addInstability($result); fo...
php
protected function normalizeMetrics(array $metrics, $type) { $result = array(); foreach ($this->metrics[$type] as $metric => $replacement) { $result[$replacement] = isset($metrics[$metric]) ? $metrics[$metric] : 0; } $result = $this->addInstability($result); fo...
[ "protected", "function", "normalizeMetrics", "(", "array", "$", "metrics", ",", "$", "type", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "metrics", "[", "$", "type", "]", "as", "$", "metric", "=>", "$", ...
@param array $metrics @param string $type @return array
[ "@param", "array", "$metrics", "@param", "string", "$type" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/JsonGenerator.php#L278-L299
cauditor/php-analyzer
src/Analyzers/PDepend/JsonGenerator.php
JsonGenerator.addInstability
protected function addInstability(array $metrics) { if (isset($metrics['ca']) && isset($metrics['ce'])) { $metrics['i'] = $metrics['ce'] / (($metrics['ce'] + $metrics['ca']) ?: 1); } return $metrics; }
php
protected function addInstability(array $metrics) { if (isset($metrics['ca']) && isset($metrics['ce'])) { $metrics['i'] = $metrics['ce'] / (($metrics['ce'] + $metrics['ca']) ?: 1); } return $metrics; }
[ "protected", "function", "addInstability", "(", "array", "$", "metrics", ")", "{", "if", "(", "isset", "(", "$", "metrics", "[", "'ca'", "]", ")", "&&", "isset", "(", "$", "metrics", "[", "'ce'", "]", ")", ")", "{", "$", "metrics", "[", "'i'", "]",...
pdepend.analyzer.dependency also calculates instability, but not on a per-class level, and defaulting to 0 instead of 1. @param array $metrics @return array
[ "pdepend", ".", "analyzer", ".", "dependency", "also", "calculates", "instability", "but", "not", "on", "a", "per", "-", "class", "level", "and", "defaulting", "to", "0", "instead", "of", "1", "." ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Analyzers/PDepend/JsonGenerator.php#L309-L316
mamuz/MamuzBlog
src/MamuzBlog/View/Helper/AbstractPagerFactory.php
AbstractPagerFactory.createService
public function createService(ServiceLocatorInterface $serviceLocator) { if ($serviceLocator instanceof ServiceLocatorAwareInterface) { $serviceLocator = $serviceLocator->getServiceLocator(); } $this->rangeConfig = $this->getPaginationRangeConfigBy($serviceLocator); retu...
php
public function createService(ServiceLocatorInterface $serviceLocator) { if ($serviceLocator instanceof ServiceLocatorAwareInterface) { $serviceLocator = $serviceLocator->getServiceLocator(); } $this->rangeConfig = $this->getPaginationRangeConfigBy($serviceLocator); retu...
[ "public", "function", "createService", "(", "ServiceLocatorInterface", "$", "serviceLocator", ")", "{", "if", "(", "$", "serviceLocator", "instanceof", "ServiceLocatorAwareInterface", ")", "{", "$", "serviceLocator", "=", "$", "serviceLocator", "->", "getServiceLocator"...
{@inheritdoc} @return \Zend\View\Helper\HelperInterface
[ "{" ]
train
https://github.com/mamuz/MamuzBlog/blob/cb43be5c39031e3dcc939283e284824c4d07da38/src/MamuzBlog/View/Helper/AbstractPagerFactory.php#L21-L29
mimmi20/Wurfl
src/Storage/Storage.php
Storage.save
public function save($objectId, $object, $expiration = null) { if (null !== $expiration) { $this->adapter->setExpiration($expiration); } return $this->adapter->setItem($objectId, $object); }
php
public function save($objectId, $object, $expiration = null) { if (null !== $expiration) { $this->adapter->setExpiration($expiration); } return $this->adapter->setItem($objectId, $object); }
[ "public", "function", "save", "(", "$", "objectId", ",", "$", "object", ",", "$", "expiration", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "expiration", ")", "{", "$", "this", "->", "adapter", "->", "setExpiration", "(", "$", "expiration", ...
Saves the object @param string $objectId @param mixed $object @param int $expiration If supported by the provider, this is used to specify the expiration @return bool
[ "Saves", "the", "object" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Storage/Storage.php#L75-L82
mimmi20/Wurfl
src/Storage/Storage.php
Storage.load
public function load($objectId) { $success = null; $value = $this->adapter->getItem($objectId, $success); if ($success) { return $value; } return null; }
php
public function load($objectId) { $success = null; $value = $this->adapter->getItem($objectId, $success); if ($success) { return $value; } return null; }
[ "public", "function", "load", "(", "$", "objectId", ")", "{", "$", "success", "=", "null", ";", "$", "value", "=", "$", "this", "->", "adapter", "->", "getItem", "(", "$", "objectId", ",", "$", "success", ")", ";", "if", "(", "$", "success", ")", ...
Returns the object identified by $objectId @param string $objectId @return mixed value
[ "Returns", "the", "object", "identified", "by", "$objectId" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Storage/Storage.php#L91-L101
mimmi20/Wurfl
src/Storage/Storage.php
Storage.acquireLock
public function acquireLock() { if ($this->adapter->hasItem(self::WURFL_LOCKED)) { return false; } return $this->save(self::WURFL_LOCKED, true); }
php
public function acquireLock() { if ($this->adapter->hasItem(self::WURFL_LOCKED)) { return false; } return $this->save(self::WURFL_LOCKED, true); }
[ "public", "function", "acquireLock", "(", ")", "{", "if", "(", "$", "this", "->", "adapter", "->", "hasItem", "(", "self", "::", "WURFL_LOCKED", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "save", "(", "self", "::", "WURF...
Acquires a lock so only this thread reloads the WURFL data, returns false if it cannot be acquired @return bool
[ "Acquires", "a", "lock", "so", "only", "this", "thread", "reloads", "the", "WURFL", "data", "returns", "false", "if", "it", "cannot", "be", "acquired" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Storage/Storage.php#L150-L157
PandaPlatform/framework
src/Panda/Views/Viewer.php
Viewer.load
public function load($name, $extension = 'html') { // Get view file path $this->view = $this->getViewFilePath($name, $extension); // Check if there is a valid view if (empty($this->view)) { throw new InvalidArgumentException(__METHOD__ . sprintf(': The view file [%s] is ...
php
public function load($name, $extension = 'html') { // Get view file path $this->view = $this->getViewFilePath($name, $extension); // Check if there is a valid view if (empty($this->view)) { throw new InvalidArgumentException(__METHOD__ . sprintf(': The view file [%s] is ...
[ "public", "function", "load", "(", "$", "name", ",", "$", "extension", "=", "'html'", ")", "{", "// Get view file path", "$", "this", "->", "view", "=", "$", "this", "->", "getViewFilePath", "(", "$", "name", ",", "$", "extension", ")", ";", "// Check if...
Load a view. @param string $name @param string $extension @return $this @throws InvalidArgumentException
[ "Load", "a", "view", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Views/Viewer.php#L84-L95
PandaPlatform/framework
src/Panda/Views/Viewer.php
Viewer.render
public function render() { // Check if there is a valid view if (empty($this->view)) { throw new InvalidArgumentException(__METHOD__ . ': The view file given is a not valid view.'); } // Load the view file $this->output = $this->executable ? include $this->view :...
php
public function render() { // Check if there is a valid view if (empty($this->view)) { throw new InvalidArgumentException(__METHOD__ . ': The view file given is a not valid view.'); } // Load the view file $this->output = $this->executable ? include $this->view :...
[ "public", "function", "render", "(", ")", "{", "// Check if there is a valid view", "if", "(", "empty", "(", "$", "this", "->", "view", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "__METHOD__", ".", "': The view file given is a not valid view.'", ...
Render the view output. @return $this @throws InvalidArgumentException
[ "Render", "the", "view", "output", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Views/Viewer.php#L103-L117
PandaPlatform/framework
src/Panda/Views/Viewer.php
Viewer.getViewFolder
private function getViewFolder($name) { return $this->viewsConfiguration->getViewsPath($this->app->getBasePath()) . DIRECTORY_SEPARATOR . $name . '.view'; }
php
private function getViewFolder($name) { return $this->viewsConfiguration->getViewsPath($this->app->getBasePath()) . DIRECTORY_SEPARATOR . $name . '.view'; }
[ "private", "function", "getViewFolder", "(", "$", "name", ")", "{", "return", "$", "this", "->", "viewsConfiguration", "->", "getViewsPath", "(", "$", "this", "->", "app", "->", "getBasePath", "(", ")", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "name", "....
Get the view's base folder. @param string $name @return string
[ "Get", "the", "view", "s", "base", "folder", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Views/Viewer.php#L152-L155
PandaPlatform/framework
src/Panda/Views/Viewer.php
Viewer.getViewFile
private function getViewFile($name, $extension = 'html') { return $this->viewsConfiguration->getViewsPath($this->app->getBasePath()) . DIRECTORY_SEPARATOR . $name . '.' . $extension; }
php
private function getViewFile($name, $extension = 'html') { return $this->viewsConfiguration->getViewsPath($this->app->getBasePath()) . DIRECTORY_SEPARATOR . $name . '.' . $extension; }
[ "private", "function", "getViewFile", "(", "$", "name", ",", "$", "extension", "=", "'html'", ")", "{", "return", "$", "this", "->", "viewsConfiguration", "->", "getViewsPath", "(", "$", "this", "->", "app", "->", "getBasePath", "(", ")", ")", ".", "DIRE...
@param string $name @param string $extension @return string
[ "@param", "string", "$name", "@param", "string", "$extension" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Views/Viewer.php#L163-L166
PandaPlatform/framework
src/Panda/Views/Viewer.php
Viewer.getViewFilePath
private function getViewFilePath($name, $extension = 'html') { // Check view file $viewFile = $this->getViewFile($name, $extension); if (!file_exists($viewFile)) { // Check for view folder $viewBaseName = $this->getViewFolder($name) . DIRECTORY_SEPARATOR . 'view'; ...
php
private function getViewFilePath($name, $extension = 'html') { // Check view file $viewFile = $this->getViewFile($name, $extension); if (!file_exists($viewFile)) { // Check for view folder $viewBaseName = $this->getViewFolder($name) . DIRECTORY_SEPARATOR . 'view'; ...
[ "private", "function", "getViewFilePath", "(", "$", "name", ",", "$", "extension", "=", "'html'", ")", "{", "// Check view file", "$", "viewFile", "=", "$", "this", "->", "getViewFile", "(", "$", "name", ",", "$", "extension", ")", ";", "if", "(", "!", ...
Get the view file to be rendered for output. @param string $name @param string $extension @return null|string
[ "Get", "the", "view", "file", "to", "be", "rendered", "for", "output", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Views/Viewer.php#L176-L195
spryker/category-data-import
src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php
CategoryWriterStep.execute
public function execute(DataSetInterface $dataSet) { $categoryEntity = $this->findOrCreateCategory($dataSet); $this->findOrCreateAttributes($categoryEntity, $dataSet); $categoryNodeEntity = $this->findOrCreateNode($categoryEntity, $dataSet); $this->categoryReader->addCategory($categ...
php
public function execute(DataSetInterface $dataSet) { $categoryEntity = $this->findOrCreateCategory($dataSet); $this->findOrCreateAttributes($categoryEntity, $dataSet); $categoryNodeEntity = $this->findOrCreateNode($categoryEntity, $dataSet); $this->categoryReader->addCategory($categ...
[ "public", "function", "execute", "(", "DataSetInterface", "$", "dataSet", ")", "{", "$", "categoryEntity", "=", "$", "this", "->", "findOrCreateCategory", "(", "$", "dataSet", ")", ";", "$", "this", "->", "findOrCreateAttributes", "(", "$", "categoryEntity", "...
@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @return void
[ "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ]
train
https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php#L63-L70
spryker/category-data-import
src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php
CategoryWriterStep.findOrCreateCategory
protected function findOrCreateCategory(DataSetInterface $dataSet) { $categoryEntity = SpyCategoryQuery::create() ->filterByCategoryKey($dataSet[static::KEY_CATEGORY_KEY]) ->findOneOrCreate(); $categoryEntity->fromArray($dataSet->getArrayCopy()); if (!empty($dataSet...
php
protected function findOrCreateCategory(DataSetInterface $dataSet) { $categoryEntity = SpyCategoryQuery::create() ->filterByCategoryKey($dataSet[static::KEY_CATEGORY_KEY]) ->findOneOrCreate(); $categoryEntity->fromArray($dataSet->getArrayCopy()); if (!empty($dataSet...
[ "protected", "function", "findOrCreateCategory", "(", "DataSetInterface", "$", "dataSet", ")", "{", "$", "categoryEntity", "=", "SpyCategoryQuery", "::", "create", "(", ")", "->", "filterByCategoryKey", "(", "$", "dataSet", "[", "static", "::", "KEY_CATEGORY_KEY", ...
@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @return \Orm\Zed\Category\Persistence\SpyCategory
[ "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ]
train
https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php#L77-L95
spryker/category-data-import
src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php
CategoryWriterStep.findOrCreateAttributes
protected function findOrCreateAttributes(SpyCategory $categoryEntity, DataSetInterface $dataSet) { $localizedAttributeCollection = $dataSet[LocalizedAttributesExtractorStep::KEY_LOCALIZED_ATTRIBUTES]; foreach ($localizedAttributeCollection as $idLocale => $localizedAttributes) { $catego...
php
protected function findOrCreateAttributes(SpyCategory $categoryEntity, DataSetInterface $dataSet) { $localizedAttributeCollection = $dataSet[LocalizedAttributesExtractorStep::KEY_LOCALIZED_ATTRIBUTES]; foreach ($localizedAttributeCollection as $idLocale => $localizedAttributes) { $catego...
[ "protected", "function", "findOrCreateAttributes", "(", "SpyCategory", "$", "categoryEntity", ",", "DataSetInterface", "$", "dataSet", ")", "{", "$", "localizedAttributeCollection", "=", "$", "dataSet", "[", "LocalizedAttributesExtractorStep", "::", "KEY_LOCALIZED_ATTRIBUTE...
@param \Orm\Zed\Category\Persistence\SpyCategory $categoryEntity @param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @return void
[ "@param", "\\", "Orm", "\\", "Zed", "\\", "Category", "\\", "Persistence", "\\", "SpyCategory", "$categoryEntity", "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ...
train
https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php#L103-L118
spryker/category-data-import
src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php
CategoryWriterStep.findOrCreateNode
protected function findOrCreateNode(SpyCategory $categoryEntity, DataSetInterface $dataSet) { $categoryNodeEntity = SpyCategoryNodeQuery::create() ->filterByCategory($categoryEntity) ->findOneOrCreate(); if (!empty($dataSet[static::KEY_PARENT_CATEGORY_KEY])) { $i...
php
protected function findOrCreateNode(SpyCategory $categoryEntity, DataSetInterface $dataSet) { $categoryNodeEntity = SpyCategoryNodeQuery::create() ->filterByCategory($categoryEntity) ->findOneOrCreate(); if (!empty($dataSet[static::KEY_PARENT_CATEGORY_KEY])) { $i...
[ "protected", "function", "findOrCreateNode", "(", "SpyCategory", "$", "categoryEntity", ",", "DataSetInterface", "$", "dataSet", ")", "{", "$", "categoryNodeEntity", "=", "SpyCategoryNodeQuery", "::", "create", "(", ")", "->", "filterByCategory", "(", "$", "category...
@param \Orm\Zed\Category\Persistence\SpyCategory $categoryEntity @param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @return \Orm\Zed\Category\Persistence\SpyCategoryNode
[ "@param", "\\", "Orm", "\\", "Zed", "\\", "Category", "\\", "Persistence", "\\", "SpyCategory", "$categoryEntity", "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ...
train
https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php#L126-L185
spryker/category-data-import
src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php
CategoryWriterStep.getLanguageIdentifier
protected function getLanguageIdentifier($idLocale, DataSetInterface $dataSet) { foreach ($dataSet[AddLocalesStep::KEY_LOCALES] as $localeName => $localeId) { if ($idLocale === $localeId) { return mb_substr($localeName, 0, 2); } } throw new Exception(...
php
protected function getLanguageIdentifier($idLocale, DataSetInterface $dataSet) { foreach ($dataSet[AddLocalesStep::KEY_LOCALES] as $localeName => $localeId) { if ($idLocale === $localeId) { return mb_substr($localeName, 0, 2); } } throw new Exception(...
[ "protected", "function", "getLanguageIdentifier", "(", "$", "idLocale", ",", "DataSetInterface", "$", "dataSet", ")", "{", "foreach", "(", "$", "dataSet", "[", "AddLocalesStep", "::", "KEY_LOCALES", "]", "as", "$", "localeName", "=>", "$", "localeId", ")", "{"...
@param int $idLocale @param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @throws \Exception @return string
[ "@param", "int", "$idLocale", "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ]
train
https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php#L195-L204
spryker/category-data-import
src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php
CategoryWriterStep.addToClosureTable
protected function addToClosureTable(SpyCategoryNode $categoryNodeEntity) { if ($categoryNodeEntity->getFkParentCategoryNode() !== null) { $categoryClosureEntityCollection = SpyCategoryClosureTableQuery::create() ->findByFkCategoryNodeDescendant($categoryNodeEntity->getFkParentCa...
php
protected function addToClosureTable(SpyCategoryNode $categoryNodeEntity) { if ($categoryNodeEntity->getFkParentCategoryNode() !== null) { $categoryClosureEntityCollection = SpyCategoryClosureTableQuery::create() ->findByFkCategoryNodeDescendant($categoryNodeEntity->getFkParentCa...
[ "protected", "function", "addToClosureTable", "(", "SpyCategoryNode", "$", "categoryNodeEntity", ")", "{", "if", "(", "$", "categoryNodeEntity", "->", "getFkParentCategoryNode", "(", ")", "!==", "null", ")", "{", "$", "categoryClosureEntityCollection", "=", "SpyCatego...
@param \Orm\Zed\Category\Persistence\SpyCategoryNode $categoryNodeEntity @return void
[ "@param", "\\", "Orm", "\\", "Zed", "\\", "Category", "\\", "Persistence", "\\", "SpyCategoryNode", "$categoryNodeEntity" ]
train
https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php#L211-L243
spryker/category-data-import
src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php
CategoryWriterStep.getCategoryTemplate
protected function getCategoryTemplate(DataSetInterface $dataSet): SpyCategoryTemplate { $categoryTemplateEntity = SpyCategoryTemplateQuery::create()->findOneByName($dataSet[static::KEY_TEMPLATE_NAME]); if (!$categoryTemplateEntity) { throw new CategoryTemplateNotFoundException(sprintf('...
php
protected function getCategoryTemplate(DataSetInterface $dataSet): SpyCategoryTemplate { $categoryTemplateEntity = SpyCategoryTemplateQuery::create()->findOneByName($dataSet[static::KEY_TEMPLATE_NAME]); if (!$categoryTemplateEntity) { throw new CategoryTemplateNotFoundException(sprintf('...
[ "protected", "function", "getCategoryTemplate", "(", "DataSetInterface", "$", "dataSet", ")", ":", "SpyCategoryTemplate", "{", "$", "categoryTemplateEntity", "=", "SpyCategoryTemplateQuery", "::", "create", "(", ")", "->", "findOneByName", "(", "$", "dataSet", "[", ...
@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @throws \Spryker\Zed\CategoryDataImport\Business\Exception\CategoryTemplateNotFoundException @return \Orm\Zed\Category\Persistence\SpyCategoryTemplate
[ "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ]
train
https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/CategoryWriterStep.php#L252-L260
joomla-projects/jorobo
src/Tasks/Map.php
Map.run
public function run() { $this->say('Mapping ' . $this->getJConfig()->extension . " to " . $this->target); $this->say('OS: ' . $this->getOs() . " | Basedir: " . $this->getSourceFolder()); if (!$this->checkFolders()) { return false; } $dirHandle = opendir($this->getSourceFolder()); // Get all main di...
php
public function run() { $this->say('Mapping ' . $this->getJConfig()->extension . " to " . $this->target); $this->say('OS: ' . $this->getOs() . " | Basedir: " . $this->getSourceFolder()); if (!$this->checkFolders()) { return false; } $dirHandle = opendir($this->getSourceFolder()); // Get all main di...
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "say", "(", "'Mapping '", ".", "$", "this", "->", "getJConfig", "(", ")", "->", "extension", ".", "\" to \"", ".", "$", "this", "->", "target", ")", ";", "$", "this", "->", "say", "(", ...
Maps all parts of an extension into a Joomla! installation @return bool @since 1.0
[ "Maps", "all", "parts", "of", "an", "extension", "into", "a", "Joomla!", "installation" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Map.php#L65-L102
joomla-projects/jorobo
src/Tasks/Map.php
Map.processAdministrator
private function processAdministrator() { $sourceFolder = $this->getSourceFolder(); $this->processComponents($sourceFolder . '/administrator/components', $this->target . '/administrator'); $this->processLanguage($sourceFolder . '/administrator/language', $this->target . '/administrator'); $this->processModules...
php
private function processAdministrator() { $sourceFolder = $this->getSourceFolder(); $this->processComponents($sourceFolder . '/administrator/components', $this->target . '/administrator'); $this->processLanguage($sourceFolder . '/administrator/language', $this->target . '/administrator'); $this->processModules...
[ "private", "function", "processAdministrator", "(", ")", "{", "$", "sourceFolder", "=", "$", "this", "->", "getSourceFolder", "(", ")", ";", "$", "this", "->", "processComponents", "(", "$", "sourceFolder", ".", "'/administrator/components'", ",", "$", "this", ...
Process Administrator files @return void @since 1.0
[ "Process", "Administrator", "files" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Map.php#L111-L117
joomla-projects/jorobo
src/Tasks/Map.php
Map.processComponents
private function processComponents($src, $to) { // Component directory if (is_dir($src)) { $dirHandle = opendir($src); while (false !== ($element = readdir($dirHandle))) { if (false !== strpos($element, 'com_')) { $this->symlink($src . '/' . $element, $to . '/components/' . $element); ...
php
private function processComponents($src, $to) { // Component directory if (is_dir($src)) { $dirHandle = opendir($src); while (false !== ($element = readdir($dirHandle))) { if (false !== strpos($element, 'com_')) { $this->symlink($src . '/' . $element, $to . '/components/' . $element); ...
[ "private", "function", "processComponents", "(", "$", "src", ",", "$", "to", ")", "{", "// Component directory", "if", "(", "is_dir", "(", "$", "src", ")", ")", "{", "$", "dirHandle", "=", "opendir", "(", "$", "src", ")", ";", "while", "(", "false", ...
Process components @param String $src - The source @param String $to - The target @return void @since 1.0
[ "Process", "components" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Map.php#L130-L145
joomla-projects/jorobo
src/Tasks/Map.php
Map.processLanguage
private function processLanguage($src, $toDir) { if (is_dir($src)) { $dirHandle = opendir($src); while (false !== ($element = readdir($dirHandle))) { if (substr($element, 0, 1) != '.') { if (is_dir($src . "/" . $element)) { $langDirHandle = opendir($src . '/' . $element); w...
php
private function processLanguage($src, $toDir) { if (is_dir($src)) { $dirHandle = opendir($src); while (false !== ($element = readdir($dirHandle))) { if (substr($element, 0, 1) != '.') { if (is_dir($src . "/" . $element)) { $langDirHandle = opendir($src . '/' . $element); w...
[ "private", "function", "processLanguage", "(", "$", "src", ",", "$", "toDir", ")", "{", "if", "(", "is_dir", "(", "$", "src", ")", ")", "{", "$", "dirHandle", "=", "opendir", "(", "$", "src", ")", ";", "while", "(", "false", "!==", "(", "$", "ele...
Process components @param String $toDir - The target @return void @since 1.0
[ "Process", "components" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Map.php#L156-L183
joomla-projects/jorobo
src/Tasks/Map.php
Map.linkSubdirectories
private function linkSubdirectories($src, $to) { if (is_dir($src)) { $dirHandle = opendir($src); while (false !== ($element = readdir($dirHandle))) { if (substr($element, 0, 1) != '.') { if (is_dir($src . "/" . $element)) { $this->symlink($src . "/" . $element, $to . '/' . $elemen...
php
private function linkSubdirectories($src, $to) { if (is_dir($src)) { $dirHandle = opendir($src); while (false !== ($element = readdir($dirHandle))) { if (substr($element, 0, 1) != '.') { if (is_dir($src . "/" . $element)) { $this->symlink($src . "/" . $element, $to . '/' . $elemen...
[ "private", "function", "linkSubdirectories", "(", "$", "src", ",", "$", "to", ")", "{", "if", "(", "is_dir", "(", "$", "src", ")", ")", "{", "$", "dirHandle", "=", "opendir", "(", "$", "src", ")", ";", "while", "(", "false", "!==", "(", "$", "ele...
Link subdirectories into folder @param string $src The source @param string $to The target @return void @since 1.0
[ "Link", "subdirectories", "into", "folder" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Map.php#L223-L240
joomla-projects/jorobo
src/Tasks/Map.php
Map.processPlugins
private function processPlugins($src, $toDir) { // Plugin folder /plugins if (is_dir($src)) { $dirHandle = opendir($src); while (false !== ($type = readdir($dirHandle))) { if (substr($type, 0, 1) != '.') { if (is_dir($src . "/" . $type)) { $this->linkSubdirectories($src . "/" . ...
php
private function processPlugins($src, $toDir) { // Plugin folder /plugins if (is_dir($src)) { $dirHandle = opendir($src); while (false !== ($type = readdir($dirHandle))) { if (substr($type, 0, 1) != '.') { if (is_dir($src . "/" . $type)) { $this->linkSubdirectories($src . "/" . ...
[ "private", "function", "processPlugins", "(", "$", "src", ",", "$", "toDir", ")", "{", "// Plugin folder /plugins", "if", "(", "is_dir", "(", "$", "src", ")", ")", "{", "$", "dirHandle", "=", "opendir", "(", "$", "src", ")", ";", "while", "(", "false",...
Process Plugins @param String $toDir - The target @return void @since 1.0
[ "Process", "Plugins" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Map.php#L280-L298
joomla-projects/jorobo
src/Tasks/Map.php
Map.mapDir
private function mapDir($type, $toDir) { // Check if dir exists if (is_dir($this->getSourceFolder())) { $dirHandle = opendir($this->getSourceFolder()); while (false !== ($element = readdir($dirHandle))) { if (substr($element, 0, 1) != '.') { $this->symlink($this->getSourceFolder() . '/' . ...
php
private function mapDir($type, $toDir) { // Check if dir exists if (is_dir($this->getSourceFolder())) { $dirHandle = opendir($this->getSourceFolder()); while (false !== ($element = readdir($dirHandle))) { if (substr($element, 0, 1) != '.') { $this->symlink($this->getSourceFolder() . '/' . ...
[ "private", "function", "mapDir", "(", "$", "type", ",", "$", "toDir", ")", "{", "// Check if dir exists", "if", "(", "is_dir", "(", "$", "this", "->", "getSourceFolder", "(", ")", ")", ")", "{", "$", "dirHandle", "=", "opendir", "(", "$", "this", "->",...
Process components @param String $type - The type @param String $toDir - The target @return void @since 1.0
[ "Process", "components" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Map.php#L310-L325
joomla-projects/jorobo
src/Tasks/Map.php
Map.symlink
private function symlink($source, $target) { if (file_exists($target)) { if (is_dir($target)) { $this->_deleteDir($target); } else { unlink($target); } } try { $this->taskFileSystemStack() ->symlink($source, $target) ->run(); } catch (Exception $e) { $this->say(...
php
private function symlink($source, $target) { if (file_exists($target)) { if (is_dir($target)) { $this->_deleteDir($target); } else { unlink($target); } } try { $this->taskFileSystemStack() ->symlink($source, $target) ->run(); } catch (Exception $e) { $this->say(...
[ "private", "function", "symlink", "(", "$", "source", ",", "$", "target", ")", "{", "if", "(", "file_exists", "(", "$", "target", ")", ")", "{", "if", "(", "is_dir", "(", "$", "target", ")", ")", "{", "$", "this", "->", "_deleteDir", "(", "$", "t...
Symlinks files / folders @param String $source - The source @param String $target - The target @return void @since 1.0
[ "Symlinks", "files", "/", "folders" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Map.php#L337-L361
joomla-projects/jorobo
src/Tasks/Build/Component.php
Component.run
public function run() { $this->say('Building component'); // Analyze extension structure $this->analyze(); // Prepare directories $this->prepareDirectories(); if ($this->hasAdmin) { $adminFiles = $this->copyTarget($this->adminPath, $this->getBuildFolder() . "/administrator/components/com_" . $this-...
php
public function run() { $this->say('Building component'); // Analyze extension structure $this->analyze(); // Prepare directories $this->prepareDirectories(); if ($this->hasAdmin) { $adminFiles = $this->copyTarget($this->adminPath, $this->getBuildFolder() . "/administrator/components/com_" . $this-...
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "say", "(", "'Building component'", ")", ";", "// Analyze extension structure", "$", "this", "->", "analyze", "(", ")", ";", "// Prepare directories", "$", "this", "->", "prepareDirectories", "(", ...
Build the package @return bool @since 1.0
[ "Build", "the", "package" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Component.php#L66-L129
joomla-projects/jorobo
src/Tasks/Build/Component.php
Component.analyze
private function analyze() { if (!file_exists($this->adminPath)) { $this->hasAdmin = false; } if (!file_exists($this->frontPath)) { $this->hasFront = false; } if (!file_exists($this->sourceFolder . "/cli")) { $this->hasCli = false; } if (file_exists($this->sourceFolder . "/media")) { ...
php
private function analyze() { if (!file_exists($this->adminPath)) { $this->hasAdmin = false; } if (!file_exists($this->frontPath)) { $this->hasFront = false; } if (!file_exists($this->sourceFolder . "/cli")) { $this->hasCli = false; } if (file_exists($this->sourceFolder . "/media")) { ...
[ "private", "function", "analyze", "(", ")", "{", "if", "(", "!", "file_exists", "(", "$", "this", "->", "adminPath", ")", ")", "{", "$", "this", "->", "hasAdmin", "=", "false", ";", "}", "if", "(", "!", "file_exists", "(", "$", "this", "->", "front...
Analyze the component structure @return void @since 1.0
[ "Analyze", "the", "component", "structure" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Component.php#L138-L159
joomla-projects/jorobo
src/Tasks/Build/Component.php
Component.createInstaller
private function createInstaller() { $this->say("Creating component installer"); $adminFolder = $this->getBuildFolder() . "/administrator/components/com_" . $this->getExtensionName(); $xmlFile = $adminFolder . "/" . $this->getExtensionName() . ".xml"; $configFile = $adminFolder . "/config.xml"; $script...
php
private function createInstaller() { $this->say("Creating component installer"); $adminFolder = $this->getBuildFolder() . "/administrator/components/com_" . $this->getExtensionName(); $xmlFile = $adminFolder . "/" . $this->getExtensionName() . ".xml"; $configFile = $adminFolder . "/config.xml"; $script...
[ "private", "function", "createInstaller", "(", ")", "{", "$", "this", "->", "say", "(", "\"Creating component installer\"", ")", ";", "$", "adminFolder", "=", "$", "this", "->", "getBuildFolder", "(", ")", ".", "\"/administrator/components/com_\"", ".", "$", "th...
Generate the installer xml file for the component @return void @since 1.0
[ "Generate", "the", "installer", "xml", "file", "for", "the", "component" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Component.php#L188-L251
fostam/php-getopts
src/Config/Argument.php
Argument.required
public function required() { $this->validated = false; $this->config[self::REQUIRED] = true; return $this; }
php
public function required() { $this->validated = false; $this->config[self::REQUIRED] = true; return $this; }
[ "public", "function", "required", "(", ")", "{", "$", "this", "->", "validated", "=", "false", ";", "$", "this", "->", "config", "[", "self", "::", "REQUIRED", "]", "=", "true", ";", "return", "$", "this", ";", "}" ]
change the argument from optional to mandatory @return $this
[ "change", "the", "argument", "from", "optional", "to", "mandatory" ]
train
https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Argument.php#L40-L44
fostam/php-getopts
src/Config/Argument.php
Argument.name
public function name($name) { $this->config[self::NAME] = $name; if (!self::validateName($name)) { throw new ArgumentConfigException('illegal characters in name: ' . $name); } return $this; }
php
public function name($name) { $this->config[self::NAME] = $name; if (!self::validateName($name)) { throw new ArgumentConfigException('illegal characters in name: ' . $name); } return $this; }
[ "public", "function", "name", "(", "$", "name", ")", "{", "$", "this", "->", "config", "[", "self", "::", "NAME", "]", "=", "$", "name", ";", "if", "(", "!", "self", "::", "validateName", "(", "$", "name", ")", ")", "{", "throw", "new", "Argument...
set the argument's name @param string $name @return $this
[ "set", "the", "argument", "s", "name" ]
train
https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Argument.php#L52-L58
fostam/php-getopts
src/Config/Argument.php
Argument.multiple
public function multiple() { $this->validated = false; $this->config[self::MULTIPLE] = true; return $this; }
php
public function multiple() { $this->validated = false; $this->config[self::MULTIPLE] = true; return $this; }
[ "public", "function", "multiple", "(", ")", "{", "$", "this", "->", "validated", "=", "false", ";", "$", "this", "->", "config", "[", "self", "::", "MULTIPLE", "]", "=", "true", ";", "return", "$", "this", ";", "}" ]
allow the argument to be given multiple times (only valid for the last argument) @return $this
[ "allow", "the", "argument", "to", "be", "given", "multiple", "times", "(", "only", "valid", "for", "the", "last", "argument", ")" ]
train
https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Argument.php#L65-L69
fostam/php-getopts
src/Config/Argument.php
Argument.defaultValue
public function defaultValue($value) { $this->validated = false; $this->config[self::DEFAULT_VALUE] = $value; return $this; }
php
public function defaultValue($value) { $this->validated = false; $this->config[self::DEFAULT_VALUE] = $value; return $this; }
[ "public", "function", "defaultValue", "(", "$", "value", ")", "{", "$", "this", "->", "validated", "=", "false", ";", "$", "this", "->", "config", "[", "self", "::", "DEFAULT_VALUE", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
set the argument's default value @param mixed $value @return $this
[ "set", "the", "argument", "s", "default", "value" ]
train
https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Argument.php#L77-L81
fostam/php-getopts
src/Config/Argument.php
Argument.get
public function get($param = '') { $this->validate(); if ($param) { if (array_key_exists($param, $this->config)) { return $this->config[$param]; } else { throw new ArgumentConfigException('argument param not valid: ' . $param);...
php
public function get($param = '') { $this->validate(); if ($param) { if (array_key_exists($param, $this->config)) { return $this->config[$param]; } else { throw new ArgumentConfigException('argument param not valid: ' . $param);...
[ "public", "function", "get", "(", "$", "param", "=", "''", ")", "{", "$", "this", "->", "validate", "(", ")", ";", "if", "(", "$", "param", ")", "{", "if", "(", "array_key_exists", "(", "$", "param", ",", "$", "this", "->", "config", ")", ")", ...
return full argument configuration, or a specific parameter of the configuration @param string $param @return mixed @throws ArgumentConfigException
[ "return", "full", "argument", "configuration", "or", "a", "specific", "parameter", "of", "the", "configuration" ]
train
https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Config/Argument.php#L101-L114
eloquent/constance
src/AbstractConstant.php
AbstractConstant.membersToBitmask
final public static function membersToBitmask($members) { $mask = 0; foreach ($members as $member) { if (!is_integer($member->value())) { throw new Exception\NonIntegerValueException($member->value()); } $mask |= $member->value(); } ...
php
final public static function membersToBitmask($members) { $mask = 0; foreach ($members as $member) { if (!is_integer($member->value())) { throw new Exception\NonIntegerValueException($member->value()); } $mask |= $member->value(); } ...
[ "final", "public", "static", "function", "membersToBitmask", "(", "$", "members", ")", "{", "$", "mask", "=", "0", ";", "foreach", "(", "$", "members", "as", "$", "member", ")", "{", "if", "(", "!", "is_integer", "(", "$", "member", "->", "value", "(...
Generates a bitmask representing the suppled members. @param mixed<ConstantInterface> $members The members to create a bitmask for. @return integer The bitmask representing the supplied members. @throws Exception\NonIntegerValueException If any member's value is a non-integer.
[ "Generates", "a", "bitmask", "representing", "the", "suppled", "members", "." ]
train
https://github.com/eloquent/constance/blob/4af52e02bb4b074201003b952bb0269cd9e536d5/src/AbstractConstant.php#L70-L82
eloquent/constance
src/AbstractConstant.php
AbstractConstant.valueMatchesBitmask
public function valueMatchesBitmask($mask) { if (!is_integer($this->value())) { throw new Exception\NonIntegerValueException($this->value()); } return $this->value() === ($this->value() & $mask); }
php
public function valueMatchesBitmask($mask) { if (!is_integer($this->value())) { throw new Exception\NonIntegerValueException($this->value()); } return $this->value() === ($this->value() & $mask); }
[ "public", "function", "valueMatchesBitmask", "(", "$", "mask", ")", "{", "if", "(", "!", "is_integer", "(", "$", "this", "->", "value", "(", ")", ")", ")", "{", "throw", "new", "Exception", "\\", "NonIntegerValueException", "(", "$", "this", "->", "value...
Returns true if this constant's value matches the supplied bitmask. @param integer $mask The mask to test against. @return boolean True if the value matches. @throws Exception\NonIntegerValueException If this constant's value is not an integer.
[ "Returns", "true", "if", "this", "constant", "s", "value", "matches", "the", "supplied", "bitmask", "." ]
train
https://github.com/eloquent/constance/blob/4af52e02bb4b074201003b952bb0269cd9e536d5/src/AbstractConstant.php#L102-L109
middlewares/base-path-router
src/BasePathRouter.php
BasePathRouter.process
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $requestPath = $this->getNormalizedPath($request); foreach ($this->middlewares as $pathPrefix => $middleware) { if (strpos($requestPath, $pathPrefix) === 0) { ...
php
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $requestPath = $this->getNormalizedPath($request); foreach ($this->middlewares as $pathPrefix => $middleware) { if (strpos($requestPath, $pathPrefix) === 0) { ...
[ "public", "function", "process", "(", "ServerRequestInterface", "$", "request", ",", "RequestHandlerInterface", "$", "handler", ")", ":", "ResponseInterface", "{", "$", "requestPath", "=", "$", "this", "->", "getNormalizedPath", "(", "$", "request", ")", ";", "f...
Process a server request and return a response.
[ "Process", "a", "server", "request", "and", "return", "a", "response", "." ]
train
https://github.com/middlewares/base-path-router/blob/2d05ed3036374a7788e9f08958cfee55517b4995/src/BasePathRouter.php#L93-L111
ssnepenthe/soter
src/class-button-extension.php
Button_Extension.render
protected function render( $text, $url, $color = 'blue' ) { if ( ! in_array( $color, [ 'blue', 'green', 'red' ], true ) ) { $color = 'blue'; } return $this->engine->render( 'emails/components/button.php', compact( 'text', 'url', 'color' ) ); }
php
protected function render( $text, $url, $color = 'blue' ) { if ( ! in_array( $color, [ 'blue', 'green', 'red' ], true ) ) { $color = 'blue'; } return $this->engine->render( 'emails/components/button.php', compact( 'text', 'url', 'color' ) ); }
[ "protected", "function", "render", "(", "$", "text", ",", "$", "url", ",", "$", "color", "=", "'blue'", ")", "{", "if", "(", "!", "in_array", "(", "$", "color", ",", "[", "'blue'", ",", "'green'", ",", "'red'", "]", ",", "true", ")", ")", "{", ...
Render a button. @param string $text Button text. @param string $url Link URL. @param string $color Button color - one of red, green or blue. @return string
[ "Render", "a", "button", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-button-extension.php#L102-L111