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
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.readStream
public function readStream(string $path) { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->readStream($path); }
php
public function readStream(string $path) { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->readStream($path); }
[ "public", "function", "readStream", "(", "string", "$", "path", ")", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "this", "->", "assertPresent", "(", "$", "path", ")", ";", "return", "$", "this", "->", ...
读取文件流 @param string $path @return resource @throws \One\FileSystem\Exceptions\FileSystemException @throws \One\FileSystem\Exceptions\FileNotExistsException
[ "读取文件流" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L103-L109
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.readAndDelete
public function readAndDelete(string $path): string { $path = $this->normalizePath($path); $this->assertPresent($path); $contents = $this->read($path); $this->delete($path); return $contents; }
php
public function readAndDelete(string $path): string { $path = $this->normalizePath($path); $this->assertPresent($path); $contents = $this->read($path); $this->delete($path); return $contents; }
[ "public", "function", "readAndDelete", "(", "string", "$", "path", ")", ":", "string", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "this", "->", "assertPresent", "(", "$", "path", ")", ";", "$", "conten...
读取文件内容并删除文件 @param string $path @return string @throws \One\FileSystem\Exceptions\FileSystemException @throws \One\FileSystem\Exceptions\FileNotExistsException
[ "读取文件内容并删除文件" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L120-L128
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.listContents
public function listContents(string $directory = '', bool $recursive = false): array { $directory = $this->normalizePath($directory); $list = $this->getAdapter()->listContents($directory, $recursive); return (new ContentListingFormatter($directory, $recursive))->formatListing($list); }
php
public function listContents(string $directory = '', bool $recursive = false): array { $directory = $this->normalizePath($directory); $list = $this->getAdapter()->listContents($directory, $recursive); return (new ContentListingFormatter($directory, $recursive))->formatListing($list); }
[ "public", "function", "listContents", "(", "string", "$", "directory", "=", "''", ",", "bool", "$", "recursive", "=", "false", ")", ":", "array", "{", "$", "directory", "=", "$", "this", "->", "normalizePath", "(", "$", "directory", ")", ";", "$", "lis...
返回目录内容 @param string $directory @param bool $recursive @return array
[ "返回目录内容" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L138-L144
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.writeStream
public function writeStream(string $path, $resource, array $config = []): bool { $path = $this->normalizePath($path); $this->assertAbsent($path); $config = $this->prepareConfig($config); $this->rewindStream($resource); return $this->getAdapter()->writeStream($path, $resource...
php
public function writeStream(string $path, $resource, array $config = []): bool { $path = $this->normalizePath($path); $this->assertAbsent($path); $config = $this->prepareConfig($config); $this->rewindStream($resource); return $this->getAdapter()->writeStream($path, $resource...
[ "public", "function", "writeStream", "(", "string", "$", "path", ",", "$", "resource", ",", "array", "$", "config", "=", "[", "]", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "this",...
从 Stream 写入新文件 @param string $path @param resource $resource @param array $config @return bool @throws \One\FileSystem\Exceptions\FileSystemException @throws \One\FileSystem\Exceptions\FileExistsException
[ "从", "Stream", "写入新文件" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L177-L185
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.update
public function update(string $path, string $contents, array $config = []): bool { $path = $this->normalizePath($path); $this->assertPresent($path); $config = $this->prepareConfig($config); return $this->getAdapter()->update($path, $contents, $config); }
php
public function update(string $path, string $contents, array $config = []): bool { $path = $this->normalizePath($path); $this->assertPresent($path); $config = $this->prepareConfig($config); return $this->getAdapter()->update($path, $contents, $config); }
[ "public", "function", "update", "(", "string", "$", "path", ",", "string", "$", "contents", ",", "array", "$", "config", "=", "[", "]", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", ...
更新文件 @param string $path @param string $contents @param array $config @return bool @throws \One\FileSystem\Exceptions\FileSystemException @throws \One\FileSystem\Exceptions\FileNotExistsException
[ "更新文件" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L198-L205
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.updateStream
public function updateStream(string $path, $resource, array $config = []): bool { $path = $this->normalizePath($path); $this->assertPresent($path); $config = $this->prepareConfig($config); $this->rewindStream($resource); return $this->getAdapter()->updateStream($path, $resou...
php
public function updateStream(string $path, $resource, array $config = []): bool { $path = $this->normalizePath($path); $this->assertPresent($path); $config = $this->prepareConfig($config); $this->rewindStream($resource); return $this->getAdapter()->updateStream($path, $resou...
[ "public", "function", "updateStream", "(", "string", "$", "path", ",", "$", "resource", ",", "array", "$", "config", "=", "[", "]", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "this"...
从 Stream 更新文件 @param string $path @param resource $resource @param array $config @return bool @throws \One\FileSystem\Exceptions\FileSystemException @throws \One\FileSystem\Exceptions\FileNotExistsException
[ "从", "Stream", "更新文件" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L218-L226
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.put
public function put(string $path, string $contents, array $config = []): bool { $path = $this->normalizePath($path); $config = $this->prepareConfig($config); if (! $this->exists($path)) { return $this->getAdapter()->update($path, $contents, $config); } return $t...
php
public function put(string $path, string $contents, array $config = []): bool { $path = $this->normalizePath($path); $config = $this->prepareConfig($config); if (! $this->exists($path)) { return $this->getAdapter()->update($path, $contents, $config); } return $t...
[ "public", "function", "put", "(", "string", "$", "path", ",", "string", "$", "contents", ",", "array", "$", "config", "=", "[", "]", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "co...
创建或更新文件 @param string $path @param string $contents @param array $config @return bool @throws \One\FileSystem\Exceptions\FileSystemException
[ "创建或更新文件" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L238-L248
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.putStream
public function putStream(string $path, $resource, array $config = []): bool { $path = $this->normalizePath($path); $config = $this->prepareConfig($config); $this->rewindStream($resource); if (! $this->exists($path)) { return $this->getAdapter()->updateStream($path, $res...
php
public function putStream(string $path, $resource, array $config = []): bool { $path = $this->normalizePath($path); $config = $this->prepareConfig($config); $this->rewindStream($resource); if (! $this->exists($path)) { return $this->getAdapter()->updateStream($path, $res...
[ "public", "function", "putStream", "(", "string", "$", "path", ",", "$", "resource", ",", "array", "$", "config", "=", "[", "]", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "config",...
从 Stream 创建或更新文件 @param string $path @param resource $resource @param array $config @return bool @throws \One\FileSystem\Exceptions\FileSystemException
[ "从", "Stream", "创建或更新文件" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L260-L271
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.delete
public function delete(string $path): bool { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->delete($path); }
php
public function delete(string $path): bool { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->delete($path); }
[ "public", "function", "delete", "(", "string", "$", "path", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "this", "->", "assertPresent", "(", "$", "path", ")", ";", "return", "$", "thi...
删除文件 @param string $path @return bool @throws \One\FileSystem\Exceptions\FileSystemException @throws \One\FileSystem\Exceptions\FileNotExistsException
[ "删除文件" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L304-L310
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.deleteDir
public function deleteDir(string $dirname): bool { $dirname = $this->normalizePath($dirname); if ($dirname === '') { throw new DirectoryNotExistsException($dirname); } return $this->getAdapter()->deleteDir($dirname); }
php
public function deleteDir(string $dirname): bool { $dirname = $this->normalizePath($dirname); if ($dirname === '') { throw new DirectoryNotExistsException($dirname); } return $this->getAdapter()->deleteDir($dirname); }
[ "public", "function", "deleteDir", "(", "string", "$", "dirname", ")", ":", "bool", "{", "$", "dirname", "=", "$", "this", "->", "normalizePath", "(", "$", "dirname", ")", ";", "if", "(", "$", "dirname", "===", "''", ")", "{", "throw", "new", "Direct...
删除目录 @param string $dirname @return bool @throws \One\FileSystem\Exceptions\FileSystemException @throws \One\FileSystem\Exceptions\DirectoryNotExistsException
[ "删除目录" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L339-L348
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.getMimeType
public function getMimeType(string $path): string { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->getMimeType($path); }
php
public function getMimeType(string $path): string { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->getMimeType($path); }
[ "public", "function", "getMimeType", "(", "string", "$", "path", ")", ":", "string", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "this", "->", "assertPresent", "(", "$", "path", ")", ";", "return", "$",...
获得文件类型信息 @param string $path @return string
[ "获得文件类型信息" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L357-L363
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.getMetaData
public function getMetaData(string $path): array { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->getMetaData($path); }
php
public function getMetaData(string $path): array { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->getMetaData($path); }
[ "public", "function", "getMetaData", "(", "string", "$", "path", ")", ":", "array", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "this", "->", "assertPresent", "(", "$", "path", ")", ";", "return", "$", ...
获得路径源信息 @param string $path @return array
[ "获得路径源信息" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L372-L378
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.getVisibility
public function getVisibility(string $path): string { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->getVisibility($path); }
php
public function getVisibility(string $path): string { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->getVisibility($path); }
[ "public", "function", "getVisibility", "(", "string", "$", "path", ")", ":", "string", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "this", "->", "assertPresent", "(", "$", "path", ")", ";", "return", "$...
获得路径可见性 @param string $path @return string
[ "获得路径可见性" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L387-L393
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.setVisibility
public function setVisibility(string $path, string $visibility): bool { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->setVisibility($path, $visibility); }
php
public function setVisibility(string $path, string $visibility): bool { $path = $this->normalizePath($path); $this->assertPresent($path); return $this->getAdapter()->setVisibility($path, $visibility); }
[ "public", "function", "setVisibility", "(", "string", "$", "path", ",", "string", "$", "visibility", ")", ":", "bool", "{", "$", "path", "=", "$", "this", "->", "normalizePath", "(", "$", "path", ")", ";", "$", "this", "->", "assertPresent", "(", "$", ...
设置路径可见性 @param string $path @param string $visibility @return bool
[ "设置路径可见性" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L403-L409
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.normalizePath
protected function normalizePath(string $path): string { $path = str_replace('\\', '/', $path); $path = $this->removePathWhiteSpace($path); $parts = []; foreach (explode('/', $path) as $part) { switch ($part) { case '': case '.': ...
php
protected function normalizePath(string $path): string { $path = str_replace('\\', '/', $path); $path = $this->removePathWhiteSpace($path); $parts = []; foreach (explode('/', $path) as $part) { switch ($part) { case '': case '.': ...
[ "protected", "function", "normalizePath", "(", "string", "$", "path", ")", ":", "string", "{", "$", "path", "=", "str_replace", "(", "'\\\\'", ",", "'/'", ",", "$", "path", ")", ";", "$", "path", "=", "$", "this", "->", "removePathWhiteSpace", "(", "$"...
标准化路径 @param string $path @return string @throws \One\FileSystem\Exceptions\FileSystemException
[ "标准化路径" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L459-L486
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.removePathWhiteSpace
protected function removePathWhiteSpace(string $path): string { while (preg_match('#\p{C}+|^\./#u', $path)) { $path = preg_replace('#\p{C}+|^\./#u', '', $path); } return $path; }
php
protected function removePathWhiteSpace(string $path): string { while (preg_match('#\p{C}+|^\./#u', $path)) { $path = preg_replace('#\p{C}+|^\./#u', '', $path); } return $path; }
[ "protected", "function", "removePathWhiteSpace", "(", "string", "$", "path", ")", ":", "string", "{", "while", "(", "preg_match", "(", "'#\\p{C}+|^\\./#u'", ",", "$", "path", ")", ")", "{", "$", "path", "=", "preg_replace", "(", "'#\\p{C}+|^\\./#u'", ",", "'...
删除路径空格 @param string $path @return string
[ "删除路径空格" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L495-L502
movoin/one-swoole
src/FileSystem/FileSystem.php
FileSystem.rewindStream
protected function rewindStream($resource) { if (! Assert::resource($resource)) { throw new InvalidArgumentException( sprintf( '%s::%s() parameter 1 must be "resource"', __CLASS__, __METHOD__ ) ...
php
protected function rewindStream($resource) { if (! Assert::resource($resource)) { throw new InvalidArgumentException( sprintf( '%s::%s() parameter 1 must be "resource"', __CLASS__, __METHOD__ ) ...
[ "protected", "function", "rewindStream", "(", "$", "resource", ")", "{", "if", "(", "!", "Assert", "::", "resource", "(", "$", "resource", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'%s::%s() parameter 1 must be \"resource\"'"...
倒回文件指针的位置 @param resource $resource @throws \InvalidArgumentException
[ "倒回文件指针的位置" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/FileSystem.php#L511-L526
FrenchFrogs/framework
src/Core/FrenchFrogsServiceProvider.php
FrenchFrogsServiceProvider.boot
public function boot() { $this->bootBlade(); $this->bootDatatable(); $this->bootModal(); $this->bootMail(); $this->bootValidator(); $this->publish(); }
php
public function boot() { $this->bootBlade(); $this->bootDatatable(); $this->bootModal(); $this->bootMail(); $this->bootValidator(); $this->publish(); }
[ "public", "function", "boot", "(", ")", "{", "$", "this", "->", "bootBlade", "(", ")", ";", "$", "this", "->", "bootDatatable", "(", ")", ";", "$", "this", "->", "bootModal", "(", ")", ";", "$", "this", "->", "bootMail", "(", ")", ";", "$", "this...
Boot principale du service
[ "Boot", "principale", "du", "service" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Core/FrenchFrogsServiceProvider.php#L16-L24
FrenchFrogs/framework
src/Core/FrenchFrogsServiceProvider.php
FrenchFrogsServiceProvider.bootValidator
public function bootValidator() { // notExists (database) renvoie true si l'entrée n'existe pas \Validator::extend('not_exists', function($attribute, $value, $parameters) { $row = \DB::table($parameters[0])->where($parameters[1], '=', $value)->first(); return empty($...
php
public function bootValidator() { // notExists (database) renvoie true si l'entrée n'existe pas \Validator::extend('not_exists', function($attribute, $value, $parameters) { $row = \DB::table($parameters[0])->where($parameters[1], '=', $value)->first(); return empty($...
[ "public", "function", "bootValidator", "(", ")", "{", "// notExists (database) renvoie true si l'entrée n'existe pas", "\\", "Validator", "::", "extend", "(", "'not_exists'", ",", "function", "(", "$", "attribute", ",", "$", "value", ",", "$", "parameters", ")", "{"...
Ajoute de nouveau validateur
[ "Ajoute", "de", "nouveau", "validateur" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Core/FrenchFrogsServiceProvider.php#L42-L51
FrenchFrogs/framework
src/Core/FrenchFrogsServiceProvider.php
FrenchFrogsServiceProvider.bootDatatable
public function bootDatatable($route = '/datatable/{token}') { // gestion de la navifgation Ajax Route::get($route, function($token) { try{ $request = request(); // chargement de l'objet $table = FrenchFrogs\Table\Table\Table::load($toke...
php
public function bootDatatable($route = '/datatable/{token}') { // gestion de la navifgation Ajax Route::get($route, function($token) { try{ $request = request(); // chargement de l'objet $table = FrenchFrogs\Table\Table\Table::load($toke...
[ "public", "function", "bootDatatable", "(", "$", "route", "=", "'/datatable/{token}'", ")", "{", "// gestion de la navifgation Ajax", "Route", "::", "get", "(", "$", "route", ",", "function", "(", "$", "token", ")", "{", "try", "{", "$", "request", "=", "req...
Datatable render @param string $route
[ "Datatable", "render" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Core/FrenchFrogsServiceProvider.php#L67-L147
FrenchFrogs/framework
src/Core/FrenchFrogsServiceProvider.php
FrenchFrogsServiceProvider.bootModal
public function bootModal() { Response::macro('modal', function($title, $body = '', $actions = []) { if ($title instanceof FrenchFrogs\Modal\Modal\Modal) { $modal = $title->enableRemote(); } elseif($title instanceof FrenchFrogs\Form\Form\Form) { ...
php
public function bootModal() { Response::macro('modal', function($title, $body = '', $actions = []) { if ($title instanceof FrenchFrogs\Modal\Modal\Modal) { $modal = $title->enableRemote(); } elseif($title instanceof FrenchFrogs\Form\Form\Form) { ...
[ "public", "function", "bootModal", "(", ")", "{", "Response", "::", "macro", "(", "'modal'", ",", "function", "(", "$", "title", ",", "$", "body", "=", "''", ",", "$", "actions", "=", "[", "]", ")", "{", "if", "(", "$", "title", "instanceof", "Fren...
Modal Manager Gestion des reponse ajax qui s'affiche dans une modal
[ "Modal", "Manager" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Core/FrenchFrogsServiceProvider.php#L155-L172
FrenchFrogs/framework
src/Core/FrenchFrogsServiceProvider.php
FrenchFrogsServiceProvider.bootMail
public function bootMail() { /** * Mail manager * * @param string $view * @param array $data * @param array $from * @param array $to * @param string $subject * @param array $attach */ Response::macro('mail', function($v...
php
public function bootMail() { /** * Mail manager * * @param string $view * @param array $data * @param array $from * @param array $to * @param string $subject * @param array $attach */ Response::macro('mail', function($v...
[ "public", "function", "bootMail", "(", ")", "{", "/**\n * Mail manager\n *\n * @param string $view\n * @param array $data\n * @param array $from\n * @param array $to\n * @param string $subject\n * @param array $attach\n */", "Resp...
Permet d'utiliser la reponse pour envoyer un mail Cela permet de gere un email comme une page web.
[ "Permet", "d", "utiliser", "la", "reponse", "pour", "envoyer", "un", "mail" ]
train
https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Core/FrenchFrogsServiceProvider.php#L180-L230
Wonail/wocenter
core/Service.php
Service.getSubService
protected function getSubService($serviceName) { if ($this->_subService[$serviceName] instanceof Service) { return $this->_subService[$serviceName]; } elseif (!isset($this->_subService[$serviceName])) { throw new InvalidConfigException("The {$this->getId()}Service required su...
php
protected function getSubService($serviceName) { if ($this->_subService[$serviceName] instanceof Service) { return $this->_subService[$serviceName]; } elseif (!isset($this->_subService[$serviceName])) { throw new InvalidConfigException("The {$this->getId()}Service required su...
[ "protected", "function", "getSubService", "(", "$", "serviceName", ")", "{", "if", "(", "$", "this", "->", "_subService", "[", "$", "serviceName", "]", "instanceof", "Service", ")", "{", "return", "$", "this", "->", "_subService", "[", "$", "serviceName", ...
获取子服务 该方法不设为`public`类型,目的在于规范代码,使服务方法对IDE提供友好支持。故所属的子服务类必须以`public` 类型新建方法获取。 @param string $serviceName 子服务名,不带后缀`Service` @return Service|BaseObject|null @throws InvalidConfigException
[ "获取子服务" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/core/Service.php#L69-L89
o2system/filesystem
src/Files/Abstracts/AbstractFile.php
AbstractFile.createFile
final public function createFile($filePath = null) { if (isset($filePath)) { $this->filePath = $filePath; } if (pathinfo($this->filePath, PATHINFO_EXTENSION) === '') { $this->filePath .= $this->fileExtension; } return $this; }
php
final public function createFile($filePath = null) { if (isset($filePath)) { $this->filePath = $filePath; } if (pathinfo($this->filePath, PATHINFO_EXTENSION) === '') { $this->filePath .= $this->fileExtension; } return $this; }
[ "final", "public", "function", "createFile", "(", "$", "filePath", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "filePath", ")", ")", "{", "$", "this", "->", "filePath", "=", "$", "filePath", ";", "}", "if", "(", "pathinfo", "(", "$", "this...
AbstractFile::createFile @param string $filePath Path to the file. @return static
[ "AbstractFile", "::", "createFile" ]
train
https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/Abstracts/AbstractFile.php#L64-L75
ejsmont-artur/phpProxyBuilder
src/PhpProxyBuilder/Aop/Advice/CircuitBreakerAdvice.php
CircuitBreakerAdvice.interceptMethodCall
public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) { if ($this->breaker->isAvailable($this->serviceName)) { try { $result = $jointPoint->proceed(); $this->breaker->reportSuccess($this->serviceName); return $result; ...
php
public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) { if ($this->breaker->isAvailable($this->serviceName)) { try { $result = $jointPoint->proceed(); $this->breaker->reportSuccess($this->serviceName); return $result; ...
[ "public", "function", "interceptMethodCall", "(", "ProceedingJoinPointInterface", "$", "jointPoint", ")", "{", "if", "(", "$", "this", "->", "breaker", "->", "isAvailable", "(", "$", "this", "->", "serviceName", ")", ")", "{", "try", "{", "$", "result", "=",...
In this implementation we ask CircuitBreaker implementation if it is safe to proceed with the service call. @param ProceedingJoinPointInterface $jointPoint @throws ServiceUnavailableException|Exception @return mixed
[ "In", "this", "implementation", "we", "ask", "CircuitBreaker", "implementation", "if", "it", "is", "safe", "to", "proceed", "with", "the", "service", "call", "." ]
train
https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Aop/Advice/CircuitBreakerAdvice.php#L103-L121
ejsmont-artur/phpProxyBuilder
src/PhpProxyBuilder/Aop/Advice/CircuitBreakerAdvice.php
CircuitBreakerAdvice.isServiceFailureException
protected function isServiceFailureException(Exception $e) { if (empty($this->failOnExceptions)) { // if $failOnExceptions array was empty then any exception type is considered service failure return true; } else { foreach ($this->failOnExceptions as $typeName) { ...
php
protected function isServiceFailureException(Exception $e) { if (empty($this->failOnExceptions)) { // if $failOnExceptions array was empty then any exception type is considered service failure return true; } else { foreach ($this->failOnExceptions as $typeName) { ...
[ "protected", "function", "isServiceFailureException", "(", "Exception", "$", "e", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "failOnExceptions", ")", ")", "{", "// if $failOnExceptions array was empty then any exception type is considered service failure ", "retu...
Helper checks if the exception that was caught means a service failure or just a regular user/code error. Circuit breaker should only count connectivity/availability errors otherwise user/code errors could mark service as unavailable causing outage. Please be careful what exception types you provide to $failOnException...
[ "Helper", "checks", "if", "the", "exception", "that", "was", "caught", "means", "a", "service", "failure", "or", "just", "a", "regular", "user", "/", "code", "error", ".", "Circuit", "breaker", "should", "only", "count", "connectivity", "/", "availability", ...
train
https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Aop/Advice/CircuitBreakerAdvice.php#L138-L150
comodojo/dispatcher.framework
src/Comodojo/Dispatcher/Response/Preprocessor/Status200.php
Status200.consolidate
public function consolidate(Response $response) { $response->getHeaders() ->set('Content-Length', $response->getContent()->length()); $type = $response->getContent()->type(); $charset = $response->getContent()->charset(); if (empty($charset)) { $response->getHe...
php
public function consolidate(Response $response) { $response->getHeaders() ->set('Content-Length', $response->getContent()->length()); $type = $response->getContent()->type(); $charset = $response->getContent()->charset(); if (empty($charset)) { $response->getHe...
[ "public", "function", "consolidate", "(", "Response", "$", "response", ")", "{", "$", "response", "->", "getHeaders", "(", ")", "->", "set", "(", "'Content-Length'", ",", "$", "response", "->", "getContent", "(", ")", "->", "length", "(", ")", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Response/Preprocessor/Status200.php#L28-L42
belgattitude/soluble-metadata
src/Soluble/Metadata/ColumnsMetadata.php
ColumnsMetadata.getColumn
public function getColumn(string $name): AbstractColumnDefinition { if (!$this->offsetExists($name)) { throw new Exception\UnexistentColumnException("Column '$name' does not exists in metadata"); } return $this->offsetGet($name); }
php
public function getColumn(string $name): AbstractColumnDefinition { if (!$this->offsetExists($name)) { throw new Exception\UnexistentColumnException("Column '$name' does not exists in metadata"); } return $this->offsetGet($name); }
[ "public", "function", "getColumn", "(", "string", "$", "name", ")", ":", "AbstractColumnDefinition", "{", "if", "(", "!", "$", "this", "->", "offsetExists", "(", "$", "name", ")", ")", "{", "throw", "new", "Exception", "\\", "UnexistentColumnException", "(",...
Return specific column metadata. @throws Exception\UnexistentColumnException
[ "Return", "specific", "column", "metadata", "." ]
train
https://github.com/belgattitude/soluble-metadata/blob/6285461c40a619070f601184d58e6c772b769d5c/src/Soluble/Metadata/ColumnsMetadata.php#L17-L24
dantleech/glob
lib/DTL/Glob/Parser/SelectorParser.php
SelectorParser.parse
public function parse($selector) { if ('/' === $selector) { return array(); } if ('/' !== substr($selector, 0, 1)) { throw new \InvalidArgumentException(sprintf( 'Path "%s" must be absolute', $selector )); } ...
php
public function parse($selector) { if ('/' === $selector) { return array(); } if ('/' !== substr($selector, 0, 1)) { throw new \InvalidArgumentException(sprintf( 'Path "%s" must be absolute', $selector )); } ...
[ "public", "function", "parse", "(", "$", "selector", ")", "{", "if", "(", "'/'", "===", "$", "selector", ")", "{", "return", "array", "(", ")", ";", "}", "if", "(", "'/'", "!==", "substr", "(", "$", "selector", ",", "0", ",", "1", ")", ")", "{"...
Parse the given selector. Returns an associative array of path elements to bitmasks. @return array
[ "Parse", "the", "given", "selector", "." ]
train
https://github.com/dantleech/glob/blob/1f618e6b77a5de4c6b0538d82572fe19cbb1c446/lib/DTL/Glob/Parser/SelectorParser.php#L31-L64
dantleech/glob
lib/DTL/Glob/Parser/SelectorParser.php
SelectorParser.processWildcard
private function processWildcard(&$string) { if (false === $strpos = strpos($string, '*')) { return false; } $escapeChars = 0; while (isset($string[--$strpos]) && $string[$strpos] === '\\') { $escapeChars++; } $isEscaped = $escapeChars % 2 !...
php
private function processWildcard(&$string) { if (false === $strpos = strpos($string, '*')) { return false; } $escapeChars = 0; while (isset($string[--$strpos]) && $string[$strpos] === '\\') { $escapeChars++; } $isEscaped = $escapeChars % 2 !...
[ "private", "function", "processWildcard", "(", "&", "$", "string", ")", "{", "if", "(", "false", "===", "$", "strpos", "=", "strpos", "(", "$", "string", ",", "'*'", ")", ")", "{", "return", "false", ";", "}", "$", "escapeChars", "=", "0", ";", "wh...
Check to see if the given (by reference) string contains a wildcard. If the wildcard is escaped then remove the escape character. @param string @return boolean
[ "Check", "to", "see", "if", "the", "given", "(", "by", "reference", ")", "string", "contains", "a", "wildcard", "." ]
train
https://github.com/dantleech/glob/blob/1f618e6b77a5de4c6b0538d82572fe19cbb1c446/lib/DTL/Glob/Parser/SelectorParser.php#L76-L96
movoin/one-swoole
src/Swoole/Traits/HasConfig.php
HasConfig.initializeConfig
protected function initializeConfig() { // {{ 准备配置信息 $this->prepareConfig(); // }} // 初始化配置 $config = Config::get('server.' . $this->getProcessName(), []); if (! isset($config['protocol'])) { throw new SwooleException('The server protocol is undefined');...
php
protected function initializeConfig() { // {{ 准备配置信息 $this->prepareConfig(); // }} // 初始化配置 $config = Config::get('server.' . $this->getProcessName(), []); if (! isset($config['protocol'])) { throw new SwooleException('The server protocol is undefined');...
[ "protected", "function", "initializeConfig", "(", ")", "{", "// {{ 准备配置信息", "$", "this", "->", "prepareConfig", "(", ")", ";", "// }}", "// 初始化配置", "$", "config", "=", "Config", "::", "get", "(", "'server.'", ".", "$", "this", "->", "getProcessName", "(", ...
初始化配置 @throws \InvalidArgumentException @throws \One\Swoole\Exceptions\SwooleException
[ "初始化配置" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Swoole/Traits/HasConfig.php#L46-L72
TypistTech/wp-option-store
src/FilteredOptionStore.php
FilteredOptionStore.get
public function get(string $optionName) { return apply_filters( $this->filterTagFor($optionName), parent::get($optionName) ); }
php
public function get(string $optionName) { return apply_filters( $this->filterTagFor($optionName), parent::get($optionName) ); }
[ "public", "function", "get", "(", "string", "$", "optionName", ")", "{", "return", "apply_filters", "(", "$", "this", "->", "filterTagFor", "(", "$", "optionName", ")", ",", "parent", "::", "get", "(", "$", "optionName", ")", ")", ";", "}" ]
Option getter. @param string $optionName Name of option to retrieve. @return mixed|null Null if option not exists or its value is actually null.
[ "Option", "getter", "." ]
train
https://github.com/TypistTech/wp-option-store/blob/115ff7cb4b5f566c89c1294fe2b68c82d62cccc2/src/FilteredOptionStore.php#L30-L36
bigfork/htmleditorsrcset
src/ImageShortcodeHandler.php
ImageShortcodeHandler.handle_shortcode
public static function handle_shortcode($args, $content, $parser, $shortcode, $extra = array()) { // Find appropriate record, with fallback for error handlers $record = ImageShortcodeProvider::find_shortcode_record($args); if (!$record) { return null; // There were no suitable m...
php
public static function handle_shortcode($args, $content, $parser, $shortcode, $extra = array()) { // Find appropriate record, with fallback for error handlers $record = ImageShortcodeProvider::find_shortcode_record($args); if (!$record) { return null; // There were no suitable m...
[ "public", "static", "function", "handle_shortcode", "(", "$", "args", ",", "$", "content", ",", "$", "parser", ",", "$", "shortcode", ",", "$", "extra", "=", "array", "(", ")", ")", "{", "// Find appropriate record, with fallback for error handlers", "$", "recor...
Most of this is copied straight from Image::handle_shortcode() Replace"[image id=n]" shortcode with an image reference. Permission checks will be enforced by the file routing itself. @param array $args Arguments passed to the parser @param string $content Raw shortcode @param ShortcodeParser $parser Parser @param str...
[ "Most", "of", "this", "is", "copied", "straight", "from", "Image", "::", "handle_shortcode", "()" ]
train
https://github.com/bigfork/htmleditorsrcset/blob/7ac9934fbaadcd4112543f182d07d8f8d9e766e0/src/ImageShortcodeHandler.php#L40-L102
kleijnweb/php-api-routing-bundle
src/Routing/OpenApiRouteLoader.php
OpenApiRouteLoader.load
public function load($resource, $type = null): RouteCollection { $resource = (string)$resource; if (in_array($resource, $this->descriptions)) { throw new \RuntimeException("Resource '$resource' was already loaded"); } $description = $this->repository->get($resource); ...
php
public function load($resource, $type = null): RouteCollection { $resource = (string)$resource; if (in_array($resource, $this->descriptions)) { throw new \RuntimeException("Resource '$resource' was already loaded"); } $description = $this->repository->get($resource); ...
[ "public", "function", "load", "(", "$", "resource", ",", "$", "type", "=", "null", ")", ":", "RouteCollection", "{", "$", "resource", "=", "(", "string", ")", "$", "resource", ";", "if", "(", "in_array", "(", "$", "resource", ",", "$", "this", "->", ...
@SuppressWarnings(PHPMD.UnusedFormalParameter) @param mixed $resource @param null $type @return RouteCollection
[ "@SuppressWarnings", "(", "PHPMD", ".", "UnusedFormalParameter", ")" ]
train
https://github.com/kleijnweb/php-api-routing-bundle/blob/7671e513de0411efc14baf299010dc57c8e1a0a5/src/Routing/OpenApiRouteLoader.php#L77-L127
kleijnweb/php-api-routing-bundle
src/Routing/OpenApiRouteLoader.php
OpenApiRouteLoader.resolveRequirements
private function resolveRequirements(Operation $operation): array { $requirements = []; foreach ($operation->getParameters() as $parameter) { if ($parameter->getIn() === Parameter::IN_PATH && ($schema = $parameter->getSchema()) instanceof ScalarSchema ) { ...
php
private function resolveRequirements(Operation $operation): array { $requirements = []; foreach ($operation->getParameters() as $parameter) { if ($parameter->getIn() === Parameter::IN_PATH && ($schema = $parameter->getSchema()) instanceof ScalarSchema ) { ...
[ "private", "function", "resolveRequirements", "(", "Operation", "$", "operation", ")", ":", "array", "{", "$", "requirements", "=", "[", "]", ";", "foreach", "(", "$", "operation", "->", "getParameters", "(", ")", "as", "$", "parameter", ")", "{", "if", ...
@param Operation $operation @return array
[ "@param", "Operation", "$operation" ]
train
https://github.com/kleijnweb/php-api-routing-bundle/blob/7671e513de0411efc14baf299010dc57c8e1a0a5/src/Routing/OpenApiRouteLoader.php#L134-L147
kleijnweb/php-api-routing-bundle
src/Routing/OpenApiRouteLoader.php
OpenApiRouteLoader.resolveControllerKey
private function resolveControllerKey( Operation $operation, string $resourceName, string $router, string $routerController = null ): string { $operationName = $operation->getMethod(); $diKey = "$router.$resourceName"; if (0 !== strpos($operation->ge...
php
private function resolveControllerKey( Operation $operation, string $resourceName, string $router, string $routerController = null ): string { $operationName = $operation->getMethod(); $diKey = "$router.$resourceName"; if (0 !== strpos($operation->ge...
[ "private", "function", "resolveControllerKey", "(", "Operation", "$", "operation", ",", "string", "$", "resourceName", ",", "string", "$", "router", ",", "string", "$", "routerController", "=", "null", ")", ":", "string", "{", "$", "operationName", "=", "$", ...
@param Operation $operation @param string $resourceName @param string $router @param string|null $routerController @return string
[ "@param", "Operation", "$operation", "@param", "string", "$resourceName", "@param", "string", "$router", "@param", "string|null", "$routerController" ]
train
https://github.com/kleijnweb/php-api-routing-bundle/blob/7671e513de0411efc14baf299010dc57c8e1a0a5/src/Routing/OpenApiRouteLoader.php#L157-L188
kleijnweb/php-api-routing-bundle
src/Routing/OpenApiRouteLoader.php
OpenApiRouteLoader.createRouteId
private function createRouteId(string $resource, string $path, string $controllerKey): string { $controllerSegments = explode(':', $controllerKey); $operationName = 'action'; if (count($controllerSegments) === 2) { list(, $operationName) = $controllerSegments; } ...
php
private function createRouteId(string $resource, string $path, string $controllerKey): string { $controllerSegments = explode(':', $controllerKey); $operationName = 'action'; if (count($controllerSegments) === 2) { list(, $operationName) = $controllerSegments; } ...
[ "private", "function", "createRouteId", "(", "string", "$", "resource", ",", "string", "$", "path", ",", "string", "$", "controllerKey", ")", ":", "string", "{", "$", "controllerSegments", "=", "explode", "(", "':'", ",", "$", "controllerKey", ")", ";", "$...
@param string $resource @param string $path @param string $controllerKey @return string
[ "@param", "string", "$resource", "@param", "string", "$path" ]
train
https://github.com/kleijnweb/php-api-routing-bundle/blob/7671e513de0411efc14baf299010dc57c8e1a0a5/src/Routing/OpenApiRouteLoader.php#L198-L212
chriswoodford/foursquare-php
lib/TheTwelve/Foursquare/EndpointGateway.php
EndpointGateway.makeAuthenticatedApiRequest
public function makeAuthenticatedApiRequest($resource, array $params = array(), $method = 'GET') { $this->assertHasActiveUser(); $params['oauth_token'] = $this->token; return $this->makeApiRequest($resource, $params, $method); }
php
public function makeAuthenticatedApiRequest($resource, array $params = array(), $method = 'GET') { $this->assertHasActiveUser(); $params['oauth_token'] = $this->token; return $this->makeApiRequest($resource, $params, $method); }
[ "public", "function", "makeAuthenticatedApiRequest", "(", "$", "resource", ",", "array", "$", "params", "=", "array", "(", ")", ",", "$", "method", "=", "'GET'", ")", "{", "$", "this", "->", "assertHasActiveUser", "(", ")", ";", "$", "params", "[", "'oau...
make an authenticated request to the api @param string $resource @param array $params @param string $method @return stdClass
[ "make", "an", "authenticated", "request", "to", "the", "api" ]
train
https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/EndpointGateway.php#L94-L101
chriswoodford/foursquare-php
lib/TheTwelve/Foursquare/EndpointGateway.php
EndpointGateway.makeApiRequest
public function makeApiRequest($resource, array $params = array(), $method = 'GET') { $uri = $this->requestUri . '/' . ltrim($resource, '/'); if ($this->hasValidToken()) { $params['oauth_token'] = $this->token; } else { $params['client_id'] = $this->clientId; ...
php
public function makeApiRequest($resource, array $params = array(), $method = 'GET') { $uri = $this->requestUri . '/' . ltrim($resource, '/'); if ($this->hasValidToken()) { $params['oauth_token'] = $this->token; } else { $params['client_id'] = $this->clientId; ...
[ "public", "function", "makeApiRequest", "(", "$", "resource", ",", "array", "$", "params", "=", "array", "(", ")", ",", "$", "method", "=", "'GET'", ")", "{", "$", "uri", "=", "$", "this", "->", "requestUri", ".", "'/'", ".", "ltrim", "(", "$", "re...
make a generic request to the api @param string $resource @param array $params @param string $method @return \stdClass
[ "make", "a", "generic", "request", "to", "the", "api" ]
train
https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/EndpointGateway.php#L110-L159
kderyabin/logger
src/Channel.php
Channel.deliver
public function deliver(string $level, array $data): bool { $this->isDelivered = false; if (!$this->canLog($level)) { return $this->isDelivered; } return $this->isDelivered = $this->handler->handle($level, $this->formatter->format($data)); }
php
public function deliver(string $level, array $data): bool { $this->isDelivered = false; if (!$this->canLog($level)) { return $this->isDelivered; } return $this->isDelivered = $this->handler->handle($level, $this->formatter->format($data)); }
[ "public", "function", "deliver", "(", "string", "$", "level", ",", "array", "$", "data", ")", ":", "bool", "{", "$", "this", "->", "isDelivered", "=", "false", ";", "if", "(", "!", "$", "this", "->", "canLog", "(", "$", "level", ")", ")", "{", "r...
Delivers a log data to some destination (handler). @param string $level @param array $data @return bool
[ "Delivers", "a", "log", "data", "to", "some", "destination", "(", "handler", ")", "." ]
train
https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/Channel.php#L52-L59
crossjoin/Css
src/Crossjoin/Css/Reader/HtmlFile.php
HtmlFile.getCssContent
protected function getCssContent() { $styleString = ""; if (class_exists("\\DOMDocument")) { $doc = new \DOMDocument(); $doc->loadHTMLFile($this->getFilename()); // Extract styles from the HTML file foreach($doc->getElementsByTagName('style') as $sty...
php
protected function getCssContent() { $styleString = ""; if (class_exists("\\DOMDocument")) { $doc = new \DOMDocument(); $doc->loadHTMLFile($this->getFilename()); // Extract styles from the HTML file foreach($doc->getElementsByTagName('style') as $sty...
[ "protected", "function", "getCssContent", "(", ")", "{", "$", "styleString", "=", "\"\"", ";", "if", "(", "class_exists", "(", "\"\\\\DOMDocument\"", ")", ")", "{", "$", "doc", "=", "new", "\\", "DOMDocument", "(", ")", ";", "$", "doc", "->", "loadHTMLFi...
Gets the CSS content from the HTML source. @return string
[ "Gets", "the", "CSS", "content", "from", "the", "HTML", "source", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Reader/HtmlFile.php#L12-L29
sulu/SuluPricingBundle
Manager/PriceCalculationManager.php
PriceCalculationManager.retrieveItemPrices
public function retrieveItemPrices($itemsData, $currency, $locale) { $items = []; $previousItem = null; // Prepare item data. foreach ($itemsData as $itemData) { $useProductsPrice = false; if (isset($itemData['useProductsPrice']) && $itemData['useProductsPric...
php
public function retrieveItemPrices($itemsData, $currency, $locale) { $items = []; $previousItem = null; // Prepare item data. foreach ($itemsData as $itemData) { $useProductsPrice = false; if (isset($itemData['useProductsPrice']) && $itemData['useProductsPric...
[ "public", "function", "retrieveItemPrices", "(", "$", "itemsData", ",", "$", "currency", ",", "$", "locale", ")", "{", "$", "items", "=", "[", "]", ";", "$", "previousItem", "=", "null", ";", "// Prepare item data.", "foreach", "(", "$", "itemsData", "as",...
Calculates total prices of all items given in data array. @param array $itemsData @param string $currency @param string $locale @return array
[ "Calculates", "total", "prices", "of", "all", "items", "given", "in", "data", "array", "." ]
train
https://github.com/sulu/SuluPricingBundle/blob/cd65f823c7c72992d0e423ee758a61f951f1d7d9/Manager/PriceCalculationManager.php#L56-L104
Stampie/stampie-bundle
DataCollector/StampieDataCollector.php
StampieDataCollector.collect
public function collect(Request $request, Response $response, \Exception $exception = null) { $messages = []; if (null !== $this->messageLogger) { foreach ($this->messageLogger->getMessages() as $message) { $messages[] = $this->normalizeMessage($message); } ...
php
public function collect(Request $request, Response $response, \Exception $exception = null) { $messages = []; if (null !== $this->messageLogger) { foreach ($this->messageLogger->getMessages() as $message) { $messages[] = $this->normalizeMessage($message); } ...
[ "public", "function", "collect", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "$", "messages", "=", "[", "]", ";", "if", "(", "null", "!==", "$", "this", "->", "mes...
{@inheritdoc}
[ "{" ]
train
https://github.com/Stampie/stampie-bundle/blob/a996d355a9d24ff667096315cc70b92f426b45f1/DataCollector/StampieDataCollector.php#L26-L37
o2system/html
src/Dom/Element.php
Element.addAttributes
public function addAttributes(array $attr) { foreach ($attr as $name => $value) { $this->setAttribute($name, $value); } return $this; }
php
public function addAttributes(array $attr) { foreach ($attr as $name => $value) { $this->setAttribute($name, $value); } return $this; }
[ "public", "function", "addAttributes", "(", "array", "$", "attr", ")", "{", "foreach", "(", "$", "attr", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "this", "->", "setAttribute", "(", "$", "name", ",", "$", "value", ")", ";", "}", "return...
Element::addAttributes @param array $attr @return static
[ "Element", "::", "addAttributes" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L111-L118
o2system/html
src/Dom/Element.php
Element.getAttributes
public function getAttributes() { $attributesCount = $this->attributes->length; $attributes = []; for ($i = 0; $i < $attributesCount; $i++) { $attributes[] = $this->attributes->item($i); } return $attributes; }
php
public function getAttributes() { $attributesCount = $this->attributes->length; $attributes = []; for ($i = 0; $i < $attributesCount; $i++) { $attributes[] = $this->attributes->item($i); } return $attributes; }
[ "public", "function", "getAttributes", "(", ")", "{", "$", "attributesCount", "=", "$", "this", "->", "attributes", "->", "length", ";", "$", "attributes", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "attributesCount"...
Element::getAttributes Returns an array containing all attributes @return array An associative array containing all attributes
[ "Element", "::", "getAttributes" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L129-L139
o2system/html
src/Dom/Element.php
Element.clear
public function clear() { if ($this->childNodes->length > 0) { foreach ($this->childNodes as $childNode) { $this->removeChild($childNode); } } $this->textContent = null; }
php
public function clear() { if ($this->childNodes->length > 0) { foreach ($this->childNodes as $childNode) { $this->removeChild($childNode); } } $this->textContent = null; }
[ "public", "function", "clear", "(", ")", "{", "if", "(", "$", "this", "->", "childNodes", "->", "length", ">", "0", ")", "{", "foreach", "(", "$", "this", "->", "childNodes", "as", "$", "childNode", ")", "{", "$", "this", "->", "removeChild", "(", ...
Element::clear @return void
[ "Element", "::", "clear" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L174-L183
o2system/html
src/Dom/Element.php
Element.html
public function html($newInnerHTML = null) { if (isset($newInnerHTML)) { $this->replace($newInnerHTML); } return $this->innerHTML; }
php
public function html($newInnerHTML = null) { if (isset($newInnerHTML)) { $this->replace($newInnerHTML); } return $this->innerHTML; }
[ "public", "function", "html", "(", "$", "newInnerHTML", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "newInnerHTML", ")", ")", "{", "$", "this", "->", "replace", "(", "$", "newInnerHTML", ")", ";", "}", "return", "$", "this", "->", "innerHTML...
Element::html @param null $newInnerHTML @return string
[ "Element", "::", "html" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L194-L201
o2system/html
src/Dom/Element.php
Element.replace
public function replace($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); return $this->parentNode->replaceChild($importNode, $this); }
php
public function replace($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); return $this->parentNode->replaceChild($importNode, $this); }
[ "public", "function", "replace", "(", "$", "source", ")", "{", "$", "importNode", "=", "$", "this", "->", "ownerDocument", "->", "importNode", "(", "$", "this", "->", "ownerDocument", "->", "importSourceNode", "(", "$", "source", ")", ",", "true", ")", "...
Element::replace @param $source @return \DOMNode
[ "Element", "::", "replace" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L212-L217
o2system/html
src/Dom/Element.php
Element.text
public function text($newTextContent = null) { if (isset($newTextContent)) { $this->textContent = $this->nodeValue = $newTextContent; } return $this->textContent; }
php
public function text($newTextContent = null) { if (isset($newTextContent)) { $this->textContent = $this->nodeValue = $newTextContent; } return $this->textContent; }
[ "public", "function", "text", "(", "$", "newTextContent", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "newTextContent", ")", ")", "{", "$", "this", "->", "textContent", "=", "$", "this", "->", "nodeValue", "=", "$", "newTextContent", ";", "}",...
Element::text @param null $newTextContent @return null
[ "Element", "::", "text" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L228-L235
o2system/html
src/Dom/Element.php
Element.append
public function append($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); return $this->insertBefore($importNode, $this->firstChild); }
php
public function append($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); return $this->insertBefore($importNode, $this->firstChild); }
[ "public", "function", "append", "(", "$", "source", ")", "{", "$", "importNode", "=", "$", "this", "->", "ownerDocument", "->", "importNode", "(", "$", "this", "->", "ownerDocument", "->", "importSourceNode", "(", "$", "source", ")", ",", "true", ")", ";...
Element::append @param $source @return \DOMNode
[ "Element", "::", "append" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L246-L251
o2system/html
src/Dom/Element.php
Element.prepend
public function prepend($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); return $this->appendChild($importNode); }
php
public function prepend($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); return $this->appendChild($importNode); }
[ "public", "function", "prepend", "(", "$", "source", ")", "{", "$", "importNode", "=", "$", "this", "->", "ownerDocument", "->", "importNode", "(", "$", "this", "->", "ownerDocument", "->", "importSourceNode", "(", "$", "source", ")", ",", "true", ")", "...
Element::prepend @param $source @return \DOMNode
[ "Element", "::", "prepend" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L262-L267
o2system/html
src/Dom/Element.php
Element.before
public function before($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); return $this->parentNode->insertBefore($importNode, $this); }
php
public function before($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); return $this->parentNode->insertBefore($importNode, $this); }
[ "public", "function", "before", "(", "$", "source", ")", "{", "$", "importNode", "=", "$", "this", "->", "ownerDocument", "->", "importNode", "(", "$", "this", "->", "ownerDocument", "->", "importSourceNode", "(", "$", "source", ")", ",", "true", ")", ";...
Element::before @param $source @return \DOMNode
[ "Element", "::", "before" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L278-L283
o2system/html
src/Dom/Element.php
Element.after
public function after($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); $isFoundSameNode = false; foreach ($this->parentNode->childNodes as $key => $childNode) { if ($childNode->isSameNode($this)) { ...
php
public function after($source) { $importNode = $this->ownerDocument->importNode($this->ownerDocument->importSourceNode($source), true); $isFoundSameNode = false; foreach ($this->parentNode->childNodes as $key => $childNode) { if ($childNode->isSameNode($this)) { ...
[ "public", "function", "after", "(", "$", "source", ")", "{", "$", "importNode", "=", "$", "this", "->", "ownerDocument", "->", "importNode", "(", "$", "this", "->", "ownerDocument", "->", "importSourceNode", "(", "$", "source", ")", ",", "true", ")", ";"...
Element::after @param $source @return bool
[ "Element", "::", "after" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Element.php#L294-L311
Wonail/wocenter
helpers/WebConsoleHelper.php
WebConsoleHelper.run
public static function run($cmd, $show = true) { if (self::isWin()) { $cmd = str_replace("\\", "\\\\", $cmd); } $handler = popen($cmd, 'r'); while (!feof($handler)) { $show ? self::writeInfoMessage(fgets($handler), 1) : fgets($handler); } pclos...
php
public static function run($cmd, $show = true) { if (self::isWin()) { $cmd = str_replace("\\", "\\\\", $cmd); } $handler = popen($cmd, 'r'); while (!feof($handler)) { $show ? self::writeInfoMessage(fgets($handler), 1) : fgets($handler); } pclos...
[ "public", "static", "function", "run", "(", "$", "cmd", ",", "$", "show", "=", "true", ")", "{", "if", "(", "self", "::", "isWin", "(", ")", ")", "{", "$", "cmd", "=", "str_replace", "(", "\"\\\\\"", ",", "\"\\\\\\\\\"", ",", "$", "cmd", ")", ";"...
执行控制台命令 @param string $cmd @param bool $show 是否显示输出信息,默认显示
[ "执行控制台命令" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/WebConsoleHelper.php#L41-L51
Wonail/wocenter
helpers/WebConsoleHelper.php
WebConsoleHelper.writeMessage
public static function writeMessage($message, $rnCount = 0) { $message = str_replace(["'", "\n"], ["\"", ""], $message) . str_repeat("<br />", $rnCount); self::writeScript("parent.writeMessage('$message')"); }
php
public static function writeMessage($message, $rnCount = 0) { $message = str_replace(["'", "\n"], ["\"", ""], $message) . str_repeat("<br />", $rnCount); self::writeScript("parent.writeMessage('$message')"); }
[ "public", "static", "function", "writeMessage", "(", "$", "message", ",", "$", "rnCount", "=", "0", ")", "{", "$", "message", "=", "str_replace", "(", "[", "\"'\"", ",", "\"\\n\"", "]", ",", "[", "\"\\\"\"", ",", "\"\"", "]", ",", "$", "message", ")"...
显示信息 @param string $message 需要显示的信息 @param int $rnCount 换行总数
[ "显示信息" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/WebConsoleHelper.php#L105-L109
JoffreyPoreeCoding/MongoDB-ODM
src/Factory/ClassMetadataFactory.php
ClassMetadataFactory.getMetadataForClass
public function getMetadataForClass($className) { if (!class_exists($className)) { throw new \Exception("Class $className does not exist!"); } if (isset($this->loadedMetadatas[$className])) { return $this->loadedMetadatas[$className]; } return $this->...
php
public function getMetadataForClass($className) { if (!class_exists($className)) { throw new \Exception("Class $className does not exist!"); } if (isset($this->loadedMetadatas[$className])) { return $this->loadedMetadatas[$className]; } return $this->...
[ "public", "function", "getMetadataForClass", "(", "$", "className", ")", "{", "if", "(", "!", "class_exists", "(", "$", "className", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Class $className does not exist!\"", ")", ";", "}", "if", "(", "iss...
Allow to get class metadata for specified class @param string $className Name of the class to get metadatas @return ClassMetadata Class metadatas
[ "Allow", "to", "get", "class", "metadata", "for", "specified", "class" ]
train
https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Factory/ClassMetadataFactory.php#L57-L67
groupby/api-php
src/API/AbstractBridge.php
AbstractBridge.search
public function search($query) { $content = $query->getBridgeJson($this->clientKey); return $this->query($this->bridgeUrl, $content, self::RESULTS_CLASS); }
php
public function search($query) { $content = $query->getBridgeJson($this->clientKey); return $this->query($this->bridgeUrl, $content, self::RESULTS_CLASS); }
[ "public", "function", "search", "(", "$", "query", ")", "{", "$", "content", "=", "$", "query", "->", "getBridgeJson", "(", "$", "this", "->", "clientKey", ")", ";", "return", "$", "this", "->", "query", "(", "$", "this", "->", "bridgeUrl", ",", "$",...
@param Query $query @return mixed
[ "@param", "Query", "$query" ]
train
https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/AbstractBridge.php#L63-L68
groupby/api-php
src/API/AbstractBridge.php
AbstractBridge.refinements
public function refinements($query, $navigationName) { $content = $query->getBridgeRefinementsJson($this->clientKey, $navigationName); return $this->query($this->bridgeRefinementsUrl, $content, self::REFINEMENTS_RESULT_CLASS); }
php
public function refinements($query, $navigationName) { $content = $query->getBridgeRefinementsJson($this->clientKey, $navigationName); return $this->query($this->bridgeRefinementsUrl, $content, self::REFINEMENTS_RESULT_CLASS); }
[ "public", "function", "refinements", "(", "$", "query", ",", "$", "navigationName", ")", "{", "$", "content", "=", "$", "query", "->", "getBridgeRefinementsJson", "(", "$", "this", "->", "clientKey", ",", "$", "navigationName", ")", ";", "return", "$", "th...
@param Query $query @param string $navigationName @return mixed
[ "@param", "Query", "$query", "@param", "string", "$navigationName" ]
train
https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/AbstractBridge.php#L76-L81
groupby/api-php
src/API/AbstractBridge.php
AbstractBridge.query
private function query($url, $content, $class) { $response = null; $tries = 0; $lastError = null; while ($tries < self::MAX_TRIES) { try { $response = $this->execute($url, $content, $tries); break; } catch (Exception $e) { usleep(self::RETRY_TIMEOUT); error...
php
private function query($url, $content, $class) { $response = null; $tries = 0; $lastError = null; while ($tries < self::MAX_TRIES) { try { $response = $this->execute($url, $content, $tries); break; } catch (Exception $e) { usleep(self::RETRY_TIMEOUT); error...
[ "private", "function", "query", "(", "$", "url", ",", "$", "content", ",", "$", "class", ")", "{", "$", "response", "=", "null", ";", "$", "tries", "=", "0", ";", "$", "lastError", "=", "null", ";", "while", "(", "$", "tries", "<", "self", "::", ...
@param string $url @param string $content @param string $class @return mixed
[ "@param", "string", "$url", "@param", "string", "$content", "@param", "string", "$class" ]
train
https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/AbstractBridge.php#L90-L126
groupby/api-php
src/API/AbstractBridge.php
AbstractBridge.execute
protected function execute($url, $content, $tries) { echo "sending request $content to $url"; return Request::post($url . "?retry=$tries") ->body($content) ->timeout(isset($this->timeout) ? $this->timeout : self::DEFAULT_TIMEOUT) ->addOnCurlOption(CURLOPT_CONNECTTIMEOUT_MS, (isset($th...
php
protected function execute($url, $content, $tries) { echo "sending request $content to $url"; return Request::post($url . "?retry=$tries") ->body($content) ->timeout(isset($this->timeout) ? $this->timeout : self::DEFAULT_TIMEOUT) ->addOnCurlOption(CURLOPT_CONNECTTIMEOUT_MS, (isset($th...
[ "protected", "function", "execute", "(", "$", "url", ",", "$", "content", ",", "$", "tries", ")", "{", "echo", "\"sending request $content to $url\"", ";", "return", "Request", "::", "post", "(", "$", "url", ".", "\"?retry=$tries\"", ")", "->", "body", "(", ...
@param string $url @param string $content @param int $tries @return Response
[ "@param", "string", "$url", "@param", "string", "$content", "@param", "int", "$tries" ]
train
https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/AbstractBridge.php#L135-L145
groupby/api-php
src/API/AbstractBridge.php
AbstractBridge.getContentEncoding
private function getContentEncoding($response) { $headers = $response->headers; foreach ($headers as $header) { list($k, $v) = explode(':', $header); if ('content-encoding' == strtolower($k)) { return trim($v); } } return false; }
php
private function getContentEncoding($response) { $headers = $response->headers; foreach ($headers as $header) { list($k, $v) = explode(':', $header); if ('content-encoding' == strtolower($k)) { return trim($v); } } return false; }
[ "private", "function", "getContentEncoding", "(", "$", "response", ")", "{", "$", "headers", "=", "$", "response", "->", "headers", ";", "foreach", "(", "$", "headers", "as", "$", "header", ")", "{", "list", "(", "$", "k", ",", "$", "v", ")", "=", ...
@param Response $response @return bool|string
[ "@param", "Response", "$response" ]
train
https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/AbstractBridge.php#L152-L162
yoanm/php-jsonrpc-http-server-openapi-doc-sdk
src/App/Normalizer/Component/OperationDocNormalizer.php
OperationDocNormalizer.normalize
public function normalize(MethodDoc $method, ServerDoc $serverDoc) : array { $self = $this; $extraErrorDefinitionIdRefList = array_map( function (ErrorDoc $errorDoc) use ($self) { return [ '$ref' => $self->definitionRefResolver->getDefinitionRef( ...
php
public function normalize(MethodDoc $method, ServerDoc $serverDoc) : array { $self = $this; $extraErrorDefinitionIdRefList = array_map( function (ErrorDoc $errorDoc) use ($self) { return [ '$ref' => $self->definitionRefResolver->getDefinitionRef( ...
[ "public", "function", "normalize", "(", "MethodDoc", "$", "method", ",", "ServerDoc", "$", "serverDoc", ")", ":", "array", "{", "$", "self", "=", "$", "this", ";", "$", "extraErrorDefinitionIdRefList", "=", "array_map", "(", "function", "(", "ErrorDoc", "$",...
@param MethodDoc $method @param ServerDoc $serverDoc @return array
[ "@param", "MethodDoc", "$method", "@param", "ServerDoc", "$serverDoc" ]
train
https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Normalizer/Component/OperationDocNormalizer.php#L42-L100
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtCharset/CharsetRule.php
CharsetRule.setValue
protected function setValue($value) { if (is_string($value)) { $value = trim($value); if ($value !== "") { $this->value = $value; } else { throw new \InvalidArgumentException("Invalid value for argument 'value' given."); } ...
php
protected function setValue($value) { if (is_string($value)) { $value = trim($value); if ($value !== "") { $this->value = $value; } else { throw new \InvalidArgumentException("Invalid value for argument 'value' given."); } ...
[ "protected", "function", "setValue", "(", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "if", "(", "$", "value", "!==", "\"\"", ")", "{", "$", "this", "...
Sets the value for the charset rule. @param string $value @return $this
[ "Sets", "the", "value", "for", "the", "charset", "rule", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtCharset/CharsetRule.php#L39-L55
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtCharset/CharsetRule.php
CharsetRule.parseRuleString
protected function parseRuleString($ruleString) { if (is_string($ruleString)) { // Parse for @charset rule if (preg_match('/^@charset\s+(["\'])([-a-zA-Z0-9_]+)\g{1}/i', rtrim($ruleString), $matches)) { $this->setValue($matches[2]); } else { ...
php
protected function parseRuleString($ruleString) { if (is_string($ruleString)) { // Parse for @charset rule if (preg_match('/^@charset\s+(["\'])([-a-zA-Z0-9_]+)\g{1}/i', rtrim($ruleString), $matches)) { $this->setValue($matches[2]); } else { ...
[ "protected", "function", "parseRuleString", "(", "$", "ruleString", ")", "{", "if", "(", "is_string", "(", "$", "ruleString", ")", ")", "{", "// Parse for @charset rule", "if", "(", "preg_match", "(", "'/^@charset\\s+([\"\\'])([-a-zA-Z0-9_]+)\\g{1}/i'", ",", "rtrim", ...
Parses the charset rule. @param string $ruleString
[ "Parses", "the", "charset", "rule", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtCharset/CharsetRule.php#L72-L86
weavephp/weave
src/Weave.php
Weave.start
public function start($environment = null, $configLocation = null) { $config = $this->loadConfig($environment, $configLocation); $this->loadErrorHandler($config, $environment); $instantiator = $this->loadContainer($config, $environment); $middleware = $instantiator(Middleware\Middleware::class); $response =...
php
public function start($environment = null, $configLocation = null) { $config = $this->loadConfig($environment, $configLocation); $this->loadErrorHandler($config, $environment); $instantiator = $this->loadContainer($config, $environment); $middleware = $instantiator(Middleware\Middleware::class); $response =...
[ "public", "function", "start", "(", "$", "environment", "=", "null", ",", "$", "configLocation", "=", "null", ")", "{", "$", "config", "=", "$", "this", "->", "loadConfig", "(", "$", "environment", ",", "$", "configLocation", ")", ";", "$", "this", "->...
The starting point for any Weave App. Environment and config location details are passed on to the config adaptor and environment is also passed to the error adaptor and the container adaptor. @param string $environment Optional indication of the runtime environment. @param string $configLocation Optional location...
[ "The", "starting", "point", "for", "any", "Weave", "App", "." ]
train
https://github.com/weavephp/weave/blob/44183a5bcb9e3ed3754cc76aa9e0724d718caeec/src/Weave.php#L24-L34
opis/utils
lib/Punycode.php
Punycode.encode
public static function encode($input) { $parts = explode('.', $input); foreach ($parts as &$part) { $part = static::encodePart($part); } return implode('.', $parts); }
php
public static function encode($input) { $parts = explode('.', $input); foreach ($parts as &$part) { $part = static::encodePart($part); } return implode('.', $parts); }
[ "public", "static", "function", "encode", "(", "$", "input", ")", "{", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "input", ")", ";", "foreach", "(", "$", "parts", "as", "&", "$", "part", ")", "{", "$", "part", "=", "static", "::", "encod...
Encode a domain to its Punycode version @param string $input Domain name in Unicde to be encoded @return string Punycode representation in ASCII
[ "Encode", "a", "domain", "to", "its", "Punycode", "version" ]
train
https://github.com/opis/utils/blob/239cd3dc3760eb746838011e712592700fe5d58c/lib/Punycode.php#L72-L81
opis/utils
lib/Punycode.php
Punycode.encodePart
protected static function encodePart(&$input) { $codePoints = &static::codePoints($input); $n = static::INITIAL_N; $bias = static::INITIAL_BIAS; $delta = 0; $h = $b = count($codePoints['basic']); $output = static::getString($codePoints['basic']); if ($input...
php
protected static function encodePart(&$input) { $codePoints = &static::codePoints($input); $n = static::INITIAL_N; $bias = static::INITIAL_BIAS; $delta = 0; $h = $b = count($codePoints['basic']); $output = static::getString($codePoints['basic']); if ($input...
[ "protected", "static", "function", "encodePart", "(", "&", "$", "input", ")", "{", "$", "codePoints", "=", "&", "static", "::", "codePoints", "(", "$", "input", ")", ";", "$", "n", "=", "static", "::", "INITIAL_N", ";", "$", "bias", "=", "static", ":...
Encode a part of a domain name, such as tld, to its Punycode version @param string $input Part of a domain name @return string Punycode representation of a domain part
[ "Encode", "a", "part", "of", "a", "domain", "name", "such", "as", "tld", "to", "its", "Punycode", "version" ]
train
https://github.com/opis/utils/blob/239cd3dc3760eb746838011e712592700fe5d58c/lib/Punycode.php#L89-L150
opis/utils
lib/Punycode.php
Punycode.decodePart
protected static function decodePart($input) { $n = static::INITIAL_N; $i = 0; $bias = static::INITIAL_BIAS; $output = ''; $pos = strrpos($input, static::DELIMITER); if ($pos !== false) { $output = substr($input, 0, $pos++); } else { ...
php
protected static function decodePart($input) { $n = static::INITIAL_N; $i = 0; $bias = static::INITIAL_BIAS; $output = ''; $pos = strrpos($input, static::DELIMITER); if ($pos !== false) { $output = substr($input, 0, $pos++); } else { ...
[ "protected", "static", "function", "decodePart", "(", "$", "input", ")", "{", "$", "n", "=", "static", "::", "INITIAL_N", ";", "$", "i", "=", "0", ";", "$", "bias", "=", "static", "::", "INITIAL_BIAS", ";", "$", "output", "=", "''", ";", "$", "pos"...
Decode a part of domain name, such as tld @param string $input Part of a domain name @return string Unicode domain part @throws Exception
[ "Decode", "a", "part", "of", "domain", "name", "such", "as", "tld" ]
train
https://github.com/opis/utils/blob/239cd3dc3760eb746838011e712592700fe5d58c/lib/Punycode.php#L181-L239
opis/utils
lib/Punycode.php
Punycode.&
protected static function &codePoints($input) { $codePoints = array( 'all' => array(), 'basic' => array(), 'nonBasic' => array(), ); $codes = &static::getCharsCodes($input); $codePoints['length'] = $length = count($codes); for ($i = 0; $i...
php
protected static function &codePoints($input) { $codePoints = array( 'all' => array(), 'basic' => array(), 'nonBasic' => array(), ); $codes = &static::getCharsCodes($input); $codePoints['length'] = $length = count($codes); for ($i = 0; $i...
[ "protected", "static", "function", "&", "codePoints", "(", "$", "input", ")", "{", "$", "codePoints", "=", "array", "(", "'all'", "=>", "array", "(", ")", ",", "'basic'", "=>", "array", "(", ")", ",", "'nonBasic'", "=>", "array", "(", ")", ",", ")", ...
List code points for a given input @param string $input @return array Multi-dimension array with basic, non-basic and aggregated code points
[ "List", "code", "points", "for", "a", "given", "input" ]
train
https://github.com/opis/utils/blob/239cd3dc3760eb746838011e712592700fe5d58c/lib/Punycode.php#L292-L314
gdbots/pbjx-bundle-php
src/Command/PbjxBatchCommand.php
PbjxBatchCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $dryRun = $input->getOption('dry-run'); $skipInvalid = $input->getOption('skip-invalid'); $skipErrors = $input->getOption('skip-errors'); $batchSize = NumberUtils::bound($input->getOption('batch-size'), 1, 5...
php
protected function execute(InputInterface $input, OutputInterface $output) { $dryRun = $input->getOption('dry-run'); $skipInvalid = $input->getOption('skip-invalid'); $skipErrors = $input->getOption('skip-errors'); $batchSize = NumberUtils::bound($input->getOption('batch-size'), 1, 5...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "dryRun", "=", "$", "input", "->", "getOption", "(", "'dry-run'", ")", ";", "$", "skipInvalid", "=", "$", "input", "->", "getOpti...
@param InputInterface $input @param OutputInterface $output @return null
[ "@param", "InputInterface", "$input", "@param", "OutputInterface", "$output" ]
train
https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/PbjxBatchCommand.php#L128-L302
ARCANEDEV/SpamBlocker
src/Entities/SpammerCollection.php
SpammerCollection.blockOne
public function blockOne($host) { return $this->exists($host) ? $this->updateOne($host) : $this->addOne($host); }
php
public function blockOne($host) { return $this->exists($host) ? $this->updateOne($host) : $this->addOne($host); }
[ "public", "function", "blockOne", "(", "$", "host", ")", "{", "return", "$", "this", "->", "exists", "(", "$", "host", ")", "?", "$", "this", "->", "updateOne", "(", "$", "host", ")", ":", "$", "this", "->", "addOne", "(", "$", "host", ")", ";", ...
Add a host to a blacklist collection. @param string $host @return self
[ "Add", "a", "host", "to", "a", "blacklist", "collection", "." ]
train
https://github.com/ARCANEDEV/SpamBlocker/blob/708c9d5363616e0b257451256c4ca9fb9a9ff55f/src/Entities/SpammerCollection.php#L69-L74
ARCANEDEV/SpamBlocker
src/Entities/SpammerCollection.php
SpammerCollection.allowOne
public function allowOne($host) { return $this->exists($host) ? $this->updateOne($host, false) : $this->addOne($host, false); }
php
public function allowOne($host) { return $this->exists($host) ? $this->updateOne($host, false) : $this->addOne($host, false); }
[ "public", "function", "allowOne", "(", "$", "host", ")", "{", "return", "$", "this", "->", "exists", "(", "$", "host", ")", "?", "$", "this", "->", "updateOne", "(", "$", "host", ",", "false", ")", ":", "$", "this", "->", "addOne", "(", "$", "hos...
Add a host to a whitelist collection. @param string $host @return self
[ "Add", "a", "host", "to", "a", "whitelist", "collection", "." ]
train
https://github.com/ARCANEDEV/SpamBlocker/blob/708c9d5363616e0b257451256c4ca9fb9a9ff55f/src/Entities/SpammerCollection.php#L83-L88
ARCANEDEV/SpamBlocker
src/Entities/SpammerCollection.php
SpammerCollection.addOne
private function addOne($host, $blocked = true) { $spammer = Spammer::make($host, $blocked); return $this->put($spammer->host(), $spammer); }
php
private function addOne($host, $blocked = true) { $spammer = Spammer::make($host, $blocked); return $this->put($spammer->host(), $spammer); }
[ "private", "function", "addOne", "(", "$", "host", ",", "$", "blocked", "=", "true", ")", "{", "$", "spammer", "=", "Spammer", "::", "make", "(", "$", "host", ",", "$", "blocked", ")", ";", "return", "$", "this", "->", "put", "(", "$", "spammer", ...
Add a host to the collection. @param string $host @param bool $blocked @return self
[ "Add", "a", "host", "to", "the", "collection", "." ]
train
https://github.com/ARCANEDEV/SpamBlocker/blob/708c9d5363616e0b257451256c4ca9fb9a9ff55f/src/Entities/SpammerCollection.php#L98-L103
ARCANEDEV/SpamBlocker
src/Entities/SpammerCollection.php
SpammerCollection.updateOne
private function updateOne($host, $blocked = true) { if ($this->exists($host)) { /** @var \Arcanedev\SpamBlocker\Entities\Spammer $spammer */ $spammer = $this->get($host); if ($spammer->isBlocked() !== $blocked) $this->put($spammer->host(), $spammer->se...
php
private function updateOne($host, $blocked = true) { if ($this->exists($host)) { /** @var \Arcanedev\SpamBlocker\Entities\Spammer $spammer */ $spammer = $this->get($host); if ($spammer->isBlocked() !== $blocked) $this->put($spammer->host(), $spammer->se...
[ "private", "function", "updateOne", "(", "$", "host", ",", "$", "blocked", "=", "true", ")", "{", "if", "(", "$", "this", "->", "exists", "(", "$", "host", ")", ")", "{", "/** @var \\Arcanedev\\SpamBlocker\\Entities\\Spammer $spammer */", "$", "spammer", "="...
Update a host/spammer. @param string $host @param bool $blocked @return self
[ "Update", "a", "host", "/", "spammer", "." ]
train
https://github.com/ARCANEDEV/SpamBlocker/blob/708c9d5363616e0b257451256c4ca9fb9a9ff55f/src/Entities/SpammerCollection.php#L113-L124
ARCANEDEV/SpamBlocker
src/Entities/SpammerCollection.php
SpammerCollection.whereHostIn
public function whereHostIn(array $hosts, $strict = false) { $values = $this->getArrayableItems($hosts); return $this->filter(function (Spammer $spammer) use ($values, $strict) { return in_array($spammer->host(), $values, $strict); }); }
php
public function whereHostIn(array $hosts, $strict = false) { $values = $this->getArrayableItems($hosts); return $this->filter(function (Spammer $spammer) use ($values, $strict) { return in_array($spammer->host(), $values, $strict); }); }
[ "public", "function", "whereHostIn", "(", "array", "$", "hosts", ",", "$", "strict", "=", "false", ")", "{", "$", "values", "=", "$", "this", "->", "getArrayableItems", "(", "$", "hosts", ")", ";", "return", "$", "this", "->", "filter", "(", "function"...
Filter the spammer by the given hosts. @param array $hosts @param bool $strict @return self
[ "Filter", "the", "spammer", "by", "the", "given", "hosts", "." ]
train
https://github.com/ARCANEDEV/SpamBlocker/blob/708c9d5363616e0b257451256c4ca9fb9a9ff55f/src/Entities/SpammerCollection.php#L148-L155
Laralum/Roles
src/Controllers/RoleController.php
RoleController.update
public function update(Request $request, Role $role) { $this->authorize('update', Role::class); $this->validate($request, [ 'name' => 'required|max:255', 'color' => 'required|size:7', 'description' => 'required|max:500', ]); $role->upd...
php
public function update(Request $request, Role $role) { $this->authorize('update', Role::class); $this->validate($request, [ 'name' => 'required|max:255', 'color' => 'required|size:7', 'description' => 'required|max:500', ]); $role->upd...
[ "public", "function", "update", "(", "Request", "$", "request", ",", "Role", "$", "role", ")", "{", "$", "this", "->", "authorize", "(", "'update'", ",", "Role", "::", "class", ")", ";", "$", "this", "->", "validate", "(", "$", "request", ",", "[", ...
Update the specified resource in storage. @param \Illuminate\Http\Request $request @param \Laralum\Roles\Models\Role $role @return \Illuminate\Http\Response
[ "Update", "the", "specified", "resource", "in", "storage", "." ]
train
https://github.com/Laralum/Roles/blob/f934967a5dcebebf81915dd50fccdbcb7e23c113/src/Controllers/RoleController.php#L76-L87
Laralum/Roles
src/Controllers/RoleController.php
RoleController.permissions
public function permissions(Role $role) { $this->authorize('manage_permissions', Role::class); return view('laralum_roles::permissions', ['permissions' => Permission::all(), 'role' => $role]); }
php
public function permissions(Role $role) { $this->authorize('manage_permissions', Role::class); return view('laralum_roles::permissions', ['permissions' => Permission::all(), 'role' => $role]); }
[ "public", "function", "permissions", "(", "Role", "$", "role", ")", "{", "$", "this", "->", "authorize", "(", "'manage_permissions'", ",", "Role", "::", "class", ")", ";", "return", "view", "(", "'laralum_roles::permissions'", ",", "[", "'permissions'", "=>", ...
Show / edit the role permissions. @param \Laralum\Roles\Models\Role $role @return \Illuminate\Http\Response
[ "Show", "/", "edit", "the", "role", "permissions", "." ]
train
https://github.com/Laralum/Roles/blob/f934967a5dcebebf81915dd50fccdbcb7e23c113/src/Controllers/RoleController.php#L96-L101
Laralum/Roles
src/Controllers/RoleController.php
RoleController.updatePermissions
public function updatePermissions(Request $request, Role $role) { $this->authorize('manage_permissions', Role::class); $permissions = Permission::all(); foreach ($permissions as $permission) { if (array_key_exists($permission->id, $request->all())) { $role->addPe...
php
public function updatePermissions(Request $request, Role $role) { $this->authorize('manage_permissions', Role::class); $permissions = Permission::all(); foreach ($permissions as $permission) { if (array_key_exists($permission->id, $request->all())) { $role->addPe...
[ "public", "function", "updatePermissions", "(", "Request", "$", "request", ",", "Role", "$", "role", ")", "{", "$", "this", "->", "authorize", "(", "'manage_permissions'", ",", "Role", "::", "class", ")", ";", "$", "permissions", "=", "Permission", "::", "...
Update the role permissions. @param \Illuminate\Http\Request $request @param \Laralum\Roles\Models\Role $role @return \Illuminate\Http\Response
[ "Update", "the", "role", "permissions", "." ]
train
https://github.com/Laralum/Roles/blob/f934967a5dcebebf81915dd50fccdbcb7e23c113/src/Controllers/RoleController.php#L111-L125
Laralum/Roles
src/Controllers/RoleController.php
RoleController.destroy
public function destroy(Request $request, Role $role) { $this->authorize('delete', Role::class); $role->deletePermissions($role->permissions); $role->deleteUsers($role->users); $role->delete(); return redirect()->route('laralum::roles.index')->with('success', __('laralum_ro...
php
public function destroy(Request $request, Role $role) { $this->authorize('delete', Role::class); $role->deletePermissions($role->permissions); $role->deleteUsers($role->users); $role->delete(); return redirect()->route('laralum::roles.index')->with('success', __('laralum_ro...
[ "public", "function", "destroy", "(", "Request", "$", "request", ",", "Role", "$", "role", ")", "{", "$", "this", "->", "authorize", "(", "'delete'", ",", "Role", "::", "class", ")", ";", "$", "role", "->", "deletePermissions", "(", "$", "role", "->", ...
Remove the specified resource from storage. @param \Illuminate\Http\Request $request @param \Laralum\Roles\Models\Role $role @return \Illuminate\Http\Response
[ "Remove", "the", "specified", "resource", "from", "storage", "." ]
train
https://github.com/Laralum/Roles/blob/f934967a5dcebebf81915dd50fccdbcb7e23c113/src/Controllers/RoleController.php#L152-L161
WellCommerce/OrderBundle
DataSet/Transformer/ClientTransformer.php
ClientTransformer.transformValue
public function transformValue($value) { list($firstName, $lastName, $email) = explode(':', $value); return sprintf('<strong>%s %s</strong><br/>%s', $firstName, $lastName, $email); }
php
public function transformValue($value) { list($firstName, $lastName, $email) = explode(':', $value); return sprintf('<strong>%s %s</strong><br/>%s', $firstName, $lastName, $email); }
[ "public", "function", "transformValue", "(", "$", "value", ")", "{", "list", "(", "$", "firstName", ",", "$", "lastName", ",", "$", "email", ")", "=", "explode", "(", "':'", ",", "$", "value", ")", ";", "return", "sprintf", "(", "'<strong>%s %s</strong><...
{@inheritdoc}
[ "{" ]
train
https://github.com/WellCommerce/OrderBundle/blob/d72cfb51eab7a1f66f186900d1e2d533a822c424/DataSet/Transformer/ClientTransformer.php#L27-L32
shawnsandy/ui-pages
src/Controllers/PageKitController.php
PageKitController.contactUs
public function contactUs(Request $request) { $this->validate($request, [ 'full_name' => 'required', 'email' => 'required', 'subject' => 'required', 'message' => 'required' ] ); Mail::send( 'page::emails.contact-info', ['data...
php
public function contactUs(Request $request) { $this->validate($request, [ 'full_name' => 'required', 'email' => 'required', 'subject' => 'required', 'message' => 'required' ] ); Mail::send( 'page::emails.contact-info', ['data...
[ "public", "function", "contactUs", "(", "Request", "$", "request", ")", "{", "$", "this", "->", "validate", "(", "$", "request", ",", "[", "'full_name'", "=>", "'required'", ",", "'email'", "=>", "'required'", ",", "'subject'", "=>", "'required'", ",", "'m...
Process the contact form name. @return Response
[ "Process", "the", "contact", "form", "name", "." ]
train
https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Controllers/PageKitController.php#L21-L38
huasituo/hstcms
src/Database/Migrations/2016_12_06_044026_create_modules_table.php
CreateModulesTable.up
public function up() { // Schema::create('modules', function (Blueprint $table) { $table->increments('id')->comment('ID'); $table->string('name')->nullable()->comment(hst_lang('hstcms::public.name')); $table->text('description')->comment(); $t...
php
public function up() { // Schema::create('modules', function (Blueprint $table) { $table->increments('id')->comment('ID'); $table->string('name')->nullable()->comment(hst_lang('hstcms::public.name')); $table->text('description')->comment(); $t...
[ "public", "function", "up", "(", ")", "{", "//", "Schema", "::", "create", "(", "'modules'", ",", "function", "(", "Blueprint", "$", "table", ")", "{", "$", "table", "->", "increments", "(", "'id'", ")", "->", "comment", "(", "'ID'", ")", ";", "$", ...
Run the migrations. @return void
[ "Run", "the", "migrations", "." ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Database/Migrations/2016_12_06_044026_create_modules_table.php#L18-L31
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/CoreBundle/Manager/EmailManager.php
EmailManager.writeLog
protected function writeLog($message) { $fileName = 'app/logs/mail/error.log'; $log = sprintf("[%s]: %s\n", date_format(new \DateTime(), 'Y-m-d H:i:s'), $message); file_put_contents($fileName, $log, FILE_APPEND); }
php
protected function writeLog($message) { $fileName = 'app/logs/mail/error.log'; $log = sprintf("[%s]: %s\n", date_format(new \DateTime(), 'Y-m-d H:i:s'), $message); file_put_contents($fileName, $log, FILE_APPEND); }
[ "protected", "function", "writeLog", "(", "$", "message", ")", "{", "$", "fileName", "=", "'app/logs/mail/error.log'", ";", "$", "log", "=", "sprintf", "(", "\"[%s]: %s\\n\"", ",", "date_format", "(", "new", "\\", "DateTime", "(", ")", ",", "'Y-m-d H:i:s'", ...
Writes a new line to mail error log @param string $message
[ "Writes", "a", "new", "line", "to", "mail", "error", "log" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Manager/EmailManager.php#L193-L199
CalderaWP/magic-tags
src/two/magictag.php
magictag.author_traversal
protected function author_traversal( $field, $post ) { $parts = explode( '.', $field ); $author = get_user_by( 'id', $post->post_author ); $parts = explode( '.', $field ); $author = get_user_by( 'id', $post->post_author ); if( is_object( $author ) && isset( $parts[1] ) && 'posts_url' == $parts[1] ) { $...
php
protected function author_traversal( $field, $post ) { $parts = explode( '.', $field ); $author = get_user_by( 'id', $post->post_author ); $parts = explode( '.', $field ); $author = get_user_by( 'id', $post->post_author ); if( is_object( $author ) && isset( $parts[1] ) && 'posts_url' == $parts[1] ) { $...
[ "protected", "function", "author_traversal", "(", "$", "field", ",", "$", "post", ")", "{", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "field", ")", ";", "$", "author", "=", "get_user_by", "(", "'id'", ",", "$", "post", "->", "post_author", ...
Handle author.field traversals @since 2.0.0 @param string $field Field @param \WP_Post $post Current post @return mixed
[ "Handle", "author", ".", "field", "traversals" ]
train
https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/two/magictag.php#L153-L169
CalderaWP/magic-tags
src/two/magictag.php
magictag.filter_post
public function filter_post( $in_params ){ // check if there is a third $params = explode( ':', $in_params ); if( isset( $params[1] ) ){ // a third e.g {post:24:post_title} indicates post ID 24 value post_title $post = get_post( $params[0] ); $field = $params[1]; }else{ // stic to current post ...
php
public function filter_post( $in_params ){ // check if there is a third $params = explode( ':', $in_params ); if( isset( $params[1] ) ){ // a third e.g {post:24:post_title} indicates post ID 24 value post_title $post = get_post( $params[0] ); $field = $params[1]; }else{ // stic to current post ...
[ "public", "function", "filter_post", "(", "$", "in_params", ")", "{", "// check if there is a third", "$", "params", "=", "explode", "(", "':'", ",", "$", "in_params", ")", ";", "if", "(", "isset", "(", "$", "params", "[", "1", "]", ")", ")", "{", "// ...
Filters a post magic tag @since 0.0.1 @return string converted tag value
[ "Filters", "a", "post", "magic", "tag" ]
train
https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/two/magictag.php#L178-L198
CalderaWP/magic-tags
src/two/magictag.php
magictag.filter_get_var
public function filter_get_var( $params ){ if( isset($_GET[$params])){ return wp_slash( $_GET[$params] ); }elseif( !empty( $_SERVER['HTTP_REFERER'] ) ){ return $this->filter_get_referr_var( $params ); } return $params; }
php
public function filter_get_var( $params ){ if( isset($_GET[$params])){ return wp_slash( $_GET[$params] ); }elseif( !empty( $_SERVER['HTTP_REFERER'] ) ){ return $this->filter_get_referr_var( $params ); } return $params; }
[ "public", "function", "filter_get_var", "(", "$", "params", ")", "{", "if", "(", "isset", "(", "$", "_GET", "[", "$", "params", "]", ")", ")", "{", "return", "wp_slash", "(", "$", "_GET", "[", "$", "params", "]", ")", ";", "}", "elseif", "(", "!"...
Filters a GET magic tag @since 0.0.1 @return string converted tag value
[ "Filters", "a", "GET", "magic", "tag" ]
train
https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/two/magictag.php#L206-L215
CalderaWP/magic-tags
src/two/magictag.php
magictag.filter_get_referr_var
private function filter_get_referr_var( $params ){ $referer = parse_url( $_SERVER['HTTP_REFERER'] ); if( !empty( $referer['query'] ) ){ parse_str( $referer['query'], $get_vars ); if( isset( $get_vars[$params] ) ){ return wp_slash( $get_vars[$params] ); } } return $params; }
php
private function filter_get_referr_var( $params ){ $referer = parse_url( $_SERVER['HTTP_REFERER'] ); if( !empty( $referer['query'] ) ){ parse_str( $referer['query'], $get_vars ); if( isset( $get_vars[$params] ) ){ return wp_slash( $get_vars[$params] ); } } return $params; }
[ "private", "function", "filter_get_referr_var", "(", "$", "params", ")", "{", "$", "referer", "=", "parse_url", "(", "$", "_SERVER", "[", "'HTTP_REFERER'", "]", ")", ";", "if", "(", "!", "empty", "(", "$", "referer", "[", "'query'", "]", ")", ")", "{",...
Filters a GET from a referrer @since 0.0.1 @return string converted tag value
[ "Filters", "a", "GET", "from", "a", "referrer" ]
train
https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/two/magictag.php#L224-L234
CalderaWP/magic-tags
src/two/magictag.php
magictag.filter_user
public function filter_user( $params ){ if(!is_user_logged_in() ){ return $params; } $user = get_userdata( get_current_user_id() ); if(isset( $user->data->{$params} )){ $params = $user->data->{$params}; } $is_meta = get_user_meta( $user->ID, $params, true ); if( !empty( $is_meta ) ){ $params = ...
php
public function filter_user( $params ){ if(!is_user_logged_in() ){ return $params; } $user = get_userdata( get_current_user_id() ); if(isset( $user->data->{$params} )){ $params = $user->data->{$params}; } $is_meta = get_user_meta( $user->ID, $params, true ); if( !empty( $is_meta ) ){ $params = ...
[ "public", "function", "filter_user", "(", "$", "params", ")", "{", "if", "(", "!", "is_user_logged_in", "(", ")", ")", "{", "return", "$", "params", ";", "}", "$", "user", "=", "get_userdata", "(", "get_current_user_id", "(", ")", ")", ";", "if", "(", ...
Filters a user magic tag @since 0.0.1 @return string converted tag value
[ "Filters", "a", "user", "magic", "tag" ]
train
https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/two/magictag.php#L275-L291
CalderaWP/magic-tags
src/two/magictag.php
magictag.filter_ip
public function filter_ip( ){ // get IP $ip = $_SERVER['REMOTE_ADDR']; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } return $ip; }
php
public function filter_ip( ){ // get IP $ip = $_SERVER['REMOTE_ADDR']; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } return $ip; }
[ "public", "function", "filter_ip", "(", ")", "{", "// get IP", "$", "ip", "=", "$", "_SERVER", "[", "'REMOTE_ADDR'", "]", ";", "if", "(", "!", "empty", "(", "$", "_SERVER", "[", "'HTTP_CLIENT_IP'", "]", ")", ")", "{", "$", "ip", "=", "$", "_SERVER", ...
Filters a ip magic tag @since 0.0.1 @return string converted tag value
[ "Filters", "a", "ip", "magic", "tag" ]
train
https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/two/magictag.php#L313-L325
CalderaWP/magic-tags
src/two/magictag.php
magictag.maybe_do_post_thumbnail
private function maybe_do_post_thumbnail( $field, $post ) { if ( 'post_thumbnail' == $field || false !== strpos( $field, 'post_thumbnail.' ) ) { $size = 'thumbnail'; if ( false !== ( $pos = strpos( $field, '.' ) ) ) { $size = substr( $field, $pos + 1); } $id = get_post_thumbnail_id( $post->ID ); i...
php
private function maybe_do_post_thumbnail( $field, $post ) { if ( 'post_thumbnail' == $field || false !== strpos( $field, 'post_thumbnail.' ) ) { $size = 'thumbnail'; if ( false !== ( $pos = strpos( $field, '.' ) ) ) { $size = substr( $field, $pos + 1); } $id = get_post_thumbnail_id( $post->ID ); i...
[ "private", "function", "maybe_do_post_thumbnail", "(", "$", "field", ",", "$", "post", ")", "{", "if", "(", "'post_thumbnail'", "==", "$", "field", "||", "false", "!==", "strpos", "(", "$", "field", ",", "'post_thumbnail.'", ")", ")", "{", "$", "size", "...
If field is "post_thumbnail" return image source URL Supports .size traversal @param string $field @param \WP_Post|object $post Post object @since 1.1.0 @return bool
[ "If", "field", "is", "post_thumbnail", "return", "image", "source", "URL" ]
train
https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/two/magictag.php#L339-L364
CalderaWP/magic-tags
src/two/magictag.php
magictag.maybe_do_featured
private function maybe_do_featured( $field, $post ){ if ( 'post_featured' == $field ) { $id = get_post_thumbnail_id( $post->ID ); if ( 0 < absint( $id ) ) { return wp_get_attachment_image( $id, 'large' ); } return ''; } }
php
private function maybe_do_featured( $field, $post ){ if ( 'post_featured' == $field ) { $id = get_post_thumbnail_id( $post->ID ); if ( 0 < absint( $id ) ) { return wp_get_attachment_image( $id, 'large' ); } return ''; } }
[ "private", "function", "maybe_do_featured", "(", "$", "field", ",", "$", "post", ")", "{", "if", "(", "'post_featured'", "==", "$", "field", ")", "{", "$", "id", "=", "get_post_thumbnail_id", "(", "$", "post", "->", "ID", ")", ";", "if", "(", "0", "<...
Handle 'post_featured' tags @since 2.1.0 @param string $field @param \WP_Post|object $post Post object @return string|void
[ "Handle", "post_featured", "tags" ]
train
https://github.com/CalderaWP/magic-tags/blob/0e46a6d187bff87c027ed8a6a9e09446aa5f3bd9/src/two/magictag.php#L376-L391
o2system/html
src/Dom/Script.php
Script.import
public function import(Script $script) { foreach ($script->getArrayCopy() as $scriptTextContent) { $this->append($scriptTextContent); } }
php
public function import(Script $script) { foreach ($script->getArrayCopy() as $scriptTextContent) { $this->append($scriptTextContent); } }
[ "public", "function", "import", "(", "Script", "$", "script", ")", "{", "foreach", "(", "$", "script", "->", "getArrayCopy", "(", ")", "as", "$", "scriptTextContent", ")", "{", "$", "this", "->", "append", "(", "$", "scriptTextContent", ")", ";", "}", ...
Script::import @param \O2System\Html\Dom\Script $script
[ "Script", "::", "import" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Script.php#L39-L44
o2system/html
src/Dom/Script.php
Script.append
public function append($value) { $value = trim($value); if ( ! empty($value)) { $hash = md5($value); if ( ! in_array($hash, $this->hashes)) { parent::append($value); $this->hashes[] = $hash; } } }
php
public function append($value) { $value = trim($value); if ( ! empty($value)) { $hash = md5($value); if ( ! in_array($hash, $this->hashes)) { parent::append($value); $this->hashes[] = $hash; } } }
[ "public", "function", "append", "(", "$", "value", ")", "{", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "if", "(", "!", "empty", "(", "$", "value", ")", ")", "{", "$", "hash", "=", "md5", "(", "$", "value", ")", ";", "if", "(", ...
Script::append @param string $value
[ "Script", "::", "append" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Script.php#L53-L65
o2system/html
src/Dom/Script.php
Script.offsetSet
public function offsetSet($offset, $value) { $value = trim($value); if ( ! empty($value)) { parent::offsetSet($offset, $value); } }
php
public function offsetSet($offset, $value) { $value = trim($value); if ( ! empty($value)) { parent::offsetSet($offset, $value); } }
[ "public", "function", "offsetSet", "(", "$", "offset", ",", "$", "value", ")", "{", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "if", "(", "!", "empty", "(", "$", "value", ")", ")", "{", "parent", "::", "offsetSet", "(", "$", "offset"...
Script::offsetSet @param string $offset @param string $value
[ "Script", "::", "offsetSet" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Script.php#L75-L82
o2system/html
src/Dom/Script.php
Script.exists
public function exists($value) { $value = trim($value); if ( ! empty($value)) { $hash = md5($value); return (bool)in_array($hash, $this->hashes); } return false; }
php
public function exists($value) { $value = trim($value); if ( ! empty($value)) { $hash = md5($value); return (bool)in_array($hash, $this->hashes); } return false; }
[ "public", "function", "exists", "(", "$", "value", ")", "{", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "if", "(", "!", "empty", "(", "$", "value", ")", ")", "{", "$", "hash", "=", "md5", "(", "$", "value", ")", ";", "return", "(...
Script::exists @param string $value @return bool
[ "Script", "::", "exists" ]
train
https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Dom/Script.php#L93-L105
acasademont/wurfl
WURFL/VirtualCapability/UserAgentTool.php
WURFL_VirtualCapability_UserAgentTool.getDevice
public function getDevice(WURFL_Request_GenericRequest $request) { $device = $this->assignProperties(new WURFL_VirtualCapability_UserAgentTool_Device($request)); $device->normalize(); return $device; }
php
public function getDevice(WURFL_Request_GenericRequest $request) { $device = $this->assignProperties(new WURFL_VirtualCapability_UserAgentTool_Device($request)); $device->normalize(); return $device; }
[ "public", "function", "getDevice", "(", "WURFL_Request_GenericRequest", "$", "request", ")", "{", "$", "device", "=", "$", "this", "->", "assignProperties", "(", "new", "WURFL_VirtualCapability_UserAgentTool_Device", "(", "$", "request", ")", ")", ";", "$", "devic...
Gets a device from the UA @param WURFL_Request_GenericRequest $request @return WURFL_VirtualCapability_UserAgentTool_Device
[ "Gets", "a", "device", "from", "the", "UA" ]
train
https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/VirtualCapability/UserAgentTool.php#L44-L49
acasademont/wurfl
WURFL/VirtualCapability/UserAgentTool.php
WURFL_VirtualCapability_UserAgentTool.assignProperties
protected function assignProperties($device) { //Is UA Windows Mobile? if ($device->os->setContains($device->device_ua, 'Windows CE', 'Windows Mobile') && $device->browser->set('IE Mobile')) { return $device; } //Is UA Windows Phone OS? - WP before Android if (s...
php
protected function assignProperties($device) { //Is UA Windows Mobile? if ($device->os->setContains($device->device_ua, 'Windows CE', 'Windows Mobile') && $device->browser->set('IE Mobile')) { return $device; } //Is UA Windows Phone OS? - WP before Android if (s...
[ "protected", "function", "assignProperties", "(", "$", "device", ")", "{", "//Is UA Windows Mobile?", "if", "(", "$", "device", "->", "os", "->", "setContains", "(", "$", "device", "->", "device_ua", ",", "'Windows CE'", ",", "'Windows Mobile'", ")", "&&", "$"...
Gets a device from the UA @param WURFL_VirtualCapability_UserAgentTool_Device $device @return WURFL_VirtualCapability_UserAgentTool_Device
[ "Gets", "a", "device", "from", "the", "UA" ]
train
https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/VirtualCapability/UserAgentTool.php#L56-L490
repli2dev/nette-mailpanel
src/SessionMailer.php
SessionMailer.send
public function send(Message $mail) { $mails = array(); if($this->sessionSection->offsetExists('sentMessages')) { $mails = $this->sessionSection->sentMessages; } if (count($mails) === $this->limit) { array_pop($mails); } // get message with generated html instead of set FileTemplate etc $reflectio...
php
public function send(Message $mail) { $mails = array(); if($this->sessionSection->offsetExists('sentMessages')) { $mails = $this->sessionSection->sentMessages; } if (count($mails) === $this->limit) { array_pop($mails); } // get message with generated html instead of set FileTemplate etc $reflectio...
[ "public", "function", "send", "(", "Message", "$", "mail", ")", "{", "$", "mails", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "sessionSection", "->", "offsetExists", "(", "'sentMessages'", ")", ")", "{", "$", "mails", "=", "$", "this"...
Sends given message via this mailer @param Message $mail
[ "Sends", "given", "message", "via", "this", "mailer" ]
train
https://github.com/repli2dev/nette-mailpanel/blob/608e6967098b6a27aae2fbc5637b00f3723cbbff/src/SessionMailer.php#L44-L62
gregorybesson/PlaygroundCore
src/Filter/Sanitize.php
Sanitize.filterSubstring
public function filterSubstring($s) { //convert to ascii -> translate strange chars $s = $this->convertToAscii($s); //trim spaces $s = $this->trimString($s); //replace delimiters with another character $s = $this->replaceDelimiters($s); //lower chars $...
php
public function filterSubstring($s) { //convert to ascii -> translate strange chars $s = $this->convertToAscii($s); //trim spaces $s = $this->trimString($s); //replace delimiters with another character $s = $this->replaceDelimiters($s); //lower chars $...
[ "public", "function", "filterSubstring", "(", "$", "s", ")", "{", "//convert to ascii -> translate strange chars", "$", "s", "=", "$", "this", "->", "convertToAscii", "(", "$", "s", ")", ";", "//trim spaces", "$", "s", "=", "$", "this", "->", "trimString", "...
Defined by Zend_Filter_Interface Returns $value filtered to valid url @param string $value @return string
[ "Defined", "by", "Zend_Filter_Interface" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Sanitize.php#L91-L108
gregorybesson/PlaygroundCore
src/Filter/Sanitize.php
Sanitize.removeNotReplacedChar
public function removeNotReplacedChar($notReplaced) { if (empty($notReplaced)) { throw new \Exception('Not replaced character cannot be null.'); } if (is_array($notReplaced)) { foreach ($notReplaced as $n) { $this->removeNotReplacedChar($n); ...
php
public function removeNotReplacedChar($notReplaced) { if (empty($notReplaced)) { throw new \Exception('Not replaced character cannot be null.'); } if (is_array($notReplaced)) { foreach ($notReplaced as $n) { $this->removeNotReplacedChar($n); ...
[ "public", "function", "removeNotReplacedChar", "(", "$", "notReplaced", ")", "{", "if", "(", "empty", "(", "$", "notReplaced", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Not replaced character cannot be null.'", ")", ";", "}", "if", "(", "is_arra...
Remove not replaced character @param string|array $notReplaced @return Zend_Filter_Sanitize
[ "Remove", "not", "replaced", "character" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Sanitize.php#L142-L164