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
Danack/GithubArtaxService
lib/GithubService/Operation/searchRepos.php
searchRepos.dispatchAsync
public function dispatchAsync(\Amp\Artax\Request $request, callable $callable) { return $this->api->executeAsync($request, $this, $callable); }
php
public function dispatchAsync(\Amp\Artax\Request $request, callable $callable) { return $this->api->executeAsync($request, $this, $callable); }
[ "public", "function", "dispatchAsync", "(", "\\", "Amp", "\\", "Artax", "\\", "Request", "$", "request", ",", "callable", "$", "callable", ")", "{", "return", "$", "this", "->", "api", "->", "executeAsync", "(", "$", "request", ",", "$", "this", ",", "...
Dispatch the request for this operation and process the response asynchronously. Allows you to modify the request before it is sent. @return \GithubService\Model\SearchRepos @param \Amp\Artax\Request $request The request to be processed @param callable $callable The callable that processes the response
[ "Dispatch", "the", "request", "for", "this", "operation", "and", "process", "the", "response", "asynchronously", ".", "Allows", "you", "to", "modify", "the", "request", "before", "it", "is", "sent", "." ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/Operation/searchRepos.php#L359-L361
Danack/GithubArtaxService
lib/GithubService/Operation/searchRepos.php
searchRepos.processResponse
public function processResponse(\Amp\Artax\Response $response) { $instance = $this->api->instantiateResult($response, $this); return $instance; }
php
public function processResponse(\Amp\Artax\Response $response) { $instance = $this->api->instantiateResult($response, $this); return $instance; }
[ "public", "function", "processResponse", "(", "\\", "Amp", "\\", "Artax", "\\", "Response", "$", "response", ")", "{", "$", "instance", "=", "$", "this", "->", "api", "->", "instantiateResult", "(", "$", "response", ",", "$", "this", ")", ";", "return", ...
Dispatch the request for this operation and process the response. Allows you to modify the request before it is sent. @return \GithubService\Model\SearchRepos @param \Amp\Artax\Response $response The HTTP response.
[ "Dispatch", "the", "request", "for", "this", "operation", "and", "process", "the", "response", ".", "Allows", "you", "to", "modify", "the", "request", "before", "it", "is", "sent", "." ]
train
https://github.com/Danack/GithubArtaxService/blob/9f62b5be4f413207d4012e7fa084d0ae505680eb/lib/GithubService/Operation/searchRepos.php#L370-L374
ekuiter/feature-php
FeaturePhp/Generator/Generator.php
Generator.getGeneratorMap
public static function getGeneratorMap() { $generatorMap = array(); foreach (self::getGenerators() as $generator) $generatorMap[call_user_func(array($generator, "getKey"))] = $generator; return $generatorMap; }
php
public static function getGeneratorMap() { $generatorMap = array(); foreach (self::getGenerators() as $generator) $generatorMap[call_user_func(array($generator, "getKey"))] = $generator; return $generatorMap; }
[ "public", "static", "function", "getGeneratorMap", "(", ")", "{", "$", "generatorMap", "=", "array", "(", ")", ";", "foreach", "(", "self", "::", "getGenerators", "(", ")", "as", "$", "generator", ")", "$", "generatorMap", "[", "call_user_func", "(", "arra...
Returns a map from all generator keys to class names. @return string[]
[ "Returns", "a", "map", "from", "all", "generator", "keys", "to", "class", "names", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Generator/Generator.php#L68-L73
ekuiter/feature-php
FeaturePhp/Generator/Generator.php
Generator.generateFiles
public function generateFiles() { if ($this->files === null) { $this->files = array(); $this->tracingLinks = array(); $this->_generateFiles(); } if ($this->settings->getOptional("logFile", false)) return array_merge(array($this->logFile), $this->fi...
php
public function generateFiles() { if ($this->files === null) { $this->files = array(); $this->tracingLinks = array(); $this->_generateFiles(); } if ($this->settings->getOptional("logFile", false)) return array_merge(array($this->logFile), $this->fi...
[ "public", "function", "generateFiles", "(", ")", "{", "if", "(", "$", "this", "->", "files", "===", "null", ")", "{", "$", "this", "->", "files", "=", "array", "(", ")", ";", "$", "this", "->", "tracingLinks", "=", "array", "(", ")", ";", "$", "t...
Generates the files for all registered artifacts. If the files have already been generated, returns the cached files. The generator's log file is included. @return \FeaturePhp\File\File[]
[ "Generates", "the", "files", "for", "all", "registered", "artifacts", ".", "If", "the", "files", "have", "already", "been", "generated", "returns", "the", "cached", "files", ".", "The", "generator", "s", "log", "file", "is", "included", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Generator/Generator.php#L134-L144
ekuiter/feature-php
FeaturePhp/Generator/Generator.php
Generator.isSelectedFeature
protected function isSelectedFeature($featureName) { $isSelected = false; foreach ($this->selectedArtifacts as $selectedArtifact) if ($featureName === $selectedArtifact->getFeature()->getName()) $isSelected = true; return $isSelected; }
php
protected function isSelectedFeature($featureName) { $isSelected = false; foreach ($this->selectedArtifacts as $selectedArtifact) if ($featureName === $selectedArtifact->getFeature()->getName()) $isSelected = true; return $isSelected; }
[ "protected", "function", "isSelectedFeature", "(", "$", "featureName", ")", "{", "$", "isSelected", "=", "false", ";", "foreach", "(", "$", "this", "->", "selectedArtifacts", "as", "$", "selectedArtifact", ")", "if", "(", "$", "featureName", "===", "$", "sel...
Returns whether a feature's artifact is selected. @param string $featureName @return bool
[ "Returns", "whether", "a", "feature", "s", "artifact", "is", "selected", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Generator/Generator.php#L160-L166
kenphp/ken
src/Http/MiddlewareFactory.php
MiddlewareFactory.createObject
public function createObject($builder, $parameters = array()) { if (is_string($builder)) { if (class_exists($builder)) { $response = $parameters['response']; $nextMiddleware = $parameters['next']; if ($response == null) { throw new...
php
public function createObject($builder, $parameters = array()) { if (is_string($builder)) { if (class_exists($builder)) { $response = $parameters['response']; $nextMiddleware = $parameters['next']; if ($response == null) { throw new...
[ "public", "function", "createObject", "(", "$", "builder", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "if", "(", "is_string", "(", "$", "builder", ")", ")", "{", "if", "(", "class_exists", "(", "$", "builder", ")", ")", "{", "$", "re...
Creates a middleware instance @param string $builder A fully qualified namespace of middleware class. The middleware class must extend **Ken\Http\BaseMiddleware** class. @param array $parameters An array containing : 'response' : an instance of **Psr\Http\Message\ResponseInterface** 'next' : null or an instance o...
[ "Creates", "a", "middleware", "instance" ]
train
https://github.com/kenphp/ken/blob/c454a86f0ab55c52c88e9bff5bc6fb4e7bd9e0eb/src/Http/MiddlewareFactory.php#L23-L46
skeeks-cms/cms-log-db-target
src/console/controllers/AgentsController.php
AgentsController.actionClearLogs
public function actionClearLogs() { $deleted = LogDbTargetModel::deleteAll([ '<=', 'log_time', \Yii::$app->formatter->asTimestamp(time()) - (int) \Yii::$app->logDbTargetSettings->storeLogsTime ]); $this->stdout('storeLogsTime: ' . \Yii::$app->logDbTargetSettings->storeLogsTime ....
php
public function actionClearLogs() { $deleted = LogDbTargetModel::deleteAll([ '<=', 'log_time', \Yii::$app->formatter->asTimestamp(time()) - (int) \Yii::$app->logDbTargetSettings->storeLogsTime ]); $this->stdout('storeLogsTime: ' . \Yii::$app->logDbTargetSettings->storeLogsTime ....
[ "public", "function", "actionClearLogs", "(", ")", "{", "$", "deleted", "=", "LogDbTargetModel", "::", "deleteAll", "(", "[", "'<='", ",", "'log_time'", ",", "\\", "Yii", "::", "$", "app", "->", "formatter", "->", "asTimestamp", "(", "time", "(", ")", ")...
Просмотр созданных бекапов баз данных
[ "Просмотр", "созданных", "бекапов", "баз", "данных" ]
train
https://github.com/skeeks-cms/cms-log-db-target/blob/cb660a50d0d4d734096230e525f66855a7373d14/src/console/controllers/AgentsController.php#L23-L33
mothership-ec/composer
src/Composer/Repository/PlatformRepository.php
PlatformRepository.addPackage
public function addPackage(PackageInterface $package) { // Skip if overridden if (isset($this->overrides[strtolower($package->getName())])) { return; } parent::addPackage($package); }
php
public function addPackage(PackageInterface $package) { // Skip if overridden if (isset($this->overrides[strtolower($package->getName())])) { return; } parent::addPackage($package); }
[ "public", "function", "addPackage", "(", "PackageInterface", "$", "package", ")", "{", "// Skip if overridden", "if", "(", "isset", "(", "$", "this", "->", "overrides", "[", "strtolower", "(", "$", "package", "->", "getName", "(", ")", ")", "]", ")", ")", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Repository/PlatformRepository.php#L200-L207
asbamboo/database
command/CommandAbstract.php
CommandAbstract.getDbFactory
protected function getDbFactory() : FactoryInterface { $guess_config_in_dir = getcwd(); for($i = 0; $i < 3; $i++ ){ $custom_config_path = $guess_config_in_dir . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'db-config.php'; if(file_exists($custom_config_path)){ ...
php
protected function getDbFactory() : FactoryInterface { $guess_config_in_dir = getcwd(); for($i = 0; $i < 3; $i++ ){ $custom_config_path = $guess_config_in_dir . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'db-config.php'; if(file_exists($custom_config_path)){ ...
[ "protected", "function", "getDbFactory", "(", ")", ":", "FactoryInterface", "{", "$", "guess_config_in_dir", "=", "getcwd", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "3", ";", "$", "i", "++", ")", "{", "$", "custom_config_pat...
返回一个 Factory 实例 通过在查找项目里面 ../config/db-config.php 文件得到一个 factory 使用本命令工具前你需要首先添加在项目中添加配置文件 config/db-config.php 这个文件返回一个 Factory 实例 @return FactoryInterface
[ "返回一个", "Factory", "实例", "通过在查找项目里面", "..", "/", "config", "/", "db", "-", "config", ".", "php", "文件得到一个", "factory", "使用本命令工具前你需要首先添加在项目中添加配置文件", "config", "/", "db", "-", "config", ".", "php", "这个文件返回一个", "Factory", "实例" ]
train
https://github.com/asbamboo/database/blob/cb3260b0b267def7257d728ec639b6776d1b5a10/command/CommandAbstract.php#L42-L55
nabab/bbn
src/bbn/file/dir.php
dir.has_file
public static function has_file(string $dir): bool { $dir = self::clean($dir); $as = \func_get_args(); array_shift($as); foreach ( $as as $a ){ if ( !file_exists($dir.'/'.$a) ){ return false; } } return true; }
php
public static function has_file(string $dir): bool { $dir = self::clean($dir); $as = \func_get_args(); array_shift($as); foreach ( $as as $a ){ if ( !file_exists($dir.'/'.$a) ){ return false; } } return true; }
[ "public", "static", "function", "has_file", "(", "string", "$", "dir", ")", ":", "bool", "{", "$", "dir", "=", "self", "::", "clean", "(", "$", "dir", ")", ";", "$", "as", "=", "\\", "func_get_args", "(", ")", ";", "array_shift", "(", "$", "as", ...
Checks if the given file(s) exists in the directory. Accepts unlimited arguments (files name). ```php \bbn\x::dump(\bbn\file\dir::has_file("/home/data/test/file.txt")); // (bool) true \bbn\x::dump(\bbn\file\dir::has_file("/home/data/test", "file.txt", "doc.pdf")); // (bool) true ``` @param string $dir The directory's...
[ "Checks", "if", "the", "given", "file", "(", "s", ")", "exists", "in", "the", "directory", ".", "Accepts", "unlimited", "arguments", "(", "files", "name", ")", "." ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L55-L66
nabab/bbn
src/bbn/file/dir.php
dir.get_dirs
public static function get_dirs($dir, $hidden = false){ $dir = self::clean($dir); clearstatcache(); if ( $dir === './' ){ $dir = '.'; } if ( is_dir($dir) && (($dir === '.') || ((strpos(basename($dir), '.') !== 0) || $hidden)) ){ $dirs = []; $fs = scandir($dir, SCANDIR_SORT_ASCENDING ); ...
php
public static function get_dirs($dir, $hidden = false){ $dir = self::clean($dir); clearstatcache(); if ( $dir === './' ){ $dir = '.'; } if ( is_dir($dir) && (($dir === '.') || ((strpos(basename($dir), '.') !== 0) || $hidden)) ){ $dirs = []; $fs = scandir($dir, SCANDIR_SORT_ASCENDING ); ...
[ "public", "static", "function", "get_dirs", "(", "$", "dir", ",", "$", "hidden", "=", "false", ")", "{", "$", "dir", "=", "self", "::", "clean", "(", "$", "dir", ")", ";", "clearstatcache", "(", ")", ";", "if", "(", "$", "dir", "===", "'./'", ")"...
Return an array of directories contained in the given directory. It will return directories' full path. @todo vedere il parametro $hidden non mi funziona ```php \bbn\x::dump(\bbn\file\dir::get_dirs("C:\Docs\Test")); // (array) ['C:\DocsTest\test1', 'C:\DocsTest\test2', 'C:\DocsTest\test3'] ``` @param string $dir The ...
[ "Return", "an", "array", "of", "directories", "contained", "in", "the", "given", "directory", ".", "It", "will", "return", "directories", "full", "path", ".", "@todo", "vedere", "il", "parametro", "$hidden", "non", "mi", "funziona" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L100-L120
nabab/bbn
src/bbn/file/dir.php
dir.get_files
public static function get_files($dir, $including_dirs = false, $hidden = false, $extension = null) { $dir = self::clean($dir); clearstatcache(); if ( $dir === './' ){ $dir = '.'; } if ( is_dir($dir) && (($dir === '.') || ((strpos(basename($dir), '.') !== 0) || $hidden)) ){ $files = []; ...
php
public static function get_files($dir, $including_dirs = false, $hidden = false, $extension = null) { $dir = self::clean($dir); clearstatcache(); if ( $dir === './' ){ $dir = '.'; } if ( is_dir($dir) && (($dir === '.') || ((strpos(basename($dir), '.') !== 0) || $hidden)) ){ $files = []; ...
[ "public", "static", "function", "get_files", "(", "$", "dir", ",", "$", "including_dirs", "=", "false", ",", "$", "hidden", "=", "false", ",", "$", "extension", "=", "null", ")", "{", "$", "dir", "=", "self", "::", "clean", "(", "$", "dir", ")", ";...
Returns an array of files contained in the given directory. Returns the full path of files. ```php \bbn\x::dump(\bbn\file\dir::get_files("/home/Docs/Test")); // (array) ['/home/Docs/Test/file.txt'] \bbn\x::dump(\bbn\file\dir::get_files("/home/Docs/Test",0,1)); // (array) ['/home/Docs/Test/file.txt', '/home/Docs/Test/....
[ "Returns", "an", "array", "of", "files", "contained", "in", "the", "given", "directory", ".", "Returns", "the", "full", "path", "of", "files", "." ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L142-L179
nabab/bbn
src/bbn/file/dir.php
dir.delete
public static function delete(string $dir, bool $full = true): bool { $dir = self::clean($dir); if ( is_dir($dir) ){ $files = self::get_files($dir, 1, 1); foreach ( $files as $file ){ self::delete($file); } if ( $full ){ return rmdir($dir); } return true; } if ( is_file($di...
php
public static function delete(string $dir, bool $full = true): bool { $dir = self::clean($dir); if ( is_dir($dir) ){ $files = self::get_files($dir, 1, 1); foreach ( $files as $file ){ self::delete($file); } if ( $full ){ return rmdir($dir); } return true; } if ( is_file($di...
[ "public", "static", "function", "delete", "(", "string", "$", "dir", ",", "bool", "$", "full", "=", "true", ")", ":", "bool", "{", "$", "dir", "=", "self", "::", "clean", "(", "$", "dir", ")", ";", "if", "(", "is_dir", "(", "$", "dir", ")", ")"...
Deletes the given directory and all its content. ```php \bbn\x::dump(\bbn\file\dir::delete('/home/Docs/Test/') // (bool) true \bbn\x::dump(\bbn\file\dir::delete('/home/Docs/Test', 0); // (bool) false \bbn\x::dump(\bbn\file\dir::delete('/home/Docs/Test/file.txt'); // (bool) false ``` @param string $dir The directory p...
[ "Deletes", "the", "given", "directory", "and", "all", "its", "content", "." ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L197-L214
nabab/bbn
src/bbn/file/dir.php
dir.scan
public static function scan(string $dir, string $type = null, bool $hidden = false): array { $all = []; $dir = self::clean($dir); $dirs = self::get_dirs($dir); if ( \is_array($dirs) ){ if ( $type && (strpos($type, 'file') === 0) ){ $all = self::get_files($dir, false, $hidden); } ...
php
public static function scan(string $dir, string $type = null, bool $hidden = false): array { $all = []; $dir = self::clean($dir); $dirs = self::get_dirs($dir); if ( \is_array($dirs) ){ if ( $type && (strpos($type, 'file') === 0) ){ $all = self::get_files($dir, false, $hidden); } ...
[ "public", "static", "function", "scan", "(", "string", "$", "dir", ",", "string", "$", "type", "=", "null", ",", "bool", "$", "hidden", "=", "false", ")", ":", "array", "{", "$", "all", "=", "[", "]", ";", "$", "dir", "=", "self", "::", "clean", ...
Returns an array with all the content of the given directory. @todo check the default value for $hidden ```php \bbn\x::dump(\bbn\file\dir::scan("/home/data/test")); // (array) ["/home/data/test/Folder", "/home/data/test/Folder_test/image.png"] \bbn\x::dump(\bbn\file\dir::scan("/home/data/test", "", true)); // (array)...
[ "Returns", "an", "array", "with", "all", "the", "content", "of", "the", "given", "directory", "." ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L238-L267
nabab/bbn
src/bbn/file/dir.php
dir.mscan
public static function mscan(string $dir, string $type = null, $hidden = false): array { $res = []; if ( $all = self::scan($dir, $type, $hidden) ){ foreach ($all as $a ){ $t = filemtime($a); $res[] = ['name' => $a, 'mtime' => $t, 'date' => date('Y-m-d H:i:s', $t)]; } } r...
php
public static function mscan(string $dir, string $type = null, $hidden = false): array { $res = []; if ( $all = self::scan($dir, $type, $hidden) ){ foreach ($all as $a ){ $t = filemtime($a); $res[] = ['name' => $a, 'mtime' => $t, 'date' => date('Y-m-d H:i:s', $t)]; } } r...
[ "public", "static", "function", "mscan", "(", "string", "$", "dir", ",", "string", "$", "type", "=", "null", ",", "$", "hidden", "=", "false", ")", ":", "array", "{", "$", "res", "=", "[", "]", ";", "if", "(", "$", "all", "=", "self", "::", "sc...
Returns an array of indexed arrays with the 'name' of the file/folder contained in the given directory, the 'mtime', and the 'date' of creation the file/folder. ```php \bbn\x::dump(\bbn\file\dir::mscan("/home/data/test")); /* (array) [ [ "name" => "/home/data/test/Folder", "mtime" => 1480422173, "date" => "2016-...
[ "Returns", "an", "array", "of", "indexed", "arrays", "with", "the", "name", "of", "the", "file", "/", "folder", "contained", "in", "the", "given", "directory", "the", "mtime", "and", "the", "date", "of", "creation", "the", "file", "/", "folder", "." ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L336-L346
nabab/bbn
src/bbn/file/dir.php
dir.get_tree
public static function get_tree(string $dir, bool $only_dir = false, callable $filter = null, bool $hidden = false): array { $r = []; $dir = self::clean($dir); $dirs = self::get_dirs($dir, $hidden); if ( \is_array($dirs) ){ foreach ( $dirs as $d ){ $x = [ 'name' => $d, ...
php
public static function get_tree(string $dir, bool $only_dir = false, callable $filter = null, bool $hidden = false): array { $r = []; $dir = self::clean($dir); $dirs = self::get_dirs($dir, $hidden); if ( \is_array($dirs) ){ foreach ( $dirs as $d ){ $x = [ 'name' => $d, ...
[ "public", "static", "function", "get_tree", "(", "string", "$", "dir", ",", "bool", "$", "only_dir", "=", "false", ",", "callable", "$", "filter", "=", "null", ",", "bool", "$", "hidden", "=", "false", ")", ":", "array", "{", "$", "r", "=", "[", "]...
Return an array with the tree of the folder's content. ```php \bbn\x::dump(\bbn\file\dir::get_tree("/home/data/test")); /* (array) [ [ "name" => "/home/data/test/Folder", "type" => "dir", "num_children" => 0, "items" => [], ], [ "name" => "/home/data/test/Folder_test", "type" => "dir", "num_children" => ...
[ "Return", "an", "array", "with", "the", "tree", "of", "the", "folder", "s", "content", "." ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L425-L468
nabab/bbn
src/bbn/file/dir.php
dir.create_path
public static function create_path(string $dir, $chmod=false){ if ( !$dir || !\is_string($dir) ){ return false; } clearstatcache(); if ( !is_dir($dir) ){ $bits = explode('/', $dir); $path = empty($bits[0]) ? '/' : ''; foreach ( $bits as $i => $b ){ if ( !empty($b) ){ ...
php
public static function create_path(string $dir, $chmod=false){ if ( !$dir || !\is_string($dir) ){ return false; } clearstatcache(); if ( !is_dir($dir) ){ $bits = explode('/', $dir); $path = empty($bits[0]) ? '/' : ''; foreach ( $bits as $i => $b ){ if ( !empty($b) ){ ...
[ "public", "static", "function", "create_path", "(", "string", "$", "dir", ",", "$", "chmod", "=", "false", ")", "{", "if", "(", "!", "$", "dir", "||", "!", "\\", "is_string", "(", "$", "dir", ")", ")", "{", "return", "false", ";", "}", "clearstatca...
Creates a folder with the given path. ```php \bbn\x::dump(\bbn\file\dir::create_path("/home/data/test/New")); \\ (string) "/home/data/test/New" ``` @param string $dir The new directory's path. @param bool $chmod If set to true the user won't have the permissions to view the content of the folder created @return strin...
[ "Creates", "a", "folder", "with", "the", "given", "path", "." ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L482-L506
nabab/bbn
src/bbn/file/dir.php
dir.move
public static function move($orig, $dest, $st = '_v', $length = 0): bool { if ( file_exists($orig) && self::create_path(\dirname($dest)) ){ if ( file_exists($dest) ){ if ( $st === true ){ self::delete($dest); } else{ $i = 1; while ( $i ){ $dir...
php
public static function move($orig, $dest, $st = '_v', $length = 0): bool { if ( file_exists($orig) && self::create_path(\dirname($dest)) ){ if ( file_exists($dest) ){ if ( $st === true ){ self::delete($dest); } else{ $i = 1; while ( $i ){ $dir...
[ "public", "static", "function", "move", "(", "$", "orig", ",", "$", "dest", ",", "$", "st", "=", "'_v'", ",", "$", "length", "=", "0", ")", ":", "bool", "{", "if", "(", "file_exists", "(", "$", "orig", ")", "&&", "self", "::", "create_path", "(",...
Moves a file or directory to a new location ```php \bbn\x::dump(\bbn\file\dir::move("/home/data/test/Folder/image.png","/home/data/test/Folder_test/image.png")); \\ (string) "image.png" \bbn\x::dump(\bbn\file\dir::move("/home/data/test/Folder/image.png","/home/data/test/Folder_test/Intro/image.png")); \\ (string) "ima...
[ "Moves", "a", "file", "or", "directory", "to", "a", "new", "location" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L528-L565
nabab/bbn
src/bbn/file/dir.php
dir.copy
public static function copy($src, $dst): bool { if ( is_file($src) ){ return copy($src, $dst); } if ( is_dir($src) && self::create_path($dst) ){ $files = self::get_files($src); $dirs = self::get_dirs($src); foreach ( $files as $f ){ copy($f, $dst.'/'.basename($f)); } ...
php
public static function copy($src, $dst): bool { if ( is_file($src) ){ return copy($src, $dst); } if ( is_dir($src) && self::create_path($dst) ){ $files = self::get_files($src); $dirs = self::get_dirs($src); foreach ( $files as $f ){ copy($f, $dst.'/'.basename($f)); } ...
[ "public", "static", "function", "copy", "(", "$", "src", ",", "$", "dst", ")", ":", "bool", "{", "if", "(", "is_file", "(", "$", "src", ")", ")", "{", "return", "copy", "(", "$", "src", ",", "$", "dst", ")", ";", "}", "if", "(", "is_dir", "("...
Will move the content of the given folder to a new destination. Doesn't move the hidden files. ```php \bbn\x::dump(\bbn\file\dir::copy("/home/data/test/Folder","/home/data/test/Folder_test")); \\ (bool) 1 ``` @param string $src The path of the files to move @param string $dst The new destination of files @return bool
[ "Will", "move", "the", "content", "of", "the", "given", "folder", "to", "a", "new", "destination", ".", "Doesn", "t", "move", "the", "hidden", "files", "." ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/file/dir.php#L578-L597
expectation-php/expect
src/FailedMessage.php
FailedMessage.appendText
public function appendText($value) { $text = $this->stringify($value); $this->message = $this->message . $text; return $this; }
php
public function appendText($value) { $text = $this->stringify($value); $this->message = $this->message . $text; return $this; }
[ "public", "function", "appendText", "(", "$", "value", ")", "{", "$", "text", "=", "$", "this", "->", "stringify", "(", "$", "value", ")", ";", "$", "this", "->", "message", "=", "$", "this", "->", "message", ".", "$", "text", ";", "return", "$", ...
Append the text to the last. @param mixed $value @return $this
[ "Append", "the", "text", "to", "the", "last", "." ]
train
https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/FailedMessage.php#L41-L47
expectation-php/expect
src/FailedMessage.php
FailedMessage.appendSpace
public function appendSpace($length) { $paddingLength = (int) $length; $this->message = $this->message . str_pad('', $paddingLength, ' '); return $this; }
php
public function appendSpace($length) { $paddingLength = (int) $length; $this->message = $this->message . str_pad('', $paddingLength, ' '); return $this; }
[ "public", "function", "appendSpace", "(", "$", "length", ")", "{", "$", "paddingLength", "=", "(", "int", ")", "$", "length", ";", "$", "this", "->", "message", "=", "$", "this", "->", "message", ".", "str_pad", "(", "''", ",", "$", "paddingLength", ...
Append the length space. @param int $length @return $this
[ "Append", "the", "length", "space", "." ]
train
https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/FailedMessage.php#L56-L62
expectation-php/expect
src/FailedMessage.php
FailedMessage.appendValue
public function appendValue($value) { $appendValue = $this->formatValue($value); $this->message = $this->message . $appendValue; return $this; }
php
public function appendValue($value) { $appendValue = $this->formatValue($value); $this->message = $this->message . $appendValue; return $this; }
[ "public", "function", "appendValue", "(", "$", "value", ")", "{", "$", "appendValue", "=", "$", "this", "->", "formatValue", "(", "$", "value", ")", ";", "$", "this", "->", "message", "=", "$", "this", "->", "message", ".", "$", "appendValue", ";", "...
Append the value to the last. @param mixed $value @return $this
[ "Append", "the", "value", "to", "the", "last", "." ]
train
https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/FailedMessage.php#L71-L77
expectation-php/expect
src/FailedMessage.php
FailedMessage.appendValues
public function appendValues(array $values) { $appendValues = []; foreach ($values as $value) { $appendValues[] = $this->formatValue($value); } $this->message = $this->message . implode(', ', $appendValues); return $this; }
php
public function appendValues(array $values) { $appendValues = []; foreach ($values as $value) { $appendValues[] = $this->formatValue($value); } $this->message = $this->message . implode(', ', $appendValues); return $this; }
[ "public", "function", "appendValues", "(", "array", "$", "values", ")", "{", "$", "appendValues", "=", "[", "]", ";", "foreach", "(", "$", "values", "as", "$", "value", ")", "{", "$", "appendValues", "[", "]", "=", "$", "this", "->", "formatValue", "...
Append the values to the last. @param array $values @return $this
[ "Append", "the", "values", "to", "the", "last", "." ]
train
https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/FailedMessage.php#L86-L97
zhouyl/mellivora
Mellivora/Validation/Valid.php
Valid.length
public static function length($value, $min = null, $max = null) { $length = mb_strlen($value); if (is_numeric($min) && $min > 0 && $length < $min) { return false; } if (is_numeric($max) && $max > 0 && $length > $max) { return false; } return...
php
public static function length($value, $min = null, $max = null) { $length = mb_strlen($value); if (is_numeric($min) && $min > 0 && $length < $min) { return false; } if (is_numeric($max) && $max > 0 && $length > $max) { return false; } return...
[ "public", "static", "function", "length", "(", "$", "value", ",", "$", "min", "=", "null", ",", "$", "max", "=", "null", ")", "{", "$", "length", "=", "mb_strlen", "(", "$", "value", ")", ";", "if", "(", "is_numeric", "(", "$", "min", ")", "&&", ...
检测字符串是否符合长度范围 @param string $value @param int $min @param int $max @return bool
[ "检测字符串是否符合长度范围" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Validation/Valid.php#L71-L84
zhouyl/mellivora
Mellivora/Validation/Valid.php
Valid.lengths
public static function lengths($value, $length) { if (is_array($length)) { foreach ($length as $strlen) { if (mb_strlen($value) === $strlen) { return true; } } return false; } return mb_strlen($value) =...
php
public static function lengths($value, $length) { if (is_array($length)) { foreach ($length as $strlen) { if (mb_strlen($value) === $strlen) { return true; } } return false; } return mb_strlen($value) =...
[ "public", "static", "function", "lengths", "(", "$", "value", ",", "$", "length", ")", "{", "if", "(", "is_array", "(", "$", "length", ")", ")", "{", "foreach", "(", "$", "length", "as", "$", "strlen", ")", "{", "if", "(", "mb_strlen", "(", "$", ...
检测字符串是否符合指定的长度 Valid::lengths($value, [10, 20]); Valid::lengths($value, 10); @param string $value @param array|int $length @return bool
[ "检测字符串是否符合指定的长度" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Validation/Valid.php#L97-L110
zhouyl/mellivora
Mellivora/Validation/Valid.php
Valid.equal
public static function equal($value, $target, $ignoreCase = false) { if ($ignoreCase) { if (is_string($value)) { $value = strtolower($value); } if (is_string($target)) { $target = strtolower($target); } } retur...
php
public static function equal($value, $target, $ignoreCase = false) { if ($ignoreCase) { if (is_string($value)) { $value = strtolower($value); } if (is_string($target)) { $target = strtolower($target); } } retur...
[ "public", "static", "function", "equal", "(", "$", "value", ",", "$", "target", ",", "$", "ignoreCase", "=", "false", ")", "{", "if", "(", "$", "ignoreCase", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "$", "value", "=", "...
检测两个值是否完全相等 @param string $value @param string $target @param bool $ignoreCase @return bool
[ "检测两个值是否完全相等" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Validation/Valid.php#L121-L134
zhouyl/mellivora
Mellivora/Validation/Valid.php
Valid.email
public static function email($value, $strict = false) { if (mb_strlen($value) > 254) { return false; } if ($strict === true) { $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; $atom = '[^\\x00-\\x20\\x22\\x...
php
public static function email($value, $strict = false) { if (mb_strlen($value) > 254) { return false; } if ($strict === true) { $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; $atom = '[^\\x00-\\x20\\x22\\x...
[ "public", "static", "function", "email", "(", "$", "value", ",", "$", "strict", "=", "false", ")", "{", "if", "(", "mb_strlen", "(", "$", "value", ")", ">", "254", ")", "{", "return", "false", ";", "}", "if", "(", "$", "strict", "===", "true", ")...
检测是否有效的 email 地址 @see http://www.iamcal.com/publish/articles/php/parsing_email/ @see http://www.w3.org/Protocols/rfc822/ @param string $value @param bool $strict @return bool
[ "检测是否有效的", "email", "地址" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Validation/Valid.php#L161-L186
zhouyl/mellivora
Mellivora/Validation/Valid.php
Valid.url
public static function url($value, $onlyHttp = false) { if (!is_string($value)) { return false; } // 限制仅允许 http url if ($onlyHttp && !preg_match('~^https?://.*~i', $value)) { return false; } /* * This pattern is derived from Symfony\...
php
public static function url($value, $onlyHttp = false) { if (!is_string($value)) { return false; } // 限制仅允许 http url if ($onlyHttp && !preg_match('~^https?://.*~i', $value)) { return false; } /* * This pattern is derived from Symfony\...
[ "public", "static", "function", "url", "(", "$", "value", ",", "$", "onlyHttp", "=", "false", ")", "{", "if", "(", "!", "is_string", "(", "$", "value", ")", ")", "{", "return", "false", ";", "}", "// 限制仅允许 http url", "if", "(", "$", "onlyHttp", "&&",...
检测是否有效的 url 地址 @param string $value @param bool $onlyHttp @return bool
[ "检测是否有效的", "url", "地址" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Validation/Valid.php#L196-L229
zhouyl/mellivora
Mellivora/Validation/Valid.php
Valid.numeric
public static function numeric($value) { // Get the decimal point for the current locale list($decimal) = array_values(localeconv()); // A lookahead is used to make sure the string contains at least one digit (before or after the decimal point) return (bool) preg_match('/^-?+(?=.*[0...
php
public static function numeric($value) { // Get the decimal point for the current locale list($decimal) = array_values(localeconv()); // A lookahead is used to make sure the string contains at least one digit (before or after the decimal point) return (bool) preg_match('/^-?+(?=.*[0...
[ "public", "static", "function", "numeric", "(", "$", "value", ")", "{", "// Get the decimal point for the current locale", "list", "(", "$", "decimal", ")", "=", "array_values", "(", "localeconv", "(", ")", ")", ";", "// A lookahead is used to make sure the string conta...
检测是否有效的数字 (包括本地化字符格式) Uses {@link http://www.php.net/manual/en/function.localeconv.php locale conversion} to allow decimal point to be locale specific. @param string input string @param mixed $value @return bool
[ "检测是否有效的数字", "(", "包括本地化字符格式", ")" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Validation/Valid.php#L356-L363
zhouyl/mellivora
Mellivora/Validation/Valid.php
Valid.min
public static function min($value, $min = 0, $equal = true) { return $equal ? $value >= $min : $value > $min; }
php
public static function min($value, $min = 0, $equal = true) { return $equal ? $value >= $min : $value > $min; }
[ "public", "static", "function", "min", "(", "$", "value", ",", "$", "min", "=", "0", ",", "$", "equal", "=", "true", ")", "{", "return", "$", "equal", "?", "$", "value", ">=", "$", "min", ":", "$", "value", ">", "$", "min", ";", "}" ]
检测是否大于指定的值 @param int $value @param int $min @param bool $equal @return bool
[ "检测是否大于指定的值" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Validation/Valid.php#L402-L405
zhouyl/mellivora
Mellivora/Validation/Valid.php
Valid.max
public static function max($value, $max = 0, $equal = true) { return $equal ? $value <= $max : $value < $max; }
php
public static function max($value, $max = 0, $equal = true) { return $equal ? $value <= $max : $value < $max; }
[ "public", "static", "function", "max", "(", "$", "value", ",", "$", "max", "=", "0", ",", "$", "equal", "=", "true", ")", "{", "return", "$", "equal", "?", "$", "value", "<=", "$", "max", ":", "$", "value", "<", "$", "max", ";", "}" ]
检测是否小于指定的值 @param int $value @param int $max @param bool $equal @return bool
[ "检测是否小于指定的值" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Validation/Valid.php#L416-L419
zhouyl/mellivora
Mellivora/Validation/Valid.php
Valid.json
public static function json($value) { if (!is_scalar($value) && !method_exists($value, '__toString')) { return false; } json_decode((string) $value); return json_last_error() === JSON_ERROR_NONE; }
php
public static function json($value) { if (!is_scalar($value) && !method_exists($value, '__toString')) { return false; } json_decode((string) $value); return json_last_error() === JSON_ERROR_NONE; }
[ "public", "static", "function", "json", "(", "$", "value", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "value", ")", "&&", "!", "method_exists", "(", "$", "value", ",", "'__toString'", ")", ")", "{", "return", "false", ";", "}", "json_decode", "...
检测是否有效的 json 数据 @param string $value @return bool
[ "检测是否有效的", "json", "数据" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Validation/Valid.php#L463-L472
tttptd/laravel-responder
src/Http/ResponseBuilder.php
ResponseBuilder.respond
public function respond(int $statusCode = null, array $headers = []):JsonResponse { if (! is_null($statusCode)) { $this->setStatus($statusCode); } $data = $this->toArray(); $data = $this->includeStatusCode($data); $data = $this->includeSuccessFlag($data); ...
php
public function respond(int $statusCode = null, array $headers = []):JsonResponse { if (! is_null($statusCode)) { $this->setStatus($statusCode); } $data = $this->toArray(); $data = $this->includeStatusCode($data); $data = $this->includeSuccessFlag($data); ...
[ "public", "function", "respond", "(", "int", "$", "statusCode", "=", "null", ",", "array", "$", "headers", "=", "[", "]", ")", ":", "JsonResponse", "{", "if", "(", "!", "is_null", "(", "$", "statusCode", ")", ")", "{", "$", "this", "->", "setStatus",...
Serialize the data and wrap it in a JSON response object. @param int|null $statusCode @param array $headers @return \Illuminate\Http\JsonResponse
[ "Serialize", "the", "data", "and", "wrap", "it", "in", "a", "JSON", "response", "object", "." ]
train
https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/ResponseBuilder.php#L67-L78
flowcode/AmulenUserBundle
src/Flowcode/UserBundle/Controller/AdminUserController.php
AdminUserController.indexAction
public function indexAction(Request $request) { /* init filters */ $filter['q'] = $request->get('q'); $em = $this->getDoctrine()->getManager(); $qb = $em->getRepository('AmulenUserBundle:User')->createQueryBuilder('u'); if ($filter['q']) { $qb->andWhere('(u.usern...
php
public function indexAction(Request $request) { /* init filters */ $filter['q'] = $request->get('q'); $em = $this->getDoctrine()->getManager(); $qb = $em->getRepository('AmulenUserBundle:User')->createQueryBuilder('u'); if ($filter['q']) { $qb->andWhere('(u.usern...
[ "public", "function", "indexAction", "(", "Request", "$", "request", ")", "{", "/* init filters */", "$", "filter", "[", "'q'", "]", "=", "$", "request", "->", "get", "(", "'q'", ")", ";", "$", "em", "=", "$", "this", "->", "getDoctrine", "(", ")", "...
Lists all User entities. @Route("/", name="admin_user") @Method("GET") @Template()
[ "Lists", "all", "User", "entities", "." ]
train
https://github.com/flowcode/AmulenUserBundle/blob/00055834d9f094e63dcd8d66e2fedb822fcddee0/src/Flowcode/UserBundle/Controller/AdminUserController.php#L30-L47
flowcode/AmulenUserBundle
src/Flowcode/UserBundle/Controller/AdminUserController.php
AdminUserController.createAction
public function createAction(Request $request) { $entity = new User(); $form = $this->createCreateForm($entity); $form->handleRequest($request); if ($form->isValid()) { $userService = $this->get("flowcode.user"); $userService->create($entity); re...
php
public function createAction(Request $request) { $entity = new User(); $form = $this->createCreateForm($entity); $form->handleRequest($request); if ($form->isValid()) { $userService = $this->get("flowcode.user"); $userService->create($entity); re...
[ "public", "function", "createAction", "(", "Request", "$", "request", ")", "{", "$", "entity", "=", "new", "User", "(", ")", ";", "$", "form", "=", "$", "this", "->", "createCreateForm", "(", "$", "entity", ")", ";", "$", "form", "->", "handleRequest",...
Creates a new User entity. @Route("/", name="admin_user_create") @Method("POST") @Template("FlowcodeUserBundle:User:new.html.twig")
[ "Creates", "a", "new", "User", "entity", "." ]
train
https://github.com/flowcode/AmulenUserBundle/blob/00055834d9f094e63dcd8d66e2fedb822fcddee0/src/Flowcode/UserBundle/Controller/AdminUserController.php#L56-L73
flowcode/AmulenUserBundle
src/Flowcode/UserBundle/Controller/AdminUserController.php
AdminUserController.newAction
public function newAction() { $userManager = $this->container->get('flowcode.user'); $entity = new User(); $form = $this->createCreateForm($entity); return array( 'entity' => $entity, 'form' => $form->createView(), ); }
php
public function newAction() { $userManager = $this->container->get('flowcode.user'); $entity = new User(); $form = $this->createCreateForm($entity); return array( 'entity' => $entity, 'form' => $form->createView(), ); }
[ "public", "function", "newAction", "(", ")", "{", "$", "userManager", "=", "$", "this", "->", "container", "->", "get", "(", "'flowcode.user'", ")", ";", "$", "entity", "=", "new", "User", "(", ")", ";", "$", "form", "=", "$", "this", "->", "createCr...
Displays a form to create a new User entity. @Route("/new", name="admin_user_new") @Method("GET") @Template()
[ "Displays", "a", "form", "to", "create", "a", "new", "User", "entity", "." ]
train
https://github.com/flowcode/AmulenUserBundle/blob/00055834d9f094e63dcd8d66e2fedb822fcddee0/src/Flowcode/UserBundle/Controller/AdminUserController.php#L101-L112
SporkCode/Spork
src/Filter/DateTime.php
DateTime.filter
public function filter($value) { if ($value instanceof \DateTime) { return $value; } try { $datetime = new \DateTime($value); } catch (\Exception $exception) { return false; } return $datetime; }
php
public function filter($value) { if ($value instanceof \DateTime) { return $value; } try { $datetime = new \DateTime($value); } catch (\Exception $exception) { return false; } return $datetime; }
[ "public", "function", "filter", "(", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "\\", "DateTime", ")", "{", "return", "$", "value", ";", "}", "try", "{", "$", "datetime", "=", "new", "\\", "DateTime", "(", "$", "value", ")", ";"...
filter @see \Zend\Filter\FilterInterface::filter() @param mixed $value @return \DateTime|boolean
[ "filter" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Filter/DateTime.php#L21-L34
yosymfony/ConfigServiceProvider
src/Yosymfony/Silex/ConfigServiceProvider/Config.php
Config.load
public function load($resource, $type = null) { $repository = $this->delegatingLoader->load($resource, $type); if(!$repository instanceof ConfigRepositoryInterface) { throw new \UnexpectedValueException('The loader must return a repository instance'); } ...
php
public function load($resource, $type = null) { $repository = $this->delegatingLoader->load($resource, $type); if(!$repository instanceof ConfigRepositoryInterface) { throw new \UnexpectedValueException('The loader must return a repository instance'); } ...
[ "public", "function", "load", "(", "$", "resource", ",", "$", "type", "=", "null", ")", "{", "$", "repository", "=", "$", "this", "->", "delegatingLoader", "->", "load", "(", "$", "resource", ",", "$", "type", ")", ";", "if", "(", "!", "$", "reposi...
Loads a resource like file or inline configuration @param string $resource A resource @param string $type The resource type. Don't set this argument in files case. @return ConfigRepositoryInterface @throws Symfony\Component\Config\Exception\FileLoaderLoadException If the loader not found. @throws \UnexpectedValu...
[ "Loads", "a", "resource", "like", "file", "or", "inline", "configuration" ]
train
https://github.com/yosymfony/ConfigServiceProvider/blob/f6cb9a9fc707b6c92e0d03201e5ecc17eaee3114/src/Yosymfony/Silex/ConfigServiceProvider/Config.php#L60-L70
antaresproject/notifications
src/Widgets/NotificationSender/NotificationsWidget.php
NotificationsWidget.routes
public static function routes() { $area = area(); Route::post($area . '/notifications/notifications', NotificationController::class . '@index'); Route::post($area . '/notifications/widgets/send', NotificationController::class . '@send'); }
php
public static function routes() { $area = area(); Route::post($area . '/notifications/notifications', NotificationController::class . '@index'); Route::post($area . '/notifications/widgets/send', NotificationController::class . '@send'); }
[ "public", "static", "function", "routes", "(", ")", "{", "$", "area", "=", "area", "(", ")", ";", "Route", "::", "post", "(", "$", "area", ".", "'/notifications/notifications'", ",", "NotificationController", "::", "class", ".", "'@index'", ")", ";", "Rout...
Widgets routes implementations @return void
[ "Widgets", "routes", "implementations" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Widgets/NotificationSender/NotificationsWidget.php#L85-L90
antaresproject/notifications
src/Widgets/NotificationSender/NotificationsWidget.php
NotificationsWidget.render
public function render() { app('antares.asset')->container('antares/foundation::application')->add('webpack_forms_basic', '/webpack/forms_basic.js', ['app_cache']); publish('notifications', ['js/notification-widget.js']); return view('antares/notifications::widgets.send_notification', ['for...
php
public function render() { app('antares.asset')->container('antares/foundation::application')->add('webpack_forms_basic', '/webpack/forms_basic.js', ['app_cache']); publish('notifications', ['js/notification-widget.js']); return view('antares/notifications::widgets.send_notification', ['for...
[ "public", "function", "render", "(", ")", "{", "app", "(", "'antares.asset'", ")", "->", "container", "(", "'antares/foundation::application'", ")", "->", "add", "(", "'webpack_forms_basic'", ",", "'/webpack/forms_basic.js'", ",", "[", "'app_cache'", "]", ")", ";"...
Renders widget content @return \Illuminate\View\View
[ "Renders", "widget", "content" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Widgets/NotificationSender/NotificationsWidget.php#L97-L103
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Pass/ExampleTagsEnricher.php
ExampleTagsEnricher.execute
public function execute(ProjectDescriptor $project) { $elements = $project->getIndexes()->get('elements'); /** @var DescriptorAbstract $element */ foreach ($elements as $element) { $element->setDescription($this->replaceInlineExamples($element)); } }
php
public function execute(ProjectDescriptor $project) { $elements = $project->getIndexes()->get('elements'); /** @var DescriptorAbstract $element */ foreach ($elements as $element) { $element->setDescription($this->replaceInlineExamples($element)); } }
[ "public", "function", "execute", "(", "ProjectDescriptor", "$", "project", ")", "{", "$", "elements", "=", "$", "project", "->", "getIndexes", "(", ")", "->", "get", "(", "'elements'", ")", ";", "/** @var DescriptorAbstract $element */", "foreach", "(", "$", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Pass/ExampleTagsEnricher.php#L52-L60
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Pass/ExampleTagsEnricher.php
ExampleTagsEnricher.replaceInlineExamples
protected function replaceInlineExamples(DescriptorAbstract $element) { $description = $element->getDescription(); $matches = array(); if (! $description || ! preg_match_all('/\{@example\s(.+?)\}/', $description, $matches) || count($matches[0]) < 1 ) { ...
php
protected function replaceInlineExamples(DescriptorAbstract $element) { $description = $element->getDescription(); $matches = array(); if (! $description || ! preg_match_all('/\{@example\s(.+?)\}/', $description, $matches) || count($matches[0]) < 1 ) { ...
[ "protected", "function", "replaceInlineExamples", "(", "DescriptorAbstract", "$", "element", ")", "{", "$", "description", "=", "$", "element", "->", "getDescription", "(", ")", ";", "$", "matches", "=", "array", "(", ")", ";", "if", "(", "!", "$", "descri...
Replaces the example tags in the description with the contents of the found example. @param DescriptorAbstract $element @return string
[ "Replaces", "the", "example", "tags", "in", "the", "description", "with", "the", "contents", "of", "the", "found", "example", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Pass/ExampleTagsEnricher.php#L69-L101
php-lug/lug
src/Bundle/ResourceBundle/EventSubscriber/Doctrine/MongoDB/ResolveTargetDocumentSubscriber.php
ResolveTargetDocumentSubscriber.addResolveTargetDocument
public function addResolveTargetDocument($originalDocument, $newDocument, array $mapping) { $mapping['targetDocument'] = ltrim($newDocument, '\\\\'); $this->resolveTargetEntities[ltrim($originalDocument, '\\\\')] = $mapping; parent::addResolveTargetDocument($originalDocument, $newDocument, ...
php
public function addResolveTargetDocument($originalDocument, $newDocument, array $mapping) { $mapping['targetDocument'] = ltrim($newDocument, '\\\\'); $this->resolveTargetEntities[ltrim($originalDocument, '\\\\')] = $mapping; parent::addResolveTargetDocument($originalDocument, $newDocument, ...
[ "public", "function", "addResolveTargetDocument", "(", "$", "originalDocument", ",", "$", "newDocument", ",", "array", "$", "mapping", ")", "{", "$", "mapping", "[", "'targetDocument'", "]", "=", "ltrim", "(", "$", "newDocument", ",", "'\\\\\\\\'", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/ResourceBundle/EventSubscriber/Doctrine/MongoDB/ResolveTargetDocumentSubscriber.php#L41-L47
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/common_sql_reader.php
ezcDbSchemaCommonSqlReader.processSchema
protected function processSchema( array $tables ) { $schemaDefinition = array(); array_walk( $tables, create_function( '&$item,$key', '$item = $item[0];' ) ); // strip out the prefix and only return tables with the prefix set. $prefix = ezcDbSchema::$options->tableNamePrefix; ...
php
protected function processSchema( array $tables ) { $schemaDefinition = array(); array_walk( $tables, create_function( '&$item,$key', '$item = $item[0];' ) ); // strip out the prefix and only return tables with the prefix set. $prefix = ezcDbSchema::$options->tableNamePrefix; ...
[ "protected", "function", "processSchema", "(", "array", "$", "tables", ")", "{", "$", "schemaDefinition", "=", "array", "(", ")", ";", "array_walk", "(", "$", "tables", ",", "create_function", "(", "'&$item,$key'", ",", "'$item = $item[0];'", ")", ")", ";", ...
Loops over all the table names in the array and extracts schema information. This method extracts information about a database's schema from the database itself and returns this schema as an ezcDbSchema object. @param array(string) $tables @return ezcDbSchema
[ "Loops", "over", "all", "the", "table", "names", "in", "the", "array", "and", "extracts", "schema", "information", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/common_sql_reader.php#L58-L83
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/common_sql_reader.php
ezcDbSchemaCommonSqlReader.lowercase
protected function lowercase( array $source ) { $result = array(); foreach ($source as $key => $value ) $result[strtolower($key)] = $value; return $result; }
php
protected function lowercase( array $source ) { $result = array(); foreach ($source as $key => $value ) $result[strtolower($key)] = $value; return $result; }
[ "protected", "function", "lowercase", "(", "array", "$", "source", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "source", "as", "$", "key", "=>", "$", "value", ")", "$", "result", "[", "strtolower", "(", "$", "key", ")...
Lowercase all array keys to conform default Database behaviour @param array(string=>mixed) $source @return array
[ "Lowercase", "all", "array", "keys", "to", "conform", "default", "Database", "behaviour" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/common_sql_reader.php#L91-L99
highday/glitter
database/migrations/2016_12_14_000042_create_store_customer_table.php
CreateStoreCustomerTable.up
public function up() { Schema::create('store_customer', function (Blueprint $table) { $table->increments('id'); $table->integer('store_id')->unsigned(); $table->foreign('store_id')->references('id')->on('stores')->onDelete('cascade'); $table->integer('customer...
php
public function up() { Schema::create('store_customer', function (Blueprint $table) { $table->increments('id'); $table->integer('store_id')->unsigned(); $table->foreign('store_id')->references('id')->on('stores')->onDelete('cascade'); $table->integer('customer...
[ "public", "function", "up", "(", ")", "{", "Schema", "::", "create", "(", "'store_customer'", ",", "function", "(", "Blueprint", "$", "table", ")", "{", "$", "table", "->", "increments", "(", "'id'", ")", ";", "$", "table", "->", "integer", "(", "'stor...
Run the migrations. @return void
[ "Run", "the", "migrations", "." ]
train
https://github.com/highday/glitter/blob/d1c7a227fd2343806bd3ec0314e621ced57dfe66/database/migrations/2016_12_14_000042_create_store_customer_table.php#L14-L29
sabre-io/cs
lib/PublicVisibility.php
PublicVisibility.fix
function fix(\SplFileInfo $file, $content) { $tokens = Tokens::fromCode($content); $elements = $tokens->getClassyElements(); foreach (array_reverse($elements, true) as $index => $element) { if ('method' === $element['type']) { $this->applyAttribs($tokens, $index,...
php
function fix(\SplFileInfo $file, $content) { $tokens = Tokens::fromCode($content); $elements = $tokens->getClassyElements(); foreach (array_reverse($elements, true) as $index => $element) { if ('method' === $element['type']) { $this->applyAttribs($tokens, $index,...
[ "function", "fix", "(", "\\", "SplFileInfo", "$", "file", ",", "$", "content", ")", "{", "$", "tokens", "=", "Tokens", "::", "fromCode", "(", "$", "content", ")", ";", "$", "elements", "=", "$", "tokens", "->", "getClassyElements", "(", ")", ";", "fo...
{@inheritdoc}
[ "{" ]
train
https://github.com/sabre-io/cs/blob/a4c57e213bf3f5e7d6b29a2f70d1ca4b0dce6d86/lib/PublicVisibility.php#L44-L65
sabre-io/cs
lib/PublicVisibility.php
PublicVisibility.applyAttribs
private function applyAttribs(Tokens $tokens, $index, array $attribs) { $toInsert = []; foreach ($attribs as $attrib) { if (null !== $attrib && '' !== $attrib->getContent()) { $toInsert[] = $attrib; $toInsert[] = new Token([T_WHITESPACE, ' ']); ...
php
private function applyAttribs(Tokens $tokens, $index, array $attribs) { $toInsert = []; foreach ($attribs as $attrib) { if (null !== $attrib && '' !== $attrib->getContent()) { $toInsert[] = $attrib; $toInsert[] = new Token([T_WHITESPACE, ' ']); ...
[ "private", "function", "applyAttribs", "(", "Tokens", "$", "tokens", ",", "$", "index", ",", "array", "$", "attribs", ")", "{", "$", "toInsert", "=", "[", "]", ";", "foreach", "(", "$", "attribs", "as", "$", "attrib", ")", "{", "if", "(", "null", "...
Apply token attributes. Token at given index is prepended by attributes. @param Tokens $tokens Tokens collection @param int $index token index @param array $attribs array of token attributes
[ "Apply", "token", "attributes", "." ]
train
https://github.com/sabre-io/cs/blob/a4c57e213bf3f5e7d6b29a2f70d1ca4b0dce6d86/lib/PublicVisibility.php#L84-L98
sabre-io/cs
lib/PublicVisibility.php
PublicVisibility.grabAttribsBeforeMethodToken
private function grabAttribsBeforeMethodToken(Tokens $tokens, $index) { static $tokenAttribsMap = [ T_PRIVATE => 'visibility', T_PROTECTED => 'visibility', T_PUBLIC => null, // destroy T_PUBLIC token. This is literally the only change from the original T_...
php
private function grabAttribsBeforeMethodToken(Tokens $tokens, $index) { static $tokenAttribsMap = [ T_PRIVATE => 'visibility', T_PROTECTED => 'visibility', T_PUBLIC => null, // destroy T_PUBLIC token. This is literally the only change from the original T_...
[ "private", "function", "grabAttribsBeforeMethodToken", "(", "Tokens", "$", "tokens", ",", "$", "index", ")", "{", "static", "$", "tokenAttribsMap", "=", "[", "T_PRIVATE", "=>", "'visibility'", ",", "T_PROTECTED", "=>", "'visibility'", ",", "T_PUBLIC", "=>", "nul...
Grab attributes before method token at given index. It's a shorthand for grabAttribsBeforeToken method. @param Tokens $tokens Tokens collection @param int $index token index @return array array of grabbed attributes
[ "Grab", "attributes", "before", "method", "token", "at", "given", "index", "." ]
train
https://github.com/sabre-io/cs/blob/a4c57e213bf3f5e7d6b29a2f70d1ca4b0dce6d86/lib/PublicVisibility.php#L110-L132
sabre-io/cs
lib/PublicVisibility.php
PublicVisibility.grabAttribsBeforePropertyToken
private function grabAttribsBeforePropertyToken(Tokens $tokens, $index) { static $tokenAttribsMap = [ T_VAR => null, // destroy T_VAR token! T_PRIVATE => 'visibility', T_PROTECTED => 'visibility', T_PUBLIC => 'visibility', T_STATIC =>...
php
private function grabAttribsBeforePropertyToken(Tokens $tokens, $index) { static $tokenAttribsMap = [ T_VAR => null, // destroy T_VAR token! T_PRIVATE => 'visibility', T_PROTECTED => 'visibility', T_PUBLIC => 'visibility', T_STATIC =>...
[ "private", "function", "grabAttribsBeforePropertyToken", "(", "Tokens", "$", "tokens", ",", "$", "index", ")", "{", "static", "$", "tokenAttribsMap", "=", "[", "T_VAR", "=>", "null", ",", "// destroy T_VAR token!", "T_PRIVATE", "=>", "'visibility'", ",", "T_PROTEC...
Grab attributes before property token at given index. It's a shorthand for grabAttribsBeforeToken method. @param Tokens $tokens Tokens collection @param int $index token index @return array array of grabbed attributes
[ "Grab", "attributes", "before", "property", "token", "at", "given", "index", "." ]
train
https://github.com/sabre-io/cs/blob/a4c57e213bf3f5e7d6b29a2f70d1ca4b0dce6d86/lib/PublicVisibility.php#L144-L170
sabre-io/cs
lib/PublicVisibility.php
PublicVisibility.grabAttribsBeforeToken
private function grabAttribsBeforeToken(Tokens $tokens, $index, array $tokenAttribsMap, array $attribs) { while (true) { $token = $tokens[--$index]; if (!$token->isArray()) { if ($token->equalsAny(['{', '}', '(', ')'])) { break; } ...
php
private function grabAttribsBeforeToken(Tokens $tokens, $index, array $tokenAttribsMap, array $attribs) { while (true) { $token = $tokens[--$index]; if (!$token->isArray()) { if ($token->equalsAny(['{', '}', '(', ')'])) { break; } ...
[ "private", "function", "grabAttribsBeforeToken", "(", "Tokens", "$", "tokens", ",", "$", "index", ",", "array", "$", "tokenAttribsMap", ",", "array", "$", "attribs", ")", "{", "while", "(", "true", ")", "{", "$", "token", "=", "$", "tokens", "[", "--", ...
Grab attributes before token at given index. Grabbed attributes are cleared by overriding them with empty string and should be manually applied with applyTokenAttribs method. @param Tokens $tokens Tokens collection @param int $index token index @param array $tokenAttribsMap token to attribute n...
[ "Grab", "attributes", "before", "token", "at", "given", "index", "." ]
train
https://github.com/sabre-io/cs/blob/a4c57e213bf3f5e7d6b29a2f70d1ca4b0dce6d86/lib/PublicVisibility.php#L184-L219
Laralum/Permissions
src/Controllers/PermissionController.php
PermissionController.store
public function store(Request $request) { $this->authorize('create', Permission::class); if (str_replace(' ', '', $request->slug) != $request->slug) { return redirect()->back()->withInput()->with('error', __('laralum_permissions::general.slug_cannot_contain_spaces')); } ...
php
public function store(Request $request) { $this->authorize('create', Permission::class); if (str_replace(' ', '', $request->slug) != $request->slug) { return redirect()->back()->withInput()->with('error', __('laralum_permissions::general.slug_cannot_contain_spaces')); } ...
[ "public", "function", "store", "(", "Request", "$", "request", ")", "{", "$", "this", "->", "authorize", "(", "'create'", ",", "Permission", "::", "class", ")", ";", "if", "(", "str_replace", "(", "' '", ",", "''", ",", "$", "request", "->", "slug", ...
Store a newly created resource in storage. @param \Illuminate\Http\Request $request @return \Illuminate\Http\Response
[ "Store", "a", "newly", "created", "resource", "in", "storage", "." ]
train
https://github.com/Laralum/Permissions/blob/79970ee7d1bff816ad4b9adee29067faead3f756/src/Controllers/PermissionController.php#L51-L67
Laralum/Permissions
src/Controllers/PermissionController.php
PermissionController.update
public function update(Request $request, Permission $permission) { $this->authorize('update', Permission::class); if (str_replace(' ', '', $request->slug) != $request->slug) { return redirect()->back()->withInput()->with('error', __('laralum_permissions::general.slug_cannot_contain_spac...
php
public function update(Request $request, Permission $permission) { $this->authorize('update', Permission::class); if (str_replace(' ', '', $request->slug) != $request->slug) { return redirect()->back()->withInput()->with('error', __('laralum_permissions::general.slug_cannot_contain_spac...
[ "public", "function", "update", "(", "Request", "$", "request", ",", "Permission", "$", "permission", ")", "{", "$", "this", "->", "authorize", "(", "'update'", ",", "Permission", "::", "class", ")", ";", "if", "(", "str_replace", "(", "' '", ",", "''", ...
Update the specified resource in storage. @param \Illuminate\Http\Request $request @param \Laralum\Permission\Models\Permission $permission @return \Illuminate\Http\Response
[ "Update", "the", "specified", "resource", "in", "storage", "." ]
train
https://github.com/Laralum/Permissions/blob/79970ee7d1bff816ad4b9adee29067faead3f756/src/Controllers/PermissionController.php#L91-L107
Laralum/Permissions
src/Controllers/PermissionController.php
PermissionController.confirmDelete
public function confirmDelete(Permission $permission) { $this->authorize('delete', Permission::class); return view('laralum::pages.confirmation', [ 'method' => 'DELETE', 'action' => route('laralum::permissions.destroy', ['permission' => $permission->id]), ]); }
php
public function confirmDelete(Permission $permission) { $this->authorize('delete', Permission::class); return view('laralum::pages.confirmation', [ 'method' => 'DELETE', 'action' => route('laralum::permissions.destroy', ['permission' => $permission->id]), ]); }
[ "public", "function", "confirmDelete", "(", "Permission", "$", "permission", ")", "{", "$", "this", "->", "authorize", "(", "'delete'", ",", "Permission", "::", "class", ")", ";", "return", "view", "(", "'laralum::pages.confirmation'", ",", "[", "'method'", "=...
Displays a view to confirm delete. @param \Laralum\Permission\Models\Permission $permission @return \Illuminate\Http\Response
[ "Displays", "a", "view", "to", "confirm", "delete", "." ]
train
https://github.com/Laralum/Permissions/blob/79970ee7d1bff816ad4b9adee29067faead3f756/src/Controllers/PermissionController.php#L116-L124
Laralum/Permissions
src/Controllers/PermissionController.php
PermissionController.destroy
public function destroy(Request $request, Permission $permission) { $this->authorize('delete', Permission::class); $permission->delete(); return redirect()->route('laralum::permissions.index')->with('success', __('laralum_permissions::general.permission_deleted', ['id' => $permission->id]))...
php
public function destroy(Request $request, Permission $permission) { $this->authorize('delete', Permission::class); $permission->delete(); return redirect()->route('laralum::permissions.index')->with('success', __('laralum_permissions::general.permission_deleted', ['id' => $permission->id]))...
[ "public", "function", "destroy", "(", "Request", "$", "request", ",", "Permission", "$", "permission", ")", "{", "$", "this", "->", "authorize", "(", "'delete'", ",", "Permission", "::", "class", ")", ";", "$", "permission", "->", "delete", "(", ")", ";"...
Remove the specified resource from storage. @param \Illuminate\Http\Request $request @param \Laralum\Permission\Models\Permission $permission @return \Illuminate\Http\Response
[ "Remove", "the", "specified", "resource", "from", "storage", "." ]
train
https://github.com/Laralum/Permissions/blob/79970ee7d1bff816ad4b9adee29067faead3f756/src/Controllers/PermissionController.php#L134-L140
tttptd/laravel-responder
src/Exceptions/Handler.php
Handler.render
public function render($request, Exception $exception) { $this->transformException($exception); if ($exception instanceof ApiException) { return $this->renderApiError($exception); } return parent::render($request, $exception); }
php
public function render($request, Exception $exception) { $this->transformException($exception); if ($exception instanceof ApiException) { return $this->renderApiError($exception); } return parent::render($request, $exception); }
[ "public", "function", "render", "(", "$", "request", ",", "Exception", "$", "exception", ")", "{", "$", "this", "->", "transformException", "(", "$", "exception", ")", ";", "if", "(", "$", "exception", "instanceof", "ApiException", ")", "{", "return", "$",...
Render an exception into an HTTP response. @param \Illuminate\Http\Request $request @param Exception $exception @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
[ "Render", "an", "exception", "into", "an", "HTTP", "response", "." ]
train
https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Exceptions/Handler.php#L21-L30
mustardandrew/muan-laravel-acl
src/Commands/Role/ViewCommand.php
ViewCommand.handle
public function handle() { $roleName = $this->argument('role'); if (! $role = Role::whereName($roleName)->first()) { $this->warn("Role {$roleName} not found!"); return 1; } echo "Role: {$role->name} (ID = {$role->id})", PHP_EOL; echo "Created at: {$r...
php
public function handle() { $roleName = $this->argument('role'); if (! $role = Role::whereName($roleName)->first()) { $this->warn("Role {$roleName} not found!"); return 1; } echo "Role: {$role->name} (ID = {$role->id})", PHP_EOL; echo "Created at: {$r...
[ "public", "function", "handle", "(", ")", "{", "$", "roleName", "=", "$", "this", "->", "argument", "(", "'role'", ")", ";", "if", "(", "!", "$", "role", "=", "Role", "::", "whereName", "(", "$", "roleName", ")", "->", "first", "(", ")", ")", "{"...
Execute the console command. @return mixed
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/mustardandrew/muan-laravel-acl/blob/b5f23340b5536babb98d9fd0d727a7a3371c97d5/src/Commands/Role/ViewCommand.php#L34-L60
spiral-modules/listing
source/Listing/Traits/SelectorValidationTrait.php
SelectorValidationTrait.validateSelector
protected function validateSelector(PaginatorAwareInterface $selector) { if (!$selector instanceof RecordSelector && !$selector instanceof DocumentSelector) { throw new InvalidSelectorException( "Only instance of Record/Document selectors are allowed, '" . get_cla...
php
protected function validateSelector(PaginatorAwareInterface $selector) { if (!$selector instanceof RecordSelector && !$selector instanceof DocumentSelector) { throw new InvalidSelectorException( "Only instance of Record/Document selectors are allowed, '" . get_cla...
[ "protected", "function", "validateSelector", "(", "PaginatorAwareInterface", "$", "selector", ")", "{", "if", "(", "!", "$", "selector", "instanceof", "RecordSelector", "&&", "!", "$", "selector", "instanceof", "DocumentSelector", ")", "{", "throw", "new", "Invali...
@param PaginatorAwareInterface|RecordSelector|DocumentSelector $selector @throws InvalidSelectorException
[ "@param", "PaginatorAwareInterface|RecordSelector|DocumentSelector", "$selector" ]
train
https://github.com/spiral-modules/listing/blob/89abe8939ce91cbf61b51b99e93ce1e57c8af83c/source/Listing/Traits/SelectorValidationTrait.php#L22-L30
webignition/guzzle-curl-exception
src/Factory.php
Factory.fromConnectException
public static function fromConnectException(ConnectException $connectException) { if (!self::isCurlException($connectException)) { return null; } $curlMessageParts = explode(':', $connectException->getMessage(), 2); return new Exception( trim($curlMessagePar...
php
public static function fromConnectException(ConnectException $connectException) { if (!self::isCurlException($connectException)) { return null; } $curlMessageParts = explode(':', $connectException->getMessage(), 2); return new Exception( trim($curlMessagePar...
[ "public", "static", "function", "fromConnectException", "(", "ConnectException", "$", "connectException", ")", "{", "if", "(", "!", "self", "::", "isCurlException", "(", "$", "connectException", ")", ")", "{", "return", "null", ";", "}", "$", "curlMessageParts",...
@param ConnectException $connectException @return null|Exception
[ "@param", "ConnectException", "$connectException" ]
train
https://github.com/webignition/guzzle-curl-exception/blob/87b991140030c1e47cb1514635fa48a553ed061d/src/Factory.php#L14-L27
hirnsturm/typo3-exceptionhandler
TYPO3/ExceptionHandler/ProductionExceptionHandler.php
ProductionExceptionHandler.sendNotificationMail
protected function sendNotificationMail($exception) { // Build message $message = array(); $message[] = 'Title: ' . $this->getTitle($exception); $message[] = 'Message: ' . PHP_EOL . $this->getMessage($exception); $message[] = 'Server name: ' . filter_input(INPUT_SERVER, 'SERV...
php
protected function sendNotificationMail($exception) { // Build message $message = array(); $message[] = 'Title: ' . $this->getTitle($exception); $message[] = 'Message: ' . PHP_EOL . $this->getMessage($exception); $message[] = 'Server name: ' . filter_input(INPUT_SERVER, 'SERV...
[ "protected", "function", "sendNotificationMail", "(", "$", "exception", ")", "{", "// Build message", "$", "message", "=", "array", "(", ")", ";", "$", "message", "[", "]", "=", "'Title: '", ".", "$", "this", "->", "getTitle", "(", "$", "exception", ")", ...
Sends an exception as notification e-mail @param $exception
[ "Sends", "an", "exception", "as", "notification", "e", "-", "mail" ]
train
https://github.com/hirnsturm/typo3-exceptionhandler/blob/268c3f3269d39b238d6fa1b39d8fbae3f0d5921d/TYPO3/ExceptionHandler/ProductionExceptionHandler.php#L33-L60
nikolaposa/ZfOpenGraph
src/ZfOpenGraph/View/Helper/HeadMeta.php
HeadMeta.isValid
protected function isValid($item) { if ((!$item instanceof stdClass) || !isset($item->type) || !isset($item->modifiers) ) { return false; } if ($this->doctypeValidationEnabled) { if (!isset($item->content) && (! $this->...
php
protected function isValid($item) { if ((!$item instanceof stdClass) || !isset($item->type) || !isset($item->modifiers) ) { return false; } if ($this->doctypeValidationEnabled) { if (!isset($item->content) && (! $this->...
[ "protected", "function", "isValid", "(", "$", "item", ")", "{", "if", "(", "(", "!", "$", "item", "instanceof", "stdClass", ")", "||", "!", "isset", "(", "$", "item", "->", "type", ")", "||", "!", "isset", "(", "$", "item", "->", "modifiers", ")", ...
Determine if item is valid @param mixed $item @return bool
[ "Determine", "if", "item", "is", "valid" ]
train
https://github.com/nikolaposa/ZfOpenGraph/blob/5e1a9b6ff8d2e149dc9d949635f39786f6acc347/src/ZfOpenGraph/View/Helper/HeadMeta.php#L52-L85
arndtteunissen/column-layout
Classes/ViewHelpers/ColumnWrapViewHelper.php
ColumnWrapViewHelper.renderStatic
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { if (isset($GLOBALS['TX_COLUMN_LAYOUT']['enabled']) && $GLOBALS['TX_COLUMN_LAYOUT']['enabled']) { return self::wrapContent($arguments, $renderChildrenClosure); ...
php
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { if (isset($GLOBALS['TX_COLUMN_LAYOUT']['enabled']) && $GLOBALS['TX_COLUMN_LAYOUT']['enabled']) { return self::wrapContent($arguments, $renderChildrenClosure); ...
[ "public", "static", "function", "renderStatic", "(", "array", "$", "arguments", ",", "\\", "Closure", "$", "renderChildrenClosure", ",", "RenderingContextInterface", "$", "renderingContext", ")", "{", "if", "(", "isset", "(", "$", "GLOBALS", "[", "'TX_COLUMN_LAYOU...
{@inheritdoc}
[ "{" ]
train
https://github.com/arndtteunissen/column-layout/blob/ad737068eef3b084d4d0e3a48e6a3d8277af9560/Classes/ViewHelpers/ColumnWrapViewHelper.php#L60-L67
josh-taylor/migrations-generator
src/Describer.php
Describer.describe
public function describe($table) { $schema = $this->db->connection() ->getDoctrineConnection() ->getSchemaManager(); return $this->parseSchema( $schema->listTableColumns($table) ); }
php
public function describe($table) { $schema = $this->db->connection() ->getDoctrineConnection() ->getSchemaManager(); return $this->parseSchema( $schema->listTableColumns($table) ); }
[ "public", "function", "describe", "(", "$", "table", ")", "{", "$", "schema", "=", "$", "this", "->", "db", "->", "connection", "(", ")", "->", "getDoctrineConnection", "(", ")", "->", "getSchemaManager", "(", ")", ";", "return", "$", "this", "->", "pa...
Describe all columns in a single table @param string $table @return array
[ "Describe", "all", "columns", "in", "a", "single", "table" ]
train
https://github.com/josh-taylor/migrations-generator/blob/bb6edc78773d11491881f12265a658bf058cb218/src/Describer.php#L32-L41
josh-taylor/migrations-generator
src/Describer.php
Describer.parseSchema
protected function parseSchema(array $columns) { $schema = []; foreach ($columns as $name => $column) { $schema[] = [ 'name' => $column->getName(), 'type' => $column->getType()->getName() ]; } return $schema; }
php
protected function parseSchema(array $columns) { $schema = []; foreach ($columns as $name => $column) { $schema[] = [ 'name' => $column->getName(), 'type' => $column->getType()->getName() ]; } return $schema; }
[ "protected", "function", "parseSchema", "(", "array", "$", "columns", ")", "{", "$", "schema", "=", "[", "]", ";", "foreach", "(", "$", "columns", "as", "$", "name", "=>", "$", "column", ")", "{", "$", "schema", "[", "]", "=", "[", "'name'", "=>", ...
Convert the DBAL schema to an assoc array. @param array $columns @return array
[ "Convert", "the", "DBAL", "schema", "to", "an", "assoc", "array", "." ]
train
https://github.com/josh-taylor/migrations-generator/blob/bb6edc78773d11491881f12265a658bf058cb218/src/Describer.php#L49-L61
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/Descriptor/Validator/Constraints/Property/HasSummaryValidator.php
HasSummaryValidator.validate
public function validate($value, Constraint $constraint) { if (! $value instanceof PropertyDescriptor) { throw new ConstraintDefinitionException( 'The Property\HasSummary validator may only be used on property objects' ); } $var = $value->getVar(); ...
php
public function validate($value, Constraint $constraint) { if (! $value instanceof PropertyDescriptor) { throw new ConstraintDefinitionException( 'The Property\HasSummary validator may only be used on property objects' ); } $var = $value->getVar(); ...
[ "public", "function", "validate", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "$", "value", "instanceof", "PropertyDescriptor", ")", "{", "throw", "new", "ConstraintDefinitionException", "(", "'The Property\\HasSummary validato...
Checks if the passed value is valid. @param PropertyDescriptor $value The value that should be validated @param Constraint $constraint The constraint for the validation @throws ConstraintDefinitionException if this is not a constraint on a PropertyDescriptor object.
[ "Checks", "if", "the", "passed", "value", "is", "valid", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Descriptor/Validator/Constraints/Property/HasSummaryValidator.php#L31-L43
traderinteractive/filter-arrays-php
src/Arrays.php
Arrays.filter
public static function filter($value, int $minCount = 1, int $maxCount = PHP_INT_MAX) : array { if (!is_array($value)) { throw new FilterException("Value '" . trim(var_export($value, true), "'") . "' is not an array"); } $count = count($value); if ($count < $minCount) { ...
php
public static function filter($value, int $minCount = 1, int $maxCount = PHP_INT_MAX) : array { if (!is_array($value)) { throw new FilterException("Value '" . trim(var_export($value, true), "'") . "' is not an array"); } $count = count($value); if ($count < $minCount) { ...
[ "public", "static", "function", "filter", "(", "$", "value", ",", "int", "$", "minCount", "=", "1", ",", "int", "$", "maxCount", "=", "PHP_INT_MAX", ")", ":", "array", "{", "if", "(", "!", "is_array", "(", "$", "value", ")", ")", "{", "throw", "new...
Filter an array by throwing if not an array or count not in the min/max range. @param mixed $value The value to filter. @param integer $minCount The minimum allowed count in the array. @param integer $maxCount The maximum allowed count in the array. @return array @throws FilterException if $value is not an arra...
[ "Filter", "an", "array", "by", "throwing", "if", "not", "an", "array", "or", "count", "not", "in", "the", "min", "/", "max", "range", "." ]
train
https://github.com/traderinteractive/filter-arrays-php/blob/8958109f3e10e6c37fcc6c7c4830d9bcba3ed222/src/Arrays.php#L25-L41
traderinteractive/filter-arrays-php
src/Arrays.php
Arrays.in
public static function in($value, array $haystack, bool $strict = true) { if (!in_array($value, $haystack, $strict)) { throw new FilterException( "Value '" . trim(var_export($value, true), "'") . "' is not in array " . var_export($haystack, true) ); } ...
php
public static function in($value, array $haystack, bool $strict = true) { if (!in_array($value, $haystack, $strict)) { throw new FilterException( "Value '" . trim(var_export($value, true), "'") . "' is not in array " . var_export($haystack, true) ); } ...
[ "public", "static", "function", "in", "(", "$", "value", ",", "array", "$", "haystack", ",", "bool", "$", "strict", "=", "true", ")", "{", "if", "(", "!", "in_array", "(", "$", "value", ",", "$", "haystack", ",", "$", "strict", ")", ")", "{", "th...
Filter an array by throwing if $value is not in $haystack adhering to $strict. @param mixed $value The searched value. @param array $haystack The array to be searched. @param bool $strict Flag to compare strictly or not. @see in_array() @return mixed The passed in value @throws FilterException if $value is not...
[ "Filter", "an", "array", "by", "throwing", "if", "$value", "is", "not", "in", "$haystack", "adhering", "to", "$strict", "." ]
train
https://github.com/traderinteractive/filter-arrays-php/blob/8958109f3e10e6c37fcc6c7c4830d9bcba3ed222/src/Arrays.php#L54-L63
traderinteractive/filter-arrays-php
src/Arrays.php
Arrays.flatten
public static function flatten(array $value) : array { $result = []; array_walk_recursive( $value, function ($item) use (&$result) { $result[] = $item; } ); return $result; }
php
public static function flatten(array $value) : array { $result = []; array_walk_recursive( $value, function ($item) use (&$result) { $result[] = $item; } ); return $result; }
[ "public", "static", "function", "flatten", "(", "array", "$", "value", ")", ":", "array", "{", "$", "result", "=", "[", "]", ";", "array_walk_recursive", "(", "$", "value", ",", "function", "(", "$", "item", ")", "use", "(", "&", "$", "result", ")", ...
Given a multi-dimensional array, flatten the array to a single level. The order of the values will be maintained, but the keys will not. For example, given the array [[1, 2], [3, [4, 5]]], this would result in the array [1, 2, 3, 4, 5]. @param array $value The array to flatten. @return array The single-dimension ar...
[ "Given", "a", "multi", "-", "dimensional", "array", "flatten", "the", "array", "to", "a", "single", "level", "." ]
train
https://github.com/traderinteractive/filter-arrays-php/blob/8958109f3e10e6c37fcc6c7c4830d9bcba3ed222/src/Arrays.php#L76-L88
fabulator/fitbit-api-base
lib/Fabulator/Fitbit/FitbitApiBase.php
FitbitApiBase.getLoginUrl
public function getLoginUrl( $redirectUri, $scope, $responseType = 'code', $expiresIn = null, $prompt = 'none', $state = null) { $parameters = [ 'response_type' => $responseType, 'client_id' => $this->clientId, 'redirect_uri...
php
public function getLoginUrl( $redirectUri, $scope, $responseType = 'code', $expiresIn = null, $prompt = 'none', $state = null) { $parameters = [ 'response_type' => $responseType, 'client_id' => $this->clientId, 'redirect_uri...
[ "public", "function", "getLoginUrl", "(", "$", "redirectUri", ",", "$", "scope", ",", "$", "responseType", "=", "'code'", ",", "$", "expiresIn", "=", "null", ",", "$", "prompt", "=", "'none'", ",", "$", "state", "=", "null", ")", "{", "$", "parameters"...
Login url for users https://dev.fitbit.com/docs/oauth2/#authorization-page @param string $redirectUri Where will be user redirected @param array(activity, heartrate, location, nutrition, profile, settings, sleep, social, weight) $scope Array of scopes you require @param string(code, token) $responseType type of Fitbit...
[ "Login", "url", "for", "users", "https", ":", "//", "dev", ".", "fitbit", ".", "com", "/", "docs", "/", "oauth2", "/", "#authorization", "-", "page" ]
train
https://github.com/fabulator/fitbit-api-base/blob/c2ef868796f991586fe227a659553f304994bdd9/lib/Fabulator/Fitbit/FitbitApiBase.php#L75-L100
fabulator/fitbit-api-base
lib/Fabulator/Fitbit/FitbitApiBase.php
FitbitApiBase.requestAccessToken
public function requestAccessToken($code, $redirectUri, $expiresIn = null, $state = null) { $parameters = [ 'code' => $code, 'grant_type' => 'authorization_code', 'client_id' => $this->clientId, 'redirect_uri' => $redirectUri, ]; if ($expiresI...
php
public function requestAccessToken($code, $redirectUri, $expiresIn = null, $state = null) { $parameters = [ 'code' => $code, 'grant_type' => 'authorization_code', 'client_id' => $this->clientId, 'redirect_uri' => $redirectUri, ]; if ($expiresI...
[ "public", "function", "requestAccessToken", "(", "$", "code", ",", "$", "redirectUri", ",", "$", "expiresIn", "=", "null", ",", "$", "state", "=", "null", ")", "{", "$", "parameters", "=", "[", "'code'", "=>", "$", "code", ",", "'grant_type'", "=>", "'...
Request new Fitbit access token. @param string $code code from Fitbit @param string $redirectUri redirect uri used to get code @param int|null $expiresIn set length of token @param string|null $state This parameter will be added to the redirect URI exactly as your application specifies. @return ResponseInterface respo...
[ "Request", "new", "Fitbit", "access", "token", "." ]
train
https://github.com/fabulator/fitbit-api-base/blob/c2ef868796f991586fe227a659553f304994bdd9/lib/Fabulator/Fitbit/FitbitApiBase.php#L111-L129
fabulator/fitbit-api-base
lib/Fabulator/Fitbit/FitbitApiBase.php
FitbitApiBase.refreshAccessToken
public function refreshAccessToken($refreshToken, $expiresIn = null) { $parameters = [ 'grant_type' => 'refresh_token', 'refresh_token' => $refreshToken, ]; if ($expiresIn != null) { $parameters['expires_in'] = $expiresIn; } return $this-...
php
public function refreshAccessToken($refreshToken, $expiresIn = null) { $parameters = [ 'grant_type' => 'refresh_token', 'refresh_token' => $refreshToken, ]; if ($expiresIn != null) { $parameters['expires_in'] = $expiresIn; } return $this-...
[ "public", "function", "refreshAccessToken", "(", "$", "refreshToken", ",", "$", "expiresIn", "=", "null", ")", "{", "$", "parameters", "=", "[", "'grant_type'", "=>", "'refresh_token'", ",", "'refresh_token'", "=>", "$", "refreshToken", ",", "]", ";", "if", ...
Refresh Fitbit token. @param string $refreshToken refresh token @param int|null $expiresIn set length of token @return ResponseInterface response from Fitbit API
[ "Refresh", "Fitbit", "token", "." ]
train
https://github.com/fabulator/fitbit-api-base/blob/c2ef868796f991586fe227a659553f304994bdd9/lib/Fabulator/Fitbit/FitbitApiBase.php#L138-L150
fabulator/fitbit-api-base
lib/Fabulator/Fitbit/FitbitApiBase.php
FitbitApiBase.tokenRequest
private function tokenRequest($namespace, $parameters) { $client = new Client([ 'headers' => [ 'content-type' => 'application/x-www-form-urlencoded', 'Authorization' => 'Basic '. base64_encode($this->clientId . ':' . $this->secret), ] ]); ...
php
private function tokenRequest($namespace, $parameters) { $client = new Client([ 'headers' => [ 'content-type' => 'application/x-www-form-urlencoded', 'Authorization' => 'Basic '. base64_encode($this->clientId . ':' . $this->secret), ] ]); ...
[ "private", "function", "tokenRequest", "(", "$", "namespace", ",", "$", "parameters", ")", "{", "$", "client", "=", "new", "Client", "(", "[", "'headers'", "=>", "[", "'content-type'", "=>", "'application/x-www-form-urlencoded'", ",", "'Authorization'", "=>", "'...
Request token action. @param string $namespace namespace of request @param array $parameters request parameters @return ResponseInterface response from Fitbit API
[ "Request", "token", "action", "." ]
train
https://github.com/fabulator/fitbit-api-base/blob/c2ef868796f991586fe227a659553f304994bdd9/lib/Fabulator/Fitbit/FitbitApiBase.php#L174-L184
fabulator/fitbit-api-base
lib/Fabulator/Fitbit/FitbitApiBase.php
FitbitApiBase.send
public function send($url, $method = 'GET', $data = []) { $method = strtolower($method); $settings = [ 'headers' => array_merge([ 'Authorization' => 'Bearer ' . $this->getToken(), 'Content-Type' => 'application/x-www-form-urlencoded', ], $thi...
php
public function send($url, $method = 'GET', $data = []) { $method = strtolower($method); $settings = [ 'headers' => array_merge([ 'Authorization' => 'Bearer ' . $this->getToken(), 'Content-Type' => 'application/x-www-form-urlencoded', ], $thi...
[ "public", "function", "send", "(", "$", "url", ",", "$", "method", "=", "'GET'", ",", "$", "data", "=", "[", "]", ")", "{", "$", "method", "=", "strtolower", "(", "$", "method", ")", ";", "$", "settings", "=", "[", "'headers'", "=>", "array_merge",...
Send authorized request to Fitbit API. @param string $url called url @param string $method http method @param array $data data in body @return ResponseInterface response from Fitbit API
[ "Send", "authorized", "request", "to", "Fitbit", "API", "." ]
train
https://github.com/fabulator/fitbit-api-base/blob/c2ef868796f991586fe227a659553f304994bdd9/lib/Fabulator/Fitbit/FitbitApiBase.php#L239-L256
php-lug/lug
src/Component/Grid/DataSource/Doctrine/MongoDB/ExpressionBuilder.php
ExpressionBuilder.notLike
public function notLike($x, $y) { return $this->field($x)->not($this->convertLikeToRegex($y)); }
php
public function notLike($x, $y) { return $this->field($x)->not($this->convertLikeToRegex($y)); }
[ "public", "function", "notLike", "(", "$", "x", ",", "$", "y", ")", "{", "return", "$", "this", "->", "field", "(", "$", "x", ")", "->", "not", "(", "$", "this", "->", "convertLikeToRegex", "(", "$", "y", ")", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/DataSource/Doctrine/MongoDB/ExpressionBuilder.php#L179-L182
php-lug/lug
src/Component/Grid/DataSource/Doctrine/MongoDB/ExpressionBuilder.php
ExpressionBuilder.between
public function between($value, $x, $y) { return $this->andX([ $this->gte($value, $x), $this->lte($value, $y), ]); }
php
public function between($value, $x, $y) { return $this->andX([ $this->gte($value, $x), $this->lte($value, $y), ]); }
[ "public", "function", "between", "(", "$", "value", ",", "$", "x", ",", "$", "y", ")", "{", "return", "$", "this", "->", "andX", "(", "[", "$", "this", "->", "gte", "(", "$", "value", ",", "$", "x", ")", ",", "$", "this", "->", "lte", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/DataSource/Doctrine/MongoDB/ExpressionBuilder.php#L187-L193
php-lug/lug
src/Component/Grid/DataSource/Doctrine/MongoDB/ExpressionBuilder.php
ExpressionBuilder.notBetween
public function notBetween($value, $x, $y) { return $this->orX([ $this->lt($value, $x), $this->gt($value, $y), ]); }
php
public function notBetween($value, $x, $y) { return $this->orX([ $this->lt($value, $x), $this->gt($value, $y), ]); }
[ "public", "function", "notBetween", "(", "$", "value", ",", "$", "x", ",", "$", "y", ")", "{", "return", "$", "this", "->", "orX", "(", "[", "$", "this", "->", "lt", "(", "$", "value", ",", "$", "x", ")", ",", "$", "this", "->", "gt", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/DataSource/Doctrine/MongoDB/ExpressionBuilder.php#L198-L204
php-lug/lug
src/Component/Grid/DataSource/Doctrine/MongoDB/ExpressionBuilder.php
ExpressionBuilder.convertLikeToRegex
private function convertLikeToRegex($x) { $x = preg_quote($x); $pattern = '.*?'; $regex = null; if (strpos($x, $like = '%') === 0) { $regex .= $pattern; $x = substr($x, 1); } if (strrpos($x, $like) === strlen($x) - 1) { $regex .= ...
php
private function convertLikeToRegex($x) { $x = preg_quote($x); $pattern = '.*?'; $regex = null; if (strpos($x, $like = '%') === 0) { $regex .= $pattern; $x = substr($x, 1); } if (strrpos($x, $like) === strlen($x) - 1) { $regex .= ...
[ "private", "function", "convertLikeToRegex", "(", "$", "x", ")", "{", "$", "x", "=", "preg_quote", "(", "$", "x", ")", ";", "$", "pattern", "=", "'.*?'", ";", "$", "regex", "=", "null", ";", "if", "(", "strpos", "(", "$", "x", ",", "$", "like", ...
@param string $x @return \MongoRegex
[ "@param", "string", "$x" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/DataSource/Doctrine/MongoDB/ExpressionBuilder.php#L229-L247
davedevelopment/twig-inflection
src/DaveDevelopment/TwigInflection/Twig/Extension/Inflection.php
Inflection.singularize
public static function singularize($plural, $count = 1, $singular = null) { $count = intval($count); if ($count != 1) { return $plural; } if (null == $singular) { $singular = \Doctrine\Common\Inflector\Inflector::singularize($plural); } ret...
php
public static function singularize($plural, $count = 1, $singular = null) { $count = intval($count); if ($count != 1) { return $plural; } if (null == $singular) { $singular = \Doctrine\Common\Inflector\Inflector::singularize($plural); } ret...
[ "public", "static", "function", "singularize", "(", "$", "plural", ",", "$", "count", "=", "1", ",", "$", "singular", "=", "null", ")", "{", "$", "count", "=", "intval", "(", "$", "count", ")", ";", "if", "(", "$", "count", "!=", "1", ")", "{", ...
Singularize the $plural word if count == 1. If $singular is passed, it will be used instead of trying to use doctrine\inflector @param string $plural - chicken @param int $count - e.g. 4 @param string $singular - (optional) chickens @return string
[ "Singularize", "the", "$plural", "word", "if", "count", "==", "1", ".", "If", "$singular", "is", "passed", "it", "will", "be", "used", "instead", "of", "trying", "to", "use", "doctrine", "\\", "inflector" ]
train
https://github.com/davedevelopment/twig-inflection/blob/c5c64de5673580f1a30790bb8784a64ac6191dde/src/DaveDevelopment/TwigInflection/Twig/Extension/Inflection.php#L29-L42
Danzabar/config-builder
src/Data/Converter.php
Converter.setExtension
public function setExtension($ext) { $this->extension = $ext; if(!$this->extensionMap->has($ext)) { throw new Exceptions\InvalidExtension($ext); } return $this; }
php
public function setExtension($ext) { $this->extension = $ext; if(!$this->extensionMap->has($ext)) { throw new Exceptions\InvalidExtension($ext); } return $this; }
[ "public", "function", "setExtension", "(", "$", "ext", ")", "{", "$", "this", "->", "extension", "=", "$", "ext", ";", "if", "(", "!", "$", "this", "->", "extensionMap", "->", "has", "(", "$", "ext", ")", ")", "{", "throw", "new", "Exceptions", "\\...
Sets the extension @param String $ext @return Converter @author Dan Cox
[ "Sets", "the", "extension" ]
train
https://github.com/Danzabar/config-builder/blob/3b237be578172c32498bbcdfb360e69a6243739d/src/Data/Converter.php#L63-L73
Danzabar/config-builder
src/Data/Converter.php
Converter.process
public function process($data = '') { $this->data = $data; $ext = $this->extensionMap->get($this->extension); $arr = $ext->load($data)->toArray(); $this->paramBag = new ParamBag($arr); return true; }
php
public function process($data = '') { $this->data = $data; $ext = $this->extensionMap->get($this->extension); $arr = $ext->load($data)->toArray(); $this->paramBag = new ParamBag($arr); return true; }
[ "public", "function", "process", "(", "$", "data", "=", "''", ")", "{", "$", "this", "->", "data", "=", "$", "data", ";", "$", "ext", "=", "$", "this", "->", "extensionMap", "->", "get", "(", "$", "this", "->", "extension", ")", ";", "$", "arr", ...
Loads an extension class to convert the data to an array and pass it back as a param bag @param String $data @return ParamBag @author Dan Cox
[ "Loads", "an", "extension", "class", "to", "convert", "the", "data", "to", "an", "array", "and", "pass", "it", "back", "as", "a", "param", "bag" ]
train
https://github.com/Danzabar/config-builder/blob/3b237be578172c32498bbcdfb360e69a6243739d/src/Data/Converter.php#L82-L92
Danzabar/config-builder
src/Data/Converter.php
Converter.toNative
public function toNative(ParamBag $paramBag) { // We can assume the extension exists, since it has already been used $ext = $this->extensionMap->get($this->extension); $native = $ext->load($paramBag->all())->toNative(); return $native; }
php
public function toNative(ParamBag $paramBag) { // We can assume the extension exists, since it has already been used $ext = $this->extensionMap->get($this->extension); $native = $ext->load($paramBag->all())->toNative(); return $native; }
[ "public", "function", "toNative", "(", "ParamBag", "$", "paramBag", ")", "{", "// We can assume the extension exists, since it has already been used", "$", "ext", "=", "$", "this", "->", "extensionMap", "->", "get", "(", "$", "this", "->", "extension", ")", ";", "...
Converts the parambag instance of the native extension format @param \Danzabar\Config\Data\ParamBag $paramBag @return Mixed @author Dan Cox
[ "Converts", "the", "parambag", "instance", "of", "the", "native", "extension", "format" ]
train
https://github.com/Danzabar/config-builder/blob/3b237be578172c32498bbcdfb360e69a6243739d/src/Data/Converter.php#L101-L108
php-lug/lug
src/Bundle/ResourceBundle/LugResourceBundle.php
LugResourceBundle.build
public function build(ContainerBuilder $container) { $container ->addCompilerPass(new RegisterResourcePass()) ->addCompilerPass(new RegisterDriverMappingPass()) ->addCompilerPass(new RegisterFactoryPass()) ->addCompilerPass(new RegisterManagerTagPass()) ...
php
public function build(ContainerBuilder $container) { $container ->addCompilerPass(new RegisterResourcePass()) ->addCompilerPass(new RegisterDriverMappingPass()) ->addCompilerPass(new RegisterFactoryPass()) ->addCompilerPass(new RegisterManagerTagPass()) ...
[ "public", "function", "build", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "container", "->", "addCompilerPass", "(", "new", "RegisterResourcePass", "(", ")", ")", "->", "addCompilerPass", "(", "new", "RegisterDriverMappingPass", "(", ")", ")", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/ResourceBundle/LugResourceBundle.php#L38-L54
GrupaZero/api
src/Gzero/Api/Transformer/LangTransformer.php
LangTransformer.transform
public function transform($lang) { $lang = $this->entityToArray(Lang::class, $lang); return [ 'code' => $lang['code'], 'i18n' => $lang['i18n'], 'isEnabled' => (bool) $lang['is_enabled'], 'isDefault' => (bool) $lang['is_default'], ]; ...
php
public function transform($lang) { $lang = $this->entityToArray(Lang::class, $lang); return [ 'code' => $lang['code'], 'i18n' => $lang['i18n'], 'isEnabled' => (bool) $lang['is_enabled'], 'isDefault' => (bool) $lang['is_default'], ]; ...
[ "public", "function", "transform", "(", "$", "lang", ")", "{", "$", "lang", "=", "$", "this", "->", "entityToArray", "(", "Lang", "::", "class", ",", "$", "lang", ")", ";", "return", "[", "'code'", "=>", "$", "lang", "[", "'code'", "]", ",", "'i18n...
Transforms lang entity @param Lang|array $lang Lang entity @return array
[ "Transforms", "lang", "entity" ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Transformer/LangTransformer.php#L26-L35
blast-project/BaseEntitiesBundle
src/Admin/TreeableAdmin.php
TreeableAdmin.create
public function create($object) { $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); $this->prePersist($object); foreach ($this->extensions as $extension) { $extension->prePersist($this, $object); } $object->setMaterializedPath('...
php
public function create($object) { $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); $this->prePersist($object); foreach ($this->extensions as $extension) { $extension->prePersist($this, $object); } $object->setMaterializedPath('...
[ "public", "function", "create", "(", "$", "object", ")", "{", "$", "em", "=", "$", "this", "->", "getConfigurationPool", "(", ")", "->", "getContainer", "(", ")", "->", "get", "(", "'doctrine'", ")", "->", "getManager", "(", ")", ";", "$", "this", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Admin/TreeableAdmin.php#L22-L49
blast-project/BaseEntitiesBundle
src/Admin/TreeableAdmin.php
TreeableAdmin.getObject
public function getObject($id) { $object = parent::getObject($id); $parent_node_id = $object->getParentNodeId(); $parent_node = $this->getModelManager()->find($this->getClass(), $parent_node_id); $object->setParentNode($parent_node); return $object; }
php
public function getObject($id) { $object = parent::getObject($id); $parent_node_id = $object->getParentNodeId(); $parent_node = $this->getModelManager()->find($this->getClass(), $parent_node_id); $object->setParentNode($parent_node); return $object; }
[ "public", "function", "getObject", "(", "$", "id", ")", "{", "$", "object", "=", "parent", "::", "getObject", "(", "$", "id", ")", ";", "$", "parent_node_id", "=", "$", "object", "->", "getParentNodeId", "(", ")", ";", "$", "parent_node", "=", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Admin/TreeableAdmin.php#L54-L63
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Scrybe/Template/Twig.php
Twig.setPath
public function setPath($path) { if (!file_exists($path) || !is_dir($path)) { throw new \InvalidArgumentException( 'Expected the template path to be an existing directory, received: '.$path ); } $this->path = $path; }
php
public function setPath($path) { if (!file_exists($path) || !is_dir($path)) { throw new \InvalidArgumentException( 'Expected the template path to be an existing directory, received: '.$path ); } $this->path = $path; }
[ "public", "function", "setPath", "(", "$", "path", ")", "{", "if", "(", "!", "file_exists", "(", "$", "path", ")", "||", "!", "is_dir", "(", "$", "path", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Expected the template path to ...
Sets the base path where the templates are stored. @param string $path @throws \InvalidArgumentException @return void
[ "Sets", "the", "base", "path", "where", "the", "templates", "are", "stored", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Template/Twig.php#L83-L92
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Scrybe/Template/Twig.php
Twig.decorate
public function decorate($contents, array $options = array()) { return $this->getTwigEnvironment()->render( $this->getTemplateFilename(), array_merge(array('contents' => $contents), $options) ); }
php
public function decorate($contents, array $options = array()) { return $this->getTwigEnvironment()->render( $this->getTemplateFilename(), array_merge(array('contents' => $contents), $options) ); }
[ "public", "function", "decorate", "(", "$", "contents", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "getTwigEnvironment", "(", ")", "->", "render", "(", "$", "this", "->", "getTemplateFilename", "(", ")", ...
Applies the relevant template upon the given content. This method takes the combines the template with the given contents and generates a final piece of text from that. The user may add additional options that are set as parameters in the template. @param string $contents @param string[] $options @see getTemplate...
[ "Applies", "the", "relevant", "template", "upon", "the", "given", "content", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Template/Twig.php#L154-L160
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Scrybe/Template/Twig.php
Twig.getAssets
public function getAssets() { $finder = new Finder(); return iterator_to_array( $finder->files() ->in($this->path.DIRECTORY_SEPARATOR . $this->name) ->depth('> 0') ->notName('*.twig') ->sortByName() ); }
php
public function getAssets() { $finder = new Finder(); return iterator_to_array( $finder->files() ->in($this->path.DIRECTORY_SEPARATOR . $this->name) ->depth('> 0') ->notName('*.twig') ->sortByName() ); }
[ "public", "function", "getAssets", "(", ")", "{", "$", "finder", "=", "new", "Finder", "(", ")", ";", "return", "iterator_to_array", "(", "$", "finder", "->", "files", "(", ")", "->", "in", "(", "$", "this", "->", "path", ".", "DIRECTORY_SEPARATOR", "....
Returns a list of files that need to be copied to the destination location. Examples of assets can be: * CSS files * Javascript files * Images Assets for this template engine means every file that is contained in a subfolder of the template folder and does not end with the extension twig. Thus every file in the roo...
[ "Returns", "a", "list", "of", "files", "that", "need", "to", "be", "copied", "to", "the", "destination", "location", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Template/Twig.php#L179-L190
jasny/codeception-module
src/Connector.php
Connector.setBaseRequest
public function setBaseRequest(ServerRequestInterface $request) { if ($request instanceof GlobalEnvironmentInterface && $request->isStale()) { throw new \RuntimeException("Unable to set base request: ServerRequest is stale"); } $this->baseRequest = $request; }
php
public function setBaseRequest(ServerRequestInterface $request) { if ($request instanceof GlobalEnvironmentInterface && $request->isStale()) { throw new \RuntimeException("Unable to set base request: ServerRequest is stale"); } $this->baseRequest = $request; }
[ "public", "function", "setBaseRequest", "(", "ServerRequestInterface", "$", "request", ")", "{", "if", "(", "$", "request", "instanceof", "GlobalEnvironmentInterface", "&&", "$", "request", "->", "isStale", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeExcep...
Set the base request @param ServerRequestInterface $request
[ "Set", "the", "base", "request" ]
train
https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/Connector.php#L77-L84
jasny/codeception-module
src/Connector.php
Connector.getBaseRequest
public function getBaseRequest() { if (!isset($this->baseRequest)) { $this->baseRequest = new ServerRequest(); } $request = $this->baseRequest; if ($request instanceof GlobalEnvironmentInterface && $request->isStale() === false) { $request = ...
php
public function getBaseRequest() { if (!isset($this->baseRequest)) { $this->baseRequest = new ServerRequest(); } $request = $this->baseRequest; if ($request instanceof GlobalEnvironmentInterface && $request->isStale() === false) { $request = ...
[ "public", "function", "getBaseRequest", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "baseRequest", ")", ")", "{", "$", "this", "->", "baseRequest", "=", "new", "ServerRequest", "(", ")", ";", "}", "$", "request", "=", "$", "this",...
Get the base request @return ServerRequestInterface
[ "Get", "the", "base", "request" ]
train
https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/Connector.php#L91-L104
jasny/codeception-module
src/Connector.php
Connector.setBaseResponse
public function setBaseResponse(ResponseInterface $response) { if ($response instanceof GlobalEnvironmentInterface && $response->isStale()) { throw new \RuntimeException("Unable to set base response: Response is stale"); } $this->baseResponse = $response; }
php
public function setBaseResponse(ResponseInterface $response) { if ($response instanceof GlobalEnvironmentInterface && $response->isStale()) { throw new \RuntimeException("Unable to set base response: Response is stale"); } $this->baseResponse = $response; }
[ "public", "function", "setBaseResponse", "(", "ResponseInterface", "$", "response", ")", "{", "if", "(", "$", "response", "instanceof", "GlobalEnvironmentInterface", "&&", "$", "response", "->", "isStale", "(", ")", ")", "{", "throw", "new", "\\", "RuntimeExcept...
Set the base response @param ResponseInterface $response
[ "Set", "the", "base", "response" ]
train
https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/Connector.php#L112-L119
jasny/codeception-module
src/Connector.php
Connector.getBaseResponse
public function getBaseResponse() { if (!isset($this->baseResponse)) { $this->baseResponse = new Response(); } $response = $this->baseResponse; if ($response instanceof GlobalEnvironmentInterface && $response->isStale() === false) { $response...
php
public function getBaseResponse() { if (!isset($this->baseResponse)) { $this->baseResponse = new Response(); } $response = $this->baseResponse; if ($response instanceof GlobalEnvironmentInterface && $response->isStale() === false) { $response...
[ "public", "function", "getBaseResponse", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "baseResponse", ")", ")", "{", "$", "this", "->", "baseResponse", "=", "new", "Response", "(", ")", ";", "}", "$", "response", "=", "$", "this", ...
Get the base response @return ResponseInterface
[ "Get", "the", "base", "response" ]
train
https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/Connector.php#L126-L139
jasny/codeception-module
src/Connector.php
Connector.resetOutput
protected function resetOutput() { if ($this->baseResponse instanceof GlobalEnvironmentInterface) { $this->baseResponse = $this->baseResponse->revive(); } // Clear output buffer if (isset($this->baseResponse) && $this->baseResponse->getBody() instanceof OutputBuf...
php
protected function resetOutput() { if ($this->baseResponse instanceof GlobalEnvironmentInterface) { $this->baseResponse = $this->baseResponse->revive(); } // Clear output buffer if (isset($this->baseResponse) && $this->baseResponse->getBody() instanceof OutputBuf...
[ "protected", "function", "resetOutput", "(", ")", "{", "if", "(", "$", "this", "->", "baseResponse", "instanceof", "GlobalEnvironmentInterface", ")", "{", "$", "this", "->", "baseResponse", "=", "$", "this", "->", "baseResponse", "->", "revive", "(", ")", ";...
Reset the response
[ "Reset", "the", "response" ]
train
https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/Connector.php#L155-L165
jasny/codeception-module
src/Connector.php
Connector.doRequest
protected function doRequest($request) { if ($this->getRouter() === null) { throw new \BadMethodCallException("Router not set"); } $this->reset(); // Reset before each HTTP request $psrRequest = $this->getRequestConvertor()->convert($request, $this->getB...
php
protected function doRequest($request) { if ($this->getRouter() === null) { throw new \BadMethodCallException("Router not set"); } $this->reset(); // Reset before each HTTP request $psrRequest = $this->getRequestConvertor()->convert($request, $this->getB...
[ "protected", "function", "doRequest", "(", "$", "request", ")", "{", "if", "(", "$", "this", "->", "getRouter", "(", ")", "===", "null", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "\"Router not set\"", ")", ";", "}", "$", "this", "->"...
Makes a request. @param BrowserKitRequest $request @return BrowserKitResponse
[ "Makes", "a", "request", "." ]
train
https://github.com/jasny/codeception-module/blob/5c2b12e4ab291f26424fda9fbf1618c818bc8d6e/src/Connector.php#L234-L248
Eresus/EresusCMS
src/core/framework/core/WWW/HTTP/HttpMessage.php
HttpMessage.fromEnv
public static function fromEnv($messageType, $className = 'HttpMessage') { if (Eresus_Kernel::isCLI()) { return null; } /* * Create message instance */ if (!class_exists($className, true)) { throw new RuntimeException("Class ...
php
public static function fromEnv($messageType, $className = 'HttpMessage') { if (Eresus_Kernel::isCLI()) { return null; } /* * Create message instance */ if (!class_exists($className, true)) { throw new RuntimeException("Class ...
[ "public", "static", "function", "fromEnv", "(", "$", "messageType", ",", "$", "className", "=", "'HttpMessage'", ")", "{", "if", "(", "Eresus_Kernel", "::", "isCLI", "(", ")", ")", "{", "return", "null", ";", "}", "/*\n * Create message instance\n ...
Создаёт объект HttpMessage из окружения В режиме CLI результат всегда будет null. @param int $messageType тип сообщения, см. константы TYPE_xxx @param string $className класс, расширяющий HttpMessage @return HttpMessage|null объект HttpMessage или null в случае ошибки @throws RuntimeException если класс $cl...
[ "Создаёт", "объект", "HttpMessage", "из", "окружения" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/WWW/HTTP/HttpMessage.php#L86-L136
Eresus/EresusCMS
src/core/framework/core/WWW/HTTP/HttpMessage.php
HttpMessage.setHttpVersion
public function setHttpVersion($version) { // Version validation pattern $pattern = '~^1\.[01]$~'; if (! preg_match($pattern, $version)) return false; $this->httpVersion = $version; return true; }
php
public function setHttpVersion($version) { // Version validation pattern $pattern = '~^1\.[01]$~'; if (! preg_match($pattern, $version)) return false; $this->httpVersion = $version; return true; }
[ "public", "function", "setHttpVersion", "(", "$", "version", ")", "{", "// Version validation pattern", "$", "pattern", "=", "'~^1\\.[01]$~'", ";", "if", "(", "!", "preg_match", "(", "$", "pattern", ",", "$", "version", ")", ")", "return", "false", ";", "$",...
Set the HTTP Protocol version of the Message @param string $version @return bool Returns TRUE on success, or FALSE if supplied version is out of range (1.0/1.1)
[ "Set", "the", "HTTP", "Protocol", "version", "of", "the", "Message" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/WWW/HTTP/HttpMessage.php#L167-L177
Eresus/EresusCMS
src/core/framework/core/WWW/HTTP/HttpMessage.php
HttpMessage.setRequestMethod
public function setRequestMethod($method) { if ($this->getType() !== self::TYPE_REQUEST) return false; $method = strtoupper($method); $REQUEST_METHODS = array('OPTIONS', 'GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'TRACE'); if (!in_array($method, $REQUEST_METHODS)) ...
php
public function setRequestMethod($method) { if ($this->getType() !== self::TYPE_REQUEST) return false; $method = strtoupper($method); $REQUEST_METHODS = array('OPTIONS', 'GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'TRACE'); if (!in_array($method, $REQUEST_METHODS)) ...
[ "public", "function", "setRequestMethod", "(", "$", "method", ")", "{", "if", "(", "$", "this", "->", "getType", "(", ")", "!==", "self", "::", "TYPE_REQUEST", ")", "return", "false", ";", "$", "method", "=", "strtoupper", "(", "$", "method", ")", ";",...
Set the Request Method of the HTTP Message @param string $method The request method name. {@link http://tools.ietf.org/html/rfc2068#section-5.1.1 See RFC2068 section 5.1.1} for list of acceptable methods @return bool TRUE on success, or FALSE if the message is not of type HttpMessage::TYPE_REQUEST or an invalid requ...
[ "Set", "the", "Request", "Method", "of", "the", "HTTP", "Message" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/WWW/HTTP/HttpMessage.php#L200-L213
Lansoweb/LosI18n
src/Service/CountryService.php
CountryService.getAllCountries
public function getAllCountries(string $translatedTo = '', bool $filterOfficiallyAssigned = true): array { if ('' === $translatedTo) { $translatedTo = $this->defaultLang; } $fileName = $this->path.'/'.$translatedTo.'/countries.php'; if (! file_exists($fileName)) { ...
php
public function getAllCountries(string $translatedTo = '', bool $filterOfficiallyAssigned = true): array { if ('' === $translatedTo) { $translatedTo = $this->defaultLang; } $fileName = $this->path.'/'.$translatedTo.'/countries.php'; if (! file_exists($fileName)) { ...
[ "public", "function", "getAllCountries", "(", "string", "$", "translatedTo", "=", "''", ",", "bool", "$", "filterOfficiallyAssigned", "=", "true", ")", ":", "array", "{", "if", "(", "''", "===", "$", "translatedTo", ")", "{", "$", "translatedTo", "=", "$",...
Returns all countries. If needed it can return only officially assigned ones by passing second parameter as true. @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements @param string $translatedTo @param bool $filterOfficiallyAssigned @return array
[ "Returns", "all", "countries", ".", "If", "needed", "it", "can", "return", "only", "officially", "assigned", "ones", "by", "passing", "second", "parameter", "as", "true", ".", "@see", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "...
train
https://github.com/Lansoweb/LosI18n/blob/ef8c513775bafac7ced62f79bd579e4b1b143f59/src/Service/CountryService.php#L30-L48
GrupaZero/api
src/Gzero/Api/Transformer/OptionCategoryTransformer.php
OptionCategoryTransformer.transform
public function transform($option) { $options = $this->entityToArray(OptionCategory::class, $option); $data = ['data' => []]; foreach ($options as $option) { $data['data'][] = [ 'key' => $option, ]; } return $data; }
php
public function transform($option) { $options = $this->entityToArray(OptionCategory::class, $option); $data = ['data' => []]; foreach ($options as $option) { $data['data'][] = [ 'key' => $option, ]; } return $data; }
[ "public", "function", "transform", "(", "$", "option", ")", "{", "$", "options", "=", "$", "this", "->", "entityToArray", "(", "OptionCategory", "::", "class", ",", "$", "option", ")", ";", "$", "data", "=", "[", "'data'", "=>", "[", "]", "]", ";", ...
Transforms option category entity @param array $option OptionCategory entity @return array
[ "Transforms", "option", "category", "entity" ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Transformer/OptionCategoryTransformer.php#L26-L37
hametuha/wpametu
src/WPametu/API/QueryHighJack.php
QueryHighJack.query_vars
public function query_vars( array $vars ){ if( !empty($this->query_var) ){ foreach( $this->query_var as $var ){ if( false === array_search($var, $vars) ){ $vars[] = $var; } } } return $vars; }
php
public function query_vars( array $vars ){ if( !empty($this->query_var) ){ foreach( $this->query_var as $var ){ if( false === array_search($var, $vars) ){ $vars[] = $var; } } } return $vars; }
[ "public", "function", "query_vars", "(", "array", "$", "vars", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "query_var", ")", ")", "{", "foreach", "(", "$", "this", "->", "query_var", "as", "$", "var", ")", "{", "if", "(", "false", ...
Add query var filter @param array $vars @return array
[ "Add", "query", "var", "filter" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/API/QueryHighJack.php#L54-L63