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
fuelphp/filesystem
src/File.php
File.update
public function update($data) { $bites = file_put_contents($this->path, $data, LOCK_EX); return $bites !== false; }
php
public function update($data) { $bites = file_put_contents($this->path, $data, LOCK_EX); return $bites !== false; }
[ "public", "function", "update", "(", "$", "data", ")", "{", "$", "bites", "=", "file_put_contents", "(", "$", "this", "->", "path", ",", "$", "data", ",", "LOCK_EX", ")", ";", "return", "$", "bites", "!==", "false", ";", "}" ]
Updates a file @param string $data @return boolean
[ "Updates", "a", "file" ]
train
https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/File.php#L46-L51
fuelphp/filesystem
src/File.php
File.getMimeType
public function getMimeType() { $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($finfo, $this->path); finfo_close($finfo); return $mime; }
php
public function getMimeType() { $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($finfo, $this->path); finfo_close($finfo); return $mime; }
[ "public", "function", "getMimeType", "(", ")", "{", "$", "finfo", "=", "finfo_open", "(", "FILEINFO_MIME_TYPE", ")", ";", "$", "mime", "=", "finfo_file", "(", "$", "finfo", ",", "$", "this", "->", "path", ")", ";", "finfo_close", "(", "$", "finfo", ")"...
Returns the mime-type @return string
[ "Returns", "the", "mime", "-", "type" ]
train
https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/File.php#L82-L89
crysalead/net
src/Http/Cookie/Jar.php
Jar.toJar
public static function toJar($cookies) { $result = []; foreach ($cookies as $name => $cookie) { if (!$cookie->expired()) { $result[] = static::_line($name, $cookie); } } return $result ? join("\n", $result) . "\n" : ''; }
php
public static function toJar($cookies) { $result = []; foreach ($cookies as $name => $cookie) { if (!$cookie->expired()) { $result[] = static::_line($name, $cookie); } } return $result ? join("\n", $result) . "\n" : ''; }
[ "public", "static", "function", "toJar", "(", "$", "cookies", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "cookies", "as", "$", "name", "=>", "$", "cookie", ")", "{", "if", "(", "!", "$", "cookie", "->", "expired", "(", ")",...
Exports the cookies into a JAR string. @param object $cookies A `SetCookies` collection. @return string
[ "Exports", "the", "cookies", "into", "a", "JAR", "string", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Jar.php#L17-L26
crysalead/net
src/Http/Cookie/Jar.php
Jar._line
protected static function _line($name, $cookie) { if (!$cookie->isValid()) { throw new RuntimeException("Invalid cookie `'{$name}'`."); } $domain = $cookie->domain(); $parts = [ $cookie->httponly() ? '#HttpOnly_' . $domain : $domain, $domain === ...
php
protected static function _line($name, $cookie) { if (!$cookie->isValid()) { throw new RuntimeException("Invalid cookie `'{$name}'`."); } $domain = $cookie->domain(); $parts = [ $cookie->httponly() ? '#HttpOnly_' . $domain : $domain, $domain === ...
[ "protected", "static", "function", "_line", "(", "$", "name", ",", "$", "cookie", ")", "{", "if", "(", "!", "$", "cookie", "->", "isValid", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Invalid cookie `'{$name}'`.\"", ")", ";", "}", "$"...
Creates a cookie JAR line from a name and a SetCookie value. @param string The cookie name. @param string The cookie instance value. @return string
[ "Creates", "a", "cookie", "JAR", "line", "from", "a", "name", "and", "a", "SetCookie", "value", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Jar.php#L35-L52
crysalead/net
src/Http/Cookie/Jar.php
Jar.parse
public static function parse($line) { $parts = explode("\t", trim($line)); if (count($parts) !== 7) { throw new RuntimeException("Invalid cookie JAR format."); } $config = []; $config['httponly'] = '#HttpOnly_' === substr($parts[0], 0, 10); $config['doma...
php
public static function parse($line) { $parts = explode("\t", trim($line)); if (count($parts) !== 7) { throw new RuntimeException("Invalid cookie JAR format."); } $config = []; $config['httponly'] = '#HttpOnly_' === substr($parts[0], 0, 10); $config['doma...
[ "public", "static", "function", "parse", "(", "$", "line", ")", "{", "$", "parts", "=", "explode", "(", "\"\\t\"", ",", "trim", "(", "$", "line", ")", ")", ";", "if", "(", "count", "(", "$", "parts", ")", "!==", "7", ")", "{", "throw", "new", "...
Parses a cookie JAR line. @param string $line The cookie JAR line. @return array The data array. @throws Exception It throws an exception the cookie JAR line is invalid.
[ "Parses", "a", "cookie", "JAR", "line", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Jar.php#L61-L79
fostam/php-getopts
src/Parser.php
Parser.collectShortLong
private function collectShortLong() { foreach ($this->configOpts as $name => $configOpt) { if ($configOpt->get(Option::LONG)) { $this->optsLong[$configOpt->get(Option::LONG)] = $name; } if ($configOpt->get(Option::SHORT)) { $this->optsSho...
php
private function collectShortLong() { foreach ($this->configOpts as $name => $configOpt) { if ($configOpt->get(Option::LONG)) { $this->optsLong[$configOpt->get(Option::LONG)] = $name; } if ($configOpt->get(Option::SHORT)) { $this->optsSho...
[ "private", "function", "collectShortLong", "(", ")", "{", "foreach", "(", "$", "this", "->", "configOpts", "as", "$", "name", "=>", "$", "configOpt", ")", "{", "if", "(", "$", "configOpt", "->", "get", "(", "Option", "::", "LONG", ")", ")", "{", "$",...
collect short/long opts
[ "collect", "short", "/", "long", "opts" ]
train
https://github.com/fostam/php-getopts/blob/0d0209eb48201e3e0b28305ae8d28d4657d6d979/src/Parser.php#L306-L315
unimapper/unimapper
src/Connection.php
Connection.getAdapter
public function getAdapter($name) { if (!isset($this->adapters[$name])) { throw new Exception\ConnectionException( "Adapter " . $name . " not registered on connection!" ); } return $this->adapters[$name]; }
php
public function getAdapter($name) { if (!isset($this->adapters[$name])) { throw new Exception\ConnectionException( "Adapter " . $name . " not registered on connection!" ); } return $this->adapters[$name]; }
[ "public", "function", "getAdapter", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "adapters", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "Exception", "\\", "ConnectionException", "(", "\"Adapter \"", ".", "$", ...
Get adapter @param string $name @return Adapter @throws Exception\ConnectionException
[ "Get", "adapter" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Connection.php#L55-L64
iP1SMS/ip1-php-sdk
src/SMS/OutGoingSMS.php
OutGoingSMS.removeNumber
public function removeNumber(int $index): void { unset($this->numbers[$index]); $this->numbers = array_values($this->numbers); }
php
public function removeNumber(int $index): void { unset($this->numbers[$index]); $this->numbers = array_values($this->numbers); }
[ "public", "function", "removeNumber", "(", "int", "$", "index", ")", ":", "void", "{", "unset", "(", "$", "this", "->", "numbers", "[", "$", "index", "]", ")", ";", "$", "this", "->", "numbers", "=", "array_values", "(", "$", "this", "->", "numbers",...
Removes the given index from the number recipient list. @param integer $index The index being requested for deletion. @return void
[ "Removes", "the", "given", "index", "from", "the", "number", "recipient", "list", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/OutGoingSMS.php#L68-L72
iP1SMS/ip1-php-sdk
src/SMS/OutGoingSMS.php
OutGoingSMS.getNumber
public function getNumber(int $index): string { if ($index >= count($this->numbers)) { throw new \UndefinedOffsetException(); } return $this->numbers[$index]; }
php
public function getNumber(int $index): string { if ($index >= count($this->numbers)) { throw new \UndefinedOffsetException(); } return $this->numbers[$index]; }
[ "public", "function", "getNumber", "(", "int", "$", "index", ")", ":", "string", "{", "if", "(", "$", "index", ">=", "count", "(", "$", "this", "->", "numbers", ")", ")", "{", "throw", "new", "\\", "UndefinedOffsetException", "(", ")", ";", "}", "ret...
Returns the number in the given index. @param integer $index The index being requested. @return string Phone number. @throws \UndefinedOffsetException Thrown when the index requested does not exist.
[ "Returns", "the", "number", "in", "the", "given", "index", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/OutGoingSMS.php#L79-L85
iP1SMS/ip1-php-sdk
src/SMS/OutGoingSMS.php
OutGoingSMS.removeContact
public function removeContact(int $index): void { unset($this->contacts[$index]); $this->contacts = array_values($this->contacts); }
php
public function removeContact(int $index): void { unset($this->contacts[$index]); $this->contacts = array_values($this->contacts); }
[ "public", "function", "removeContact", "(", "int", "$", "index", ")", ":", "void", "{", "unset", "(", "$", "this", "->", "contacts", "[", "$", "index", "]", ")", ";", "$", "this", "->", "contacts", "=", "array_values", "(", "$", "this", "->", "contac...
Removes the Contact in the given index and reindexes the array. @param integer $index The index being requested for deletion. @return void
[ "Removes", "the", "Contact", "in", "the", "given", "index", "and", "reindexes", "the", "array", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/OutGoingSMS.php#L108-L112
iP1SMS/ip1-php-sdk
src/SMS/OutGoingSMS.php
OutGoingSMS.removeGroup
public function removeGroup(int $index): void { unset($this->groups[$index]); $this->groups = array_values($this->groups); }
php
public function removeGroup(int $index): void { unset($this->groups[$index]); $this->groups = array_values($this->groups); }
[ "public", "function", "removeGroup", "(", "int", "$", "index", ")", ":", "void", "{", "unset", "(", "$", "this", "->", "groups", "[", "$", "index", "]", ")", ";", "$", "this", "->", "groups", "=", "array_values", "(", "$", "this", "->", "groups", "...
Removes the Group in the given index and reindexes the array. @param integer $index The index being requested for deletion. @return void
[ "Removes", "the", "Group", "in", "the", "given", "index", "and", "reindexes", "the", "array", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/OutGoingSMS.php#L145-L149
iP1SMS/ip1-php-sdk
src/SMS/OutGoingSMS.php
OutGoingSMS.getGroup
public function getGroup(int $index): Group { if ($index >= count($this->groups)) { throw new \UndefinedOffsetException(); } return $this->groups[$index]; }
php
public function getGroup(int $index): Group { if ($index >= count($this->groups)) { throw new \UndefinedOffsetException(); } return $this->groups[$index]; }
[ "public", "function", "getGroup", "(", "int", "$", "index", ")", ":", "Group", "{", "if", "(", "$", "index", ">=", "count", "(", "$", "this", "->", "groups", ")", ")", "{", "throw", "new", "\\", "UndefinedOffsetException", "(", ")", ";", "}", "return...
Returns the group in the given index. @param integer $index The index being requested. @return Group @throws \UndefinedOffsetException Thrown when the index requested does not exist.
[ "Returns", "the", "group", "in", "the", "given", "index", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/OutGoingSMS.php#L156-L162
iP1SMS/ip1-php-sdk
src/SMS/OutGoingSMS.php
OutGoingSMS.jsonSerialize
public function jsonSerialize(): array { $returnArray = parent::jsonSerialize(); $returnArray['Email'] = $this->email; $returnArray['Numbers'] = $this->numbers; if (count($this->contacts) > 0) { $returnArray['Contacts'] = []; foreach ($this->contacts as $cont...
php
public function jsonSerialize(): array { $returnArray = parent::jsonSerialize(); $returnArray['Email'] = $this->email; $returnArray['Numbers'] = $this->numbers; if (count($this->contacts) > 0) { $returnArray['Contacts'] = []; foreach ($this->contacts as $cont...
[ "public", "function", "jsonSerialize", "(", ")", ":", "array", "{", "$", "returnArray", "=", "parent", "::", "jsonSerialize", "(", ")", ";", "$", "returnArray", "[", "'Email'", "]", "=", "$", "this", "->", "email", ";", "$", "returnArray", "[", "'Numbers...
Serializes the object to a value that can be serialized natively by json_encode(). @return array Associative . @link http://php.net/manual/en/jsonserializable.jsonserialize.php
[ "Serializes", "the", "object", "to", "a", "value", "that", "can", "be", "serialized", "natively", "by", "json_encode", "()", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/OutGoingSMS.php#L178-L197
yiidoc/yii2-selectize
Selectize.php
Selectize.registerAssetBundle
public function registerAssetBundle() { if (isset($this->clientOptions['plugins']) && in_array('drag_drop', $this->clientOptions['plugins'])) { JuiAsset::register($this->getView()); } MicroPluginAsset::register($this->getView()); SifterAsset::register($this->getView()); ...
php
public function registerAssetBundle() { if (isset($this->clientOptions['plugins']) && in_array('drag_drop', $this->clientOptions['plugins'])) { JuiAsset::register($this->getView()); } MicroPluginAsset::register($this->getView()); SifterAsset::register($this->getView()); ...
[ "public", "function", "registerAssetBundle", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "clientOptions", "[", "'plugins'", "]", ")", "&&", "in_array", "(", "'drag_drop'", ",", "$", "this", "->", "clientOptions", "[", "'plugins'", "]", ")", ...
Register asset bundles
[ "Register", "asset", "bundles" ]
train
https://github.com/yiidoc/yii2-selectize/blob/4bb53e73c7b9324e687c0a5f7ef391ec7b29da44/Selectize.php#L66-L74
yiidoc/yii2-selectize
Selectize.php
Selectize.registerJs
public function registerJs() { if (!isset($this->clientOptions['create']) && empty($this->items)) { $this->clientOptions['create'] = "function(input) { return { value: input, text: input };}"; } $clientOptions = (count($this->clientOptions)) ? Json::encode($this->clientOptions) :...
php
public function registerJs() { if (!isset($this->clientOptions['create']) && empty($this->items)) { $this->clientOptions['create'] = "function(input) { return { value: input, text: input };}"; } $clientOptions = (count($this->clientOptions)) ? Json::encode($this->clientOptions) :...
[ "public", "function", "registerJs", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "clientOptions", "[", "'create'", "]", ")", "&&", "empty", "(", "$", "this", "->", "items", ")", ")", "{", "$", "this", "->", "clientOptions", "[", ...
Register client script
[ "Register", "client", "script" ]
train
https://github.com/yiidoc/yii2-selectize/blob/4bb53e73c7b9324e687c0a5f7ef391ec7b29da44/Selectize.php#L79-L86
yiidoc/yii2-selectize
Selectize.php
Selectize.registerEvents
public function registerEvents() { if (!empty($this->clientEvents)) { $js = []; foreach ($this->clientEvents as $event => $handle) { $js[] = "jQuery('#{$this->options['id']}').on('{$event}',{$handle});"; } $this->getView()->registerJs(implode(P...
php
public function registerEvents() { if (!empty($this->clientEvents)) { $js = []; foreach ($this->clientEvents as $event => $handle) { $js[] = "jQuery('#{$this->options['id']}').on('{$event}',{$handle});"; } $this->getView()->registerJs(implode(P...
[ "public", "function", "registerEvents", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "clientEvents", ")", ")", "{", "$", "js", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "clientEvents", "as", "$", "event", "=>", "$", ...
Register client script handles
[ "Register", "client", "script", "handles" ]
train
https://github.com/yiidoc/yii2-selectize/blob/4bb53e73c7b9324e687c0a5f7ef391ec7b29da44/Selectize.php#L91-L100
markwatkinson/luminous
src/Luminous/Core/Filters.php
Filters.doxygenize
public static function doxygenize($token) { $token = Utils::escapeToken($token); $token[1] = preg_replace_callback( "/(^(?>[\/\*#\s\{]*))([\@\\\])([\\w]*)(\}|[ \t]+.*?)?$/m", array('Luminous\\Core\\Filters', 'doxygenizeCb'), $token[1] ); return $to...
php
public static function doxygenize($token) { $token = Utils::escapeToken($token); $token[1] = preg_replace_callback( "/(^(?>[\/\*#\s\{]*))([\@\\\])([\\w]*)(\}|[ \t]+.*?)?$/m", array('Luminous\\Core\\Filters', 'doxygenizeCb'), $token[1] ); return $to...
[ "public", "static", "function", "doxygenize", "(", "$", "token", ")", "{", "$", "token", "=", "Utils", "::", "escapeToken", "(", "$", "token", ")", ";", "$", "token", "[", "1", "]", "=", "preg_replace_callback", "(", "\"/(^(?>[\\/\\*#\\s\\{]*))([\\@\\\\\\])([\...
@brief Highlights doc-comment tags inside a comment block. @see generic_doc_comment @internal
[ "@brief", "Highlights", "doc", "-", "comment", "tags", "inside", "a", "comment", "block", "." ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Filters.php#L130-L139
markwatkinson/luminous
src/Luminous/Core/Filters.php
Filters.genericDocComment
public static function genericDocComment($token) { // checks if a comment is in the form: // xyyz where x may = y but y != z. // This matches, say, /** comment but does not match /********/ // same with /// comment but not /////////////// $s = $token[1]; if (!isset(...
php
public static function genericDocComment($token) { // checks if a comment is in the form: // xyyz where x may = y but y != z. // This matches, say, /** comment but does not match /********/ // same with /// comment but not /////////////// $s = $token[1]; if (!isset(...
[ "public", "static", "function", "genericDocComment", "(", "$", "token", ")", "{", "// checks if a comment is in the form:", "// xyyz where x may = y but y != z.", "// This matches, say, /** comment but does not match /********/", "// same with /// comment but not ///////////////", "$", ...
@brief Generic filter to highlight JavaDoc, PHPDoc, Doxygen, JSdoc, and similar doc comment syntax. A cursory check will be performed to try to validate that the token really is a doc-comment, it does this by checking for common formats. If the check is successful, the token will be switched to type 'DOCCOMMENT' and ...
[ "@brief", "Generic", "filter", "to", "highlight", "JavaDoc", "PHPDoc", "Doxygen", "JSdoc", "and", "similar", "doc", "comment", "syntax", "." ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Filters.php#L154-L169
markwatkinson/luminous
src/Luminous/Core/Filters.php
Filters.ooStreamFilter
public static function ooStreamFilter($tokens) { $c = count($tokens); for ($i = 0; $i < $c; $i++) { if ($tokens[$i][0] !== 'IDENT') { continue; } if ($i > 0) { $s = $tokens[$i-1][1]; if ($s === '.' || $s === '->' || ...
php
public static function ooStreamFilter($tokens) { $c = count($tokens); for ($i = 0; $i < $c; $i++) { if ($tokens[$i][0] !== 'IDENT') { continue; } if ($i > 0) { $s = $tokens[$i-1][1]; if ($s === '.' || $s === '->' || ...
[ "public", "static", "function", "ooStreamFilter", "(", "$", "tokens", ")", "{", "$", "c", "=", "count", "(", "$", "tokens", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "c", ";", "$", "i", "++", ")", "{", "if", "(", "$...
@brief Attempts to apply OO syntax highlighting Tries to apply generic OO syntax highlighting. Any identifer immediately preceding a '.', '::' or '->' token is mapped to an 'OO'. Any identifer token immediatel following any of those tokens is mapped to an 'OBJ'. This is a stream filter.
[ "@brief", "Attempts", "to", "apply", "OO", "syntax", "highlighting" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Filters.php#L313-L337
crysalead/net
src/Header.php
Header.name
public function name($name = null) { if (func_num_args() === 0) { return $this->_name; } return $this->_name = (string) $name; }
php
public function name($name = null) { if (func_num_args() === 0) { return $this->_name; } return $this->_name = (string) $name; }
[ "public", "function", "name", "(", "$", "name", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_name", ";", "}", "return", "$", "this", "->", "_name", "=", "(", "string", ")", "$",...
Gets/sets the Header name. @param string $name The name string. @return string Returns the name string.
[ "Gets", "/", "sets", "the", "Header", "name", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Header.php#L68-L74
crysalead/net
src/Header.php
Header.offsetSet
public function offsetSet($name, $value) { if ($name && !is_numeric($name)) { throw new RuntimeException("Invalid index, should be numeric or empty."); } return $name === null ? $this->_data[] = $value : $this->_data[$name] = $value; }
php
public function offsetSet($name, $value) { if ($name && !is_numeric($name)) { throw new RuntimeException("Invalid index, should be numeric or empty."); } return $name === null ? $this->_data[] = $value : $this->_data[$name] = $value; }
[ "public", "function", "offsetSet", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "$", "name", "&&", "!", "is_numeric", "(", "$", "name", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Invalid index, should be numeric or empty.\"", ")"...
Assigns a header. @param string $name The header name. @param mixed $value The header value. @return mixed The setted value.
[ "Assigns", "a", "header", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Header.php#L83-L89
crysalead/net
src/Header.php
Header.value
public function value() { if (strtolower($this->name()) === 'set-cookie') { return join("\r\n" . $this->name() . ': ', $this->data()); } else { return join(', ', $this->_data); } }
php
public function value() { if (strtolower($this->name()) === 'set-cookie') { return join("\r\n" . $this->name() . ': ', $this->data()); } else { return join(', ', $this->_data); } }
[ "public", "function", "value", "(", ")", "{", "if", "(", "strtolower", "(", "$", "this", "->", "name", "(", ")", ")", "===", "'set-cookie'", ")", "{", "return", "join", "(", "\"\\r\\n\"", ".", "$", "this", "->", "name", "(", ")", ".", "': '", ",", ...
Gets the header's value. @return array Returns the headers.
[ "Gets", "the", "header", "s", "value", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Header.php#L106-L113
crysalead/net
src/Header.php
Header.parse
public static function parse($value) { $values = explode(':', $value, 2); if (count($values) !== 2) { return; } return new static($values[0], trim($values[1])); }
php
public static function parse($value) { $values = explode(':', $value, 2); if (count($values) !== 2) { return; } return new static($values[0], trim($values[1])); }
[ "public", "static", "function", "parse", "(", "$", "value", ")", "{", "$", "values", "=", "explode", "(", "':'", ",", "$", "value", ",", "2", ")", ";", "if", "(", "count", "(", "$", "values", ")", "!==", "2", ")", "{", "return", ";", "}", "retu...
Parses a header string value. @param string $header A header string value. @return object A header collection.
[ "Parses", "a", "header", "string", "value", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Header.php#L141-L149
crysalead/net
src/Header.php
Header.toHeader
public static function toHeader($collection, $options = []) { $defaults = [ 'length' => 0, 'maxLength' => 0 ]; $options += $defaults; if (strtolower($collection->name()) === 'set-cookie') { $header = static::wrap($collection->name() . ': ' . jo...
php
public static function toHeader($collection, $options = []) { $defaults = [ 'length' => 0, 'maxLength' => 0 ]; $options += $defaults; if (strtolower($collection->name()) === 'set-cookie') { $header = static::wrap($collection->name() . ': ' . jo...
[ "public", "static", "function", "toHeader", "(", "$", "collection", ",", "$", "options", "=", "[", "]", ")", "{", "$", "defaults", "=", "[", "'length'", "=>", "0", ",", "'maxLength'", "=>", "0", "]", ";", "$", "options", "+=", "$", "defaults", ";", ...
Returns the headers as a string. @return string
[ "Returns", "the", "headers", "as", "a", "string", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Header.php#L156-L175
crysalead/net
src/Header.php
Header.wrap
public static function wrap($header, $width = 0) { if ($width <= 0) { return $header; } $result = []; $lineLength = 0; $parts = preg_split('~\s+~', $header); while ($current = current($parts)) { $next = next($parts); $lineL...
php
public static function wrap($header, $width = 0) { if ($width <= 0) { return $header; } $result = []; $lineLength = 0; $parts = preg_split('~\s+~', $header); while ($current = current($parts)) { $next = next($parts); $lineL...
[ "public", "static", "function", "wrap", "(", "$", "header", ",", "$", "width", "=", "0", ")", "{", "if", "(", "$", "width", "<=", "0", ")", "{", "return", "$", "header", ";", "}", "$", "result", "=", "[", "]", ";", "$", "lineLength", "=", "0", ...
Fold a header entry @param string $header The header to fold.
[ "Fold", "a", "header", "entry" ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Header.php#L182-L203
eliep/avro-rpc-php
lib/avro/data_file.php
AvroDataIO.open_file
public static function open_file($file_path, $mode=AvroFile::READ_MODE, $schema_json=null) { $schema = !is_null($schema_json) ? AvroSchema::parse($schema_json) : null; $io = false; switch ($mode) { case AvroFile::WRITE_MODE: if (is_null($schema))...
php
public static function open_file($file_path, $mode=AvroFile::READ_MODE, $schema_json=null) { $schema = !is_null($schema_json) ? AvroSchema::parse($schema_json) : null; $io = false; switch ($mode) { case AvroFile::WRITE_MODE: if (is_null($schema))...
[ "public", "static", "function", "open_file", "(", "$", "file_path", ",", "$", "mode", "=", "AvroFile", "::", "READ_MODE", ",", "$", "schema_json", "=", "null", ")", "{", "$", "schema", "=", "!", "is_null", "(", "$", "schema_json", ")", "?", "AvroSchema",...
@param string $file_path file_path of file to open @param string $mode one of AvroFile::READ_MODE or AvroFile::WRITE_MODE @param string $schema_json JSON of writer's schema @returns AvroDataIOWriter instance of AvroDataIOWriter @throws AvroDataIOException if $writers_schema is not provided or if an invalid $mode is gi...
[ "@param", "string", "$file_path", "file_path", "of", "file", "to", "open", "@param", "string", "$mode", "one", "of", "AvroFile", "::", "READ_MODE", "or", "AvroFile", "::", "WRITE_MODE", "@param", "string", "$schema_json", "JSON", "of", "writer", "s", "schema", ...
train
https://github.com/eliep/avro-rpc-php/blob/645321e5224eac9234fc79dbf447de3973a9ed1e/lib/avro/data_file.php#L119-L144
iP1SMS/ip1-php-sdk
src/SMS/ProcessedOutGoingSMS.php
ProcessedOutGoingSMS.getUpdated
public function getUpdated(\DateTimeZone $timezone = null): ?\DateTime { if (!is_null($timezone)) { $returnDate = clone $this->updated; $returnDate->setTimeZone($timezone); return $returnDate; } return $this->updated ?? null; }
php
public function getUpdated(\DateTimeZone $timezone = null): ?\DateTime { if (!is_null($timezone)) { $returnDate = clone $this->updated; $returnDate->setTimeZone($timezone); return $returnDate; } return $this->updated ?? null; }
[ "public", "function", "getUpdated", "(", "\\", "DateTimeZone", "$", "timezone", "=", "null", ")", ":", "?", "\\", "DateTime", "{", "if", "(", "!", "is_null", "(", "$", "timezone", ")", ")", "{", "$", "returnDate", "=", "clone", "$", "this", "->", "up...
Returns when the component was updated last. @param \DateTimeZone $timezone The timezone that the user wants to get the DateTime in. Default is UTC. @return \DateTime When the contact was updated/modified last.
[ "Returns", "when", "the", "component", "was", "updated", "last", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/ProcessedOutGoingSMS.php#L128-L136
iP1SMS/ip1-php-sdk
src/SMS/ProcessedOutGoingSMS.php
ProcessedOutGoingSMS.jsonSerialize
public function jsonSerialize(): array { $parentArray = parent::jsonSerialize(); $returnArray = [ 'ID' => $this->smsID, 'BundleID' => $this->bundleID, 'Status' => $this->status, 'StatusDescription' => $this->statusDescription, 'To' => $thi...
php
public function jsonSerialize(): array { $parentArray = parent::jsonSerialize(); $returnArray = [ 'ID' => $this->smsID, 'BundleID' => $this->bundleID, 'Status' => $this->status, 'StatusDescription' => $this->statusDescription, 'To' => $thi...
[ "public", "function", "jsonSerialize", "(", ")", ":", "array", "{", "$", "parentArray", "=", "parent", "::", "jsonSerialize", "(", ")", ";", "$", "returnArray", "=", "[", "'ID'", "=>", "$", "this", "->", "smsID", ",", "'BundleID'", "=>", "$", "this", "...
Serializes the object to a value that can be serialized natively by json_encode(). @return array Associative . @link http://php.net/manual/en/jsonserializable.jsonserialize.php
[ "Serializes", "the", "object", "to", "a", "value", "that", "can", "be", "serialized", "natively", "by", "json_encode", "()", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/ProcessedOutGoingSMS.php#L172-L188
iP1SMS/ip1-php-sdk
src/SMS/ProcessedOutGoingSMS.php
ProcessedOutGoingSMS.fillEndPoint
public function fillEndPoint(string &$endPoint): void { $endPoint = str_replace("{sms}", $this->smsID, $endPoint); $endPoint = str_replace("{bundle}", $this->bundleID ?? "", $endPoint); }
php
public function fillEndPoint(string &$endPoint): void { $endPoint = str_replace("{sms}", $this->smsID, $endPoint); $endPoint = str_replace("{bundle}", $this->bundleID ?? "", $endPoint); }
[ "public", "function", "fillEndPoint", "(", "string", "&", "$", "endPoint", ")", ":", "void", "{", "$", "endPoint", "=", "str_replace", "(", "\"{sms}\"", ",", "$", "this", "->", "smsID", ",", "$", "endPoint", ")", ";", "$", "endPoint", "=", "str_replace",...
Takes the given argument and replaces strings such as {id} to an actual value. @param string $endPoint The endpoint to be corrected. @return void
[ "Takes", "the", "given", "argument", "and", "replaces", "strings", "such", "as", "{", "id", "}", "to", "an", "actual", "value", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/ProcessedOutGoingSMS.php#L194-L198
venta/framework
src/Http/src/CookieJar.php
CookieJar.expirationToDateTime
private function expirationToDateTime($expires): DateTimeInterface { if ($expires instanceof DateTimeImmutable) { return $expires; } if ($expires instanceof DateInterval) { $expires = (new DateTime)->add($expires); } elseif (is_string($expires) || is_int($exp...
php
private function expirationToDateTime($expires): DateTimeInterface { if ($expires instanceof DateTimeImmutable) { return $expires; } if ($expires instanceof DateInterval) { $expires = (new DateTime)->add($expires); } elseif (is_string($expires) || is_int($exp...
[ "private", "function", "expirationToDateTime", "(", "$", "expires", ")", ":", "DateTimeInterface", "{", "if", "(", "$", "expires", "instanceof", "DateTimeImmutable", ")", "{", "return", "$", "expires", ";", "}", "if", "(", "$", "expires", "instanceof", "DateIn...
Parses expiration time and returns valid DateTimeInterface implementation. @param DateTimeInterface|DateInterval|string $expires @return DateTimeInterface @throws InvalidArgumentException
[ "Parses", "expiration", "time", "and", "returns", "valid", "DateTimeInterface", "implementation", "." ]
train
https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Http/src/CookieJar.php#L119-L138
mimmi20/Wurfl
src/Handlers/NokiaOviBrowserHandler.php
NokiaOviBrowserHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { $idx = strpos($userAgent, 'Nokia'); $tolerance = Utils::indexOfAnyOrLength($userAgent, array('/', ' '), $idx); return $this->getDeviceIDFromRIS($userAgent, $tolerance); }
php
public function applyConclusiveMatch($userAgent) { $idx = strpos($userAgent, 'Nokia'); $tolerance = Utils::indexOfAnyOrLength($userAgent, array('/', ' '), $idx); return $this->getDeviceIDFromRIS($userAgent, $tolerance); }
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "$", "idx", "=", "strpos", "(", "$", "userAgent", ",", "'Nokia'", ")", ";", "$", "tolerance", "=", "Utils", "::", "indexOfAnyOrLength", "(", "$", "userAgent", ",", "array", "(",...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/NokiaOviBrowserHandler.php#L58-L64
AymDev/Phunder
src/Config.php
Config.loadParameters
public static function loadParameters() : void { // APPLICATION PARAMETERS // Application root directory defined('PHUNDER_ROOT_DIR') or define('PHUNDER_ROOT_DIR', __DIR__ . '/../'); // template directory path (from root dir) defined('PHUNDER_TEMPLATE_DIRECTORY') or define('...
php
public static function loadParameters() : void { // APPLICATION PARAMETERS // Application root directory defined('PHUNDER_ROOT_DIR') or define('PHUNDER_ROOT_DIR', __DIR__ . '/../'); // template directory path (from root dir) defined('PHUNDER_TEMPLATE_DIRECTORY') or define('...
[ "public", "static", "function", "loadParameters", "(", ")", ":", "void", "{", "// APPLICATION PARAMETERS", "// Application root directory", "defined", "(", "'PHUNDER_ROOT_DIR'", ")", "or", "define", "(", "'PHUNDER_ROOT_DIR'", ",", "__DIR__", ".", "'/../'", ")", ";", ...
Define undefined Phunder constants @return void
[ "Define", "undefined", "Phunder", "constants" ]
train
https://github.com/AymDev/Phunder/blob/32dbe6c81100f1ac3fc2a0080e323d8ab31cab10/src/Config.php#L27-L55
AymDev/Phunder
src/Config.php
Config.configureSession
public static function configureSession() : void { // Session runtime configuration http://php.net/manual/en/session.configuration.php if (session_status() !== \PHP_SESSION_ACTIVE ) { session_start([ 'cookie_httponly' => true, 'cookie_secure' => \PH...
php
public static function configureSession() : void { // Session runtime configuration http://php.net/manual/en/session.configuration.php if (session_status() !== \PHP_SESSION_ACTIVE ) { session_start([ 'cookie_httponly' => true, 'cookie_secure' => \PH...
[ "public", "static", "function", "configureSession", "(", ")", ":", "void", "{", "// Session runtime configuration http://php.net/manual/en/session.configuration.php", "if", "(", "session_status", "(", ")", "!==", "\\", "PHP_SESSION_ACTIVE", ")", "{", "session_start", "("...
Session configuration @return void
[ "Session", "configuration" ]
train
https://github.com/AymDev/Phunder/blob/32dbe6c81100f1ac3fc2a0080e323d8ab31cab10/src/Config.php#L66-L127
iP1SMS/ip1-php-sdk
src/Recipient/Contact.php
Contact.jsonSerialize
public function jsonSerialize(): array { $returnArray = [ 'FirstName' => $this->firstName, 'LastName' => $this->lastName, 'Organization' => $this->organization, 'Phone' => $this->phone, 'Email' => $this->email, 'Title' => $this->title, ...
php
public function jsonSerialize(): array { $returnArray = [ 'FirstName' => $this->firstName, 'LastName' => $this->lastName, 'Organization' => $this->organization, 'Phone' => $this->phone, 'Email' => $this->email, 'Title' => $this->title, ...
[ "public", "function", "jsonSerialize", "(", ")", ":", "array", "{", "$", "returnArray", "=", "[", "'FirstName'", "=>", "$", "this", "->", "firstName", ",", "'LastName'", "=>", "$", "this", "->", "lastName", ",", "'Organization'", "=>", "$", "this", "->", ...
Serializes the object to a value that can be serialized natively by json_encode(). @return array Associative. @link http://php.net/manual/en/jsonserializable.jsonserialize.php
[ "Serializes", "the", "object", "to", "a", "value", "that", "can", "be", "serialized", "natively", "by", "json_encode", "()", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/Contact.php#L96-L108
DevGroup-ru/yii2-data-structure-tools
src/searchOld/elastic/Search.php
Search.init
public function init() { $client = ClientBuilder::create(); if (true === is_array($this->hosts) && count($this->hosts) > 0) { $client->setHosts($this->hosts); } $this->client = $client->build(); try { $e = $this->client->search(['index' => '_all', '_so...
php
public function init() { $client = ClientBuilder::create(); if (true === is_array($this->hosts) && count($this->hosts) > 0) { $client->setHosts($this->hosts); } $this->client = $client->build(); try { $e = $this->client->search(['index' => '_all', '_so...
[ "public", "function", "init", "(", ")", "{", "$", "client", "=", "ClientBuilder", "::", "create", "(", ")", ";", "if", "(", "true", "===", "is_array", "(", "$", "this", "->", "hosts", ")", "&&", "count", "(", "$", "this", "->", "hosts", ")", ">", ...
Initiates self::$watcher and sets the flag self::$started if all started ok or not
[ "Initiates", "self", "::", "$watcher", "and", "sets", "the", "flag", "self", "::", "$started", "if", "all", "started", "ok", "or", "not" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Search.php#L52-L82
DevGroup-ru/yii2-data-structure-tools
src/searchOld/elastic/Search.php
Search.extendedFilter
final private function extendedFilter($modelClass = '', $config = [], $params = [], $intersect = false) { //перечсечение: внутри свойства ИЛИ между свойствами И //объединение: везде ИЛИ $index = IndexHelper::classToIndex($modelClass); if (true === empty($index)) { return ...
php
final private function extendedFilter($modelClass = '', $config = [], $params = [], $intersect = false) { //перечсечение: внутри свойства ИЛИ между свойствами И //объединение: везде ИЛИ $index = IndexHelper::classToIndex($modelClass); if (true === empty($index)) { return ...
[ "final", "private", "function", "extendedFilter", "(", "$", "modelClass", "=", "''", ",", "$", "config", "=", "[", "]", ",", "$", "params", "=", "[", "]", ",", "$", "intersect", "=", "false", ")", "{", "//перечсечение: внутри свойства ИЛИ между свойствами И", ...
Future feature. This method have ability to use combined extended search & filter form TODO implement @codeCoverageIgnore @param string $modelClass @param array $config @param array $params @param bool $intersect @return array
[ "Future", "feature", ".", "This", "method", "have", "ability", "to", "use", "combined", "extended", "search", "&", "filter", "form", "TODO", "implement" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Search.php#L323-L397
DevGroup-ru/yii2-data-structure-tools
src/searchOld/elastic/Search.php
Search.buildFilterQuery
public static function buildFilterQuery($params, $index, $types) { self::filterInput($params); $storageToId = (new Query()) ->from(PropertyStorage::tableName()) ->select('class_name') ->where(['class_name' => array_keys($types)]) ->indexBy('id') ...
php
public static function buildFilterQuery($params, $index, $types) { self::filterInput($params); $storageToId = (new Query()) ->from(PropertyStorage::tableName()) ->select('class_name') ->where(['class_name' => array_keys($types)]) ->indexBy('id') ...
[ "public", "static", "function", "buildFilterQuery", "(", "$", "params", ",", "$", "index", ",", "$", "types", ")", "{", "self", "::", "filterInput", "(", "$", "params", ")", ";", "$", "storageToId", "=", "(", "new", "Query", "(", ")", ")", "->", "fro...
Prepares filter query @param array $params @param string $index @return array
[ "Prepares", "filter", "query" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Search.php#L486-L540
DevGroup-ru/yii2-data-structure-tools
src/searchOld/elastic/Search.php
Search.filterInput
protected static function filterInput(&$params) { $params = array_filter($params, function ($v) { if (true === is_array($v)) { $first = reset($v); return (count($v) > 0 && false === empty($first)); } else { return false === empty($v); ...
php
protected static function filterInput(&$params) { $params = array_filter($params, function ($v) { if (true === is_array($v)) { $first = reset($v); return (count($v) > 0 && false === empty($first)); } else { return false === empty($v); ...
[ "protected", "static", "function", "filterInput", "(", "&", "$", "params", ")", "{", "$", "params", "=", "array_filter", "(", "$", "params", ",", "function", "(", "$", "v", ")", "{", "if", "(", "true", "===", "is_array", "(", "$", "v", ")", ")", "{...
Leave only not empty values to work with @param $params
[ "Leave", "only", "not", "empty", "values", "to", "work", "with" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Search.php#L547-L557
DevGroup-ru/yii2-data-structure-tools
src/searchOld/elastic/Search.php
Search.dataTypeToIndexField
protected static function dataTypeToIndexField($type) { $key = ''; $currentLang = LanguageHelper::getCurrent(); switch ($type) { case Property::DATA_TYPE_STRING : $key = 'str_value_' . $currentLang; break; case Property::DATA_TYPE_TEXT ...
php
protected static function dataTypeToIndexField($type) { $key = ''; $currentLang = LanguageHelper::getCurrent(); switch ($type) { case Property::DATA_TYPE_STRING : $key = 'str_value_' . $currentLang; break; case Property::DATA_TYPE_TEXT ...
[ "protected", "static", "function", "dataTypeToIndexField", "(", "$", "type", ")", "{", "$", "key", "=", "''", ";", "$", "currentLang", "=", "LanguageHelper", "::", "getCurrent", "(", ")", ";", "switch", "(", "$", "type", ")", "{", "case", "Property", "::...
Cast property data_type to elastic index column @param $type @return string
[ "Cast", "property", "data_type", "to", "elastic", "index", "column" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Search.php#L565-L589
DevGroup-ru/yii2-data-structure-tools
src/searchOld/elastic/Search.php
Search.prepareTypes
protected static function prepareTypes($config) { $list = isset($config['storage']) ? $config['storage'] : []; $list = is_array($list) ? $list : [$list]; if (count($list) == 0) { $list[] = StaticValues::class; } foreach ($list as $i => $storageClass) { ...
php
protected static function prepareTypes($config) { $list = isset($config['storage']) ? $config['storage'] : []; $list = is_array($list) ? $list : [$list]; if (count($list) == 0) { $list[] = StaticValues::class; } foreach ($list as $i => $storageClass) { ...
[ "protected", "static", "function", "prepareTypes", "(", "$", "config", ")", "{", "$", "list", "=", "isset", "(", "$", "config", "[", "'storage'", "]", ")", "?", "$", "config", "[", "'storage'", "]", ":", "[", "]", ";", "$", "list", "=", "is_array", ...
Prepares list of types to search against for @param array $config @return array
[ "Prepares", "list", "of", "types", "to", "search", "against", "for" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Search.php#L597-L609
nyeholt/silverstripe-simplewiki
thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Context.php
HTMLPurifier_Context.register
public function register($name, &$ref) { if (isset($this->_storage[$name])) { trigger_error("Name $name produces collision, cannot re-register", E_USER_ERROR); return; } $this->_storage[$name] =& $ref; }
php
public function register($name, &$ref) { if (isset($this->_storage[$name])) { trigger_error("Name $name produces collision, cannot re-register", E_USER_ERROR); return; } $this->_storage[$name] =& $ref; }
[ "public", "function", "register", "(", "$", "name", ",", "&", "$", "ref", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_storage", "[", "$", "name", "]", ")", ")", "{", "trigger_error", "(", "\"Name $name produces collision, cannot re-register\"", ...
Registers a variable into the context. @param $name String name @param $ref Reference to variable to be registered
[ "Registers", "a", "variable", "into", "the", "context", "." ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Context.php#L23-L30
nyeholt/silverstripe-simplewiki
thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Context.php
HTMLPurifier_Context.destroy
public function destroy($name) { if (!isset($this->_storage[$name])) { trigger_error("Attempted to destroy non-existent variable $name", E_USER_ERROR); return; } unset($this->_storage[$name]); }
php
public function destroy($name) { if (!isset($this->_storage[$name])) { trigger_error("Attempted to destroy non-existent variable $name", E_USER_ERROR); return; } unset($this->_storage[$name]); }
[ "public", "function", "destroy", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_storage", "[", "$", "name", "]", ")", ")", "{", "trigger_error", "(", "\"Attempted to destroy non-existent variable $name\"", ",", "E_USER_ERROR", ...
Destorys a variable in the context. @param $name String name
[ "Destorys", "a", "variable", "in", "the", "context", "." ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Context.php#L53-L60
wshafer/assetmanager-core
src/Resolver/PathStackResolver.php
PathStackResolver.resolve
public function resolve($name) { if ($this->isLfiProtectionOn() && preg_match('#\.\.[\\\/]#', $name)) { return null; } foreach ($this->getPaths() as $path) { $asset = $this->resolveFile($path . $name); if (!$asset) { return null; ...
php
public function resolve($name) { if ($this->isLfiProtectionOn() && preg_match('#\.\.[\\\/]#', $name)) { return null; } foreach ($this->getPaths() as $path) { $asset = $this->resolveFile($path . $name); if (!$asset) { return null; ...
[ "public", "function", "resolve", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "isLfiProtectionOn", "(", ")", "&&", "preg_match", "(", "'#\\.\\.[\\\\\\/]#'", ",", "$", "name", ")", ")", "{", "return", "null", ";", "}", "foreach", "(", "$", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Resolver/PathStackResolver.php#L150-L169
yosmanyga/validation
src/Yosmanyga/Validation/Validator/ArrayValidator.php
ArrayValidator.validate
public function validate($value) { $errors = []; $this->configureMessages(); if ($value === null) { if ($this->options['allowNull'] === false) { $errors[] = new Error($this->options['messages']['null']); } return $errors; } ...
php
public function validate($value) { $errors = []; $this->configureMessages(); if ($value === null) { if ($this->options['allowNull'] === false) { $errors[] = new Error($this->options['messages']['null']); } return $errors; } ...
[ "public", "function", "validate", "(", "$", "value", ")", "{", "$", "errors", "=", "[", "]", ";", "$", "this", "->", "configureMessages", "(", ")", ";", "if", "(", "$", "value", "===", "null", ")", "{", "if", "(", "$", "this", "->", "options", "[...
{@inheritdoc}
[ "{" ]
train
https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Validator/ArrayValidator.php#L41-L90
PandaPlatform/framework
src/Panda/Registry/AbstractRegistry.php
AbstractRegistry.get
public function get($key, $default = null) { return ArrayHelper::get($this->getItems(), $key, $default, $useDotSyntax = true); }
php
public function get($key, $default = null) { return ArrayHelper::get($this->getItems(), $key, $default, $useDotSyntax = true); }
[ "public", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "return", "ArrayHelper", "::", "get", "(", "$", "this", "->", "getItems", "(", ")", ",", "$", "key", ",", "$", "default", ",", "$", "useDotSyntax", "=", "true...
@param string $key @param mixed $default @return mixed
[ "@param", "string", "$key", "@param", "mixed", "$default" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Registry/AbstractRegistry.php#L40-L43
PandaPlatform/framework
src/Panda/Registry/AbstractRegistry.php
AbstractRegistry.set
public function set($key, $value) { $registry = ArrayHelper::set($this->getItems(), $key, $value, $useDotSyntax = true); $this->setItems($registry); return $this->getItems(); }
php
public function set($key, $value) { $registry = ArrayHelper::set($this->getItems(), $key, $value, $useDotSyntax = true); $this->setItems($registry); return $this->getItems(); }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "$", "registry", "=", "ArrayHelper", "::", "set", "(", "$", "this", "->", "getItems", "(", ")", ",", "$", "key", ",", "$", "value", ",", "$", "useDotSyntax", "=", "true", ...
@param string $key @param mixed $value @return array @throws InvalidArgumentException
[ "@param", "string", "$key", "@param", "mixed", "$value" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Registry/AbstractRegistry.php#L52-L58
PandaPlatform/framework
src/Panda/Registry/AbstractRegistry.php
AbstractRegistry.offsetSet
public function offsetSet($offset, $value) { // Normalize offset if (StringHelper::emptyString($offset, true)) { // Get next key $numericItems = ArrayHelper::filter($this->getItems(), function ($key) { if (is_numeric($key) && is_int($key) && $key >= 0) { ...
php
public function offsetSet($offset, $value) { // Normalize offset if (StringHelper::emptyString($offset, true)) { // Get next key $numericItems = ArrayHelper::filter($this->getItems(), function ($key) { if (is_numeric($key) && is_int($key) && $key >= 0) { ...
[ "public", "function", "offsetSet", "(", "$", "offset", ",", "$", "value", ")", "{", "// Normalize offset", "if", "(", "StringHelper", "::", "emptyString", "(", "$", "offset", ",", "true", ")", ")", "{", "// Get next key", "$", "numericItems", "=", "ArrayHelp...
{@inheritdoc}
[ "{" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Registry/AbstractRegistry.php#L89-L107
cauditor/php-analyzer
src/Api.php
Api.get
public function get($uri) { $options = array( CURLOPT_URL => $this->domain.'/'.ltrim($uri, '/'), CURLOPT_FOLLOWLOCATION => 1, CURLOPT_RETURNTRANSFER => 1, ); return $this->exec($options); }
php
public function get($uri) { $options = array( CURLOPT_URL => $this->domain.'/'.ltrim($uri, '/'), CURLOPT_FOLLOWLOCATION => 1, CURLOPT_RETURNTRANSFER => 1, ); return $this->exec($options); }
[ "public", "function", "get", "(", "$", "uri", ")", "{", "$", "options", "=", "array", "(", "CURLOPT_URL", "=>", "$", "this", "->", "domain", ".", "'/'", ".", "ltrim", "(", "$", "uri", ",", "'/'", ")", ",", "CURLOPT_FOLLOWLOCATION", "=>", "1", ",", ...
Read data from cauditor API. @param string $uri @return string|bool API response (on success) or false (on failure)
[ "Read", "data", "from", "cauditor", "API", "." ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Api.php#L40-L49
cauditor/php-analyzer
src/Api.php
Api.put
public function put($uri, array $data) { // PUT requests need an fopen wrapper, so we'll create a temporary one // for the data to submit... $json = json_encode($data); $file = fopen('php://temp', 'w+'); fwrite($file, $json, strlen($json)); fseek($file, 0); $...
php
public function put($uri, array $data) { // PUT requests need an fopen wrapper, so we'll create a temporary one // for the data to submit... $json = json_encode($data); $file = fopen('php://temp', 'w+'); fwrite($file, $json, strlen($json)); fseek($file, 0); $...
[ "public", "function", "put", "(", "$", "uri", ",", "array", "$", "data", ")", "{", "// PUT requests need an fopen wrapper, so we'll create a temporary one", "// for the data to submit...", "$", "json", "=", "json_encode", "(", "$", "data", ")", ";", "$", "file", "="...
Submit the data to cauditor API. @param string $uri @param array $data @return string|bool API response (on success) or false (on failure)
[ "Submit", "the", "data", "to", "cauditor", "API", "." ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Api.php#L59-L82
cauditor/php-analyzer
src/Api.php
Api.exec
protected function exec($options) { $curl = curl_init(); curl_setopt_array($curl, $options); $result = curl_exec($curl); curl_close($curl); return $result; }
php
protected function exec($options) { $curl = curl_init(); curl_setopt_array($curl, $options); $result = curl_exec($curl); curl_close($curl); return $result; }
[ "protected", "function", "exec", "(", "$", "options", ")", "{", "$", "curl", "=", "curl_init", "(", ")", ";", "curl_setopt_array", "(", "$", "curl", ",", "$", "options", ")", ";", "$", "result", "=", "curl_exec", "(", "$", "curl", ")", ";", "curl_clo...
@param array $options array of CURLOPT_* options @return string|bool API response (on success) or false (on failure)
[ "@param", "array", "$options", "array", "of", "CURLOPT_", "*", "options" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Api.php#L89-L97
liip/LiipDrupalConnectorModule
src/Liip/Drupal/Modules/DrupalConnector/Form.php
Form.form_set_error
public function form_set_error($name = NULL, $message = '', $limit_validation_errors = NULL) { return form_set_error($name, $message, $limit_validation_errors); }
php
public function form_set_error($name = NULL, $message = '', $limit_validation_errors = NULL) { return form_set_error($name, $message, $limit_validation_errors); }
[ "public", "function", "form_set_error", "(", "$", "name", "=", "NULL", ",", "$", "message", "=", "''", ",", "$", "limit_validation_errors", "=", "NULL", ")", "{", "return", "form_set_error", "(", "$", "name", ",", "$", "message", ",", "$", "limit_validatio...
Files an error against a form element. When a validation error is detected, the validator calls form_set_error() to indicate which element needs to be changed and provide an error message. This causes the Form API to not execute the form submit handlers, and instead to re-display the form to the user with the correspo...
[ "Files", "an", "error", "against", "a", "form", "element", "." ]
train
https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Form.php#L147-L150
DevGroup-ru/yii2-data-structure-tools
src/searchOld/base/AbstractWatch.php
AbstractWatch.init
public function init() { if (true === $this->beforeInit()) { HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_SAVE, [$this, 'onSave']); HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_UPDATE, [$this, 'onUpdate']); HasProperti...
php
public function init() { if (true === $this->beforeInit()) { HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_SAVE, [$this, 'onSave']); HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_UPDATE, [$this, 'onUpdate']); HasProperti...
[ "public", "function", "init", "(", ")", "{", "if", "(", "true", "===", "$", "this", "->", "beforeInit", "(", ")", ")", "{", "HasPropertiesEvent", "::", "on", "(", "HasProperties", "::", "class", ",", "HasProperties", "::", "EVENT_AFTER_SAVE", ",", "[", "...
Adds event listeners to perform search index actualization if pre initialization was successful
[ "Adds", "event", "listeners", "to", "perform", "search", "index", "actualization", "if", "pre", "initialization", "was", "successful" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/base/AbstractWatch.php#L20-L27
pyaesone17/sms-poh
src/SmsPohServiceProvider.php
SmsPohServiceProvider.boot
public function boot() { $this->app->singleton(SmsPohChannel::class, function ($app) { ['token' => $token, 'end_point' => $endPoint] = $app['config']->get('sms-poh'); return new SmsPohChannel($token, $endPoint); }); $this->app->singleton(SmsPoh::class, function (...
php
public function boot() { $this->app->singleton(SmsPohChannel::class, function ($app) { ['token' => $token, 'end_point' => $endPoint] = $app['config']->get('sms-poh'); return new SmsPohChannel($token, $endPoint); }); $this->app->singleton(SmsPoh::class, function (...
[ "public", "function", "boot", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "SmsPohChannel", "::", "class", ",", "function", "(", "$", "app", ")", "{", "[", "'token'", "=>", "$", "token", ",", "'end_point'", "=>", "$", "endPoint", ...
Perform post-registration booting of services. @return void
[ "Perform", "post", "-", "registration", "booting", "of", "services", "." ]
train
https://github.com/pyaesone17/sms-poh/blob/c5ee88c47da886f1209b08b48c28852a90e916f4/src/SmsPohServiceProvider.php#L14-L29
csun-metalab/laravel-directory-authentication
src/Authentication/Providers/AuthServiceProvider.php
AuthServiceProvider.register
public function register() { // if the provider method exists then we are at least in Laravel 5.1 if(method_exists('Illuminate\Auth\AuthManager', 'provider')) { // LDAP auth extension Auth::provider('ldap', function($app, array $config) { return new \CSUNMetaLab\Authentication\Providers\UserProviderLDAP()...
php
public function register() { // if the provider method exists then we are at least in Laravel 5.1 if(method_exists('Illuminate\Auth\AuthManager', 'provider')) { // LDAP auth extension Auth::provider('ldap', function($app, array $config) { return new \CSUNMetaLab\Authentication\Providers\UserProviderLDAP()...
[ "public", "function", "register", "(", ")", "{", "// if the provider method exists then we are at least in Laravel 5.1", "if", "(", "method_exists", "(", "'Illuminate\\Auth\\AuthManager'", ",", "'provider'", ")", ")", "{", "// LDAP auth extension", "Auth", "::", "provider", ...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Providers/AuthServiceProvider.php#L24-L49
mimmi20/Wurfl
src/Handlers/SamsungHandler.php
SamsungHandler.canHandle
public function canHandle($userAgent) { if (Utils::isDesktopBrowser($userAgent)) { return false; } return Utils::checkIfContainsCaseInsensitive($userAgent, 'samsung') || Utils::checkIfStartsWithAnyOf($userAgent, array('SEC-', 'SPH', 'SGH', 'SCH')); }
php
public function canHandle($userAgent) { if (Utils::isDesktopBrowser($userAgent)) { return false; } return Utils::checkIfContainsCaseInsensitive($userAgent, 'samsung') || Utils::checkIfStartsWithAnyOf($userAgent, array('SEC-', 'SPH', 'SGH', 'SCH')); }
[ "public", "function", "canHandle", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "isDesktopBrowser", "(", "$", "userAgent", ")", ")", "{", "return", "false", ";", "}", "return", "Utils", "::", "checkIfContainsCaseInsensitive", "(", "$", "userAge...
@param string $userAgent @return bool
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/SamsungHandler.php#L39-L47
mimmi20/Wurfl
src/Handlers/SamsungHandler.php
SamsungHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { if (Utils::checkIfStartsWithAnyOf($userAgent, array('SEC-', 'SAMSUNG-', 'SCH'))) { $tolerance = Utils::firstSlash($userAgent); } else { if (Utils::checkIfStartsWithAnyOf($userAgent, array('Samsung', 'SPH', 'SGH'))) { ...
php
public function applyConclusiveMatch($userAgent) { if (Utils::checkIfStartsWithAnyOf($userAgent, array('SEC-', 'SAMSUNG-', 'SCH'))) { $tolerance = Utils::firstSlash($userAgent); } else { if (Utils::checkIfStartsWithAnyOf($userAgent, array('Samsung', 'SPH', 'SGH'))) { ...
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "checkIfStartsWithAnyOf", "(", "$", "userAgent", ",", "array", "(", "'SEC-'", ",", "'SAMSUNG-'", ",", "'SCH'", ")", ")", ")", "{", "$", "tolerance", "=...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/SamsungHandler.php#L54-L67
mimmi20/Wurfl
src/Handlers/SamsungHandler.php
SamsungHandler.applyRecoveryMatch
public function applyRecoveryMatch($userAgent) { $tolerance = Utils::indexOfOrLength($userAgent, '/', strpos($userAgent, 'Samsung')); return $this->getDeviceIDFromRIS($userAgent, $tolerance); }
php
public function applyRecoveryMatch($userAgent) { $tolerance = Utils::indexOfOrLength($userAgent, '/', strpos($userAgent, 'Samsung')); return $this->getDeviceIDFromRIS($userAgent, $tolerance); }
[ "public", "function", "applyRecoveryMatch", "(", "$", "userAgent", ")", "{", "$", "tolerance", "=", "Utils", "::", "indexOfOrLength", "(", "$", "userAgent", ",", "'/'", ",", "strpos", "(", "$", "userAgent", ",", "'Samsung'", ")", ")", ";", "return", "$", ...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/SamsungHandler.php#L74-L79
DevGroup-ru/yii2-data-structure-tools
src/Properties/actions/ListGroupProperties.php
ListGroupProperties.run
public function run($id) { $propertyGroup = PropertyGroup::loadModel( $id, false, true, 86400, new NotFoundHttpException("Property group with specified id not found") ); $model = new Property(); $model->setScenario('search'...
php
public function run($id) { $propertyGroup = PropertyGroup::loadModel( $id, false, true, 86400, new NotFoundHttpException("Property group with specified id not found") ); $model = new Property(); $model->setScenario('search'...
[ "public", "function", "run", "(", "$", "id", ")", "{", "$", "propertyGroup", "=", "PropertyGroup", "::", "loadModel", "(", "$", "id", ",", "false", ",", "true", ",", "86400", ",", "new", "NotFoundHttpException", "(", "\"Property group with specified id not found...
Runs action @param integer $id id of property group model @return string @throws \yii\web\NotFoundHttpException
[ "Runs", "action" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/Properties/actions/ListGroupProperties.php#L33-L56
gorkalaucirica/HipchatAPIv2Client
API/RoomAPI.php
RoomAPI.getRooms
public function getRooms($params = array()) { $response = $this->client->get("/v2/room", $params); $rooms = array(); foreach ($response['items'] as $response) { $rooms[] = new Room($response); } return $rooms; }
php
public function getRooms($params = array()) { $response = $this->client->get("/v2/room", $params); $rooms = array(); foreach ($response['items'] as $response) { $rooms[] = new Room($response); } return $rooms; }
[ "public", "function", "getRooms", "(", "$", "params", "=", "array", "(", ")", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "get", "(", "\"/v2/room\"", ",", "$", "params", ")", ";", "$", "rooms", "=", "array", "(", ")", ";", ...
List non-archived rooms for this group More info: https://www.hipchat.com/docs/apiv2/method/get_all_rooms @param array $params Query string parameter(s), for example: array('max-results' => 30) @return array
[ "List", "non", "-", "archived", "rooms", "for", "this", "group", "More", "info", ":", "https", ":", "//", "www", ".", "hipchat", ".", "com", "/", "docs", "/", "apiv2", "/", "method", "/", "get_all_rooms" ]
train
https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/RoomAPI.php#L34-L43
gorkalaucirica/HipchatAPIv2Client
API/RoomAPI.php
RoomAPI.getRecentHistory
public function getRecentHistory($id, $params = array()) { $response = $this->client->get(sprintf('/v2/room/%s/history/latest', $id), $params); $messages = array(); foreach ($response['items'] as $response) { $messages[] = new Message($response); } return $messag...
php
public function getRecentHistory($id, $params = array()) { $response = $this->client->get(sprintf('/v2/room/%s/history/latest', $id), $params); $messages = array(); foreach ($response['items'] as $response) { $messages[] = new Message($response); } return $messag...
[ "public", "function", "getRecentHistory", "(", "$", "id", ",", "$", "params", "=", "array", "(", ")", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'/v2/room/%s/history/latest'", ",", "$", "id", ")", ",...
Fetch latest chat history for this room. More info: https://www.hipchat.com/docs/apiv2/method/view_recent_room_history @param string $id The id or name of the room @param array $params Query string parameter(s), for example: array('max-results' => 30) @return array
[ "Fetch", "latest", "chat", "history", "for", "this", "room", ".", "More", "info", ":", "https", ":", "//", "www", ".", "hipchat", ".", "com", "/", "docs", "/", "apiv2", "/", "method", "/", "view_recent_room_history" ]
train
https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/RoomAPI.php#L69-L78
gorkalaucirica/HipchatAPIv2Client
API/RoomAPI.php
RoomAPI.createRoom
public function createRoom(Room $room) { $response = $this->client->post("/v2/room", $room->toJson()); return $response['id']; }
php
public function createRoom(Room $room) { $response = $this->client->post("/v2/room", $room->toJson()); return $response['id']; }
[ "public", "function", "createRoom", "(", "Room", "$", "room", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "post", "(", "\"/v2/room\"", ",", "$", "room", "->", "toJson", "(", ")", ")", ";", "return", "$", "response", "[", "'id'"...
Creates a room More info: https://www.hipchat.com/docs/apiv2/method/create_room @param Room $room New room to be persisted @return integer Just created room id
[ "Creates", "a", "room", "More", "info", ":", "https", ":", "//", "www", ".", "hipchat", ".", "com", "/", "docs", "/", "apiv2", "/", "method", "/", "create_room" ]
train
https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/RoomAPI.php#L88-L93
gorkalaucirica/HipchatAPIv2Client
API/RoomAPI.php
RoomAPI.updateRoom
public function updateRoom(Room $room) { $this->client->put(sprintf("/v2/room/%s", $room->getId()), $room->toJson()); }
php
public function updateRoom(Room $room) { $this->client->put(sprintf("/v2/room/%s", $room->getId()), $room->toJson()); }
[ "public", "function", "updateRoom", "(", "Room", "$", "room", ")", "{", "$", "this", "->", "client", "->", "put", "(", "sprintf", "(", "\"/v2/room/%s\"", ",", "$", "room", "->", "getId", "(", ")", ")", ",", "$", "room", "->", "toJson", "(", ")", ")...
Updates a room More info: https://www.hipchat.com/docs/apiv2/method/update_room @param Room $room Existing room to be updated @return void
[ "Updates", "a", "room", "More", "info", ":", "https", ":", "//", "www", ".", "hipchat", ".", "com", "/", "docs", "/", "apiv2", "/", "method", "/", "update_room" ]
train
https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/RoomAPI.php#L103-L106
gorkalaucirica/HipchatAPIv2Client
API/RoomAPI.php
RoomAPI.sendRoomNotification
public function sendRoomNotification($id, Message $message) { $id = rawurlencode($id); $this->client->post("/v2/room/$id/notification", $message->toJson()); }
php
public function sendRoomNotification($id, Message $message) { $id = rawurlencode($id); $this->client->post("/v2/room/$id/notification", $message->toJson()); }
[ "public", "function", "sendRoomNotification", "(", "$", "id", ",", "Message", "$", "message", ")", "{", "$", "id", "=", "rawurlencode", "(", "$", "id", ")", ";", "$", "this", "->", "client", "->", "post", "(", "\"/v2/room/$id/notification\"", ",", "$", "...
Send a room a notification More info: https://www.hipchat.com/docs/apiv2/method/send_room_notification @param string $id The id or name of the room @param Message $message The message to be sent @return void
[ "Send", "a", "room", "a", "notification", "More", "info", ":", "https", ":", "//", "www", ".", "hipchat", ".", "com", "/", "docs", "/", "apiv2", "/", "method", "/", "send_room_notification" ]
train
https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/RoomAPI.php#L130-L134
gorkalaucirica/HipchatAPIv2Client
API/RoomAPI.php
RoomAPI.inviteUser
public function inviteUser($roomId, $memberId, $reason) { $this->client->post(sprintf('/v2/room/%s/invite/%s', $roomId, $memberId), array('reason' => $reason)); }
php
public function inviteUser($roomId, $memberId, $reason) { $this->client->post(sprintf('/v2/room/%s/invite/%s', $roomId, $memberId), array('reason' => $reason)); }
[ "public", "function", "inviteUser", "(", "$", "roomId", ",", "$", "memberId", ",", "$", "reason", ")", "{", "$", "this", "->", "client", "->", "post", "(", "sprintf", "(", "'/v2/room/%s/invite/%s'", ",", "$", "roomId", ",", "$", "memberId", ")", ",", "...
Invites a member to a public room More info: https://www.hipchat.com/docs/apiv2/method/invite_user @param string $roomId The id or name of the room @param string $memberId The id, email address, or mention name (beginning with an '@') of the user @param string $reason The message displayed to a user when they are invi...
[ "Invites", "a", "member", "to", "a", "public", "room", "More", "info", ":", "https", ":", "//", "www", ".", "hipchat", ".", "com", "/", "docs", "/", "apiv2", "/", "method", "/", "invite_user" ]
train
https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/RoomAPI.php#L174-L177
gorkalaucirica/HipchatAPIv2Client
API/RoomAPI.php
RoomAPI.createWebhook
public function createWebhook($roomId, Webhook $webhook) { $response = $this->client->post(sprintf('/v2/room/%s/webhook', $roomId), $webhook->toJson()); return $response['id']; }
php
public function createWebhook($roomId, Webhook $webhook) { $response = $this->client->post(sprintf('/v2/room/%s/webhook', $roomId), $webhook->toJson()); return $response['id']; }
[ "public", "function", "createWebhook", "(", "$", "roomId", ",", "Webhook", "$", "webhook", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "post", "(", "sprintf", "(", "'/v2/room/%s/webhook'", ",", "$", "roomId", ")", ",", "$", "webhoo...
Creates a new webhook More info: https://www.hipchat.com/docs/apiv2/method/create_webhook @param string $roomId The id or name of the room @param Webhook $webhook The webhook to create @return int Just created webhook id
[ "Creates", "a", "new", "webhook", "More", "info", ":", "https", ":", "//", "www", ".", "hipchat", ".", "com", "/", "docs", "/", "apiv2", "/", "method", "/", "create_webhook" ]
train
https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/RoomAPI.php#L202-L207
gorkalaucirica/HipchatAPIv2Client
API/RoomAPI.php
RoomAPI.getAllWebhooks
public function getAllWebhooks($roomId) { $webhooks = array(); $response = $this->client->get(sprintf('/v2/room/%s/webhook', $roomId)); foreach ($response['items'] as $item) { $webhooks[] = new Webhook($item); } return $webhooks; }
php
public function getAllWebhooks($roomId) { $webhooks = array(); $response = $this->client->get(sprintf('/v2/room/%s/webhook', $roomId)); foreach ($response['items'] as $item) { $webhooks[] = new Webhook($item); } return $webhooks; }
[ "public", "function", "getAllWebhooks", "(", "$", "roomId", ")", "{", "$", "webhooks", "=", "array", "(", ")", ";", "$", "response", "=", "$", "this", "->", "client", "->", "get", "(", "sprintf", "(", "'/v2/room/%s/webhook'", ",", "$", "roomId", ")", "...
Gets all webhooks for this room More info: https://www.hipchat.com/docs/apiv2/method/get_all_webhooks @param string $roomId The id or name of the room @TODO should return a Collection @return array Array of Webhook
[ "Gets", "all", "webhooks", "for", "this", "room", "More", "info", ":", "https", ":", "//", "www", ".", "hipchat", ".", "com", "/", "docs", "/", "apiv2", "/", "method", "/", "get_all_webhooks" ]
train
https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/API/RoomAPI.php#L232-L241
PandaPlatform/framework
src/Panda/Support/Helpers/NumberHelper.php
NumberHelper.floor
public static function floor($number, $precision = 0) { $decimals = pow(10, $precision); return floor($number * $decimals) / $decimals; }
php
public static function floor($number, $precision = 0) { $decimals = pow(10, $precision); return floor($number * $decimals) / $decimals; }
[ "public", "static", "function", "floor", "(", "$", "number", ",", "$", "precision", "=", "0", ")", "{", "$", "decimals", "=", "pow", "(", "10", ",", "$", "precision", ")", ";", "return", "floor", "(", "$", "number", "*", "$", "decimals", ")", "/", ...
Calculate the floor of a number including decimals. It has the same functionality as floor() but it can also include decimals. @param float $number The float number to round. @param int $precision The number of decimals to include. @return float
[ "Calculate", "the", "floor", "of", "a", "number", "including", "decimals", ".", "It", "has", "the", "same", "functionality", "as", "floor", "()", "but", "it", "can", "also", "include", "decimals", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/NumberHelper.php#L29-L34
PandaPlatform/framework
src/Panda/Support/Helpers/NumberHelper.php
NumberHelper.isEqual
public static function isEqual($value1, $value2, $roundPrecision = 0) { $equal = false; if (static::floor($value1, $roundPrecision) == static::floor($value2, $roundPrecision)) { $equal = true; } return $equal; }
php
public static function isEqual($value1, $value2, $roundPrecision = 0) { $equal = false; if (static::floor($value1, $roundPrecision) == static::floor($value2, $roundPrecision)) { $equal = true; } return $equal; }
[ "public", "static", "function", "isEqual", "(", "$", "value1", ",", "$", "value2", ",", "$", "roundPrecision", "=", "0", ")", "{", "$", "equal", "=", "false", ";", "if", "(", "static", "::", "floor", "(", "$", "value1", ",", "$", "roundPrecision", ")...
Checks if of two numbers are equal. Optional to set a required precision @param float $value1 @param float $value2 @param int $roundPrecision @return bool
[ "Checks", "if", "of", "two", "numbers", "are", "equal", ".", "Optional", "to", "set", "a", "required", "precision" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/NumberHelper.php#L60-L69
mimmi20/Wurfl
src/Handlers/Normalizer/Specific/WindowsPhone.php
WindowsPhone.normalize
public function normalize($userAgent) { if (Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7')) || Utils::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edge/')) ) { $model = WindowsPhoneHandler::getWindowsPhoneDesktopModel($u...
php
public function normalize($userAgent) { if (Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7')) || Utils::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edge/')) ) { $model = WindowsPhoneHandler::getWindowsPhoneDesktopModel($u...
[ "public", "function", "normalize", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "checkIfContainsAnyOf", "(", "$", "userAgent", ",", "array", "(", "'WPDesktop'", ",", "'ZuneWP7'", ")", ")", "||", "Utils", "::", "checkIfContainsAll", "(", "$", ...
@param string $userAgent @return string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Specific/WindowsPhone.php#L36-L61
christophe-brachet/aspi-framework
src/Framework/Form/Fields.php
Fields.create
public static function create($name, array $field) { if (!isset($field['type'])) { throw new Exception('Error: The field type was not set.'); } $type = $field['type']; $value = (isset($field['value'])) ? $field['value'] : null; $values ...
php
public static function create($name, array $field) { if (!isset($field['type'])) { throw new Exception('Error: The field type was not set.'); } $type = $field['type']; $value = (isset($field['value'])) ? $field['value'] : null; $values ...
[ "public", "static", "function", "create", "(", "$", "name", ",", "array", "$", "field", ")", "{", "if", "(", "!", "isset", "(", "$", "field", "[", "'type'", "]", ")", ")", "{", "throw", "new", "Exception", "(", "'Error: The field type was not set.'", ")"...
Static factory method to create a field element object from a field config array @param string $name @param array $field @throws Exception @return Element\AbstractElement
[ "Static", "factory", "method", "to", "create", "a", "field", "element", "object", "from", "a", "field", "config", "array" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fields.php#L25-L154
christophe-brachet/aspi-framework
src/Framework/Form/Fields.php
Fields.getConfigFromTable
public static function getConfigFromTable(array $tableInfo, array $attribs = null, array $config = null, $omit = null) { $fields = []; if (!isset($tableInfo['tableName']) || !isset($tableInfo['columns'])) { throw new Exception('Error: The table info parameter is not in the correct format...
php
public static function getConfigFromTable(array $tableInfo, array $attribs = null, array $config = null, $omit = null) { $fields = []; if (!isset($tableInfo['tableName']) || !isset($tableInfo['columns'])) { throw new Exception('Error: The table info parameter is not in the correct format...
[ "public", "static", "function", "getConfigFromTable", "(", "array", "$", "tableInfo", ",", "array", "$", "attribs", "=", "null", ",", "array", "$", "config", "=", "null", ",", "$", "omit", "=", "null", ")", "{", "$", "fields", "=", "[", "]", ";", "if...
Static factory method to get field configs from a database table @param array $tableInfo @param array $attribs @param array $config @param mixed $omit @throws Exception @return array
[ "Static", "factory", "method", "to", "get", "field", "configs", "from", "a", "database", "table" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fields.php#L165-L229
markwatkinson/luminous
src/Luminous/Utils/HtmlTemplates.php
HtmlTemplates.format
public static function format($template, $variables, $stripWhitespaceFromTemplate = true) { if ($stripWhitespaceFromTemplate) { $template = self::stripTemplateWhitespace($template); } foreach ($variables as $search => $replace) { $template = str_replace("{" . $search...
php
public static function format($template, $variables, $stripWhitespaceFromTemplate = true) { if ($stripWhitespaceFromTemplate) { $template = self::stripTemplateWhitespace($template); } foreach ($variables as $search => $replace) { $template = str_replace("{" . $search...
[ "public", "static", "function", "format", "(", "$", "template", ",", "$", "variables", ",", "$", "stripWhitespaceFromTemplate", "=", "true", ")", "{", "if", "(", "$", "stripWhitespaceFromTemplate", ")", "{", "$", "template", "=", "self", "::", "stripTemplateWh...
Formats a string with a given set of values The format syntax uses {xyz} as a placeholder, which will be substituted from the 'xyz' key from $variables @param $template The template string @param $variables An associative (keyed) array of values to be substituted @param $strip_whitespace_from_template If @c TRUE, the ...
[ "Formats", "a", "string", "with", "a", "given", "set", "of", "values", "The", "format", "syntax", "uses", "{", "xyz", "}", "as", "a", "placeholder", "which", "will", "be", "substituted", "from", "the", "xyz", "key", "from", "$variables" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/HtmlTemplates.php#L96-L106
Arcavias/ext-phpexcel
lib/custom/src/MW/Container/Content/PHPExcel.php
MW_Container_Content_PHPExcel.add
public function add( $data ) { $columnNum = 0; $rowNum = $this->_iterator->current()->getRowIndex(); foreach( (array) $data as $value ) { $this->_sheet->setCellValueByColumnAndRow( $columnNum++, $rowNum, $value ); } $this->_iterator->next(); }
php
public function add( $data ) { $columnNum = 0; $rowNum = $this->_iterator->current()->getRowIndex(); foreach( (array) $data as $value ) { $this->_sheet->setCellValueByColumnAndRow( $columnNum++, $rowNum, $value ); } $this->_iterator->next(); }
[ "public", "function", "add", "(", "$", "data", ")", "{", "$", "columnNum", "=", "0", ";", "$", "rowNum", "=", "$", "this", "->", "_iterator", "->", "current", "(", ")", "->", "getRowIndex", "(", ")", ";", "foreach", "(", "(", "array", ")", "$", "...
Adds a row to the content object. @param mixed $data Data to add
[ "Adds", "a", "row", "to", "the", "content", "object", "." ]
train
https://github.com/Arcavias/ext-phpexcel/blob/00e6ce6205e4f44eb0c438093b523b084a019e8d/lib/custom/src/MW/Container/Content/PHPExcel.php#L54-L64
unimapper/unimapper
src/Association.php
Association.create
public static function create(Assoc $option) { $definition = $option->getDefinition(); switch ($option->getType()) { case "m:n": case "m>n": case "m<n": return new ManyToMany( $option->getSourceReflection(), ...
php
public static function create(Assoc $option) { $definition = $option->getDefinition(); switch ($option->getType()) { case "m:n": case "m>n": case "m<n": return new ManyToMany( $option->getSourceReflection(), ...
[ "public", "static", "function", "create", "(", "Assoc", "$", "option", ")", "{", "$", "definition", "=", "$", "option", "->", "getDefinition", "(", ")", ";", "switch", "(", "$", "option", "->", "getType", "(", ")", ")", "{", "case", "\"m:n\"", ":", "...
@param Assoc $option @return Association @throws AssociationException
[ "@param", "Assoc", "$option" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Association.php#L61-L96
unimapper/unimapper
src/Association.php
Association.groupResult
public static function groupResult(array $original, array $keys, $level = 0) { $converted = []; $key = $keys[$level]; $isDeepest = sizeof($keys) - 1 == $level; $level++; $filtered = []; foreach ($original as $k => $subArray) { $subArray = (array) $subAr...
php
public static function groupResult(array $original, array $keys, $level = 0) { $converted = []; $key = $keys[$level]; $isDeepest = sizeof($keys) - 1 == $level; $level++; $filtered = []; foreach ($original as $k => $subArray) { $subArray = (array) $subAr...
[ "public", "static", "function", "groupResult", "(", "array", "$", "original", ",", "array", "$", "keys", ",", "$", "level", "=", "0", ")", "{", "$", "converted", "=", "[", "]", ";", "$", "key", "=", "$", "keys", "[", "$", "level", "]", ";", "$", ...
Group associative array @param array $original @param array $keys @param int $level @return array @link http://tigrou.nl/2012/11/26/group-a-php-array-to-a-tree-structure/ @throws \Exception
[ "Group", "associative", "array" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Association.php#L111-L154
ahuggins/utilities
src/Console/Commands/CreateUser.php
CreateUser.handle
public function handle() { User::create([ 'name' => $this->ask('Name?'), 'email' => $this->ask('Email address?'), 'password' => bcrypt($this->secret('Password?')) ]); $this->info('User saved'); }
php
public function handle() { User::create([ 'name' => $this->ask('Name?'), 'email' => $this->ask('Email address?'), 'password' => bcrypt($this->secret('Password?')) ]); $this->info('User saved'); }
[ "public", "function", "handle", "(", ")", "{", "User", "::", "create", "(", "[", "'name'", "=>", "$", "this", "->", "ask", "(", "'Name?'", ")", ",", "'email'", "=>", "$", "this", "->", "ask", "(", "'Email address?'", ")", ",", "'password'", "=>", "bc...
Execute the console command. @return mixed
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/ahuggins/utilities/blob/efb79f2dd12335e8115722568239ee22c899e0f1/src/Console/Commands/CreateUser.php#L39-L48
wshafer/assetmanager-core
src/Resolver/AliasPathStackResolver.php
AliasPathStackResolver.resolve
public function resolve($name) { if ($this->isLfiProtectionOn() && preg_match('#\.\.[\\\/]#', $name)) { return null; } foreach ($this->aliases as $alias => $path) { if (strpos($name, $alias) !== 0) { continue; } $filename = su...
php
public function resolve($name) { if ($this->isLfiProtectionOn() && preg_match('#\.\.[\\\/]#', $name)) { return null; } foreach ($this->aliases as $alias => $path) { if (strpos($name, $alias) !== 0) { continue; } $filename = su...
[ "public", "function", "resolve", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "isLfiProtectionOn", "(", ")", "&&", "preg_match", "(", "'#\\.\\.[\\\\\\/]#'", ",", "$", "name", ")", ")", "{", "return", "null", ";", "}", "foreach", "(", "$", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Resolver/AliasPathStackResolver.php#L106-L131
guillaumemonet/Rad
src/Rad/Http/RequestTrait.php
RequestTrait.getRealIPAddress
public function getRealIPAddress() { $ip = null; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //check ip from share internet $ip = $_SERVER['HTTP_CLIENT_IP']; } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy $ip ...
php
public function getRealIPAddress() { $ip = null; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //check ip from share internet $ip = $_SERVER['HTTP_CLIENT_IP']; } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy $ip ...
[ "public", "function", "getRealIPAddress", "(", ")", "{", "$", "ip", "=", "null", ";", "if", "(", "!", "empty", "(", "$", "_SERVER", "[", "'HTTP_CLIENT_IP'", "]", ")", ")", "{", "//check ip from share internet", "$", "ip", "=", "$", "_SERVER", "[", "'HTTP...
If your visitor comes from proxy server you have use another function to get a real IP address: @return string or false if no ip get
[ "If", "your", "visitor", "comes", "from", "proxy", "server", "you", "have", "use", "another", "function", "to", "get", "a", "real", "IP", "address", ":" ]
train
https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Http/RequestTrait.php#L88-L100
yosmanyga/validation
src/Yosmanyga/Validation/Validator/ValidatedObjectValidator.php
ValidatedObjectValidator.validate
public function validate($value) { if (!$value instanceof ValidatedInterface) { throw new \InvalidArgumentException('Object must be instance of ValidatedInterface'); } $validator = $value->createValidator(); return $validator->validate($value); }
php
public function validate($value) { if (!$value instanceof ValidatedInterface) { throw new \InvalidArgumentException('Object must be instance of ValidatedInterface'); } $validator = $value->createValidator(); return $validator->validate($value); }
[ "public", "function", "validate", "(", "$", "value", ")", "{", "if", "(", "!", "$", "value", "instanceof", "ValidatedInterface", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Object must be instance of ValidatedInterface'", ")", ";", "}", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Validator/ValidatedObjectValidator.php#L10-L19
fetus-hina/docomo-dialogue
src/RequestParameter.php
RequestParameter.reset
public function reset() { $this->parameters = [ 'utt' => null, 'context' => null, 'mode' => self::MODE_DIALOG, 't' => self::CHARACTER_DEFAULT, ]; $this->user_info = null; return $this; }
php
public function reset() { $this->parameters = [ 'utt' => null, 'context' => null, 'mode' => self::MODE_DIALOG, 't' => self::CHARACTER_DEFAULT, ]; $this->user_info = null; return $this; }
[ "public", "function", "reset", "(", ")", "{", "$", "this", "->", "parameters", "=", "[", "'utt'", "=>", "null", ",", "'context'", "=>", "null", ",", "'mode'", "=>", "self", "::", "MODE_DIALOG", ",", "'t'", "=>", "self", "::", "CHARACTER_DEFAULT", ",", ...
パラメータを完全にリセットする return self
[ "パラメータを完全にリセットする" ]
train
https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/RequestParameter.php#L116-L126
fetus-hina/docomo-dialogue
src/RequestParameter.php
RequestParameter.setUserInput
public function setUserInput($value) { validators\Text::validate($value, 255, 'User input too long'); $value = mb_substr($value, 0, 255, 'UTF-8'); $this->parameters['utt'] = $value; return $this; }
php
public function setUserInput($value) { validators\Text::validate($value, 255, 'User input too long'); $value = mb_substr($value, 0, 255, 'UTF-8'); $this->parameters['utt'] = $value; return $this; }
[ "public", "function", "setUserInput", "(", "$", "value", ")", "{", "validators", "\\", "Text", "::", "validate", "(", "$", "value", ",", "255", ",", "'User input too long'", ")", ";", "$", "value", "=", "mb_substr", "(", "$", "value", ",", "0", ",", "2...
ユーザ入力テキストを設定 @param string $value テキスト @return self @throws DomainError
[ "ユーザ入力テキストを設定" ]
train
https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/RequestParameter.php#L188-L194
fetus-hina/docomo-dialogue
src/RequestParameter.php
RequestParameter.setContext
public function setContext($value) { validators\Text::validate($value, 255, 'Context id too long'); $value = mb_substr($value, 0, 255, 'UTF-8'); $this->parameters['context'] = $value; return $this; }
php
public function setContext($value) { validators\Text::validate($value, 255, 'Context id too long'); $value = mb_substr($value, 0, 255, 'UTF-8'); $this->parameters['context'] = $value; return $this; }
[ "public", "function", "setContext", "(", "$", "value", ")", "{", "validators", "\\", "Text", "::", "validate", "(", "$", "value", ",", "255", ",", "'Context id too long'", ")", ";", "$", "value", "=", "mb_substr", "(", "$", "value", ",", "0", ",", "255...
コンテキストIDを設定 @param string $value コンテキストID @return self
[ "コンテキストIDを設定" ]
train
https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/RequestParameter.php#L202-L208
fetus-hina/docomo-dialogue
src/RequestParameter.php
RequestParameter.setMode
public function setMode($value) { if ($value !== null && $value !== self::MODE_DIALOG && $value !== self::MODE_SRTR) { throw new DomainError('Invalid mode'); } $this->parameters['mode'] = $value; return $this; }
php
public function setMode($value) { if ($value !== null && $value !== self::MODE_DIALOG && $value !== self::MODE_SRTR) { throw new DomainError('Invalid mode'); } $this->parameters['mode'] = $value; return $this; }
[ "public", "function", "setMode", "(", "$", "value", ")", "{", "if", "(", "$", "value", "!==", "null", "&&", "$", "value", "!==", "self", "::", "MODE_DIALOG", "&&", "$", "value", "!==", "self", "::", "MODE_SRTR", ")", "{", "throw", "new", "DomainError",...
対話モードを設定 @param string $value 対話モード MODE_DIALOG | MODE_SRTR @return self
[ "対話モードを設定" ]
train
https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/RequestParameter.php#L216-L225
fetus-hina/docomo-dialogue
src/RequestParameter.php
RequestParameter.setCharacter
public function setCharacter($value) { if ($value !== self::CHARACTER_DEFAULT && $value !== self::CHARACTER_KANSAI && $value !== self::CHARACTER_BABY) { throw new DomainError('Invalid character'); } $this->parameters['t'] = $value; return $this; ...
php
public function setCharacter($value) { if ($value !== self::CHARACTER_DEFAULT && $value !== self::CHARACTER_KANSAI && $value !== self::CHARACTER_BABY) { throw new DomainError('Invalid character'); } $this->parameters['t'] = $value; return $this; ...
[ "public", "function", "setCharacter", "(", "$", "value", ")", "{", "if", "(", "$", "value", "!==", "self", "::", "CHARACTER_DEFAULT", "&&", "$", "value", "!==", "self", "::", "CHARACTER_KANSAI", "&&", "$", "value", "!==", "self", "::", "CHARACTER_BABY", ")...
キャラクタIDを設定 @param int $value キャラクタID CHARACTER_DEFAULT | CHARACTER_KANSAI | CHARACTER_BABY @return self
[ "キャラクタIDを設定" ]
train
https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/RequestParameter.php#L233-L242
rfdy/imagemagick
CLI/Operation/Strip.php
Strip.process
public function process(Image $image, $command_line = '') { $result = new Result(); $result->setCommandLine($command_line . ' -strip'); return $result; }
php
public function process(Image $image, $command_line = '') { $result = new Result(); $result->setCommandLine($command_line . ' -strip'); return $result; }
[ "public", "function", "process", "(", "Image", "$", "image", ",", "$", "command_line", "=", "''", ")", "{", "$", "result", "=", "new", "Result", "(", ")", ";", "$", "result", "->", "setCommandLine", "(", "$", "command_line", ".", "' -strip'", ")", ";",...
@param Image $image @param string $command_line @return Result
[ "@param", "Image", "$image", "@param", "string", "$command_line" ]
train
https://github.com/rfdy/imagemagick/blob/dd1e52fbd66093828dd013e64c53dc7d68f1bc91/CLI/Operation/Strip.php#L14-L18
christophe-brachet/aspi-framework
src/Framework/Form/Element/Select.php
Select.setValue
public function setValue($value) { $this->selected = $value; if ($this->hasChildren()) { foreach ($this->childNodes as $child) { if ($child instanceof Select\Option) { if ($child->getValue() == $this->selected) { $child->select(...
php
public function setValue($value) { $this->selected = $value; if ($this->hasChildren()) { foreach ($this->childNodes as $child) { if ($child instanceof Select\Option) { if ($child->getValue() == $this->selected) { $child->select(...
[ "public", "function", "setValue", "(", "$", "value", ")", "{", "$", "this", "->", "selected", "=", "$", "value", ";", "if", "(", "$", "this", "->", "hasChildren", "(", ")", ")", "{", "foreach", "(", "$", "this", "->", "childNodes", "as", "$", "chil...
Set the selected value of the select form element @param mixed $value @return Select
[ "Set", "the", "selected", "value", "of", "the", "select", "form", "element" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Select.php#L83-L107
christophe-brachet/aspi-framework
src/Framework/Form/Element/Select.php
Select.resetValue
public function resetValue() { $this->selected = null; if ($this->hasChildren()) { foreach ($this->childNodes as $child) { if ($child instanceof Select\Option) { $child->deselect(); } else if ($child instanceof Select\Optgroup) { ...
php
public function resetValue() { $this->selected = null; if ($this->hasChildren()) { foreach ($this->childNodes as $child) { if ($child instanceof Select\Option) { $child->deselect(); } else if ($child instanceof Select\Optgroup) { ...
[ "public", "function", "resetValue", "(", ")", "{", "$", "this", "->", "selected", "=", "null", ";", "if", "(", "$", "this", "->", "hasChildren", "(", ")", ")", "{", "foreach", "(", "$", "this", "->", "childNodes", "as", "$", "child", ")", "{", "if"...
Reset the value of the form element @return Select
[ "Reset", "the", "value", "of", "the", "form", "element" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Select.php#L113-L129
cauditor/php-analyzer
src/Aggregator.php
Aggregator.average
public function average() { $flat = $this->flatten(); $avg = array(); foreach ($flat as $metric => $values) { $avg[$metric] = (float) number_format(array_sum($values) / count($values), 2, '.', ''); } return $avg; }
php
public function average() { $flat = $this->flatten(); $avg = array(); foreach ($flat as $metric => $values) { $avg[$metric] = (float) number_format(array_sum($values) / count($values), 2, '.', ''); } return $avg; }
[ "public", "function", "average", "(", ")", "{", "$", "flat", "=", "$", "this", "->", "flatten", "(", ")", ";", "$", "avg", "=", "array", "(", ")", ";", "foreach", "(", "$", "flat", "as", "$", "metric", "=>", "$", "values", ")", "{", "$", "avg",...
Get metric averages. @return float[]
[ "Get", "metric", "averages", "." ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Aggregator.php#L35-L45
cauditor/php-analyzer
src/Aggregator.php
Aggregator.weigh
public function weigh() { $flat = $this->flatten(); $weighed = array(); foreach ($flat as $metric => $data) { $weighed[$metric] = 0; $relevant = 0; foreach ($data as $name => $value) { $loc = isset($flat['loc'][$name]) ? $flat['loc'][$name...
php
public function weigh() { $flat = $this->flatten(); $weighed = array(); foreach ($flat as $metric => $data) { $weighed[$metric] = 0; $relevant = 0; foreach ($data as $name => $value) { $loc = isset($flat['loc'][$name]) ? $flat['loc'][$name...
[ "public", "function", "weigh", "(", ")", "{", "$", "flat", "=", "$", "this", "->", "flatten", "(", ")", ";", "$", "weighed", "=", "array", "(", ")", ";", "foreach", "(", "$", "flat", "as", "$", "metric", "=>", "$", "data", ")", "{", "$", "weigh...
Get weighed metric averages, where the bigger a method/class is, the more it's metric value will count towards the result. @return float[]
[ "Get", "weighed", "metric", "averages", "where", "the", "bigger", "a", "method", "/", "class", "is", "the", "more", "it", "s", "metric", "value", "will", "count", "towards", "the", "result", "." ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Aggregator.php#L77-L95
cauditor/php-analyzer
src/Aggregator.php
Aggregator.flatten
protected function flatten() { if (!$this->flat) { $this->flat = $this->recurse($this->metrics); } return $this->flat; }
php
protected function flatten() { if (!$this->flat) { $this->flat = $this->recurse($this->metrics); } return $this->flat; }
[ "protected", "function", "flatten", "(", ")", "{", "if", "(", "!", "$", "this", "->", "flat", ")", "{", "$", "this", "->", "flat", "=", "$", "this", "->", "recurse", "(", "$", "this", "->", "metrics", ")", ";", "}", "return", "$", "this", "->", ...
Flatten metrics into [metric => [value1, value1, value3]] array. @return float[][]
[ "Flatten", "metrics", "into", "[", "metric", "=", ">", "[", "value1", "value1", "value3", "]]", "array", "." ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Aggregator.php#L102-L109
cauditor/php-analyzer
src/Aggregator.php
Aggregator.recurse
protected function recurse(array $metrics) { $flat = array(); $metrics = (array) $metrics; foreach ($metrics as $metric => $value) { // name & children are meta data, not metrics if (!in_array($metric, array('name', 'children'))) { $name = isset($metr...
php
protected function recurse(array $metrics) { $flat = array(); $metrics = (array) $metrics; foreach ($metrics as $metric => $value) { // name & children are meta data, not metrics if (!in_array($metric, array('name', 'children'))) { $name = isset($metr...
[ "protected", "function", "recurse", "(", "array", "$", "metrics", ")", "{", "$", "flat", "=", "array", "(", ")", ";", "$", "metrics", "=", "(", "array", ")", "$", "metrics", ";", "foreach", "(", "$", "metrics", "as", "$", "metric", "=>", "$", "valu...
@param array $metrics @return float[][]
[ "@param", "array", "$metrics" ]
train
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Aggregator.php#L116-L146
joomla-projects/jorobo
src/Tasks/Build/CBPlugin.php
CBPlugin.run
public function run() { $this->say('Building CB Plugin: ' . $this->plgName . " (" . $this->plgType . ")"); // Prepare directories $this->prepareDirectories(); $files = $this->copyTarget($this->source, $this->target); // Build language files $language = $this->buildLanguage("plug_" . $this->plgType . "_"...
php
public function run() { $this->say('Building CB Plugin: ' . $this->plgName . " (" . $this->plgType . ")"); // Prepare directories $this->prepareDirectories(); $files = $this->copyTarget($this->source, $this->target); // Build language files $language = $this->buildLanguage("plug_" . $this->plgType . "_"...
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "say", "(", "'Building CB Plugin: '", ".", "$", "this", "->", "plgName", ".", "\" (\"", ".", "$", "this", "->", "plgType", ".", "\")\"", ")", ";", "// Prepare directories", "$", "this", "->",...
Build the package @return bool @since 1.0
[ "Build", "the", "package" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/CBPlugin.php#L67-L84
joomla-projects/jorobo
src/Tasks/Build/CBPlugin.php
CBPlugin.createInstaller
private function createInstaller($files) { $this->say("Creating plugin installer"); $xmlFile = $this->target . "/" . str_replace('plug_', '', $this->plgName) . ".xml"; // Version & Date Replace $this->replaceInFile($xmlFile); }
php
private function createInstaller($files) { $this->say("Creating plugin installer"); $xmlFile = $this->target . "/" . str_replace('plug_', '', $this->plgName) . ".xml"; // Version & Date Replace $this->replaceInFile($xmlFile); }
[ "private", "function", "createInstaller", "(", "$", "files", ")", "{", "$", "this", "->", "say", "(", "\"Creating plugin installer\"", ")", ";", "$", "xmlFile", "=", "$", "this", "->", "target", ".", "\"/\"", ".", "str_replace", "(", "'plug_'", ",", "''", ...
Generate the installer xml file for the plugin @param array $files The module files @return void @since 1.0
[ "Generate", "the", "installer", "xml", "file", "for", "the", "plugin" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/CBPlugin.php#L108-L116
terdia/legato-framework
src/Security/Auth/Auth.php
Auth.user
public static function user() { $log_me_in = session()->get('log_me_in'); try { $decrypted = decrypt($log_me_in); } catch (Exception $exception) { return false; } $authConfig = getConfigPath('app', 'auth'); return Gate::user($authConfig, $de...
php
public static function user() { $log_me_in = session()->get('log_me_in'); try { $decrypted = decrypt($log_me_in); } catch (Exception $exception) { return false; } $authConfig = getConfigPath('app', 'auth'); return Gate::user($authConfig, $de...
[ "public", "static", "function", "user", "(", ")", "{", "$", "log_me_in", "=", "session", "(", ")", "->", "get", "(", "'log_me_in'", ")", ";", "try", "{", "$", "decrypted", "=", "decrypt", "(", "$", "log_me_in", ")", ";", "}", "catch", "(", "Exception...
Get the authenticated user. @return mixed
[ "Get", "the", "authenticated", "user", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Security/Auth/Auth.php#L39-L52
terdia/legato-framework
src/Security/Auth/Auth.php
Auth.remembered
public static function remembered(Request $request) { $remember = readCookie($request, 'remember_token'); if ($remember != null) { try { $decrypted = decrypt($remember); $authConfig = getConfigPath('app', 'auth'); return Gate::user($authCo...
php
public static function remembered(Request $request) { $remember = readCookie($request, 'remember_token'); if ($remember != null) { try { $decrypted = decrypt($remember); $authConfig = getConfigPath('app', 'auth'); return Gate::user($authCo...
[ "public", "static", "function", "remembered", "(", "Request", "$", "request", ")", "{", "$", "remember", "=", "readCookie", "(", "$", "request", ",", "'remember_token'", ")", ";", "if", "(", "$", "remember", "!=", "null", ")", "{", "try", "{", "$", "de...
Check remember user. @param Request $request @return bool|mixed
[ "Check", "remember", "user", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Security/Auth/Auth.php#L71-L86
joomla-projects/jorobo
src/Tasks/Deploy/FtpUpload.php
FtpUpload.run
public function run() { $this->say('Uploading ' . $this->getJConfig()->extension . $this->getJConfig()->version . " via FTP"); // Todo Move filepath and name to config $this->filename = $this->getExtensionName() . "-" . $this->getJConfig()->version . ".zip"; $this->filepath = JPATH_BASE . "/dist/" . $this->fi...
php
public function run() { $this->say('Uploading ' . $this->getJConfig()->extension . $this->getJConfig()->version . " via FTP"); // Todo Move filepath and name to config $this->filename = $this->getExtensionName() . "-" . $this->getJConfig()->version . ".zip"; $this->filepath = JPATH_BASE . "/dist/" . $this->fi...
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "say", "(", "'Uploading '", ".", "$", "this", "->", "getJConfig", "(", ")", "->", "extension", ".", "$", "this", "->", "getJConfig", "(", ")", "->", "version", ".", "\" via FTP\"", ")", "...
Build the package @return bool @since 1.0
[ "Build", "the", "package" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Deploy/FtpUpload.php#L57-L111
falkmueller/hubert
src/generic/controller.php
controller.responseRedirect
protected function responseRedirect($url, $status = null) { $responseWithRedirect = $this->_response->withHeader('Location', (string)$url); if (is_null($status) && $this->_response->getStatusCode() === 200) { $status = 302; } if (!is_null($status)) { return $r...
php
protected function responseRedirect($url, $status = null) { $responseWithRedirect = $this->_response->withHeader('Location', (string)$url); if (is_null($status) && $this->_response->getStatusCode() === 200) { $status = 302; } if (!is_null($status)) { return $r...
[ "protected", "function", "responseRedirect", "(", "$", "url", ",", "$", "status", "=", "null", ")", "{", "$", "responseWithRedirect", "=", "$", "this", "->", "_response", "->", "withHeader", "(", "'Location'", ",", "(", "string", ")", "$", "url", ")", ";...
set redirekt url in response @param string $url @param int $status @return \Zend\Diactoros\Response
[ "set", "redirekt", "url", "in", "response" ]
train
https://github.com/falkmueller/hubert/blob/a4fa52de158262dddd9cf349bf5267f7923874f9/src/generic/controller.php#L40-L50
falkmueller/hubert
src/generic/controller.php
controller.responseJson
protected function responseJson($data, $status = null, $encodingOptions = 0) { $body = $this->_response->getBody(); $body->rewind(); $body->write($json = json_encode($data, $encodingOptions)); // Ensure that the json encoding passed successfully if ($json === false) { ...
php
protected function responseJson($data, $status = null, $encodingOptions = 0) { $body = $this->_response->getBody(); $body->rewind(); $body->write($json = json_encode($data, $encodingOptions)); // Ensure that the json encoding passed successfully if ($json === false) { ...
[ "protected", "function", "responseJson", "(", "$", "data", ",", "$", "status", "=", "null", ",", "$", "encodingOptions", "=", "0", ")", "{", "$", "body", "=", "$", "this", "->", "_response", "->", "getBody", "(", ")", ";", "$", "body", "->", "rewind"...
transform response for with json-data @param type $data @param int $status @param type $encodingOptions @return \Zend\Diactoros\Response @throws \RuntimeException
[ "transform", "response", "for", "with", "json", "-", "data" ]
train
https://github.com/falkmueller/hubert/blob/a4fa52de158262dddd9cf349bf5267f7923874f9/src/generic/controller.php#L60-L74
falkmueller/hubert
src/generic/controller.php
controller.responseTemplate
protected function responseTemplate($template, $data = array()){ if(!isset(hubert()->template)){ throw new \Exception("no template engine installed"); } $html = hubert()->template->render($template, $data); $this->_response->getBody()->write($html); ...
php
protected function responseTemplate($template, $data = array()){ if(!isset(hubert()->template)){ throw new \Exception("no template engine installed"); } $html = hubert()->template->render($template, $data); $this->_response->getBody()->write($html); ...
[ "protected", "function", "responseTemplate", "(", "$", "template", ",", "$", "data", "=", "array", "(", ")", ")", "{", "if", "(", "!", "isset", "(", "hubert", "(", ")", "->", "template", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"no te...
render template in response @param string $template @param array $data @return \Zend\Diactoros\Response
[ "render", "template", "in", "response" ]
train
https://github.com/falkmueller/hubert/blob/a4fa52de158262dddd9cf349bf5267f7923874f9/src/generic/controller.php#L82-L92
transfer-framework/transfer
src/Transfer/Worker/SplitterWorker.php
SplitterWorker.handle
public function handle($object) { if (!is_array($object)) { throw new \InvalidArgumentException(sprintf('Expected array for splitting, got %s', gettype($object))); } $storage = $this->stack->getScope('local'); foreach ($object as $element) { $storage->add($e...
php
public function handle($object) { if (!is_array($object)) { throw new \InvalidArgumentException(sprintf('Expected array for splitting, got %s', gettype($object))); } $storage = $this->stack->getScope('local'); foreach ($object as $element) { $storage->add($e...
[ "public", "function", "handle", "(", "$", "object", ")", "{", "if", "(", "!", "is_array", "(", "$", "object", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Expected array for splitting, got %s'", ",", "gettype", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Worker/SplitterWorker.php#L26-L37