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
maniaplanet/matchmaking-lobby
MatchMakingLobby/Lobby/MatchMakers/AbstractDistance.php
AbstractDistance.computeDistances
private function computeDistances($object, $followers, $distanceComputeCallback) { $distances = array(); foreach($followers as $follower) { if($follower == $object) continue; $distances[$follower->id] = call_user_func($distanceComputeCallback, $object->data, $follower->data); } return $dis...
php
private function computeDistances($object, $followers, $distanceComputeCallback) { $distances = array(); foreach($followers as $follower) { if($follower == $object) continue; $distances[$follower->id] = call_user_func($distanceComputeCallback, $object->data, $follower->data); } return $dis...
[ "private", "function", "computeDistances", "(", "$", "object", ",", "$", "followers", ",", "$", "distanceComputeCallback", ")", "{", "$", "distances", "=", "array", "(", ")", ";", "foreach", "(", "$", "followers", "as", "$", "follower", ")", "{", "if", "...
Compute distance for a player with all his followers @param string $player @param string[] $followers @return float[string]
[ "Compute", "distance", "for", "a", "player", "with", "all", "his", "followers" ]
train
https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Lobby/MatchMakers/AbstractDistance.php#L207-L217
webforge-labs/psc-cms
lib/Psc/UI/jQuery.php
jQuery.widget
public static function widget(Tag $tag, $name, $options = array()) { //$tag->addClass('\Psc\jquery-widget'); $js = sprintf("%s(%s)", $name, JSHelper::convertHashMap((object) $options) ); $tag->chain(new Code($js)); return $tag; }
php
public static function widget(Tag $tag, $name, $options = array()) { //$tag->addClass('\Psc\jquery-widget'); $js = sprintf("%s(%s)", $name, JSHelper::convertHashMap((object) $options) ); $tag->chain(new Code($js)); return $tag; }
[ "public", "static", "function", "widget", "(", "Tag", "$", "tag", ",", "$", "name", ",", "$", "options", "=", "array", "(", ")", ")", "{", "//$tag->addClass('\\Psc\\jquery-widget');", "$", "js", "=", "sprintf", "(", "\"%s(%s)\"", ",", "$", "name", ",", "...
Fügt dem Tag den Initialisierer für ein JQueryUI-Widget hinzu z. B. so: <span id="element"></span> <script type="text/javascript">$('#element').droppable({..})</script>
[ "Fügt", "dem", "Tag", "den", "Initialisierer", "für", "ein", "JQueryUI", "-", "Widget", "hinzu" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/jQuery.php#L20-L30
webforge-labs/psc-cms
lib/Psc/UI/jQuery.php
jQuery.data
public static function data(Tag $tag, $name, $data) { $js = sprintf("data(%s, %s)", JSHelper::convertString($name), JSHelper::convertValue($data) ); $tag->chain(new Code($js)); return $tag; }
php
public static function data(Tag $tag, $name, $data) { $js = sprintf("data(%s, %s)", JSHelper::convertString($name), JSHelper::convertValue($data) ); $tag->chain(new Code($js)); return $tag; }
[ "public", "static", "function", "data", "(", "Tag", "$", "tag", ",", "$", "name", ",", "$", "data", ")", "{", "$", "js", "=", "sprintf", "(", "\"data(%s, %s)\"", ",", "JSHelper", "::", "convertString", "(", "$", "name", ")", ",", "JSHelper", "::", "c...
Fügt dem Tag jquery Data hinzu
[ "Fügt", "dem", "Tag", "jquery", "Data", "hinzu" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/jQuery.php#L35-L43
ppetermann/king23
src/Http/Middleware/BasePathStripper.php
BasePathStripper.process
public function process(ServerRequestInterface $request, RequestHandlerInterface $next) : ResponseInterface { $path = $request->getUri()->getPath(); if (!empty($this->basePath) && 0 === strpos($path, $this->basePath)) { $cleanPath = substr($path, strlen($this->basePath)); if...
php
public function process(ServerRequestInterface $request, RequestHandlerInterface $next) : ResponseInterface { $path = $request->getUri()->getPath(); if (!empty($this->basePath) && 0 === strpos($path, $this->basePath)) { $cleanPath = substr($path, strlen($this->basePath)); if...
[ "public", "function", "process", "(", "ServerRequestInterface", "$", "request", ",", "RequestHandlerInterface", "$", "next", ")", ":", "ResponseInterface", "{", "$", "path", "=", "$", "request", "->", "getUri", "(", ")", "->", "getPath", "(", ")", ";", "if",...
strip away the basePath @param ServerRequestInterface $request @param RequestHandlerInterface $next @return ResponseInterface
[ "strip", "away", "the", "basePath" ]
train
https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Http/Middleware/BasePathStripper.php#L67-L80
Double-Opt-in/php-client-api
src/Guzzle/Plugin/OAuth2Plugin.php
OAuth2Plugin.setCache
public function setCache($file) { if ( ! empty($file)) { $this->cache = new AccessTokenCache($file); $this->setAccessToken($this->cache->get()); } }
php
public function setCache($file) { if ( ! empty($file)) { $this->cache = new AccessTokenCache($file); $this->setAccessToken($this->cache->get()); } }
[ "public", "function", "setCache", "(", "$", "file", ")", "{", "if", "(", "!", "empty", "(", "$", "file", ")", ")", "{", "$", "this", "->", "cache", "=", "new", "AccessTokenCache", "(", "$", "file", ")", ";", "$", "this", "->", "setAccessToken", "("...
sets the cache file when possible @param string $file
[ "sets", "the", "cache", "file", "when", "possible" ]
train
https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Guzzle/Plugin/OAuth2Plugin.php#L24-L31
Double-Opt-in/php-client-api
src/Guzzle/Plugin/OAuth2Plugin.php
OAuth2Plugin.acquireAccessToken
protected function acquireAccessToken() { $accessToken = parent::acquireAccessToken(); if ($this->cache !== null) $this->cache->put($this->accessToken); return $accessToken; }
php
protected function acquireAccessToken() { $accessToken = parent::acquireAccessToken(); if ($this->cache !== null) $this->cache->put($this->accessToken); return $accessToken; }
[ "protected", "function", "acquireAccessToken", "(", ")", "{", "$", "accessToken", "=", "parent", "::", "acquireAccessToken", "(", ")", ";", "if", "(", "$", "this", "->", "cache", "!==", "null", ")", "$", "this", "->", "cache", "->", "put", "(", "$", "t...
Acquire a new access token from the server. @return array|null
[ "Acquire", "a", "new", "access", "token", "from", "the", "server", "." ]
train
https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Guzzle/Plugin/OAuth2Plugin.php#L38-L46
kherge-abandoned/php-wise
src/lib/Herrera/Wise/Processor/DelegatingProcessor.php
DelegatingProcessor.supports
public function supports($resource, $type = null) { $this->last = $this->getResolver()->resolve($resource, $type) ?: null; return (null !== $this->last); }
php
public function supports($resource, $type = null) { $this->last = $this->getResolver()->resolve($resource, $type) ?: null; return (null !== $this->last); }
[ "public", "function", "supports", "(", "$", "resource", ",", "$", "type", "=", "null", ")", "{", "$", "this", "->", "last", "=", "$", "this", "->", "getResolver", "(", ")", "->", "resolve", "(", "$", "resource", ",", "$", "type", ")", "?", ":", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Processor/DelegatingProcessor.php#L50-L55
ondrakoupil/tools
src/Files.php
Files.extension
static function extension($in,$case=false) { $name=self::filename($in); if (preg_match('~\.(\w{1,10})\s*$~',$name,$parts)) { if (!$case) return $parts[1]; if (strtoupper($case)==self::LOWERCASE) return Strings::lower($parts[1]); if (strtoupper($case)==self::UPPERCASE) return Strings::upper($parts[1]); ...
php
static function extension($in,$case=false) { $name=self::filename($in); if (preg_match('~\.(\w{1,10})\s*$~',$name,$parts)) { if (!$case) return $parts[1]; if (strtoupper($case)==self::LOWERCASE) return Strings::lower($parts[1]); if (strtoupper($case)==self::UPPERCASE) return Strings::upper($parts[1]); ...
[ "static", "function", "extension", "(", "$", "in", ",", "$", "case", "=", "false", ")", "{", "$", "name", "=", "self", "::", "filename", "(", "$", "in", ")", ";", "if", "(", "preg_match", "(", "'~\\.(\\w{1,10})\\s*$~'", ",", "$", "name", ",", "$", ...
Přípona souboru `/var/www/vhosts/somefile.txt` => `txt` @param string $in @param string $case self::LOWERCASE nebo self::UPPERCASE. Cokoliv jiného = neměnit velikost přípony. @return string
[ "Přípona", "souboru" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L36-L47
ondrakoupil/tools
src/Files.php
Files.filenameWithoutExtension
static function filenameWithoutExtension($filename) { $filename=self::filename($filename); if (preg_match('~(.*)\.(\w{1,10})$~',$filename,$parts)) { return $parts[1]; } return $filename; }
php
static function filenameWithoutExtension($filename) { $filename=self::filename($filename); if (preg_match('~(.*)\.(\w{1,10})$~',$filename,$parts)) { return $parts[1]; } return $filename; }
[ "static", "function", "filenameWithoutExtension", "(", "$", "filename", ")", "{", "$", "filename", "=", "self", "::", "filename", "(", "$", "filename", ")", ";", "if", "(", "preg_match", "(", "'~(.*)\\.(\\w{1,10})$~'", ",", "$", "filename", ",", "$", "parts"...
Jméno souboru, ale bez přípony. `/var/www/vhosts/somefile.txt` => `somefile` @param string $filename @return string
[ "Jméno", "souboru", "ale", "bez", "přípony", "." ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L56-L62
ondrakoupil/tools
src/Files.php
Files.dir
static function dir($in,$real=false) { if ($real) { $in=realpath($in); if ($in and is_dir($in)) $in.="/file"; } return dirname($in); }
php
static function dir($in,$real=false) { if ($real) { $in=realpath($in); if ($in and is_dir($in)) $in.="/file"; } return dirname($in); }
[ "static", "function", "dir", "(", "$", "in", ",", "$", "real", "=", "false", ")", "{", "if", "(", "$", "real", ")", "{", "$", "in", "=", "realpath", "(", "$", "in", ")", ";", "if", "(", "$", "in", "and", "is_dir", "(", "$", "in", ")", ")", ...
Jen cesta k adresáři. `/var/www/vhosts/somefile.txt` => `/var/www/vhosts` @param string $in @param bool $real True = použít realpath() @return string Pokud je $real==true a $in neexistuje, vrací empty string
[ "Jen", "cesta", "k", "adresáři", "." ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L86-L92
ondrakoupil/tools
src/Files.php
Files.addBeforeExtension
static function addBeforeExtension($filename,$addedString,$withPath=true) { if ($withPath) { $dir=self::dir($filename)."/"; } else { $dir=""; } if (!$dir or $dir=="./") $dir=""; $filenameWithoutExtension=self::filenameWithoutExtension($filename); $extension=self::extension($filename); if ($extension...
php
static function addBeforeExtension($filename,$addedString,$withPath=true) { if ($withPath) { $dir=self::dir($filename)."/"; } else { $dir=""; } if (!$dir or $dir=="./") $dir=""; $filenameWithoutExtension=self::filenameWithoutExtension($filename); $extension=self::extension($filename); if ($extension...
[ "static", "function", "addBeforeExtension", "(", "$", "filename", ",", "$", "addedString", ",", "$", "withPath", "=", "true", ")", "{", "if", "(", "$", "withPath", ")", "{", "$", "dir", "=", "self", "::", "dir", "(", "$", "filename", ")", ".", "\"/\"...
Přidá do jména souboru něco na konec, před příponu. `/var/www/vhosts/somefile.txt` => `/var/www/vhosts/somefile-affix.txt` @param string $filename @param string $addedString @param bool $withPath Vracet i s cestou? Anebo jen jméno souboru? @return string
[ "Přidá", "do", "jména", "souboru", "něco", "na", "konec", "před", "příponu", "." ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L104-L116
ondrakoupil/tools
src/Files.php
Files.perms
static function perms($filename) { if (!file_exists($filename)) { throw new FileException("Missing: $filename"); } if (!is_writeable($filename)) { throw new FileException("Not writable: $filename"); } if (is_dir($filename)) { $ok=chmod($filename,0777); } else { $ok=chmod($filename,0666); } ...
php
static function perms($filename) { if (!file_exists($filename)) { throw new FileException("Missing: $filename"); } if (!is_writeable($filename)) { throw new FileException("Not writable: $filename"); } if (is_dir($filename)) { $ok=chmod($filename,0777); } else { $ok=chmod($filename,0666); } ...
[ "static", "function", "perms", "(", "$", "filename", ")", "{", "if", "(", "!", "file_exists", "(", "$", "filename", ")", ")", "{", "throw", "new", "FileException", "(", "\"Missing: $filename\"", ")", ";", "}", "if", "(", "!", "is_writeable", "(", "$", ...
Nastaví práva, aby $filename bylo zapisovatelné, ať už je to soubor nebo adresář @param string $filename @return bool Dle úspěchu @throws Exceptions\FileException Pokud zadaná cesta není @throws Exceptions\FileAccessException Pokud změna selže
[ "Nastaví", "práva", "aby", "$filename", "bylo", "zapisovatelné", "ať", "už", "je", "to", "soubor", "nebo", "adresář" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L125-L145
ondrakoupil/tools
src/Files.php
Files.rebaseFile
static function rebaseFile($file, $from, $to, $copy=false) { if (!file_exists($file)) { throw new FileException("Not found: $file"); } if (!Strings::startsWith($file, $from)) { throw new \InvalidArgumentException("File $file is not in directory $from"); } $newPath=$to."/".Strings::substring($file, Strin...
php
static function rebaseFile($file, $from, $to, $copy=false) { if (!file_exists($file)) { throw new FileException("Not found: $file"); } if (!Strings::startsWith($file, $from)) { throw new \InvalidArgumentException("File $file is not in directory $from"); } $newPath=$to."/".Strings::substring($file, Strin...
[ "static", "function", "rebaseFile", "(", "$", "file", ",", "$", "from", ",", "$", "to", ",", "$", "copy", "=", "false", ")", "{", "if", "(", "!", "file_exists", "(", "$", "file", ")", ")", "{", "throw", "new", "FileException", "(", "\"Not found: $fil...
Přesune soubor i s adresářovou strukturou zpod jednoho do jiného. @param string $file Cílový soubor @param string $from Adresář, který brát jako základ @param string $to Clový adresář @param bool $copy True (default) = kopírovat, false = přesunout @return string Cesta k novému souboru @throws FileException Když $file n...
[ "Přesune", "soubor", "i", "s", "adresářovou", "strukturou", "zpod", "jednoho", "do", "jiného", "." ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L157-L177
ondrakoupil/tools
src/Files.php
Files.rebasedFilename
static function rebasedFilename($file,$from,$to) { if (!Strings::startsWith($file, $from)) { throw new \InvalidArgumentException("File $file is not in directory $from"); } $secondPart=Strings::substring($file, Strings::length($from)); if ($secondPart[0]=="/") $secondPart=substr($secondPart,1); $newPath=$t...
php
static function rebasedFilename($file,$from,$to) { if (!Strings::startsWith($file, $from)) { throw new \InvalidArgumentException("File $file is not in directory $from"); } $secondPart=Strings::substring($file, Strings::length($from)); if ($secondPart[0]=="/") $secondPart=substr($secondPart,1); $newPath=$t...
[ "static", "function", "rebasedFilename", "(", "$", "file", ",", "$", "from", ",", "$", "to", ")", "{", "if", "(", "!", "Strings", "::", "startsWith", "(", "$", "file", ",", "$", "from", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", ...
Vrátí cestu k souboru, jako kdyby byl umístěn do jiného adresáře i s cestou k sobě. @param string $file Jméno souboru @param string $from Cesta k němu @param string $to Adresář, kam ho chceš přesunout @return string @throws \InvalidArgumentException
[ "Vrátí", "cestu", "k", "souboru", "jako", "kdyby", "byl", "umístěn", "do", "jiného", "adresáře", "i", "s", "cestou", "k", "sobě", "." ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L187-L195
ondrakoupil/tools
src/Files.php
Files.isFileInDir
static function isFileInDir($file,$dir) { if (!Strings::endsWith($dir, "/")) $dir.="/"; return Strings::startsWith($file, $dir); }
php
static function isFileInDir($file,$dir) { if (!Strings::endsWith($dir, "/")) $dir.="/"; return Strings::startsWith($file, $dir); }
[ "static", "function", "isFileInDir", "(", "$", "file", ",", "$", "dir", ")", "{", "if", "(", "!", "Strings", "::", "endsWith", "(", "$", "dir", ",", "\"/\"", ")", ")", "$", "dir", ".=", "\"/\"", ";", "return", "Strings", "::", "startsWith", "(", "$...
Ověří, zda soubor je v zadaném adresáři. @param string $file @param string $dir @return bool
[ "Ověří", "zda", "soubor", "je", "v", "zadaném", "adresáři", "." ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L203-L206
ondrakoupil/tools
src/Files.php
Files.safeName
static function safeName($filename,$unsafeExtensions=null,$safeExtension="txt") { if ($unsafeExtensions===null) $unsafeExtensions=array("php","phtml","inc","php3","php4","php5"); if ($filename[0] == '.') { $filename = substr($filename, 1); } $filename = str_replace(DIRECTORY_SEPARATOR, '-', $filename); $ex...
php
static function safeName($filename,$unsafeExtensions=null,$safeExtension="txt") { if ($unsafeExtensions===null) $unsafeExtensions=array("php","phtml","inc","php3","php4","php5"); if ($filename[0] == '.') { $filename = substr($filename, 1); } $filename = str_replace(DIRECTORY_SEPARATOR, '-', $filename); $ex...
[ "static", "function", "safeName", "(", "$", "filename", ",", "$", "unsafeExtensions", "=", "null", ",", "$", "safeExtension", "=", "\"txt\"", ")", "{", "if", "(", "$", "unsafeExtensions", "===", "null", ")", "$", "unsafeExtensions", "=", "array", "(", "\"p...
Vytvoří bezpečné jméno pro soubor @param string $filename @param array $unsafeExtensions @param string $safeExtension @return string
[ "Vytvoří", "bezpečné", "jméno", "pro", "soubor" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L215-L236
ondrakoupil/tools
src/Files.php
Files.create
static function create($filename, $createDirectoriesIfNeeded=true, $content="") { if (!$filename) { throw new \InvalidArgumentException("Completely missing argument!"); } if (file_exists($filename) and is_dir($filename)) { throw new FileException("$filename is directory!"); } if (file_exists($filename))...
php
static function create($filename, $createDirectoriesIfNeeded=true, $content="") { if (!$filename) { throw new \InvalidArgumentException("Completely missing argument!"); } if (file_exists($filename) and is_dir($filename)) { throw new FileException("$filename is directory!"); } if (file_exists($filename))...
[ "static", "function", "create", "(", "$", "filename", ",", "$", "createDirectoriesIfNeeded", "=", "true", ",", "$", "content", "=", "\"\"", ")", "{", "if", "(", "!", "$", "filename", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Compl...
Vytvoří soubor, pokud neexistuje, a udělá ho zapisovatelným @param string $filename @param bool $createDirectoriesIfNeeded @param string $content Pokud se má vytvořit nový soubor, naplní se tímto obsahem @return string Jméno vytvořného souboru (cesta k němu) @throws \InvalidArgumentException @throws FileException @thro...
[ "Vytvoří", "soubor", "pokud", "neexistuje", "a", "udělá", "ho", "zapisovatelným" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L248-L269
ondrakoupil/tools
src/Files.php
Files.createDirectories
static function createDirectories($path) { if (!$path) throw new \InvalidArgumentException("\$path can not be empty."); /* $parts=explode("/",$path); $pathPart=""; foreach($parts as $i=>$p) { if ($i) $pathPart.="/"; $pathPart.=$p; if ($pathPart) { if (@file_exists($pathPart) and !is_dir($pathPa...
php
static function createDirectories($path) { if (!$path) throw new \InvalidArgumentException("\$path can not be empty."); /* $parts=explode("/",$path); $pathPart=""; foreach($parts as $i=>$p) { if ($i) $pathPart.="/"; $pathPart.=$p; if ($pathPart) { if (@file_exists($pathPart) and !is_dir($pathPa...
[ "static", "function", "createDirectories", "(", "$", "path", ")", "{", "if", "(", "!", "$", "path", ")", "throw", "new", "\\", "InvalidArgumentException", "(", "\"\\$path can not be empty.\"", ")", ";", "/*\n\t\t$parts=explode(\"/\",$path);\n\t\t$pathPart=\"\";\n\t\tforea...
Pokusí se vytvořit strukturu adresářů v zadané cestě. @param string $path @return string Vytvořená cesta @throws FileException Když už takto pojmenovaný soubor existuje a jde o obyčejný soubor nebo když vytváření selže.
[ "Pokusí", "se", "vytvořit", "strukturu", "adresářů", "v", "zadané", "cestě", "." ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L291-L327
ondrakoupil/tools
src/Files.php
Files.mkdir
static function mkdir($filename, $createDirectoriesIfNeeded=true) { if (!$filename) { throw new \InvalidArgumentException("Completely missing argument!"); } if (file_exists($filename) and !is_dir($filename)) { throw new FileException("$filename is not a directory!"); } if (file_exists($filename)) { s...
php
static function mkdir($filename, $createDirectoriesIfNeeded=true) { if (!$filename) { throw new \InvalidArgumentException("Completely missing argument!"); } if (file_exists($filename) and !is_dir($filename)) { throw new FileException("$filename is not a directory!"); } if (file_exists($filename)) { s...
[ "static", "function", "mkdir", "(", "$", "filename", ",", "$", "createDirectoriesIfNeeded", "=", "true", ")", "{", "if", "(", "!", "$", "filename", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Completely missing argument!\"", ")", ";", "...
Vytvoří adresář, pokud neexistuje, a udělá ho obecně zapisovatelným @param string $filename @param bool $createDirectoriesIfNeeded @return string Jméno vytvořneého adresáře @throws \InvalidArgumentException @throws FileException @throws FileAccessException
[ "Vytvoří", "adresář", "pokud", "neexistuje", "a", "udělá", "ho", "obecně", "zapisovatelným" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L338-L359
ondrakoupil/tools
src/Files.php
Files.freeFilename
static function freeFilename($path,$filename) { if (!file_exists($path) or !is_dir($path) or !is_writable($path)) { throw new FileAccessException("Directory $path is missing or not writeble."); } if (!file_exists($path."/".$filename)) { return $filename; } $maxTries=99; $filenamePart=self::filenameWit...
php
static function freeFilename($path,$filename) { if (!file_exists($path) or !is_dir($path) or !is_writable($path)) { throw new FileAccessException("Directory $path is missing or not writeble."); } if (!file_exists($path."/".$filename)) { return $filename; } $maxTries=99; $filenamePart=self::filenameWit...
[ "static", "function", "freeFilename", "(", "$", "path", ",", "$", "filename", ")", "{", "if", "(", "!", "file_exists", "(", "$", "path", ")", "or", "!", "is_dir", "(", "$", "path", ")", "or", "!", "is_writable", "(", "$", "path", ")", ")", "{", "...
Najde volné pojmenování pro soubor v určitém adresáři tak, aby bylo jméno volné. <br />Pokus je obsazené, pokouší se přidávat pomlčku a čísla až do 99, pak přejde na uniqid(): <br />freeFilename("/files/somewhere","abc.txt"); <br />Bude zkoušet: abc.txt, abc-2.txt, abc-3.txt atd. @param string $path Adresář @param str...
[ "Najde", "volné", "pojmenování", "pro", "soubor", "v", "určitém", "adresáři", "tak", "aby", "bylo", "jméno", "volné", ".", "<br", "/", ">", "Pokus", "je", "obsazené", "pokouší", "se", "přidávat", "pomlčku", "a", "čísla", "až", "do", "99", "pak", "přejde", ...
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L372-L392
ondrakoupil/tools
src/Files.php
Files.purgeDir
static function purgeDir($dir) { if (!is_dir($dir)) { throw new \InvalidArgumentException("$dir is not directory."); } $content=glob($dir."/*"); if ($content) { foreach($content as $sub) { if ($sub=="." or $sub=="..") continue; self::remove($sub); } } return true; }
php
static function purgeDir($dir) { if (!is_dir($dir)) { throw new \InvalidArgumentException("$dir is not directory."); } $content=glob($dir."/*"); if ($content) { foreach($content as $sub) { if ($sub=="." or $sub=="..") continue; self::remove($sub); } } return true; }
[ "static", "function", "purgeDir", "(", "$", "dir", ")", "{", "if", "(", "!", "is_dir", "(", "$", "dir", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"$dir is not directory.\"", ")", ";", "}", "$", "content", "=", "glob", "(", ...
Vymaže obsah adresáře @param string $dir @return boolean Dle úspěchu @throws \InvalidArgumentException
[ "Vymaže", "obsah", "adresáře" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L400-L412
ondrakoupil/tools
src/Files.php
Files.removeDir
static function removeDir($dir,$depthLock=0) { if ($depthLock > 15) { throw new \RuntimeException("Recursion too deep at $dir"); } if (!file_exists($dir)) { return true; } if (!is_dir($dir)) { throw new \InvalidArgumentException("$dir is not directory."); } $content=glob($dir."/*"); if ($conte...
php
static function removeDir($dir,$depthLock=0) { if ($depthLock > 15) { throw new \RuntimeException("Recursion too deep at $dir"); } if (!file_exists($dir)) { return true; } if (!is_dir($dir)) { throw new \InvalidArgumentException("$dir is not directory."); } $content=glob($dir."/*"); if ($conte...
[ "static", "function", "removeDir", "(", "$", "dir", ",", "$", "depthLock", "=", "0", ")", "{", "if", "(", "$", "depthLock", ">", "15", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "\"Recursion too deep at $dir\"", ")", ";", "}", "if", "(", ...
Smaže adresář a rekurzivně i jeho obsah @param string $dir @param int $depthLock Interní, ochrana proti nekonečné rekurzi @return boolean Dle úspěchu @throws \RuntimeException @throws \InvalidArgumentException @throws FileAccessException
[ "Smaže", "adresář", "a", "rekurzivně", "i", "jeho", "obsah" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L423-L455
ondrakoupil/tools
src/Files.php
Files.remove
static function remove($path, $onlyFiles=false) { if (!file_exists($path)) { return true; } if (is_dir($path)) { if ($onlyFiles) throw new FileException("$path is a directory!"); return self::removeDir($path); } else { $ok=unlink($path); if (!$ok) throw new FileAccessException("Could not delete...
php
static function remove($path, $onlyFiles=false) { if (!file_exists($path)) { return true; } if (is_dir($path)) { if ($onlyFiles) throw new FileException("$path is a directory!"); return self::removeDir($path); } else { $ok=unlink($path); if (!$ok) throw new FileAccessException("Could not delete...
[ "static", "function", "remove", "(", "$", "path", ",", "$", "onlyFiles", "=", "false", ")", "{", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "return", "true", ";", "}", "if", "(", "is_dir", "(", "$", "path", ")", ")", "{", "...
Smaže $path, ať již je to adresář nebo soubor @param string $path @param bool $onlyFiles Zakáže mazání adresářů @return boolean Dle úspěchu @throws FileAccessException @throws FileException
[ "Smaže", "$path", "ať", "již", "je", "to", "adresář", "nebo", "soubor" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L465-L478
ondrakoupil/tools
src/Files.php
Files.downloadFile
public static function downloadFile($url, $path, $stream = TRUE) { $curl = curl_init($url); if(!$stream) { curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); file_put_contents($path, curl_exec($curl)); } else { $fp = fopen($path, 'w'); ...
php
public static function downloadFile($url, $path, $stream = TRUE) { $curl = curl_init($url); if(!$stream) { curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); file_put_contents($path, curl_exec($curl)); } else { $fp = fopen($path, 'w'); ...
[ "public", "static", "function", "downloadFile", "(", "$", "url", ",", "$", "path", ",", "$", "stream", "=", "TRUE", ")", "{", "$", "curl", "=", "curl_init", "(", "$", "url", ")", ";", "if", "(", "!", "$", "stream", ")", "{", "curl_setopt", "(", "...
Stažení vzdáleného souboru pomocí cURL @param $url URL vzdáleného souboru @param $path Kam stažený soubor uložit? @param bool $stream
[ "Stažení", "vzdáleného", "souboru", "pomocí", "cURL" ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L486-L505
ondrakoupil/tools
src/Files.php
Files.maxUploadFileSize
static function maxUploadFileSize() { $file_max = Strings::parsePhpNumber(ini_get("post_max_size")); $post_max = Strings::parsePhpNumber(ini_get("upload_max_filesize")); $php_max = min($file_max,$post_max); return $php_max; }
php
static function maxUploadFileSize() { $file_max = Strings::parsePhpNumber(ini_get("post_max_size")); $post_max = Strings::parsePhpNumber(ini_get("upload_max_filesize")); $php_max = min($file_max,$post_max); return $php_max; }
[ "static", "function", "maxUploadFileSize", "(", ")", "{", "$", "file_max", "=", "Strings", "::", "parsePhpNumber", "(", "ini_get", "(", "\"post_max_size\"", ")", ")", ";", "$", "post_max", "=", "Strings", "::", "parsePhpNumber", "(", "ini_get", "(", "\"upload_...
Vrací maximální nahratelnou velikost souboru. Bere menší z hodnot post_max_size a upload_max_filesize a převede je na obyčejné číslo. @return int Bytes
[ "Vrací", "maximální", "nahratelnou", "velikost", "souboru", "." ]
train
https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Files.php#L513-L518
slashworks/control-bundle
src/Slashworks/AppBundle/Form/Type/CustomerType.php
CustomerType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name'); $builder->add('street'); $builder->add('zip'); $builder->add('city'); $builder->add('country', 'model', array( 'class' => 'Slashworks\AppBundle\Model\Country', ...
php
public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name'); $builder->add('street'); $builder->add('zip'); $builder->add('city'); $builder->add('country', 'model', array( 'class' => 'Slashworks\AppBundle\Model\Country', ...
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "$", "builder", "->", "add", "(", "'name'", ")", ";", "$", "builder", "->", "add", "(", "'street'", ")", ";", "$", "builder", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Form/Type/CustomerType.php#L48-L66
jfusion/org.jfusion.framework
src/Api/Base.php
Base.readPayload
protected function readPayload($encrypt) { if (!$encrypt && isset($_GET['jfpayload'])) { ob_start(); $payload = json_decode(trim(base64_decode($_GET['jfpayload']))); ob_end_clean(); } else if ($encrypt && isset($_POST['jfpayload'])) { $payload = Api::decrypt($this->key , $_POST['jfpayload']); } if ...
php
protected function readPayload($encrypt) { if (!$encrypt && isset($_GET['jfpayload'])) { ob_start(); $payload = json_decode(trim(base64_decode($_GET['jfpayload']))); ob_end_clean(); } else if ($encrypt && isset($_POST['jfpayload'])) { $payload = Api::decrypt($this->key , $_POST['jfpayload']); } if ...
[ "protected", "function", "readPayload", "(", "$", "encrypt", ")", "{", "if", "(", "!", "$", "encrypt", "&&", "isset", "(", "$", "_GET", "[", "'jfpayload'", "]", ")", ")", "{", "ob_start", "(", ")", ";", "$", "payload", "=", "json_decode", "(", "trim"...
@param $encrypt @return bool
[ "@param", "$encrypt" ]
train
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Api/Base.php#L28-L42
jfusion/org.jfusion.framework
src/Api/Base.php
Base.doExit
protected function doExit($url = null) { if ($url && isset($_GET['jfreturn'])) { $url .= '&jfreturn=' . $_GET['jfreturn']; } else if (isset($_GET['jfreturn'])) { $url = base64_decode($_GET['jfreturn']); } if ($url) { Framework::redirect($url); } exit(); }
php
protected function doExit($url = null) { if ($url && isset($_GET['jfreturn'])) { $url .= '&jfreturn=' . $_GET['jfreturn']; } else if (isset($_GET['jfreturn'])) { $url = base64_decode($_GET['jfreturn']); } if ($url) { Framework::redirect($url); } exit(); }
[ "protected", "function", "doExit", "(", "$", "url", "=", "null", ")", "{", "if", "(", "$", "url", "&&", "isset", "(", "$", "_GET", "[", "'jfreturn'", "]", ")", ")", "{", "$", "url", ".=", "'&jfreturn='", ".", "$", "_GET", "[", "'jfreturn'", "]", ...
@param string|null $url Url of where to redirect to @return void
[ "@param", "string|null", "$url", "Url", "of", "where", "to", "redirect", "to" ]
train
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Api/Base.php#L59-L70
arsengoian/viper-framework
src/Viper/Support/Libs/Location.php
Location.distance
public static function distance(Location $a, Location $b): float { $f1 = deg2rad($a -> latitude); $f2 = deg2rad($b -> latitude); $df = deg2rad($b -> latitude - $a -> latitude); $dl = deg2rad($b -> longitude - $a -> longitude); $a = sin($df/2) * sin($df/2) + cos($f1) ...
php
public static function distance(Location $a, Location $b): float { $f1 = deg2rad($a -> latitude); $f2 = deg2rad($b -> latitude); $df = deg2rad($b -> latitude - $a -> latitude); $dl = deg2rad($b -> longitude - $a -> longitude); $a = sin($df/2) * sin($df/2) + cos($f1) ...
[ "public", "static", "function", "distance", "(", "Location", "$", "a", ",", "Location", "$", "b", ")", ":", "float", "{", "$", "f1", "=", "deg2rad", "(", "$", "a", "->", "latitude", ")", ";", "$", "f2", "=", "deg2rad", "(", "$", "b", "->", "latit...
Get distance in km (approximate) @param Location $a @param Location $b @return float
[ "Get", "distance", "in", "km", "(", "approximate", ")" ]
train
https://github.com/arsengoian/viper-framework/blob/22796c5cc219cae3ca0b4af370a347ba2acab0f2/src/Viper/Support/Libs/Location.php#L56-L68
gries/rcon
src/Messenger.php
Messenger.send
public function send($messageText, callable $callable = null) { $message = new Message($messageText); $response = $this->connection ->sendMessage($message) ->getBody() ; if ($callable) { $response = call_user_func($callable, $response); }...
php
public function send($messageText, callable $callable = null) { $message = new Message($messageText); $response = $this->connection ->sendMessage($message) ->getBody() ; if ($callable) { $response = call_user_func($callable, $response); }...
[ "public", "function", "send", "(", "$", "messageText", ",", "callable", "$", "callable", "=", "null", ")", "{", "$", "message", "=", "new", "Message", "(", "$", "messageText", ")", ";", "$", "response", "=", "$", "this", "->", "connection", "->", "send...
Send text to the server. @param $messageText @param callable $callable @return string
[ "Send", "text", "to", "the", "server", "." ]
train
https://github.com/gries/rcon/blob/7fada05b329d89542692af00ab80db02ad59d45d/src/Messenger.php#L29-L43
AydinHassan/cli-md-renderer
src/Renderer/HorizontalRuleRenderer.php
HorizontalRuleRenderer.render
public function render(AbstractBlock $block, CliRenderer $renderer) { if (!($block instanceof ThematicBreak)) { throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block))); } return $renderer->style(str_repeat('-', $this->width), 'dark_gray')...
php
public function render(AbstractBlock $block, CliRenderer $renderer) { if (!($block instanceof ThematicBreak)) { throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block))); } return $renderer->style(str_repeat('-', $this->width), 'dark_gray')...
[ "public", "function", "render", "(", "AbstractBlock", "$", "block", ",", "CliRenderer", "$", "renderer", ")", "{", "if", "(", "!", "(", "$", "block", "instanceof", "ThematicBreak", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprint...
@param AbstractBlock $block @param CliRenderer $renderer @return string
[ "@param", "AbstractBlock", "$block", "@param", "CliRenderer", "$renderer" ]
train
https://github.com/AydinHassan/cli-md-renderer/blob/521f9ace2aeadd58bf8a3910704be8360f5bd7b2/src/Renderer/HorizontalRuleRenderer.php#L45-L52
ClanCats/Core
src/bundles/Mail/Transporter/PHPMailer.php
Transporter_PHPMailer.send
public function send( CCMail $mail ) { // create new phpmailer instance $driver = new PHPMailer\PHPMailer(); // set the charset $driver->CharSet = 'utf-8'; // set the xmailer tag $driver->XMailer = "ClanCatsFramework 2.0 Mail / PHPMailer ".$driver->Version; // get the mail data as array $mail...
php
public function send( CCMail $mail ) { // create new phpmailer instance $driver = new PHPMailer\PHPMailer(); // set the charset $driver->CharSet = 'utf-8'; // set the xmailer tag $driver->XMailer = "ClanCatsFramework 2.0 Mail / PHPMailer ".$driver->Version; // get the mail data as array $mail...
[ "public", "function", "send", "(", "CCMail", "$", "mail", ")", "{", "// create new phpmailer instance", "$", "driver", "=", "new", "PHPMailer", "\\", "PHPMailer", "(", ")", ";", "// set the charset", "$", "driver", "->", "CharSet", "=", "'utf-8'", ";", "// set...
Send the mail @param CCMail $mail The mail object. @return void @throws Mail\Exception
[ "Send", "the", "mail" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Mail/Transporter/PHPMailer.php#L37-L99
uthando-cms/uthando-dompdf
src/UthandoDomPdf/View/Renderer/PdfRenderer.php
PdfRenderer.render
public function render($nameOrModel, $values = null) { $pdfOptions = $nameOrModel->getPdfOptions(); $paperSize = explode(',', $pdfOptions->getPaperSize()); $paperOrientation = $pdfOptions->getPaperOrientation(); $basePath = $pdfOptions->getBasePath(); ...
php
public function render($nameOrModel, $values = null) { $pdfOptions = $nameOrModel->getPdfOptions(); $paperSize = explode(',', $pdfOptions->getPaperSize()); $paperOrientation = $pdfOptions->getPaperOrientation(); $basePath = $pdfOptions->getBasePath(); ...
[ "public", "function", "render", "(", "$", "nameOrModel", ",", "$", "values", "=", "null", ")", "{", "$", "pdfOptions", "=", "$", "nameOrModel", "->", "getPdfOptions", "(", ")", ";", "$", "paperSize", "=", "explode", "(", "','", ",", "$", "pdfOptions", ...
Renders values as a PDF @param string|ModelInterface|PdfModel $nameOrModel @param null|array|\ArrayAccess Values to use during rendering @return string The script output.
[ "Renders", "values", "as", "a", "PDF" ]
train
https://github.com/uthando-cms/uthando-dompdf/blob/60a750058c2db9ed167476192b20c7f544c32007/src/UthandoDomPdf/View/Renderer/PdfRenderer.php#L85-L107
iocaste/microservice-foundation
src/Feature/Client/HttpClient.php
HttpClient.getResponse
public function getResponse($toJson = false, $toAssociative = false) { return $toJson ? json_decode($this->response, $toAssociative) : $this->response; }
php
public function getResponse($toJson = false, $toAssociative = false) { return $toJson ? json_decode($this->response, $toAssociative) : $this->response; }
[ "public", "function", "getResponse", "(", "$", "toJson", "=", "false", ",", "$", "toAssociative", "=", "false", ")", "{", "return", "$", "toJson", "?", "json_decode", "(", "$", "this", "->", "response", ",", "$", "toAssociative", ")", ":", "$", "this", ...
@param bool $toJson @param bool $toAssociative @return mixed
[ "@param", "bool", "$toJson", "@param", "bool", "$toAssociative" ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Feature/Client/HttpClient.php#L52-L55
iocaste/microservice-foundation
src/Feature/Client/HttpClient.php
HttpClient.json
public function json($method, $uri, array $data = [], array $headers = [], $async = false) { $content = json_encode($data); $headers = array_merge([ 'CONTENT_LENGTH' => mb_strlen($content, '8bit'), 'CONTENT_TYPE' => 'application/json', 'Accept' => 'application/js...
php
public function json($method, $uri, array $data = [], array $headers = [], $async = false) { $content = json_encode($data); $headers = array_merge([ 'CONTENT_LENGTH' => mb_strlen($content, '8bit'), 'CONTENT_TYPE' => 'application/json', 'Accept' => 'application/js...
[ "public", "function", "json", "(", "$", "method", ",", "$", "uri", ",", "array", "$", "data", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "async", "=", "false", ")", "{", "$", "content", "=", "json_encode", "(", "$", "...
Visit the given URI with a JSON request. @param $method @param $uri @param array $data @param array $headers @param bool $async @return $this
[ "Visit", "the", "given", "URI", "with", "a", "JSON", "request", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Feature/Client/HttpClient.php#L68-L81
iocaste/microservice-foundation
src/Feature/Client/HttpClient.php
HttpClient.send
public function send(Request $request, $async = false): \Psr\Http\Message\StreamInterface { $this->currentUri = $request->fullUrl(); $options = []; if ($request->method() === 'POST' || $request->method() === 'PUT') { $options['json'] = $request->request->all(); } ...
php
public function send(Request $request, $async = false): \Psr\Http\Message\StreamInterface { $this->currentUri = $request->fullUrl(); $options = []; if ($request->method() === 'POST' || $request->method() === 'PUT') { $options['json'] = $request->request->all(); } ...
[ "public", "function", "send", "(", "Request", "$", "request", ",", "$", "async", "=", "false", ")", ":", "\\", "Psr", "\\", "Http", "\\", "Message", "\\", "StreamInterface", "{", "$", "this", "->", "currentUri", "=", "$", "request", "->", "fullUrl", "(...
Send the given request through the application. This method allows you to fully customize the entire Request object. @param Request $request @param bool $async @return \Psr\Http\Message\StreamInterface
[ "Send", "the", "given", "request", "through", "the", "application", ".", "This", "method", "allows", "you", "to", "fully", "customize", "the", "entire", "Request", "object", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Feature/Client/HttpClient.php#L177-L192
iocaste/microservice-foundation
src/Feature/Client/HttpClient.php
HttpClient.call
public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null, $async = false) { $this->currentUri = $this->prepareUrlForRequest($uri); $symfonyRequest = SymfonyRequest::create( $this->currentUri, $method, $parame...
php
public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null, $async = false) { $this->currentUri = $this->prepareUrlForRequest($uri); $symfonyRequest = SymfonyRequest::create( $this->currentUri, $method, $parame...
[ "public", "function", "call", "(", "$", "method", ",", "$", "uri", ",", "$", "parameters", "=", "[", "]", ",", "$", "cookies", "=", "[", "]", ",", "$", "files", "=", "[", "]", ",", "$", "server", "=", "[", "]", ",", "$", "content", "=", "null...
Call the given URI and return the Response. @param string $method @param string $uri @param array $parameters @param array $cookies @param array $files @param array $server @param string $content @param bool $async @return mixed
[ "Call", "the", "given", "URI", "and", "return", "the", "Response", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Feature/Client/HttpClient.php#L208-L226
iocaste/microservice-foundation
src/Feature/Client/HttpClient.php
HttpClient.transformHeadersToServerVars
protected function transformHeadersToServerVars(array $headers): array { $server = []; $prefix = 'HTTP_'; foreach ($headers as $name => $value) { $name = str_replace(strtoupper($name), '-', '_'); if ($name !== 'CONTENT_TYPE' && ! starts_with($name, $prefix)) { ...
php
protected function transformHeadersToServerVars(array $headers): array { $server = []; $prefix = 'HTTP_'; foreach ($headers as $name => $value) { $name = str_replace(strtoupper($name), '-', '_'); if ($name !== 'CONTENT_TYPE' && ! starts_with($name, $prefix)) { ...
[ "protected", "function", "transformHeadersToServerVars", "(", "array", "$", "headers", ")", ":", "array", "{", "$", "server", "=", "[", "]", ";", "$", "prefix", "=", "'HTTP_'", ";", "foreach", "(", "$", "headers", "as", "$", "name", "=>", "$", "value", ...
Transform headers array to array of $_SERVER vars with HTTP_* format. @param array $headers @return array
[ "Transform", "headers", "array", "to", "array", "of", "$_SERVER", "vars", "with", "HTTP_", "*", "format", "." ]
train
https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Feature/Client/HttpClient.php#L253-L269
PeekAndPoke/psi
src/Operation/Terminal/AverageOperation.php
AverageOperation.apply
public function apply(\Iterator $set) { $data = iterator_to_array($set); if (count($data) === 0) { return 0; } return array_sum($data) / count($data); }
php
public function apply(\Iterator $set) { $data = iterator_to_array($set); if (count($data) === 0) { return 0; } return array_sum($data) / count($data); }
[ "public", "function", "apply", "(", "\\", "Iterator", "$", "set", ")", "{", "$", "data", "=", "iterator_to_array", "(", "$", "set", ")", ";", "if", "(", "count", "(", "$", "data", ")", "===", "0", ")", "{", "return", "0", ";", "}", "return", "arr...
{@inheritdoc} @return float
[ "{", "@inheritdoc", "}" ]
train
https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/Terminal/AverageOperation.php#L24-L33
adammbalogh/key-value-store-memory
src/Adapter/MemoryAdapter/KeyTrait.php
KeyTrait.delete
public function delete($key) { try { $this->get($key); } catch (KeyNotFoundException $e) { return false; } unset($this->store[$key]); return true; }
php
public function delete($key) { try { $this->get($key); } catch (KeyNotFoundException $e) { return false; } unset($this->store[$key]); return true; }
[ "public", "function", "delete", "(", "$", "key", ")", "{", "try", "{", "$", "this", "->", "get", "(", "$", "key", ")", ";", "}", "catch", "(", "KeyNotFoundException", "$", "e", ")", "{", "return", "false", ";", "}", "unset", "(", "$", "this", "->...
Removes a key. @param string $key @return bool True if the deletion was successful, false if the deletion was unsuccessful.
[ "Removes", "a", "key", "." ]
train
https://github.com/adammbalogh/key-value-store-memory/blob/6bafb9037d61911f76343a7aa7270866b1a11995/src/Adapter/MemoryAdapter/KeyTrait.php#L18-L29
adammbalogh/key-value-store-memory
src/Adapter/MemoryAdapter/KeyTrait.php
KeyTrait.getTtl
public function getTtl($key) { if (!array_key_exists($key, $this->store)) { throw new KeyNotFoundException(); } $getResult = $this->store[$key]; $unserialized = @unserialize($getResult); if (!Util::hasInternalExpireTime($unserialized)) { throw new \E...
php
public function getTtl($key) { if (!array_key_exists($key, $this->store)) { throw new KeyNotFoundException(); } $getResult = $this->store[$key]; $unserialized = @unserialize($getResult); if (!Util::hasInternalExpireTime($unserialized)) { throw new \E...
[ "public", "function", "getTtl", "(", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "store", ")", ")", "{", "throw", "new", "KeyNotFoundException", "(", ")", ";", "}", "$", "getResult", "=", "$", ...
Returns the remaining time to live of a key that has a timeout. @param string $key @return int Ttl in seconds. @throws KeyNotFoundException @throws \Exception
[ "Returns", "the", "remaining", "time", "to", "live", "of", "a", "key", "that", "has", "a", "timeout", "." ]
train
https://github.com/adammbalogh/key-value-store-memory/blob/6bafb9037d61911f76343a7aa7270866b1a11995/src/Adapter/MemoryAdapter/KeyTrait.php#L60-L74
adammbalogh/key-value-store-memory
src/Adapter/MemoryAdapter/KeyTrait.php
KeyTrait.persist
public function persist($key) { if (!array_key_exists($key, $this->store)) { return false; } $getResult = $this->store[$key]; $unserialized = @unserialize($getResult); if (!Util::hasInternalExpireTime($unserialized)) { return false; } ...
php
public function persist($key) { if (!array_key_exists($key, $this->store)) { return false; } $getResult = $this->store[$key]; $unserialized = @unserialize($getResult); if (!Util::hasInternalExpireTime($unserialized)) { return false; } ...
[ "public", "function", "persist", "(", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "store", ")", ")", "{", "return", "false", ";", "}", "$", "getResult", "=", "$", "this", "->", "store", "[", ...
Removes the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated). @param string $key @return bool True if the persist was success, false if the persis was unsuccessful. @throws \Exception
[ "Removes", "the", "existing", "timeout", "on", "key", "turning", "the", "key", "from", "volatile", "(", "a", "key", "with", "an", "expire", "set", ")", "to", "persistent", "(", "a", "key", "that", "will", "never", "expire", "as", "no", "timeout", "is", ...
train
https://github.com/adammbalogh/key-value-store-memory/blob/6bafb9037d61911f76343a7aa7270866b1a11995/src/Adapter/MemoryAdapter/KeyTrait.php#L104-L124
Nozemi/SlickBoard-Library
lib/SBLib/Users/User.php
User.setPassword
public function setPassword($p1, $p2 = null, $login = false) { $this->password = $this->integration->setPassword($p1, $p2, $login, $this); return $this; }
php
public function setPassword($p1, $p2 = null, $login = false) { $this->password = $this->integration->setPassword($p1, $p2, $login, $this); return $this; }
[ "public", "function", "setPassword", "(", "$", "p1", ",", "$", "p2", "=", "null", ",", "$", "login", "=", "false", ")", "{", "$", "this", "->", "password", "=", "$", "this", "->", "integration", "->", "setPassword", "(", "$", "p1", ",", "$", "p2", ...
Set the password if the passwords match.
[ "Set", "the", "password", "if", "the", "passwords", "match", "." ]
train
https://github.com/Nozemi/SlickBoard-Library/blob/c9f0a26a30f8127c997f75d7232eac170972418d/lib/SBLib/Users/User.php#L110-L113
comodojo/cookies
src/Comodojo/Cookies/CookieTools.php
CookieTools.setCookieProperties
public static function setCookieProperties(CookieInterface $cookie, array $properties, $serialize) { try { foreach ( $properties as $property => $value ) { switch ( $property ) { case 'value': $cookie->setValue($value, $seria...
php
public static function setCookieProperties(CookieInterface $cookie, array $properties, $serialize) { try { foreach ( $properties as $property => $value ) { switch ( $property ) { case 'value': $cookie->setValue($value, $seria...
[ "public", "static", "function", "setCookieProperties", "(", "CookieInterface", "$", "cookie", ",", "array", "$", "properties", ",", "$", "serialize", ")", "{", "try", "{", "foreach", "(", "$", "properties", "as", "$", "property", "=>", "$", "value", ")", "...
Set content of $cookie from array $properties @param CookieInterface $cookie @param array $properties Array of properties cookie should have in the format [ 'value' => '', 'expire' => '', 'path' => '', 'domain' => '', 'secure' => '', 'httponly' => '' ] @param boolean $serialize @return CookieInterface @throws Excep...
[ "Set", "content", "of", "$cookie", "from", "array", "$properties" ]
train
https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieTools.php#L46-L100
comodojo/cookies
src/Comodojo/Cookies/CookieTools.php
CookieTools.checkDomain
public static function checkDomain($domain_name) { if ( $domain_name[0] == '.' ) $domain_name = substr($domain_name, 1); return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name) //valid chars check && preg_match("/^.{1,253}$/", $domain_name) //overa...
php
public static function checkDomain($domain_name) { if ( $domain_name[0] == '.' ) $domain_name = substr($domain_name, 1); return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name) //valid chars check && preg_match("/^.{1,253}$/", $domain_name) //overa...
[ "public", "static", "function", "checkDomain", "(", "$", "domain_name", ")", "{", "if", "(", "$", "domain_name", "[", "0", "]", "==", "'.'", ")", "$", "domain_name", "=", "substr", "(", "$", "domain_name", ",", "1", ")", ";", "return", "(", "preg_match...
Check if domain is valid Main code from: http://stackoverflow.com/questions/1755144/how-to-validate-domain-name-in-php @param string $domain_name The domain name to check @return bool
[ "Check", "if", "domain", "is", "valid" ]
train
https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/CookieTools.php#L112-L120
geekwright/Po
src/PoHeader.php
PoHeader.buildStructuredHeaders
protected function buildStructuredHeaders(): void { $this->structuredHeaders = array(); $headers = $this->entry[PoTokens::TRANSLATED]; $headers = ($headers === null) ? array() : $headers; $full = implode('', $headers); $headers = explode("\n", $full); // split on ':' ...
php
protected function buildStructuredHeaders(): void { $this->structuredHeaders = array(); $headers = $this->entry[PoTokens::TRANSLATED]; $headers = ($headers === null) ? array() : $headers; $full = implode('', $headers); $headers = explode("\n", $full); // split on ':' ...
[ "protected", "function", "buildStructuredHeaders", "(", ")", ":", "void", "{", "$", "this", "->", "structuredHeaders", "=", "array", "(", ")", ";", "$", "headers", "=", "$", "this", "->", "entry", "[", "PoTokens", "::", "TRANSLATED", "]", ";", "$", "head...
Populate the internal structuredHeaders property with contents of this entry's "msgstr" value. @return void
[ "Populate", "the", "internal", "structuredHeaders", "property", "with", "contents", "of", "this", "entry", "s", "msgstr", "value", "." ]
train
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L38-L55
geekwright/Po
src/PoHeader.php
PoHeader.storeStructuredHeader
protected function storeStructuredHeader(): bool { if (is_null($this->structuredHeaders)) { return false; } $headers = array(""); foreach ($this->structuredHeaders as $h) { $headers[] = $h['key'] . ': ' . $h['value'] . "\n"; } $this->entry[PoT...
php
protected function storeStructuredHeader(): bool { if (is_null($this->structuredHeaders)) { return false; } $headers = array(""); foreach ($this->structuredHeaders as $h) { $headers[] = $h['key'] . ': ' . $h['value'] . "\n"; } $this->entry[PoT...
[ "protected", "function", "storeStructuredHeader", "(", ")", ":", "bool", "{", "if", "(", "is_null", "(", "$", "this", "->", "structuredHeaders", ")", ")", "{", "return", "false", ";", "}", "$", "headers", "=", "array", "(", "\"\"", ")", ";", "foreach", ...
Rebuild the this entry's "msgstr" value using contents of the internal structuredHeaders property. @return boolean true if rebuilt, false if not
[ "Rebuild", "the", "this", "entry", "s", "msgstr", "value", "using", "contents", "of", "the", "internal", "structuredHeaders", "property", "." ]
train
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L63-L75
geekwright/Po
src/PoHeader.php
PoHeader.getHeader
public function getHeader(string $key): ?string { $this->buildStructuredHeaders(); $lkey = strtolower($key); $header = null; if (isset($this->structuredHeaders[$lkey]['value'])) { $header = $this->structuredHeaders[$lkey]['value']; } return $header; }
php
public function getHeader(string $key): ?string { $this->buildStructuredHeaders(); $lkey = strtolower($key); $header = null; if (isset($this->structuredHeaders[$lkey]['value'])) { $header = $this->structuredHeaders[$lkey]['value']; } return $header; }
[ "public", "function", "getHeader", "(", "string", "$", "key", ")", ":", "?", "string", "{", "$", "this", "->", "buildStructuredHeaders", "(", ")", ";", "$", "lkey", "=", "strtolower", "(", "$", "key", ")", ";", "$", "header", "=", "null", ";", "if", ...
Get a header value string by key @param string $key case insensitive name of header to return @return string|null header string for key or false if not set
[ "Get", "a", "header", "value", "string", "by", "key" ]
train
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L84-L93
geekwright/Po
src/PoHeader.php
PoHeader.setHeader
public function setHeader(string $key, string $value): void { $this->buildStructuredHeaders(); $lkey = strtolower($key); if (isset($this->structuredHeaders[$lkey])) { $this->structuredHeaders[$lkey]['value'] = $value; } else { $newHeader = array('key' => $key,...
php
public function setHeader(string $key, string $value): void { $this->buildStructuredHeaders(); $lkey = strtolower($key); if (isset($this->structuredHeaders[$lkey])) { $this->structuredHeaders[$lkey]['value'] = $value; } else { $newHeader = array('key' => $key,...
[ "public", "function", "setHeader", "(", "string", "$", "key", ",", "string", "$", "value", ")", ":", "void", "{", "$", "this", "->", "buildStructuredHeaders", "(", ")", ";", "$", "lkey", "=", "strtolower", "(", "$", "key", ")", ";", "if", "(", "isset...
Set the value of a header string for a key. @param string $key name of header to set. If the header exists, the name is case insensitive. If it is new the given case will be used @param string $value value to set @return void
[ "Set", "the", "value", "of", "a", "header", "string", "for", "a", "key", "." ]
train
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L104-L115
geekwright/Po
src/PoHeader.php
PoHeader.setCreateDate
public function setCreateDate(?int $time = null): void { $this->setHeader('POT-Creation-Date', $this->formatTimestamp($time)); }
php
public function setCreateDate(?int $time = null): void { $this->setHeader('POT-Creation-Date', $this->formatTimestamp($time)); }
[ "public", "function", "setCreateDate", "(", "?", "int", "$", "time", "=", "null", ")", ":", "void", "{", "$", "this", "->", "setHeader", "(", "'POT-Creation-Date'", ",", "$", "this", "->", "formatTimestamp", "(", "$", "time", ")", ")", ";", "}" ]
Set the POT-Creation-Date header @param integer|null $time unix timestamp, null to use current @return void
[ "Set", "the", "POT", "-", "Creation", "-", "Date", "header" ]
train
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L124-L127
geekwright/Po
src/PoHeader.php
PoHeader.setRevisionDate
public function setRevisionDate(?int $time = null): void { $this->setHeader('PO-Revision-Date', $this->formatTimestamp($time)); }
php
public function setRevisionDate(?int $time = null): void { $this->setHeader('PO-Revision-Date', $this->formatTimestamp($time)); }
[ "public", "function", "setRevisionDate", "(", "?", "int", "$", "time", "=", "null", ")", ":", "void", "{", "$", "this", "->", "setHeader", "(", "'PO-Revision-Date'", ",", "$", "this", "->", "formatTimestamp", "(", "$", "time", ")", ")", ";", "}" ]
Set the PO-Revision-Date header @param integer|null $time unix timestamp, null to use current @return void
[ "Set", "the", "PO", "-", "Revision", "-", "Date", "header" ]
train
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L136-L139
geekwright/Po
src/PoHeader.php
PoHeader.formatTimestamp
protected function formatTimestamp(?int $time = null): string { if (empty($time)) { $time = time(); } return gmdate('Y-m-d H:iO', $time); }
php
protected function formatTimestamp(?int $time = null): string { if (empty($time)) { $time = time(); } return gmdate('Y-m-d H:iO', $time); }
[ "protected", "function", "formatTimestamp", "(", "?", "int", "$", "time", "=", "null", ")", ":", "string", "{", "if", "(", "empty", "(", "$", "time", ")", ")", "{", "$", "time", "=", "time", "(", ")", ";", "}", "return", "gmdate", "(", "'Y-m-d H:iO...
Format a timestamp following PO file conventions @param integer|null $time unix timestamp, null to use current @return string formatted timestamp
[ "Format", "a", "timestamp", "following", "PO", "file", "conventions" ]
train
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L148-L154
geekwright/Po
src/PoHeader.php
PoHeader.buildDefaultHeader
public function buildDefaultHeader(): void { $this->set(PoTokens::MESSAGE, ""); $this->set(PoTokens::TRANSLATOR_COMMENTS, 'SOME DESCRIPTIVE TITLE'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'Copyright (C) YEAR HOLDER'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'LICENSE'); $...
php
public function buildDefaultHeader(): void { $this->set(PoTokens::MESSAGE, ""); $this->set(PoTokens::TRANSLATOR_COMMENTS, 'SOME DESCRIPTIVE TITLE'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'Copyright (C) YEAR HOLDER'); $this->add(PoTokens::TRANSLATOR_COMMENTS, 'LICENSE'); $...
[ "public", "function", "buildDefaultHeader", "(", ")", ":", "void", "{", "$", "this", "->", "set", "(", "PoTokens", "::", "MESSAGE", ",", "\"\"", ")", ";", "$", "this", "->", "set", "(", "PoTokens", "::", "TRANSLATOR_COMMENTS", ",", "'SOME DESCRIPTIVE TITLE'"...
Create a default header entry @return void
[ "Create", "a", "default", "header", "entry" ]
train
https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoHeader.php#L161-L181
webforge-labs/psc-cms
lib/Psc/Object.php
Object.factory
public static function factory() { $args = func_get_args(); $className = array_shift($args); // className entfernen if (isset($args[1]) && $args[1] == self::REPLACE_ARGS) { $args = $args[0]; } if (!class_exists($className)) { throw new \Psc\Exception($className. ' kann nich...
php
public static function factory() { $args = func_get_args(); $className = array_shift($args); // className entfernen if (isset($args[1]) && $args[1] == self::REPLACE_ARGS) { $args = $args[0]; } if (!class_exists($className)) { throw new \Psc\Exception($className. ' kann nich...
[ "public", "static", "function", "factory", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "className", "=", "array_shift", "(", "$", "args", ")", ";", "// className entfernen", "if", "(", "isset", "(", "$", "args", "[", "1", "]",...
Erstellt ein neues Objekt und gibt dieses zurück Die Argument für den Konstruktor können ganz normal übergeben werden Der Dritte Parameter kan self::REPLACE_ARGS sein, dann wird der zweite Parameter als Parameters interpretiert @param string $className der Name der Klasse @param mixed $arg,... @return Object
[ "Erstellt", "ein", "neues", "Objekt", "und", "gibt", "dieses", "zurück" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Object.php#L79-L126
webforge-labs/psc-cms
lib/Psc/Object.php
Object.callObjectMethod
public static function callObjectMethod($object, $name, Array $args = NULL) { $args = (array) $args; /* funky switch da wir performance wollen */ switch (count($args)) { case 0: return $object->$name(); case 1: return $object->$name($args[0]); case 2: ret...
php
public static function callObjectMethod($object, $name, Array $args = NULL) { $args = (array) $args; /* funky switch da wir performance wollen */ switch (count($args)) { case 0: return $object->$name(); case 1: return $object->$name($args[0]); case 2: ret...
[ "public", "static", "function", "callObjectMethod", "(", "$", "object", ",", "$", "name", ",", "Array", "$", "args", "=", "NULL", ")", "{", "$", "args", "=", "(", "array", ")", "$", "args", ";", "/* funky switch da wir performance wollen */", "switch", "(", ...
Ruft eine Methode auf einem Objekt auf @param object $object @param string $name der Name der Methode die aufgerufen werden soll @param array $arg @return Object
[ "Ruft", "eine", "Methode", "auf", "einem", "Objekt", "auf" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Object.php#L138-L174
nodes-php/database
src/Eloquent/Model.php
Model.save
public function save(array $options = []) { try { // Save model to database $result = parent::save($options); // If save has been aborted from an event/observer // or simply returned an empty response, we'll treat // it as a failed save and throw ...
php
public function save(array $options = []) { try { // Save model to database $result = parent::save($options); // If save has been aborted from an event/observer // or simply returned an empty response, we'll treat // it as a failed save and throw ...
[ "public", "function", "save", "(", "array", "$", "options", "=", "[", "]", ")", "{", "try", "{", "// Save model to database", "$", "result", "=", "parent", "::", "save", "(", "$", "options", ")", ";", "// If save has been aborted from an event/observer", "// or ...
Save the model to the database. @author Morten Rugaard <moru@nodes.dk> @param array $options @return bool @throws \Nodes\Database\Exceptions\SaveFailedException
[ "Save", "the", "model", "to", "the", "database", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Model.php#L24-L47
yuncms/framework
src/user/models/LoginForm.php
LoginForm.confirmationValidate
public function confirmationValidate($attribute) { if (!$this->hasErrors()) { if ($this->user !== null) { $confirmationRequired = Yii::$app->settings->get('enableConfirmation', 'user') && !Yii::$app->settings->get('enableUnconfirmedLogin', 'user'); if ($confirmati...
php
public function confirmationValidate($attribute) { if (!$this->hasErrors()) { if ($this->user !== null) { $confirmationRequired = Yii::$app->settings->get('enableConfirmation', 'user') && !Yii::$app->settings->get('enableUnconfirmedLogin', 'user'); if ($confirmati...
[ "public", "function", "confirmationValidate", "(", "$", "attribute", ")", "{", "if", "(", "!", "$", "this", "->", "hasErrors", "(", ")", ")", "{", "if", "(", "$", "this", "->", "user", "!==", "null", ")", "{", "$", "confirmationRequired", "=", "Yii", ...
Validates the confirmation. This method serves as the inline validation for password. @param string $attribute the attribute currently being validated
[ "Validates", "the", "confirmation", ".", "This", "method", "serves", "as", "the", "inline", "validation", "for", "password", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/LoginForm.php#L102-L115
yuncms/framework
src/user/models/LoginForm.php
LoginForm.login
public function login() { if ($this->validate()) { UserLoginHistory::createAsync(['user_id' => $this->user->getId(), 'ip' => Yii::$app->request->userIP]); return Yii::$app->user->login($this->user, $this->rememberMe ? Yii::$app->settings->get('rememberFor', 'user') : 0); } el...
php
public function login() { if ($this->validate()) { UserLoginHistory::createAsync(['user_id' => $this->user->getId(), 'ip' => Yii::$app->request->userIP]); return Yii::$app->user->login($this->user, $this->rememberMe ? Yii::$app->settings->get('rememberFor', 'user') : 0); } el...
[ "public", "function", "login", "(", ")", "{", "if", "(", "$", "this", "->", "validate", "(", ")", ")", "{", "UserLoginHistory", "::", "createAsync", "(", "[", "'user_id'", "=>", "$", "this", "->", "user", "->", "getId", "(", ")", ",", "'ip'", "=>", ...
Validates form and logs the user in. @return boolean whether the user is logged in successfully
[ "Validates", "form", "and", "logs", "the", "user", "in", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/models/LoginForm.php#L122-L130
miisieq/InfaktClient
src/Infakt/Mapper/ClientMapper.php
ClientMapper.map
public function map($data) { return (new Client()) ->setId((int) $data['id']) ->setCompanyName($data['company_name']) ->setStreet($data['street']) ->setCity($data['city']) ->setCountry($data['country']) ->setPostalCode($data['postal_cod...
php
public function map($data) { return (new Client()) ->setId((int) $data['id']) ->setCompanyName($data['company_name']) ->setStreet($data['street']) ->setCity($data['city']) ->setCountry($data['country']) ->setPostalCode($data['postal_cod...
[ "public", "function", "map", "(", "$", "data", ")", "{", "return", "(", "new", "Client", "(", ")", ")", "->", "setId", "(", "(", "int", ")", "$", "data", "[", "'id'", "]", ")", "->", "setCompanyName", "(", "$", "data", "[", "'company_name'", "]", ...
{@inheritdoc} @param $data @return Client
[ "{", "@inheritdoc", "}" ]
train
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Mapper/ClientMapper.php#L18-L41
lode/fem
src/exception.php
exception.setUserAction
public function setUserAction($link, $label=null) { if ($label) { $this->userAction = [ 'link' => $link, 'label' => $label, ]; } else { $this->userAction = $link; } }
php
public function setUserAction($link, $label=null) { if ($label) { $this->userAction = [ 'link' => $link, 'label' => $label, ]; } else { $this->userAction = $link; } }
[ "public", "function", "setUserAction", "(", "$", "link", ",", "$", "label", "=", "null", ")", "{", "if", "(", "$", "label", ")", "{", "$", "this", "->", "userAction", "=", "[", "'link'", "=>", "$", "link", ",", "'label'", "=>", "$", "label", ",", ...
set a user facing link as continue action @param string $link @param string $label optional
[ "set", "a", "user", "facing", "link", "as", "continue", "action" ]
train
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/exception.php#L69-L79
lode/fem
src/exception.php
exception.clean_paths
public static function clean_paths($string) { $string = str_replace(ROOT_DIR, '', $string); $string = str_replace('.php', '', $string); return $string; }
php
public static function clean_paths($string) { $string = str_replace(ROOT_DIR, '', $string); $string = str_replace('.php', '', $string); return $string; }
[ "public", "static", "function", "clean_paths", "(", "$", "string", ")", "{", "$", "string", "=", "str_replace", "(", "ROOT_DIR", ",", "''", ",", "$", "string", ")", ";", "$", "string", "=", "str_replace", "(", "'.php'", ",", "''", ",", "$", "string", ...
cleans file paths from redundant information i.e. ROOT_DIR and '.php' is removed @param string $string @return string
[ "cleans", "file", "paths", "from", "redundant", "information", "i", ".", "e", ".", "ROOT_DIR", "and", ".", "php", "is", "removed" ]
train
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/exception.php#L101-L106
simple-php-mvc/simple-php-mvc
src/MVC/Server/Router.php
Router._compile_regex
protected function _compile_regex($route) { $pattern = '`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`'; if ( preg_match_all($pattern, $route, $matches, PREG_SET_ORDER) ) { $match_types = array( 'i' => '[0-9]++', 'a' => '[0-9A-Za-z]++', 'h...
php
protected function _compile_regex($route) { $pattern = '`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`'; if ( preg_match_all($pattern, $route, $matches, PREG_SET_ORDER) ) { $match_types = array( 'i' => '[0-9]++', 'a' => '[0-9A-Za-z]++', 'h...
[ "protected", "function", "_compile_regex", "(", "$", "route", ")", "{", "$", "pattern", "=", "'`(/|\\.|)\\[([^:\\]]*+)(?::([^:\\]]*+))?\\](\\?|)`'", ";", "if", "(", "preg_match_all", "(", "$", "pattern", ",", "$", "route", ",", "$", "matches", ",", "PREG_SET_ORDER...
Compiles the regex necessary to capture all match types within a route. @access protected @param string $route The route. @return string
[ "Compiles", "the", "regex", "necessary", "to", "capture", "all", "match", "types", "within", "a", "route", "." ]
train
https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Server/Router.php#L20-L53
simple-php-mvc/simple-php-mvc
src/MVC/Server/Router.php
Router.parse
public function parse(HttpRequest $request, $routes) { foreach ( $routes as $route ) { if (!$route instanceof Route) { throw new \LogicException(sprintf('The route given don\'t is instance of Route. Type given "%s".', gettype($route))); } list($methods, $p...
php
public function parse(HttpRequest $request, $routes) { foreach ( $routes as $route ) { if (!$route instanceof Route) { throw new \LogicException(sprintf('The route given don\'t is instance of Route. Type given "%s".', gettype($route))); } list($methods, $p...
[ "public", "function", "parse", "(", "HttpRequest", "$", "request", ",", "$", "routes", ")", "{", "foreach", "(", "$", "routes", "as", "$", "route", ")", "{", "if", "(", "!", "$", "route", "instanceof", "Route", ")", "{", "throw", "new", "\\", "LogicE...
Parses the supplied request uri based on the supplied routes and the request method. Routes should be of the following format: <code> $routes = array( array( mixed $request_method, string $request_uri, callable $callback ), ... ); </code> where: <code> $request_method can be a string ('GET', 'POST', 'PUT', 'DELETE'...
[ "Parses", "the", "supplied", "request", "uri", "based", "on", "the", "supplied", "routes", "and", "the", "request", "method", "." ]
train
https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Server/Router.php#L121-L197
rayrutjes/domain-foundation
src/UnitOfWork/DefaultUnitOfWork.php
DefaultUnitOfWork.registerAggregate
public function registerAggregate( AggregateRoot $aggregate, EventBus $eventBus, SaveAggregateCallback $saveAggregateCallback ) { return $this->registeredAggregates->add($aggregate, $eventBus, $saveAggregateCallback); }
php
public function registerAggregate( AggregateRoot $aggregate, EventBus $eventBus, SaveAggregateCallback $saveAggregateCallback ) { return $this->registeredAggregates->add($aggregate, $eventBus, $saveAggregateCallback); }
[ "public", "function", "registerAggregate", "(", "AggregateRoot", "$", "aggregate", ",", "EventBus", "$", "eventBus", ",", "SaveAggregateCallback", "$", "saveAggregateCallback", ")", "{", "return", "$", "this", "->", "registeredAggregates", "->", "add", "(", "$", "...
@param AggregateRoot $aggregate @param EventBus $eventBus @param SaveAggregateCallback $saveAggregateCallback @return AggregateRoot
[ "@param", "AggregateRoot", "$aggregate", "@param", "EventBus", "$eventBus", "@param", "SaveAggregateCallback", "$saveAggregateCallback" ]
train
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/UnitOfWork/DefaultUnitOfWork.php#L121-L127
mongrate/mongrate
src/Mongrate/Model/Name.php
Name.validate
private function validate($name) { if (!is_string($name)) { throw new InvalidNameException('Migration name must be a string, got ' . gettype($name)); } if (strlen($name) === 0) { throw new InvalidNameException('Migration name must not be empty'); } $...
php
private function validate($name) { if (!is_string($name)) { throw new InvalidNameException('Migration name must be a string, got ' . gettype($name)); } if (strlen($name) === 0) { throw new InvalidNameException('Migration name must not be empty'); } $...
[ "private", "function", "validate", "(", "$", "name", ")", "{", "if", "(", "!", "is_string", "(", "$", "name", ")", ")", "{", "throw", "new", "InvalidNameException", "(", "'Migration name must be a string, got '", ".", "gettype", "(", "$", "name", ")", ")", ...
Ensure the migration name is acceptable. @throws InvalidNameException if the name given is invalid.
[ "Ensure", "the", "migration", "name", "is", "acceptable", "." ]
train
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Model/Name.php#L47-L71
fyuze/framework
src/Fyuze/Kernel/Fyuze.php
Fyuze.init
protected function init() { $this->setupContainer(); $this->configure(); $this->errorHandling(); $this->registerServices(); $this->initialized = true; }
php
protected function init() { $this->setupContainer(); $this->configure(); $this->errorHandling(); $this->registerServices(); $this->initialized = true; }
[ "protected", "function", "init", "(", ")", "{", "$", "this", "->", "setupContainer", "(", ")", ";", "$", "this", "->", "configure", "(", ")", ";", "$", "this", "->", "errorHandling", "(", ")", ";", "$", "this", "->", "registerServices", "(", ")", ";"...
Initialize services return @void
[ "Initialize", "services" ]
train
https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Kernel/Fyuze.php#L112-L120
fyuze/framework
src/Fyuze/Kernel/Fyuze.php
Fyuze.setupContainer
protected function setupContainer() { $container = Registry::init(); $container->add('app', $this); $container->add('registry', $container); $container->add('config', function () { return new Config($this->getConfigPath(), 'prod'); }); $this->config = $c...
php
protected function setupContainer() { $container = Registry::init(); $container->add('app', $this); $container->add('registry', $container); $container->add('config', function () { return new Config($this->getConfigPath(), 'prod'); }); $this->config = $c...
[ "protected", "function", "setupContainer", "(", ")", "{", "$", "container", "=", "Registry", "::", "init", "(", ")", ";", "$", "container", "->", "add", "(", "'app'", ",", "$", "this", ")", ";", "$", "container", "->", "add", "(", "'registry'", ",", ...
Registers container and some classes @return void
[ "Registers", "container", "and", "some", "classes" ]
train
https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Kernel/Fyuze.php#L127-L144
fyuze/framework
src/Fyuze/Kernel/Fyuze.php
Fyuze.configure
protected function configure() { $config = $this->config->get('app'); $this->charset = $config['charset']; mb_internal_encoding($this->charset); date_default_timezone_set($config['timezone']); }
php
protected function configure() { $config = $this->config->get('app'); $this->charset = $config['charset']; mb_internal_encoding($this->charset); date_default_timezone_set($config['timezone']); }
[ "protected", "function", "configure", "(", ")", "{", "$", "config", "=", "$", "this", "->", "config", "->", "get", "(", "'app'", ")", ";", "$", "this", "->", "charset", "=", "$", "config", "[", "'charset'", "]", ";", "mb_internal_encoding", "(", "$", ...
Sets up basic application configurations @return void
[ "Sets", "up", "basic", "application", "configurations" ]
train
https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Kernel/Fyuze.php#L151-L159
fyuze/framework
src/Fyuze/Kernel/Fyuze.php
Fyuze.registerServices
protected function registerServices() { $services = array_filter($this->config->get('app.services'), function ($service) { return class_exists($service); }); foreach ($services as $service) { /** @var \Fyuze\Kernel\Service $obj */ $obj = new $service($thi...
php
protected function registerServices() { $services = array_filter($this->config->get('app.services'), function ($service) { return class_exists($service); }); foreach ($services as $service) { /** @var \Fyuze\Kernel\Service $obj */ $obj = new $service($thi...
[ "protected", "function", "registerServices", "(", ")", "{", "$", "services", "=", "array_filter", "(", "$", "this", "->", "config", "->", "get", "(", "'app.services'", ")", ",", "function", "(", "$", "service", ")", "{", "return", "class_exists", "(", "$",...
Registers all defined services @return void
[ "Registers", "all", "defined", "services" ]
train
https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Kernel/Fyuze.php#L166-L179
vorbind/influx-analytics
src/Adapter/MysqlDatabaseAdapter.php
MysqlDatabaseAdapter.getDatabaseAdapter
public function getDatabaseAdapter() { try { if (isset($this->db)) { return $this->db; } $config = $this->reader->getDbsConfig(); if (!isset($config['mysql']) || !isset($config['mysql']["username"]) ...
php
public function getDatabaseAdapter() { try { if (isset($this->db)) { return $this->db; } $config = $this->reader->getDbsConfig(); if (!isset($config['mysql']) || !isset($config['mysql']["username"]) ...
[ "public", "function", "getDatabaseAdapter", "(", ")", "{", "try", "{", "if", "(", "isset", "(", "$", "this", "->", "db", ")", ")", "{", "return", "$", "this", "->", "db", ";", "}", "$", "config", "=", "$", "this", "->", "reader", "->", "getDbsConfi...
Get db adapter @return PDO @throws Exception
[ "Get", "db", "adapter" ]
train
https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Adapter/MysqlDatabaseAdapter.php#L53-L80
madmis/exchange-api
src/ExchangeApi/Endpoint/EndpointFactory.php
EndpointFactory.getEndpoint
public function getEndpoint(string $type, ClientInterface $client, array $options = []): EndpointInterface { if (!array_key_exists($type, $this->endpointList)) { if (class_exists($type)) { $this->endpointList[$type] = new $type($client, $options); } else { ...
php
public function getEndpoint(string $type, ClientInterface $client, array $options = []): EndpointInterface { if (!array_key_exists($type, $this->endpointList)) { if (class_exists($type)) { $this->endpointList[$type] = new $type($client, $options); } else { ...
[ "public", "function", "getEndpoint", "(", "string", "$", "type", ",", "ClientInterface", "$", "client", ",", "array", "$", "options", "=", "[", "]", ")", ":", "EndpointInterface", "{", "if", "(", "!", "array_key_exists", "(", "$", "type", ",", "$", "this...
@param string $type endpoint type or class @param ClientInterface $client @param array $options additional endpoint options @return EndpointInterface @throws \InvalidArgumentException
[ "@param", "string", "$type", "endpoint", "type", "or", "class", "@param", "ClientInterface", "$client", "@param", "array", "$options", "additional", "endpoint", "options" ]
train
https://github.com/madmis/exchange-api/blob/a65121f6846c2cf4effe9e27a0e60f6b28c888c6/src/ExchangeApi/Endpoint/EndpointFactory.php#L27-L43
qcubed/orm
src/Database/PostgreSql/Row.php
Row.getColumn
public function getColumn($strColumnName, $strColumnType = null) { if (!isset($this->strColumnArray[$strColumnName])) { return null; } $strColumnValue = $this->strColumnArray[$strColumnName]; switch ($strColumnType) { case FieldType::BIT: // Po...
php
public function getColumn($strColumnName, $strColumnType = null) { if (!isset($this->strColumnArray[$strColumnName])) { return null; } $strColumnValue = $this->strColumnArray[$strColumnName]; switch ($strColumnType) { case FieldType::BIT: // Po...
[ "public", "function", "getColumn", "(", "$", "strColumnName", ",", "$", "strColumnType", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "strColumnArray", "[", "$", "strColumnName", "]", ")", ")", "{", "return", "null", ";", "}"...
Gets the value of a column from a result row returned by the database @param string $strColumnName Name of the column @param null|string $strColumnType Data type @return mixed
[ "Gets", "the", "value", "of", "a", "column", "from", "a", "result", "row", "returned", "by", "the", "database" ]
train
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/PostgreSql/Row.php#L45-L79
phpmob/changmin
src/PhpMob/CmsBundle/Form/Type/TemplateType.php
TemplateType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('type', ChoiceType::class, [ 'label' => 'phpmob.form.template.type', 'required' => true, 'choices' => array_flip([ TemplateInterface::TYPE...
php
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('type', ChoiceType::class, [ 'label' => 'phpmob.form.template.type', 'required' => true, 'choices' => array_flip([ TemplateInterface::TYPE...
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "$", "builder", "->", "add", "(", "'type'", ",", "ChoiceType", "::", "class", ",", "[", "'label'", "=>", "'phpmob.form.template.type'", ",",...
{@inheritdoc}
[ "{" ]
train
https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CmsBundle/Form/Type/TemplateType.php#L29-L57
christianblos/markdown2html
src/Filesystem.php
Filesystem.getFilesOfDir
public function getFilesOfDir($dir) { $iterator = new DirectoryIterator($dir); $iterator = new CallbackFilterIterator( $iterator, function (SplFileInfo $current, $key, DirectoryIterator $iterator) { return !$iterator->isDot(); } ); ...
php
public function getFilesOfDir($dir) { $iterator = new DirectoryIterator($dir); $iterator = new CallbackFilterIterator( $iterator, function (SplFileInfo $current, $key, DirectoryIterator $iterator) { return !$iterator->isDot(); } ); ...
[ "public", "function", "getFilesOfDir", "(", "$", "dir", ")", "{", "$", "iterator", "=", "new", "DirectoryIterator", "(", "$", "dir", ")", ";", "$", "iterator", "=", "new", "CallbackFilterIterator", "(", "$", "iterator", ",", "function", "(", "SplFileInfo", ...
@param string $dir @return SplFileInfo[]|\Iterator
[ "@param", "string", "$dir" ]
train
https://github.com/christianblos/markdown2html/blob/2ae1177d71fe313c802962dbb9226b5a90bbc65a/src/Filesystem.php#L16-L28
discordier/justtextwidgets
src/Widgets/JustAText.php
JustAText.generate
public function generate() { return sprintf( '<input type="hidden" id="ctrl_%s" name="%s" value="%s" /><span>%s</span>', $this->strId, $this->strName, StringUtil::specialchars($this->varValue), $this->label ); }
php
public function generate() { return sprintf( '<input type="hidden" id="ctrl_%s" name="%s" value="%s" /><span>%s</span>', $this->strId, $this->strName, StringUtil::specialchars($this->varValue), $this->label ); }
[ "public", "function", "generate", "(", ")", "{", "return", "sprintf", "(", "'<input type=\"hidden\" id=\"ctrl_%s\" name=\"%s\" value=\"%s\" /><span>%s</span>'", ",", "$", "this", "->", "strId", ",", "$", "this", "->", "strName", ",", "StringUtil", "::", "specialchars", ...
Generate the widget and return it as string. @return string
[ "Generate", "the", "widget", "and", "return", "it", "as", "string", "." ]
train
https://github.com/discordier/justtextwidgets/blob/585f20eec05d592bb13281ca8ef0972e956d3f06/src/Widgets/JustAText.php#L44-L53
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.get
public function get(int $entityId) { $response = $this->infakt->get($this->getServiceName().'/'.$entityId.'.json'); if (2 != substr((string) $response->getStatusCode(), 0, 1)) { return null; } return $this->getMapper()->map(\GuzzleHttp\json_decode($response->getBody()->...
php
public function get(int $entityId) { $response = $this->infakt->get($this->getServiceName().'/'.$entityId.'.json'); if (2 != substr((string) $response->getStatusCode(), 0, 1)) { return null; } return $this->getMapper()->map(\GuzzleHttp\json_decode($response->getBody()->...
[ "public", "function", "get", "(", "int", "$", "entityId", ")", "{", "$", "response", "=", "$", "this", "->", "infakt", "->", "get", "(", "$", "this", "->", "getServiceName", "(", ")", ".", "'/'", ".", "$", "entityId", ".", "'.json'", ")", ";", "if"...
Get entity by ID. @param $entityId @return null|EntityInterface
[ "Get", "entity", "by", "ID", "." ]
train
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L56-L65
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.getAll
public function getAll(int $page = 1, int $limit = 25) { return $this->match(new Criteria([], [], ($page - 1) * $limit, $limit)); }
php
public function getAll(int $page = 1, int $limit = 25) { return $this->match(new Criteria([], [], ($page - 1) * $limit, $limit)); }
[ "public", "function", "getAll", "(", "int", "$", "page", "=", "1", ",", "int", "$", "limit", "=", "25", ")", "{", "return", "$", "this", "->", "match", "(", "new", "Criteria", "(", "[", "]", ",", "[", "]", ",", "(", "$", "page", "-", "1", ")"...
@param int $page @param int $limit @return CollectionResult
[ "@param", "int", "$page", "@param", "int", "$limit" ]
train
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L73-L76
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.delete
public function delete(EntityInterface $entity) { return $this->infakt->delete($this->getServiceName().'/'.$entity->getId().'.json'); }
php
public function delete(EntityInterface $entity) { return $this->infakt->delete($this->getServiceName().'/'.$entity->getId().'.json'); }
[ "public", "function", "delete", "(", "EntityInterface", "$", "entity", ")", "{", "return", "$", "this", "->", "infakt", "->", "delete", "(", "$", "this", "->", "getServiceName", "(", ")", ".", "'/'", ".", "$", "entity", "->", "getId", "(", ")", ".", ...
Delete an entity. @param EntityInterface $entity @return \Psr\Http\Message\ResponseInterface
[ "Delete", "an", "entity", "." ]
train
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L100-L103
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.match
protected function match(Criteria $criteria) { $response = $this->infakt->get($this->buildQuery($criteria)); $data = \GuzzleHttp\json_decode($response->getBody()->getContents(), true); if (!(array_key_exists('metainfo', $data) && array_key_exists('total_count', $data['metainfo']...
php
protected function match(Criteria $criteria) { $response = $this->infakt->get($this->buildQuery($criteria)); $data = \GuzzleHttp\json_decode($response->getBody()->getContents(), true); if (!(array_key_exists('metainfo', $data) && array_key_exists('total_count', $data['metainfo']...
[ "protected", "function", "match", "(", "Criteria", "$", "criteria", ")", "{", "$", "response", "=", "$", "this", "->", "infakt", "->", "get", "(", "$", "this", "->", "buildQuery", "(", "$", "criteria", ")", ")", ";", "$", "data", "=", "\\", "GuzzleHt...
@param Criteria $criteria @throws ApiException @return CollectionResult
[ "@param", "Criteria", "$criteria" ]
train
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L158-L180
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.getServiceName
protected function getServiceName(): string { return Inflector::pluralize(Inflector::tableize(substr($this->modelClass, strrpos($this->modelClass, '\\') + 1))); }
php
protected function getServiceName(): string { return Inflector::pluralize(Inflector::tableize(substr($this->modelClass, strrpos($this->modelClass, '\\') + 1))); }
[ "protected", "function", "getServiceName", "(", ")", ":", "string", "{", "return", "Inflector", "::", "pluralize", "(", "Inflector", "::", "tableize", "(", "substr", "(", "$", "this", "->", "modelClass", ",", "strrpos", "(", "$", "this", "->", "modelClass", ...
Gets API service name, for example: "clients" or "bank_accounts". @return string
[ "Gets", "API", "service", "name", "for", "example", ":", "clients", "or", "bank_accounts", "." ]
train
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L187-L190
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.getModelClass
protected function getModelClass(): string { $class = substr(get_class($this), strrpos(get_class($this), '\\') + 1); $class = substr($class, 0, strlen($class) - strlen('Repository')); return 'Infakt\\Model\\'.$class; }
php
protected function getModelClass(): string { $class = substr(get_class($this), strrpos(get_class($this), '\\') + 1); $class = substr($class, 0, strlen($class) - strlen('Repository')); return 'Infakt\\Model\\'.$class; }
[ "protected", "function", "getModelClass", "(", ")", ":", "string", "{", "$", "class", "=", "substr", "(", "get_class", "(", "$", "this", ")", ",", "strrpos", "(", "get_class", "(", "$", "this", ")", ",", "'\\\\'", ")", "+", "1", ")", ";", "$", "cla...
Get fully-qualified class name of a model. @return string
[ "Get", "fully", "-", "qualified", "class", "name", "of", "a", "model", "." ]
train
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L207-L213
miisieq/InfaktClient
src/Infakt/Repository/AbstractObjectRepository.php
AbstractObjectRepository.getMapperClass
protected function getMapperClass(): string { $class = substr(get_class($this), strrpos(get_class($this), '\\') + 1); $class = substr($class, 0, strlen($class) - strlen('Repository')); return 'Infakt\\Mapper\\'.$class.'Mapper'; }
php
protected function getMapperClass(): string { $class = substr(get_class($this), strrpos(get_class($this), '\\') + 1); $class = substr($class, 0, strlen($class) - strlen('Repository')); return 'Infakt\\Mapper\\'.$class.'Mapper'; }
[ "protected", "function", "getMapperClass", "(", ")", ":", "string", "{", "$", "class", "=", "substr", "(", "get_class", "(", "$", "this", ")", ",", "strrpos", "(", "get_class", "(", "$", "this", ")", ",", "'\\\\'", ")", "+", "1", ")", ";", "$", "cl...
Get fully-qualified class name of a mapper. @return string
[ "Get", "fully", "-", "qualified", "class", "name", "of", "a", "mapper", "." ]
train
https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Repository/AbstractObjectRepository.php#L220-L226
shiftio/safestream-php-sdk
src/Video/Video.php
Video.withTag
public function withTag($tag) { if (is_null($this->tags)) { $this->tags = []; } array_push($this->tags, $tag); return $this; }
php
public function withTag($tag) { if (is_null($this->tags)) { $this->tags = []; } array_push($this->tags, $tag); return $this; }
[ "public", "function", "withTag", "(", "$", "tag", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "tags", ")", ")", "{", "$", "this", "->", "tags", "=", "[", "]", ";", "}", "array_push", "(", "$", "this", "->", "tags", ",", "$", "tag", ...
Fluent setter for the property tags @param $tag @return $this
[ "Fluent", "setter", "for", "the", "property", "tags" ]
train
https://github.com/shiftio/safestream-php-sdk/blob/1957cd5574725b24da1bbff9059aa30a9ca123c2/src/Video/Video.php#L143-L150
shiftio/safestream-php-sdk
src/Video/Video.php
Video.withTags
public function withTags($tags) { if (is_null($this->tags)) { $this->tags = []; } foreach ($tags as $tag) { array_push($this->tags, $tags); } return $this; }
php
public function withTags($tags) { if (is_null($this->tags)) { $this->tags = []; } foreach ($tags as $tag) { array_push($this->tags, $tags); } return $this; }
[ "public", "function", "withTags", "(", "$", "tags", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "tags", ")", ")", "{", "$", "this", "->", "tags", "=", "[", "]", ";", "}", "foreach", "(", "$", "tags", "as", "$", "tag", ")", "{", "a...
Fluent setter for the property tags @param $tags @return $this
[ "Fluent", "setter", "for", "the", "property", "tags" ]
train
https://github.com/shiftio/safestream-php-sdk/blob/1957cd5574725b24da1bbff9059aa30a9ca123c2/src/Video/Video.php#L158-L168
shiftio/safestream-php-sdk
src/Video/Video.php
Video.withExistingProxy
public function withExistingProxy(HlsProxy $hlsProxy) { if(is_null($this->proxies)) { $this->proxies = []; } array_push($this->proxies, $hlsProxy); return $this; }
php
public function withExistingProxy(HlsProxy $hlsProxy) { if(is_null($this->proxies)) { $this->proxies = []; } array_push($this->proxies, $hlsProxy); return $this; }
[ "public", "function", "withExistingProxy", "(", "HlsProxy", "$", "hlsProxy", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "proxies", ")", ")", "{", "$", "this", "->", "proxies", "=", "[", "]", ";", "}", "array_push", "(", "$", "this", "->"...
Fluent setter for the property proxies @param HlsProxy $hlsProxy @return $this
[ "Fluent", "setter", "for", "the", "property", "proxies" ]
train
https://github.com/shiftio/safestream-php-sdk/blob/1957cd5574725b24da1bbff9059aa30a9ca123c2/src/Video/Video.php#L216-L224
FuriosoJack/LaraException
src/Exceptions/ExceptionProyect.php
ExceptionProyect.toArray
public function toArray() { return [ 'message' => $this->getMessageException(), 'errors' => $this->getErrors(), 'debugCode' => $this->getDebugCode(), 'details' => $this->getDetails(), 'routeBack' => redirect()->back()->getTargetUrl() ]; ...
php
public function toArray() { return [ 'message' => $this->getMessageException(), 'errors' => $this->getErrors(), 'debugCode' => $this->getDebugCode(), 'details' => $this->getDetails(), 'routeBack' => redirect()->back()->getTargetUrl() ]; ...
[ "public", "function", "toArray", "(", ")", "{", "return", "[", "'message'", "=>", "$", "this", "->", "getMessageException", "(", ")", ",", "'errors'", "=>", "$", "this", "->", "getErrors", "(", ")", ",", "'debugCode'", "=>", "$", "this", "->", "getDebugC...
convierte el Objeto en un array @return array
[ "convierte", "el", "Objeto", "en", "un", "array" ]
train
https://github.com/FuriosoJack/LaraException/blob/b30ec2ed3331d99fca4d0ae47c8710a522bd0c19/src/Exceptions/ExceptionProyect.php#L101-L110
chubbyphp/chubbyphp-mock
src/MockByCallsTrait.php
MockByCallsTrait.getMockByCalls
private function getMockByCalls($class, array $calls = []): MockObject { $mock = $this->prepareMock($class); $mockName = (new \ReflectionObject($mock))->getShortName(); $className = $this->getMockClassAsString($class); $options = JSON_PRETTY_PRINT | JSON_PRESERVE_ZERO_FRACTION | J...
php
private function getMockByCalls($class, array $calls = []): MockObject { $mock = $this->prepareMock($class); $mockName = (new \ReflectionObject($mock))->getShortName(); $className = $this->getMockClassAsString($class); $options = JSON_PRETTY_PRINT | JSON_PRESERVE_ZERO_FRACTION | J...
[ "private", "function", "getMockByCalls", "(", "$", "class", ",", "array", "$", "calls", "=", "[", "]", ")", ":", "MockObject", "{", "$", "mock", "=", "$", "this", "->", "prepareMock", "(", "$", "class", ")", ";", "$", "mockName", "=", "(", "new", "...
@param string[]|string $class @param Call[] $calls @return MockObject
[ "@param", "string", "[]", "|string", "$class", "@param", "Call", "[]", "$calls" ]
train
https://github.com/chubbyphp/chubbyphp-mock/blob/4c58095b26eba579a2d707cf15cdab275e679041/src/MockByCallsTrait.php#L18-L58
chubbyphp/chubbyphp-mock
src/MockByCallsTrait.php
MockByCallsTrait.getMockedMethod
private function getMockedMethod(string $mockName): string { foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $trace) { if ($mockName === $trace['class']) { return $trace['function']; } } }
php
private function getMockedMethod(string $mockName): string { foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $trace) { if ($mockName === $trace['class']) { return $trace['function']; } } }
[ "private", "function", "getMockedMethod", "(", "string", "$", "mockName", ")", ":", "string", "{", "foreach", "(", "debug_backtrace", "(", "DEBUG_BACKTRACE_IGNORE_ARGS", ")", "as", "$", "trace", ")", "{", "if", "(", "$", "mockName", "===", "$", "trace", "[",...
@param string $mockName @return string
[ "@param", "string", "$mockName" ]
train
https://github.com/chubbyphp/chubbyphp-mock/blob/4c58095b26eba579a2d707cf15cdab275e679041/src/MockByCallsTrait.php#L93-L100
chubbyphp/chubbyphp-mock
src/MockByCallsTrait.php
MockByCallsTrait.getMockCallback
private function getMockCallback( string $class, int $callIndex, Call $call, MockObject $mock ): \Closure { return function () use ($class, $callIndex, $call, $mock) { if ($call->hasWith()) { $this->compareArguments($class, $call->getMethod(), $cal...
php
private function getMockCallback( string $class, int $callIndex, Call $call, MockObject $mock ): \Closure { return function () use ($class, $callIndex, $call, $mock) { if ($call->hasWith()) { $this->compareArguments($class, $call->getMethod(), $cal...
[ "private", "function", "getMockCallback", "(", "string", "$", "class", ",", "int", "$", "callIndex", ",", "Call", "$", "call", ",", "MockObject", "$", "mock", ")", ":", "\\", "Closure", "{", "return", "function", "(", ")", "use", "(", "$", "class", ","...
@param string $class @param int $callIndex @param Call $call @param MockObject $mock @return \Closure
[ "@param", "string", "$class", "@param", "int", "$callIndex", "@param", "Call", "$call", "@param", "MockObject", "$mock" ]
train
https://github.com/chubbyphp/chubbyphp-mock/blob/4c58095b26eba579a2d707cf15cdab275e679041/src/MockByCallsTrait.php#L110-L139
chubbyphp/chubbyphp-mock
src/MockByCallsTrait.php
MockByCallsTrait.getStackTrace
private function getStackTrace(MockObject $mock): array { $mockName = (new \ReflectionObject($mock))->getShortName(); $trace = []; $enableTrace = false; foreach (debug_backtrace() as $i => $row) { if (isset($row['class']) && $mockName === $row['class']) { ...
php
private function getStackTrace(MockObject $mock): array { $mockName = (new \ReflectionObject($mock))->getShortName(); $trace = []; $enableTrace = false; foreach (debug_backtrace() as $i => $row) { if (isset($row['class']) && $mockName === $row['class']) { ...
[ "private", "function", "getStackTrace", "(", "MockObject", "$", "mock", ")", ":", "array", "{", "$", "mockName", "=", "(", "new", "\\", "ReflectionObject", "(", "$", "mock", ")", ")", "->", "getShortName", "(", ")", ";", "$", "trace", "=", "[", "]", ...
@param MockObject $mock @return array
[ "@param", "MockObject", "$mock" ]
train
https://github.com/chubbyphp/chubbyphp-mock/blob/4c58095b26eba579a2d707cf15cdab275e679041/src/MockByCallsTrait.php#L200-L237
spiral-modules/auth
source/Auth/TokenManager.php
TokenManager.createToken
public function createToken(UserInterface $user, string $operator = null): TokenInterface { return $this->getOperator($operator ?? $this->config->defaultOperator())->createToken($user); }
php
public function createToken(UserInterface $user, string $operator = null): TokenInterface { return $this->getOperator($operator ?? $this->config->defaultOperator())->createToken($user); }
[ "public", "function", "createToken", "(", "UserInterface", "$", "user", ",", "string", "$", "operator", "=", "null", ")", ":", "TokenInterface", "{", "return", "$", "this", "->", "getOperator", "(", "$", "operator", "??", "$", "this", "->", "config", "->",...
@param UserInterface $user @param string $operator Default operator to be used when value is null. @return TokenInterface
[ "@param", "UserInterface", "$user", "@param", "string", "$operator", "Default", "operator", "to", "be", "used", "when", "value", "is", "null", "." ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/TokenManager.php#L53-L56
spiral-modules/auth
source/Auth/TokenManager.php
TokenManager.fetchToken
public function fetchToken(Request $request) { foreach ($this->config->getOperators() as $name) { $operator = $this->getOperator($name); if ($operator->hasToken($request)) { return $operator->fetchToken($request); } } return null; }
php
public function fetchToken(Request $request) { foreach ($this->config->getOperators() as $name) { $operator = $this->getOperator($name); if ($operator->hasToken($request)) { return $operator->fetchToken($request); } } return null; }
[ "public", "function", "fetchToken", "(", "Request", "$", "request", ")", "{", "foreach", "(", "$", "this", "->", "config", "->", "getOperators", "(", ")", "as", "$", "name", ")", "{", "$", "operator", "=", "$", "this", "->", "getOperator", "(", "$", ...
Fetch authorization token from request if any. @param Request $request @return TokenInterface|null
[ "Fetch", "authorization", "token", "from", "request", "if", "any", "." ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/TokenManager.php#L65-L76
spiral-modules/auth
source/Auth/TokenManager.php
TokenManager.getOperator
protected function getOperator(string $name): TokenOperatorInterface { if (isset($this->operators[$name])) { return $this->operators[$name]; } if (!$this->config->hasOperator($name)) { throw new AuthException("Undefined token operator '{$name}'"); } ...
php
protected function getOperator(string $name): TokenOperatorInterface { if (isset($this->operators[$name])) { return $this->operators[$name]; } if (!$this->config->hasOperator($name)) { throw new AuthException("Undefined token operator '{$name}'"); } ...
[ "protected", "function", "getOperator", "(", "string", "$", "name", ")", ":", "TokenOperatorInterface", "{", "if", "(", "isset", "(", "$", "this", "->", "operators", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "operators", "[", "...
@param string $name @return TokenOperatorInterface
[ "@param", "string", "$name" ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/TokenManager.php#L83-L97
aedart/laravel-helpers
src/Traits/Routing/ResponseTrait.php
ResponseTrait.getResponse
public function getResponse(): ?ResponseFactory { if (!$this->hasResponse()) { $this->setResponse($this->getDefaultResponse()); } return $this->response; }
php
public function getResponse(): ?ResponseFactory { if (!$this->hasResponse()) { $this->setResponse($this->getDefaultResponse()); } return $this->response; }
[ "public", "function", "getResponse", "(", ")", ":", "?", "ResponseFactory", "{", "if", "(", "!", "$", "this", "->", "hasResponse", "(", ")", ")", "{", "$", "this", "->", "setResponse", "(", "$", "this", "->", "getDefaultResponse", "(", ")", ")", ";", ...
Get response If no response has been set, this method will set and return a default response, if any such value is available @see getDefaultResponse() @return ResponseFactory|null response or null if none response has been set
[ "Get", "response" ]
train
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Routing/ResponseTrait.php#L53-L59
tomphp/patch-builder
src/TomPHP/PatchBuilder/Buffer/Exception/RangePastEndOfBufferException.php
RangePastEndOfBufferException.fromRange
public static function fromRange(LineRangeInterface $range, $bufferLength) { return new self(sprintf( 'Range %d-%d goes beyond buffer with %d lines.', $range->getStart()->getNumber(), $range->getEnd()->getNumber(), $bufferLength )); }
php
public static function fromRange(LineRangeInterface $range, $bufferLength) { return new self(sprintf( 'Range %d-%d goes beyond buffer with %d lines.', $range->getStart()->getNumber(), $range->getEnd()->getNumber(), $bufferLength )); }
[ "public", "static", "function", "fromRange", "(", "LineRangeInterface", "$", "range", ",", "$", "bufferLength", ")", "{", "return", "new", "self", "(", "sprintf", "(", "'Range %d-%d goes beyond buffer with %d lines.'", ",", "$", "range", "->", "getStart", "(", ")"...
@param int $bufferLength @return RangePastEndOfBufferException
[ "@param", "int", "$bufferLength" ]
train
https://github.com/tomphp/patch-builder/blob/4419eaad23016c7db1deffc6cce3f539096c11ce/src/TomPHP/PatchBuilder/Buffer/Exception/RangePastEndOfBufferException.php#L14-L22
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.isMigrationApplied
public function isMigrationApplied(Name $name) { $this->ensureMigrationExists($name); $collection = $this->getAppliedCollection(); $criteria = ['className' => (string) $name]; $record = $collection->find($criteria)->getSingleResult(); if ($record === null) { ret...
php
public function isMigrationApplied(Name $name) { $this->ensureMigrationExists($name); $collection = $this->getAppliedCollection(); $criteria = ['className' => (string) $name]; $record = $collection->find($criteria)->getSingleResult(); if ($record === null) { ret...
[ "public", "function", "isMigrationApplied", "(", "Name", "$", "name", ")", "{", "$", "this", "->", "ensureMigrationExists", "(", "$", "name", ")", ";", "$", "collection", "=", "$", "this", "->", "getAppliedCollection", "(", ")", ";", "$", "criteria", "=", ...
Check if a migration has been applied. @param Name $name name of the migration. @return bool
[ "Check", "if", "a", "migration", "has", "been", "applied", "." ]
train
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L151-L164
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.migrate
public function migrate(Name $name, Direction $direction, OutputInterface $output) { $migration = $this->createMigrationInstance($name, $output); $output->writeln('<info>Migrating ' . $direction . '...</info> <comment>' . $name . '</comment>'); if ($direction->isUp()) { $migrat...
php
public function migrate(Name $name, Direction $direction, OutputInterface $output) { $migration = $this->createMigrationInstance($name, $output); $output->writeln('<info>Migrating ' . $direction . '...</info> <comment>' . $name . '</comment>'); if ($direction->isUp()) { $migrat...
[ "public", "function", "migrate", "(", "Name", "$", "name", ",", "Direction", "$", "direction", ",", "OutputInterface", "$", "output", ")", "{", "$", "migration", "=", "$", "this", "->", "createMigrationInstance", "(", "$", "name", ",", "$", "output", ")", ...
Migrate up or down. @param Direction $direction
[ "Migrate", "up", "or", "down", "." ]
train
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L186-L201
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.getAllMigrations
public function getAllMigrations() { $iterator = new \DirectoryIterator($this->configuration->getMigrationsDirectory()); $migrations = []; foreach ($iterator as $file) { $fileName = (string) $file; if ($fileName === '.'|| $fileName === '..') { contin...
php
public function getAllMigrations() { $iterator = new \DirectoryIterator($this->configuration->getMigrationsDirectory()); $migrations = []; foreach ($iterator as $file) { $fileName = (string) $file; if ($fileName === '.'|| $fileName === '..') { contin...
[ "public", "function", "getAllMigrations", "(", ")", "{", "$", "iterator", "=", "new", "\\", "DirectoryIterator", "(", "$", "this", "->", "configuration", "->", "getMigrationsDirectory", "(", ")", ")", ";", "$", "migrations", "=", "[", "]", ";", "foreach", ...
Get a list of all migrations, sorted alphabetically. @return Migration[]
[ "Get", "a", "list", "of", "all", "migrations", "sorted", "alphabetically", "." ]
train
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L208-L237
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.getMigrationsNotApplied
public function getMigrationsNotApplied() { $migrationsNotApplied = []; $migrations = $this->getAllMigrations(); foreach ($migrations as $migration) { if (!$migration->isApplied()) { $migrationsNotApplied[] = $migration; } } return $m...
php
public function getMigrationsNotApplied() { $migrationsNotApplied = []; $migrations = $this->getAllMigrations(); foreach ($migrations as $migration) { if (!$migration->isApplied()) { $migrationsNotApplied[] = $migration; } } return $m...
[ "public", "function", "getMigrationsNotApplied", "(", ")", "{", "$", "migrationsNotApplied", "=", "[", "]", ";", "$", "migrations", "=", "$", "this", "->", "getAllMigrations", "(", ")", ";", "foreach", "(", "$", "migrations", "as", "$", "migration", ")", "...
Return array with all migrations that were note applied. @return Migration[]
[ "Return", "array", "with", "all", "migrations", "that", "were", "note", "applied", "." ]
train
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L244-L256
mongrate/mongrate
src/Mongrate/Service/MigrationService.php
MigrationService.setMigrationApplied
private function setMigrationApplied(Name $name, $isApplied) { $collection = $this->getAppliedCollection(); $criteria = ['className' => (string) $name]; $newObj = ['$set' => ['className' => (string) $name, 'isApplied' => $isApplied]]; $collection->upsert($criteria, $newObj); }
php
private function setMigrationApplied(Name $name, $isApplied) { $collection = $this->getAppliedCollection(); $criteria = ['className' => (string) $name]; $newObj = ['$set' => ['className' => (string) $name, 'isApplied' => $isApplied]]; $collection->upsert($criteria, $newObj); }
[ "private", "function", "setMigrationApplied", "(", "Name", "$", "name", ",", "$", "isApplied", ")", "{", "$", "collection", "=", "$", "this", "->", "getAppliedCollection", "(", ")", ";", "$", "criteria", "=", "[", "'className'", "=>", "(", "string", ")", ...
Update the database to record whether or not the migration has been applied. @param boolean $isApplied
[ "Update", "the", "database", "to", "record", "whether", "or", "not", "the", "migration", "has", "been", "applied", "." ]
train
https://github.com/mongrate/mongrate/blob/d76455a58a4ee5e6f8198e033c07bce40e2f7c7b/src/Mongrate/Service/MigrationService.php#L298-L304