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
codeburnerframework/router
src/Path.php
Path.to
public function to($name, array $args = []) { $route = $this->collector->findNamedRoute($name); $parser = $this->collector->getParser(); $pattern = $route->getPattern(); preg_match_all("~" . $parser::DYNAMIC_REGEX . "~x", $pattern, $matches, PREG_SET_ORDER); foreach ((array...
php
public function to($name, array $args = []) { $route = $this->collector->findNamedRoute($name); $parser = $this->collector->getParser(); $pattern = $route->getPattern(); preg_match_all("~" . $parser::DYNAMIC_REGEX . "~x", $pattern, $matches, PREG_SET_ORDER); foreach ((array...
[ "public", "function", "to", "(", "$", "name", ",", "array", "$", "args", "=", "[", "]", ")", "{", "$", "route", "=", "$", "this", "->", "collector", "->", "findNamedRoute", "(", "$", "name", ")", ";", "$", "parser", "=", "$", "this", "->", "colle...
Generate a path to a route named by $name. @param string $name @param array $args @throws \BadMethodCallException @return string
[ "Generate", "a", "path", "to", "a", "route", "named", "by", "$name", "." ]
train
https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Path.php#L49-L66
comelyio/comely
src/Comely/IO/Events/Event/Trigger.php
Trigger.params
public function params(...$params): self { $this->params = $params; array_push($this->params, $this->event); return $this; }
php
public function params(...$params): self { $this->params = $params; array_push($this->params, $this->event); return $this; }
[ "public", "function", "params", "(", "...", "$", "params", ")", ":", "self", "{", "$", "this", "->", "params", "=", "$", "params", ";", "array_push", "(", "$", "this", "->", "params", ",", "$", "this", "->", "event", ")", ";", "return", "$", "this"...
All arguments passed to this method will be forwarded to callback functions of all listeners @param array ...$params @return Trigger
[ "All", "arguments", "passed", "to", "this", "method", "will", "be", "forwarded", "to", "callback", "functions", "of", "all", "listeners" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Events/Event/Trigger.php#L50-L55
seeren/http
src/Request/AbstractRequest.php
AbstractRequest.parseMethod
private final function parseMethod(string $method): string { return static::GET === $method || static::POST === $method || static::PUT === $method || static::DELETE === $method || static::OPTIONS === $method ? $method : static::GET; ...
php
private final function parseMethod(string $method): string { return static::GET === $method || static::POST === $method || static::PUT === $method || static::DELETE === $method || static::OPTIONS === $method ? $method : static::GET; ...
[ "private", "final", "function", "parseMethod", "(", "string", "$", "method", ")", ":", "string", "{", "return", "static", "::", "GET", "===", "$", "method", "||", "static", "::", "POST", "===", "$", "method", "||", "static", "::", "PUT", "===", "$", "m...
Parse method @param string $method method @return string method
[ "Parse", "method" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/AbstractRequest.php#L71-L80
seeren/http
src/Request/AbstractRequest.php
AbstractRequest.withRequestTarget
public final function withRequestTarget($requestTarget): RequestInterface { return $this->with( "uri", $this->uri->withPath((string) $requestTarget)); }
php
public final function withRequestTarget($requestTarget): RequestInterface { return $this->with( "uri", $this->uri->withPath((string) $requestTarget)); }
[ "public", "final", "function", "withRequestTarget", "(", "$", "requestTarget", ")", ":", "RequestInterface", "{", "return", "$", "this", "->", "with", "(", "\"uri\"", ",", "$", "this", "->", "uri", "->", "withPath", "(", "(", "string", ")", "$", "requestTa...
{@inheritDoc} @see \Psr\Http\Message\RequestInterface::withRequestTarget()
[ "{" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/AbstractRequest.php#L95-L100
seeren/http
src/Request/AbstractRequest.php
AbstractRequest.withMethod
public final function withMethod($method): RequestInterface { if (!is_string($method) || !($toUpperMethod = strtoupper((string) $method)) || $toUpperMethod !== $this->parseMethod($method)) { throw new InvalidArgumentException( "Can't get instance for method: " ....
php
public final function withMethod($method): RequestInterface { if (!is_string($method) || !($toUpperMethod = strtoupper((string) $method)) || $toUpperMethod !== $this->parseMethod($method)) { throw new InvalidArgumentException( "Can't get instance for method: " ....
[ "public", "final", "function", "withMethod", "(", "$", "method", ")", ":", "RequestInterface", "{", "if", "(", "!", "is_string", "(", "$", "method", ")", "||", "!", "(", "$", "toUpperMethod", "=", "strtoupper", "(", "(", "string", ")", "$", "method", "...
{@inheritDoc} @see \Psr\Http\Message\RequestInterface::withMethod()
[ "{" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/AbstractRequest.php#L115-L124
seeren/http
src/Request/AbstractRequest.php
AbstractRequest.withUri
public final function withUri( UriInterface $uri, $preserveHost = false): RequestInterface { if (true === $preserveHost && !array_key_exists("Host", $this->header) && $uri->getHost()) { return $this->with("uri", $uri)->withHeader("Host", $uri->getHost()); ...
php
public final function withUri( UriInterface $uri, $preserveHost = false): RequestInterface { if (true === $preserveHost && !array_key_exists("Host", $this->header) && $uri->getHost()) { return $this->with("uri", $uri)->withHeader("Host", $uri->getHost()); ...
[ "public", "final", "function", "withUri", "(", "UriInterface", "$", "uri", ",", "$", "preserveHost", "=", "false", ")", ":", "RequestInterface", "{", "if", "(", "true", "===", "$", "preserveHost", "&&", "!", "array_key_exists", "(", "\"Host\"", ",", "$", "...
{@inheritDoc} @see \Psr\Http\Message\RequestInterface::withUri()
[ "{" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Request/AbstractRequest.php#L139-L149
linkorb/objectstorage
src/Command/EncryptCommand.php
EncryptCommand.hextostr
private function hextostr($hex) { $string=''; for ($i=0; $i < strlen($hex)-1; $i+=2) { $string .= chr(hexdec($hex[$i].$hex[$i+1])); } return $string; }
php
private function hextostr($hex) { $string=''; for ($i=0; $i < strlen($hex)-1; $i+=2) { $string .= chr(hexdec($hex[$i].$hex[$i+1])); } return $string; }
[ "private", "function", "hextostr", "(", "$", "hex", ")", "{", "$", "string", "=", "''", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "strlen", "(", "$", "hex", ")", "-", "1", ";", "$", "i", "+=", "2", ")", "{", "$", "string", ...
/* private function strtohex($x) { $s=''; foreach (str_split($x) as $c) { $s.=sprintf("%02X", ord($c)); } return($s); }
[ "/", "*", "private", "function", "strtohex", "(", "$x", ")", "{", "$s", "=", ";", "foreach", "(", "str_split", "(", "$x", ")", "as", "$c", ")", "{", "$s", ".", "=", "sprintf", "(", "%02X", "ord", "(", "$c", "))", ";", "}", "return", "(", "$s", ...
train
https://github.com/linkorb/objectstorage/blob/e363dd8f8c406c222910d8b4040c832db1c4aa48/src/Command/EncryptCommand.php#L39-L46
kabirbaidhya/AwesomeCache
src/Cache.php
Cache.cachedData
public function cachedData() { if (!$this->isCached()) { return null; } $contents = file_get_contents($this->file); $serializationEnabled = static::config('serialize'); $data = $serializationEnabled ? unserialize($contents) : $contents; return $data; ...
php
public function cachedData() { if (!$this->isCached()) { return null; } $contents = file_get_contents($this->file); $serializationEnabled = static::config('serialize'); $data = $serializationEnabled ? unserialize($contents) : $contents; return $data; ...
[ "public", "function", "cachedData", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isCached", "(", ")", ")", "{", "return", "null", ";", "}", "$", "contents", "=", "file_get_contents", "(", "$", "this", "->", "file", ")", ";", "$", "serialization...
Retrieves the cached data that is refered by this object @return mixed
[ "Retrieves", "the", "cached", "data", "that", "is", "refered", "by", "this", "object" ]
train
https://github.com/kabirbaidhya/AwesomeCache/blob/ecf6293f3bcb3855133b1a8962c53170af1ebc32/src/Cache.php#L80-L93
kabirbaidhya/AwesomeCache
src/Cache.php
Cache.putInCache
public function putInCache($data) { if (!$data) { throw new CacheException("No data provided for storing in the cache"); } $serializationEnabled = static::config('serialize'); if(!$serializationEnabled && !is_scalar($data)) { throw new CacheException("Trying...
php
public function putInCache($data) { if (!$data) { throw new CacheException("No data provided for storing in the cache"); } $serializationEnabled = static::config('serialize'); if(!$serializationEnabled && !is_scalar($data)) { throw new CacheException("Trying...
[ "public", "function", "putInCache", "(", "$", "data", ")", "{", "if", "(", "!", "$", "data", ")", "{", "throw", "new", "CacheException", "(", "\"No data provided for storing in the cache\"", ")", ";", "}", "$", "serializationEnabled", "=", "static", "::", "con...
Stores the data in the cache Note: Repeatedly calling this will overwrite the existing data @param mixed $data
[ "Stores", "the", "data", "in", "the", "cache", "Note", ":", "Repeatedly", "calling", "this", "will", "overwrite", "the", "existing", "data" ]
train
https://github.com/kabirbaidhya/AwesomeCache/blob/ecf6293f3bcb3855133b1a8962c53170af1ebc32/src/Cache.php#L100-L126
kabirbaidhya/AwesomeCache
src/Cache.php
Cache.clearAll
public static function clearAll() { $dir = new \DirectoryIterator(static::config('directory')); foreach ($dir as $fileinfo) { if ($fileinfo->isFile()) { $cacheKey = $fileinfo->getFilename(); static::clear($cacheKey); } } }
php
public static function clearAll() { $dir = new \DirectoryIterator(static::config('directory')); foreach ($dir as $fileinfo) { if ($fileinfo->isFile()) { $cacheKey = $fileinfo->getFilename(); static::clear($cacheKey); } } }
[ "public", "static", "function", "clearAll", "(", ")", "{", "$", "dir", "=", "new", "\\", "DirectoryIterator", "(", "static", "::", "config", "(", "'directory'", ")", ")", ";", "foreach", "(", "$", "dir", "as", "$", "fileinfo", ")", "{", "if", "(", "$...
Clear all the cache data stored in the cache directory @return void
[ "Clear", "all", "the", "cache", "data", "stored", "in", "the", "cache", "directory" ]
train
https://github.com/kabirbaidhya/AwesomeCache/blob/ecf6293f3bcb3855133b1a8962c53170af1ebc32/src/Cache.php#L185-L196
kabirbaidhya/AwesomeCache
src/Cache.php
Cache.countAll
public static function countAll() { $count = 0; $dir = new \DirectoryIterator(static::config('directory')); foreach ($dir as $fileinfo) { if ($fileinfo->isFile()) { $count++; } } return $count; }
php
public static function countAll() { $count = 0; $dir = new \DirectoryIterator(static::config('directory')); foreach ($dir as $fileinfo) { if ($fileinfo->isFile()) { $count++; } } return $count; }
[ "public", "static", "function", "countAll", "(", ")", "{", "$", "count", "=", "0", ";", "$", "dir", "=", "new", "\\", "DirectoryIterator", "(", "static", "::", "config", "(", "'directory'", ")", ")", ";", "foreach", "(", "$", "dir", "as", "$", "filei...
Returns the total number of unique cached data @return int
[ "Returns", "the", "total", "number", "of", "unique", "cached", "data" ]
train
https://github.com/kabirbaidhya/AwesomeCache/blob/ecf6293f3bcb3855133b1a8962c53170af1ebc32/src/Cache.php#L202-L215
kabirbaidhya/AwesomeCache
src/Cache.php
Cache.clear
public static function clear($key) { $that = new static($key); if ($that->isCached()) { $deletionSuccess = unlink($that->filePath()); if(!$deletionSuccess) { throw new CacheException(sprintf("Could not delete file '%s'", $this->filePath())); ...
php
public static function clear($key) { $that = new static($key); if ($that->isCached()) { $deletionSuccess = unlink($that->filePath()); if(!$deletionSuccess) { throw new CacheException(sprintf("Could not delete file '%s'", $this->filePath())); ...
[ "public", "static", "function", "clear", "(", "$", "key", ")", "{", "$", "that", "=", "new", "static", "(", "$", "key", ")", ";", "if", "(", "$", "that", "->", "isCached", "(", ")", ")", "{", "$", "deletionSuccess", "=", "unlink", "(", "$", "that...
Clear/Delete a specified data by its key @param string $key @return void
[ "Clear", "/", "Delete", "a", "specified", "data", "by", "its", "key" ]
train
https://github.com/kabirbaidhya/AwesomeCache/blob/ecf6293f3bcb3855133b1a8962c53170af1ebc32/src/Cache.php#L230-L242
lodev09/php-util
src/Util.php
Util.get_options
public static function get_options($config, &$message = null) { if (!$config) return []; if (is_string($config)) $config = [$config]; $config[] = 'help::'; $short_opts = ''; $long_opts = []; $required = []; $is_cli = self::is_cli(); $options_...
php
public static function get_options($config, &$message = null) { if (!$config) return []; if (is_string($config)) $config = [$config]; $config[] = 'help::'; $short_opts = ''; $long_opts = []; $required = []; $is_cli = self::is_cli(); $options_...
[ "public", "static", "function", "get_options", "(", "$", "config", ",", "&", "$", "message", "=", "null", ")", "{", "if", "(", "!", "$", "config", ")", "return", "[", "]", ";", "if", "(", "is_string", "(", "$", "config", ")", ")", "$", "config", ...
get cli options/switches. If run via http, gets data from $_GET instead @param array $config options configuration (extended). see php's getopt @param string &$message exception messages @return array | boolean returns false if not valid, returns array otherwise
[ "get", "cli", "options", "/", "switches", ".", "If", "run", "via", "http", "gets", "data", "from", "$_GET", "instead" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L127-L225
lodev09/php-util
src/Util.php
Util.print_status
public static function print_status($status = 200, $data = [], $options = JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK, $return = false) { if (is_numeric($status)) $status_code = $status; else if (is_bool($status)) $status_code = $status ? 200 : 400; else $status_code = strtolower($status) === 'ok'...
php
public static function print_status($status = 200, $data = [], $options = JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK, $return = false) { if (is_numeric($status)) $status_code = $status; else if (is_bool($status)) $status_code = $status ? 200 : 400; else $status_code = strtolower($status) === 'ok'...
[ "public", "static", "function", "print_status", "(", "$", "status", "=", "200", ",", "$", "data", "=", "[", "]", ",", "$", "options", "=", "JSON_PRETTY_PRINT", "|", "JSON_NUMERIC_CHECK", ",", "$", "return", "=", "false", ")", "{", "if", "(", "is_numeric"...
encode and print the result to json (used for ajax routines) @param string $status status @param string $message message @param mixed $data data @param bool $return should return json @return string json encoded string
[ "encode", "and", "print", "the", "result", "to", "json", "(", "used", "for", "ajax", "routines", ")" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L288-L307
lodev09/php-util
src/Util.php
Util.verify_fields
public static function verify_fields($required, $fields = null, &$missing = []) { if (!$fields) { $missing = $required; return false; } foreach ($required as $field) { $isset = is_array($fields) ? isset($fields[$field]) : isset($fields->{$field}); ...
php
public static function verify_fields($required, $fields = null, &$missing = []) { if (!$fields) { $missing = $required; return false; } foreach ($required as $field) { $isset = is_array($fields) ? isset($fields[$field]) : isset($fields->{$field}); ...
[ "public", "static", "function", "verify_fields", "(", "$", "required", ",", "$", "fields", "=", "null", ",", "&", "$", "missing", "=", "[", "]", ")", "{", "if", "(", "!", "$", "fields", ")", "{", "$", "missing", "=", "$", "required", ";", "return",...
Check params of an array/object provided by the given required keys @param mixed $required array or object that are required @param mixed $fields array or object that contains the currrent provided params @return boolean true if validated, otherwise false
[ "Check", "params", "of", "an", "array", "/", "object", "provided", "by", "the", "given", "required", "keys" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L314-L326
lodev09/php-util
src/Util.php
Util.slugify
public static function slugify($text, $lowercase = true, $skip_chars = '') { // replace non letter or digits by - $text = preg_replace('~[^\\pL\d'.$skip_chars.']+~u', '-', $text); // trim $text = trim($text, '-'); // transliterate $text = iconv('utf-8', 'us-ascii/...
php
public static function slugify($text, $lowercase = true, $skip_chars = '') { // replace non letter or digits by - $text = preg_replace('~[^\\pL\d'.$skip_chars.']+~u', '-', $text); // trim $text = trim($text, '-'); // transliterate $text = iconv('utf-8', 'us-ascii/...
[ "public", "static", "function", "slugify", "(", "$", "text", ",", "$", "lowercase", "=", "true", ",", "$", "skip_chars", "=", "''", ")", "{", "// replace non letter or digits by -\r", "$", "text", "=", "preg_replace", "(", "'~[^\\\\pL\\d'", ".", "$", "skip_cha...
Convert a string to friendly SEO string @param string $text input @return string output
[ "Convert", "a", "string", "to", "friendly", "SEO", "string" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L344-L362
lodev09/php-util
src/Util.php
Util.set_values
public static function set_values($defaults, $values, $default_key = "") { if ($default_key != "") { if (!is_array($values)) { if (isset($defaults[$default_key])) $defaults[$default_key] = $values; return $defaults; } } if ($values...
php
public static function set_values($defaults, $values, $default_key = "") { if ($default_key != "") { if (!is_array($values)) { if (isset($defaults[$default_key])) $defaults[$default_key] = $values; return $defaults; } } if ($values...
[ "public", "static", "function", "set_values", "(", "$", "defaults", ",", "$", "values", ",", "$", "default_key", "=", "\"\"", ")", "{", "if", "(", "$", "default_key", "!=", "\"\"", ")", "{", "if", "(", "!", "is_array", "(", "$", "values", ")", ")", ...
Set values from default properties of an array @param array $defaults The defualt array structure @param array $values The input array @param string $default_key Default key if input is a string or something @return array Returns the right array
[ "Set", "values", "from", "default", "properties", "of", "an", "array" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L370-L385
lodev09/php-util
src/Util.php
Util.read_csv
public static function read_csv($filename, $with_header = true, $headers = null, $delimiter = ',') { $data = []; $index = 0; $header_count = $headers ? count($headers) : 0; $handle = @fopen($filename, "r") or false; if ($handle !== FALSE) { while (($row = fget...
php
public static function read_csv($filename, $with_header = true, $headers = null, $delimiter = ',') { $data = []; $index = 0; $header_count = $headers ? count($headers) : 0; $handle = @fopen($filename, "r") or false; if ($handle !== FALSE) { while (($row = fget...
[ "public", "static", "function", "read_csv", "(", "$", "filename", ",", "$", "with_header", "=", "true", ",", "$", "headers", "=", "null", ",", "$", "delimiter", "=", "','", ")", "{", "$", "data", "=", "[", "]", ";", "$", "index", "=", "0", ";", "...
Read CSV from URL or File @param string $filename Filename @param string $headers Delimiter @return array [description]
[ "Read", "CSV", "from", "URL", "or", "File" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L392-L427
lodev09/php-util
src/Util.php
Util.parse_email
public static function parse_email($str, $separator = ",") { $str = trim(preg_replace('/\s+/', ' ', $str)); $all = []; $emails = preg_split('/(".*?"\s*<.+?>)\s*' . $separator . '*|' . $separator . '+/', $str, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); foreach ($emails as ...
php
public static function parse_email($str, $separator = ",") { $str = trim(preg_replace('/\s+/', ' ', $str)); $all = []; $emails = preg_split('/(".*?"\s*<.+?>)\s*' . $separator . '*|' . $separator . '+/', $str, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); foreach ($emails as ...
[ "public", "static", "function", "parse_email", "(", "$", "str", ",", "$", "separator", "=", "\",\"", ")", "{", "$", "str", "=", "trim", "(", "preg_replace", "(", "'/\\s+/'", ",", "' '", ",", "$", "str", ")", ")", ";", "$", "all", "=", "[", "]", "...
Parse email address string @param string $str string input @param string $separator separator, default "," @return array array
[ "Parse", "email", "address", "string" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L434-L463
lodev09/php-util
src/Util.php
Util.get_session_info
public static function get_session_info() { $browser_info = get_browser_info(); $result = new stdClass; $result->ip = get_client_ip(); $result->browser_info = (object)$browser_info; return $result; }
php
public static function get_session_info() { $browser_info = get_browser_info(); $result = new stdClass; $result->ip = get_client_ip(); $result->browser_info = (object)$browser_info; return $result; }
[ "public", "static", "function", "get_session_info", "(", ")", "{", "$", "browser_info", "=", "get_browser_info", "(", ")", ";", "$", "result", "=", "new", "stdClass", ";", "$", "result", "->", "ip", "=", "get_client_ip", "(", ")", ";", "$", "result", "->...
Store client session info to an object @return stdClass returns the object containing details of the session
[ "Store", "client", "session", "info", "to", "an", "object" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L468-L475
lodev09/php-util
src/Util.php
Util.distance
public static function distance($origin, $dest, $radius = 6371) { if (!(isset($origin[0]) && isset($origin[1]))) return false; if (!(isset($dest[0]) && isset($dest[1]))) return false; $lat_orig = $origin[0]; $lng_orig = $origin[1]; $lat_dest = $dest[0]; $lng_d...
php
public static function distance($origin, $dest, $radius = 6371) { if (!(isset($origin[0]) && isset($origin[1]))) return false; if (!(isset($dest[0]) && isset($dest[1]))) return false; $lat_orig = $origin[0]; $lng_orig = $origin[1]; $lat_dest = $dest[0]; $lng_d...
[ "public", "static", "function", "distance", "(", "$", "origin", ",", "$", "dest", ",", "$", "radius", "=", "6371", ")", "{", "if", "(", "!", "(", "isset", "(", "$", "origin", "[", "0", "]", ")", "&&", "isset", "(", "$", "origin", "[", "1", "]",...
calculate position distance (haversine formula) in miles
[ "calculate", "position", "distance", "(", "haversine", "formula", ")", "in", "miles" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L491-L510
lodev09/php-util
src/Util.php
Util.get_client_ip
public static function get_client_ip() { $ipaddress = ''; if (getenv('HTTP_CLIENT_IP')) $ipaddress = getenv('HTTP_CLIENT_IP'); else if (getenv('HTTP_X_FORWARDED_FOR')) $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); else if (getenv('HTTP_X_FORWARDED')) $ipaddress = getenv('HTTP_X_FORWAR...
php
public static function get_client_ip() { $ipaddress = ''; if (getenv('HTTP_CLIENT_IP')) $ipaddress = getenv('HTTP_CLIENT_IP'); else if (getenv('HTTP_X_FORWARDED_FOR')) $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); else if (getenv('HTTP_X_FORWARDED')) $ipaddress = getenv('HTTP_X_FORWAR...
[ "public", "static", "function", "get_client_ip", "(", ")", "{", "$", "ipaddress", "=", "''", ";", "if", "(", "getenv", "(", "'HTTP_CLIENT_IP'", ")", ")", "$", "ipaddress", "=", "getenv", "(", "'HTTP_CLIENT_IP'", ")", ";", "else", "if", "(", "getenv", "("...
Get the client's IP Address @return string IP address string
[ "Get", "the", "client", "s", "IP", "Address" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L516-L526
lodev09/php-util
src/Util.php
Util.get_browser_info
public static function get_browser_info() { $u_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'UNKNOWN'; $bname = 'Unknown'; $platform = 'Unknown'; $ub = 'Unknown'; $version = ""; //First get the platform? if (preg_match('/linux/...
php
public static function get_browser_info() { $u_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'UNKNOWN'; $bname = 'Unknown'; $platform = 'Unknown'; $ub = 'Unknown'; $version = ""; //First get the platform? if (preg_match('/linux/...
[ "public", "static", "function", "get_browser_info", "(", ")", "{", "$", "u_agent", "=", "isset", "(", "$", "_SERVER", "[", "'HTTP_USER_AGENT'", "]", ")", "?", "$", "_SERVER", "[", "'HTTP_USER_AGENT'", "]", ":", "'UNKNOWN'", ";", "$", "bname", "=", "'Unknow...
Get your browser's info @return stdClass returns the object containing the info of your browser
[ "Get", "your", "browser", "s", "info" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L531-L602
lodev09/php-util
src/Util.php
Util.encrypt
public static function encrypt($data, $key, $iv) { $output = false; $encrypt_method = "AES-256-CBC"; // hash $key = hash_hmac('sha256', $data, $iv); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr($iv, 0, 16); ...
php
public static function encrypt($data, $key, $iv) { $output = false; $encrypt_method = "AES-256-CBC"; // hash $key = hash_hmac('sha256', $data, $iv); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr($iv, 0, 16); ...
[ "public", "static", "function", "encrypt", "(", "$", "data", ",", "$", "key", ",", "$", "iv", ")", "{", "$", "output", "=", "false", ";", "$", "encrypt_method", "=", "\"AES-256-CBC\"", ";", "// hash\r", "$", "key", "=", "hash_hmac", "(", "'sha256'", ",...
Returns an base64 encoded encrypted string
[ "Returns", "an", "base64", "encoded", "encrypted", "string" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L607-L619
lodev09/php-util
src/Util.php
Util.decrypt
public static function decrypt($data, $key, $iv) { $output = false; $encrypt_method = "AES-256-CBC"; // hash $key = hash_hmac('sha256', $data, $iv); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr($iv, 0, 16); ...
php
public static function decrypt($data, $key, $iv) { $output = false; $encrypt_method = "AES-256-CBC"; // hash $key = hash_hmac('sha256', $data, $iv); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr($iv, 0, 16); ...
[ "public", "static", "function", "decrypt", "(", "$", "data", ",", "$", "key", ",", "$", "iv", ")", "{", "$", "output", "=", "false", ";", "$", "encrypt_method", "=", "\"AES-256-CBC\"", ";", "// hash\r", "$", "key", "=", "hash_hmac", "(", "'sha256'", ",...
Returns decrypted original string
[ "Returns", "decrypted", "original", "string" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L624-L635
lodev09/php-util
src/Util.php
Util.parse_seo_string
public static function parse_seo_string($input, $replace = '-', $remove_words_array = []) { //make it lowercase, remove punctuation, remove multiple/leading/ending spaces $return = trim(ereg_replace(' +', ' ', preg_replace('/[^a-zA-Z0-9\s]/', '', strtolower($input)))); //remove words, if not ...
php
public static function parse_seo_string($input, $replace = '-', $remove_words_array = []) { //make it lowercase, remove punctuation, remove multiple/leading/ending spaces $return = trim(ereg_replace(' +', ' ', preg_replace('/[^a-zA-Z0-9\s]/', '', strtolower($input)))); //remove words, if not ...
[ "public", "static", "function", "parse_seo_string", "(", "$", "input", ",", "$", "replace", "=", "'-'", ",", "$", "remove_words_array", "=", "[", "]", ")", "{", "//make it lowercase, remove punctuation, remove multiple/leading/ending spaces\r", "$", "return", "=", "tr...
/* takes the input, scrubs bad characters
[ "/", "*", "takes", "the", "input", "scrubs", "bad", "characters" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L638-L663
lodev09/php-util
src/Util.php
Util.time_in_words
public static function time_in_words($date, $with_time = true) { if (!$date) return 'N/A'; $timestamp = strtotime($date); $distance = (round(abs(time() - $timestamp) / 60)); if ($distance <= 1) { $return = ($distance == 0) ? 'a few seconds ago' : '1 minute ago'; ...
php
public static function time_in_words($date, $with_time = true) { if (!$date) return 'N/A'; $timestamp = strtotime($date); $distance = (round(abs(time() - $timestamp) / 60)); if ($distance <= 1) { $return = ($distance == 0) ? 'a few seconds ago' : '1 minute ago'; ...
[ "public", "static", "function", "time_in_words", "(", "$", "date", ",", "$", "with_time", "=", "true", ")", "{", "if", "(", "!", "$", "date", ")", "return", "'N/A'", ";", "$", "timestamp", "=", "strtotime", "(", "$", "date", ")", ";", "$", "distance"...
time_in_words() @param mixed $timestamp @return
[ "time_in_words", "()" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L799-L821
lodev09/php-util
src/Util.php
Util.escape_html
public static function escape_html($src, $nl2br = false) { if (is_array($src)) { return array_map([__CLASS__, 'escape_html'], $src); } else if (is_object($src)) { return (object)array_map([__CLASS__, 'escape_html'] , self::to_array($src)); } else { if (i...
php
public static function escape_html($src, $nl2br = false) { if (is_array($src)) { return array_map([__CLASS__, 'escape_html'], $src); } else if (is_object($src)) { return (object)array_map([__CLASS__, 'escape_html'] , self::to_array($src)); } else { if (i...
[ "public", "static", "function", "escape_html", "(", "$", "src", ",", "$", "nl2br", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "src", ")", ")", "{", "return", "array_map", "(", "[", "__CLASS__", ",", "'escape_html'", "]", ",", "$", "src"...
escape_html() @param mixed $str_value @return
[ "escape_html", "()" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L828-L838
lodev09/php-util
src/Util.php
Util.to_array
public static function to_array($object) { if (is_array($object)) return $object; if (!is_object($object) && !is_array($object)) return $object; if (is_object($object)) $object = get_object_vars($object); return array_map([ __CLASS__, 'to_array' ]...
php
public static function to_array($object) { if (is_array($object)) return $object; if (!is_object($object) && !is_array($object)) return $object; if (is_object($object)) $object = get_object_vars($object); return array_map([ __CLASS__, 'to_array' ]...
[ "public", "static", "function", "to_array", "(", "$", "object", ")", "{", "if", "(", "is_array", "(", "$", "object", ")", ")", "return", "$", "object", ";", "if", "(", "!", "is_object", "(", "$", "object", ")", "&&", "!", "is_array", "(", "$", "obj...
Convert an object to an array @param object $object The object to convert @reeturn array
[ "Convert", "an", "object", "to", "an", "array" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L865-L874
lodev09/php-util
src/Util.php
Util.to_object
public static function to_object($array, $recursive = false) { if (!is_object($array) && !is_array($array)) return $array; if (!$recursive) return (object)$array; if (is_array($array)) return (object)array_map([ __CLASS__, 'to_object' ], $array); ...
php
public static function to_object($array, $recursive = false) { if (!is_object($array) && !is_array($array)) return $array; if (!$recursive) return (object)$array; if (is_array($array)) return (object)array_map([ __CLASS__, 'to_object' ], $array); ...
[ "public", "static", "function", "to_object", "(", "$", "array", ",", "$", "recursive", "=", "false", ")", "{", "if", "(", "!", "is_object", "(", "$", "array", ")", "&&", "!", "is_array", "(", "$", "array", ")", ")", "return", "$", "array", ";", "if...
Convert an array to an object @param array $array The array to convert @reeturn object
[ "Convert", "an", "array", "to", "an", "object" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L880-L890
lodev09/php-util
src/Util.php
Util.get_card_type
public static function get_card_type($pan, $include_sub_types = false) { $pan = preg_replace('/\D/i', '', $pan); //maximum length is not fixed now, there are growing number of CCs has more numbers in length, limiting can give false negatives atm //these regexps accept not whole cc numbers t...
php
public static function get_card_type($pan, $include_sub_types = false) { $pan = preg_replace('/\D/i', '', $pan); //maximum length is not fixed now, there are growing number of CCs has more numbers in length, limiting can give false negatives atm //these regexps accept not whole cc numbers t...
[ "public", "static", "function", "get_card_type", "(", "$", "pan", ",", "$", "include_sub_types", "=", "false", ")", "{", "$", "pan", "=", "preg_replace", "(", "'/\\D/i'", ",", "''", ",", "$", "pan", ")", ";", "//maximum length is not fixed now, there are growing...
Obtain a brand constant from a PAN https://stackoverflow.com/a/21617574/3685987 @param type $pan Credit card number @param type $include_sub_types Include detection of sub visa brands @return string
[ "Obtain", "a", "brand", "constant", "from", "a", "PAN", "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "21617574", "/", "3685987" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L925-L1015
lodev09/php-util
src/Util.php
Util.zip
public static function zip($files = [], $destination = '', $overwrite = false) { // if the zip file already exists and overwrite is false, return false if (file_exists($destination) && !$overwrite) { return false; } $valid_files = []; $files = is_array($files)...
php
public static function zip($files = [], $destination = '', $overwrite = false) { // if the zip file already exists and overwrite is false, return false if (file_exists($destination) && !$overwrite) { return false; } $valid_files = []; $files = is_array($files)...
[ "public", "static", "function", "zip", "(", "$", "files", "=", "[", "]", ",", "$", "destination", "=", "''", ",", "$", "overwrite", "=", "false", ")", "{", "// if the zip file already exists and overwrite is false, return false\r", "if", "(", "file_exists", "(", ...
Create a compressed zip file @param array $files files (filename => file_location) @param string $destination destination of the zip file @param boolean $overwrite overwrite if zip file exists @return [type] true if success, otherwise false
[ "Create", "a", "compressed", "zip", "file" ]
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L1024-L1064
lodev09/php-util
src/Util.php
Util.parse_geom
public static function parse_geom($ps) { $arr = array(); //match '(' and ')' plus contents between them which contain anything other than '(' or ')' preg_match_all('/\([^\(\)]+\)/', $ps, $matches); if ($matches = $matches[0]) { foreach ($matches as $match) { ...
php
public static function parse_geom($ps) { $arr = array(); //match '(' and ')' plus contents between them which contain anything other than '(' or ')' preg_match_all('/\([^\(\)]+\)/', $ps, $matches); if ($matches = $matches[0]) { foreach ($matches as $match) { ...
[ "public", "static", "function", "parse_geom", "(", "$", "ps", ")", "{", "$", "arr", "=", "array", "(", ")", ";", "//match '(' and ')' plus contents between them which contain anything other than '(' or ')'\r", "preg_match_all", "(", "'/\\([^\\(\\)]+\\)/'", ",", "$", "ps",...
https://stackoverflow.com/questions/16482303/convert-well-known-text-wkt-from-mysql-to-google-maps-polygons-with-php
[ "https", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "16482303", "/", "convert", "-", "well", "-", "known", "-", "text", "-", "wkt", "-", "from", "-", "mysql", "-", "to", "-", "google", "-", "maps", "-", "polygons", "-", "with", ...
train
https://github.com/lodev09/php-util/blob/8f3adb0b1bbc1c9f71cab126fdf8110414e65515/src/Util.php#L1067-L1092
movoin/one-swoole
src/FileSystem/Adapter.php
Adapter.setBasePath
public function setBasePath(string $path) { if (Assert::stringNotEmpty($path)) { $this->basePath = rtrim($path, '\\/') . $this->separator; } }
php
public function setBasePath(string $path) { if (Assert::stringNotEmpty($path)) { $this->basePath = rtrim($path, '\\/') . $this->separator; } }
[ "public", "function", "setBasePath", "(", "string", "$", "path", ")", "{", "if", "(", "Assert", "::", "stringNotEmpty", "(", "$", "path", ")", ")", "{", "$", "this", "->", "basePath", "=", "rtrim", "(", "$", "path", ",", "'\\\\/'", ")", ".", "$", "...
设置根路径 @param string $path
[ "设置根路径" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Adapter.php#L48-L53
piqus/bfp4f-rcon
src/T4G/BFP4F/Rcon/Base.php
Base.init
public function init() { $this->version = $this->read(true); if(!$this->login()) return false; return true; }
php
public function init() { $this->version = $this->read(true); if(!$this->login()) return false; return true; }
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "version", "=", "$", "this", "->", "read", "(", "true", ")", ";", "if", "(", "!", "$", "this", "->", "login", "(", ")", ")", "return", "false", ";", "return", "true", ";", "}" ]
Initializes Connection and Log's In @return bool
[ "Initializes", "Connection", "and", "Log", "s", "In" ]
train
https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Base.php#L65-L72
piqus/bfp4f-rcon
src/T4G/BFP4F/Rcon/Base.php
Base.connect
public function connect(&$cn = 1, &$cs = "Unknown error") { $fp = fsockopen($this->ip, $this->port, $cn, $cs, 3) or die("Could not connect. " . date("Y-m-d H:i:s") . PHP_EOL); if (!$fp) { return false; } else { self::$socket = $fp; return true;...
php
public function connect(&$cn = 1, &$cs = "Unknown error") { $fp = fsockopen($this->ip, $this->port, $cn, $cs, 3) or die("Could not connect. " . date("Y-m-d H:i:s") . PHP_EOL); if (!$fp) { return false; } else { self::$socket = $fp; return true;...
[ "public", "function", "connect", "(", "&", "$", "cn", "=", "1", ",", "&", "$", "cs", "=", "\"Unknown error\"", ")", "{", "$", "fp", "=", "fsockopen", "(", "$", "this", "->", "ip", ",", "$", "this", "->", "port", ",", "$", "cn", ",", "$", "cs", ...
Connect with server @param int &$cn number of error @param string &$cs detailed error message @access public @return int
[ "Connect", "with", "server" ]
train
https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Base.php#L83-L93
piqus/bfp4f-rcon
src/T4G/BFP4F/Rcon/Base.php
Base.login
protected function login() { return $this->query('login '.md5(substr($this->read(true), 17) . $this->pwd)) == 'Authentication successful, rcon ready.'; }
php
protected function login() { return $this->query('login '.md5(substr($this->read(true), 17) . $this->pwd)) == 'Authentication successful, rcon ready.'; }
[ "protected", "function", "login", "(", ")", "{", "return", "$", "this", "->", "query", "(", "'login '", ".", "md5", "(", "substr", "(", "$", "this", "->", "read", "(", "true", ")", ",", "17", ")", ".", "$", "this", "->", "pwd", ")", ")", "==", ...
Tries to Login @access protected @return bool
[ "Tries", "to", "Login" ]
train
https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Base.php#L101-L104
piqus/bfp4f-rcon
src/T4G/BFP4F/Rcon/Base.php
Base.query
public static function query($line, $bare = false) { self::write($line, $bare); if(strpos($result = self::read($bare), 'rcon: unknown command:') === 0) return false; return $result; }
php
public static function query($line, $bare = false) { self::write($line, $bare); if(strpos($result = self::read($bare), 'rcon: unknown command:') === 0) return false; return $result; }
[ "public", "static", "function", "query", "(", "$", "line", ",", "$", "bare", "=", "false", ")", "{", "self", "::", "write", "(", "$", "line", ",", "$", "bare", ")", ";", "if", "(", "strpos", "(", "$", "result", "=", "self", "::", "read", "(", "...
Executes a Query on the Server @param string $line @param bool $bare @return string
[ "Executes", "a", "Query", "on", "the", "Server" ]
train
https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Base.php#L114-L121
piqus/bfp4f-rcon
src/T4G/BFP4F/Rcon/Base.php
Base.read
protected static function read($bare = false) { $delim = $bare ? "\n" : "\x04"; for($buffer = '';($char = fgetc(self::$socket)) != $delim;$buffer .= $char); return trim($buffer); }
php
protected static function read($bare = false) { $delim = $bare ? "\n" : "\x04"; for($buffer = '';($char = fgetc(self::$socket)) != $delim;$buffer .= $char); return trim($buffer); }
[ "protected", "static", "function", "read", "(", "$", "bare", "=", "false", ")", "{", "$", "delim", "=", "$", "bare", "?", "\"\\n\"", ":", "\"\\x04\"", ";", "for", "(", "$", "buffer", "=", "''", ";", "(", "$", "char", "=", "fgetc", "(", "self", ":...
Reads the Buffer @param bool $bare @return string
[ "Reads", "the", "Buffer" ]
train
https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Base.php#L143-L150
sqrt-pro/Auth
src/SQRT/Auth.php
Auth.login
public function login($login, $password, $remindme = true) { $this->user = $this->findUser($login, $password); return $this->user ? $this->saveToken($remindme) : false; }
php
public function login($login, $password, $remindme = true) { $this->user = $this->findUser($login, $password); return $this->user ? $this->saveToken($remindme) : false; }
[ "public", "function", "login", "(", "$", "login", ",", "$", "password", ",", "$", "remindme", "=", "true", ")", "{", "$", "this", "->", "user", "=", "$", "this", "->", "findUser", "(", "$", "login", ",", "$", "password", ")", ";", "return", "$", ...
Авторизация пользователя по логину и паролю. Возвращает созданный токен
[ "Авторизация", "пользователя", "по", "логину", "и", "паролю", ".", "Возвращает", "созданный", "токен" ]
train
https://github.com/sqrt-pro/Auth/blob/42a179b1075dbaa0edad70f89697462d5078c96c/src/SQRT/Auth.php#L54-L61
sqrt-pro/Auth
src/SQRT/Auth.php
Auth.loginUser
public function loginUser($user, $remindme = true) { $this->user = $user; return $this->saveToken($remindme); }
php
public function loginUser($user, $remindme = true) { $this->user = $user; return $this->saveToken($remindme); }
[ "public", "function", "loginUser", "(", "$", "user", ",", "$", "remindme", "=", "true", ")", "{", "$", "this", "->", "user", "=", "$", "user", ";", "return", "$", "this", "->", "saveToken", "(", "$", "remindme", ")", ";", "}" ]
Авторизация по объекту пользователя
[ "Авторизация", "по", "объекту", "пользователя" ]
train
https://github.com/sqrt-pro/Auth/blob/42a179b1075dbaa0edad70f89697462d5078c96c/src/SQRT/Auth.php#L64-L69
sqrt-pro/Auth
src/SQRT/Auth.php
Auth.saveToken
protected function saveToken($remindme) { if (!$u = $this->getUser()) { Ex::ThrowError(Ex::NO_USER); } $expire = strtotime('+1 month'); $token = $this->createToken($expire); $this->cookie = $remindme ? new Cookie($this->getTokenVar(), $token, $expire) : new Cookie($this->getTo...
php
protected function saveToken($remindme) { if (!$u = $this->getUser()) { Ex::ThrowError(Ex::NO_USER); } $expire = strtotime('+1 month'); $token = $this->createToken($expire); $this->cookie = $remindme ? new Cookie($this->getTokenVar(), $token, $expire) : new Cookie($this->getTo...
[ "protected", "function", "saveToken", "(", "$", "remindme", ")", "{", "if", "(", "!", "$", "u", "=", "$", "this", "->", "getUser", "(", ")", ")", "{", "Ex", "::", "ThrowError", "(", "Ex", "::", "NO_USER", ")", ";", "}", "$", "expire", "=", "strto...
Создание и сохранение токена в сессии и формирование cookie @return static
[ "Создание", "и", "сохранение", "токена", "в", "сессии", "и", "формирование", "cookie" ]
train
https://github.com/sqrt-pro/Auth/blob/42a179b1075dbaa0edad70f89697462d5078c96c/src/SQRT/Auth.php#L117-L133
sqrt-pro/Auth
src/SQRT/Auth.php
Auth.getToken
protected function getToken() { return $this->getRequest()->cookies->get($this->getTokenVar(), $this->getSession()->get($this->getTokenVar())); }
php
protected function getToken() { return $this->getRequest()->cookies->get($this->getTokenVar(), $this->getSession()->get($this->getTokenVar())); }
[ "protected", "function", "getToken", "(", ")", "{", "return", "$", "this", "->", "getRequest", "(", ")", "->", "cookies", "->", "get", "(", "$", "this", "->", "getTokenVar", "(", ")", ",", "$", "this", "->", "getSession", "(", ")", "->", "get", "(", ...
Получение токена из сессии или cookies
[ "Получение", "токена", "из", "сессии", "или", "cookies" ]
train
https://github.com/sqrt-pro/Auth/blob/42a179b1075dbaa0edad70f89697462d5078c96c/src/SQRT/Auth.php#L136-L139
movoin/one-swoole
src/Protocol/Message/Request.php
Request.getMethod
public function getMethod(): string { if ($this->method === null) { $this->method = $this->originalMethod; $customMethod = $this->getHeaderLine('X-Http-Method-Override'); if ($customMethod) { $this->method = $this->filterMethod($customMethod); ...
php
public function getMethod(): string { if ($this->method === null) { $this->method = $this->originalMethod; $customMethod = $this->getHeaderLine('X-Http-Method-Override'); if ($customMethod) { $this->method = $this->filterMethod($customMethod); ...
[ "public", "function", "getMethod", "(", ")", ":", "string", "{", "if", "(", "$", "this", "->", "method", "===", "null", ")", "{", "$", "this", "->", "method", "=", "$", "this", "->", "originalMethod", ";", "$", "customMethod", "=", "$", "this", "->",...
获得请求方法 @return string @throws \InvalidArgumentException @throws \One\Protocol\Exceptions\InvalidMethodException
[ "获得请求方法" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Request.php#L166-L182
movoin/one-swoole
src/Protocol/Message/Request.php
Request.withMethod
public function withMethod($method): RequestInterface { $method = $this->filterMethod($method); $clone = clone $this; $clone->originalMethod = $method; $clone->method = null; return $clone; }
php
public function withMethod($method): RequestInterface { $method = $this->filterMethod($method); $clone = clone $this; $clone->originalMethod = $method; $clone->method = null; return $clone; }
[ "public", "function", "withMethod", "(", "$", "method", ")", ":", "RequestInterface", "{", "$", "method", "=", "$", "this", "->", "filterMethod", "(", "$", "method", ")", ";", "$", "clone", "=", "clone", "$", "this", ";", "$", "clone", "->", "originalM...
获得指定请求方法的请求对象 @param string $method @return \One\Protocol\Contracts\Request @throws \InvalidArgumentException @throws \One\Protocol\Exceptions\InvalidMethodException
[ "获得指定请求方法的请求对象" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Request.php#L193-L202
movoin/one-swoole
src/Protocol/Message/Request.php
Request.withUri
public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface { $clone = clone $this; $clone->uri = $uri; if ($uri->getHost() !== '') { $clone->headers->set('Host', $uri->getHost()); } return $clone; }
php
public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface { $clone = clone $this; $clone->uri = $uri; if ($uri->getHost() !== '') { $clone->headers->set('Host', $uri->getHost()); } return $clone; }
[ "public", "function", "withUri", "(", "UriInterface", "$", "uri", ",", "$", "preserveHost", "=", "false", ")", ":", "RequestInterface", "{", "$", "clone", "=", "clone", "$", "this", ";", "$", "clone", "->", "uri", "=", "$", "uri", ";", "if", "(", "$"...
获得指定请求 Uri 对象的请求对象 @param \Psr\Http\Message\UriInterface $uri @param bool $preserveHost @return \One\Protocol\Contracts\Request
[ "获得指定请求", "Uri", "对象的请求对象" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Request.php#L288-L298
movoin/one-swoole
src/Protocol/Message/Request.php
Request.getParsedBody
public function getParsedBody() { if ($this->parsedBody !== false) { return $this->parsedBody; } $mediaType = $this->getMediaType(); $parts = explode('+', $mediaType); if (count($parts) >= 2) { $mediaType = 'application/' . $parts[count($parts) - 1];...
php
public function getParsedBody() { if ($this->parsedBody !== false) { return $this->parsedBody; } $mediaType = $this->getMediaType(); $parts = explode('+', $mediaType); if (count($parts) >= 2) { $mediaType = 'application/' . $parts[count($parts) - 1];...
[ "public", "function", "getParsedBody", "(", ")", "{", "if", "(", "$", "this", "->", "parsedBody", "!==", "false", ")", "{", "return", "$", "this", "->", "parsedBody", ";", "}", "$", "mediaType", "=", "$", "this", "->", "getMediaType", "(", ")", ";", ...
获得解析后的消息内容 @return null|array|object
[ "获得解析后的消息内容" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Request.php#L493-L519
movoin/one-swoole
src/Protocol/Message/Request.php
Request.header
public function header(string $name, $default = null) { if ($this->hasHeader($name)) { return $this->getHeaderLine($name); } return $default; }
php
public function header(string $name, $default = null) { if ($this->hasHeader($name)) { return $this->getHeaderLine($name); } return $default; }
[ "public", "function", "header", "(", "string", "$", "name", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "this", "->", "hasHeader", "(", "$", "name", ")", ")", "{", "return", "$", "this", "->", "getHeaderLine", "(", "$", "name", ")",...
返回 POST 参数 @param string $name @param mixed $default @return mixed
[ "返回", "POST", "参数" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Request.php#L661-L668
movoin/one-swoole
src/Protocol/Message/Request.php
Request.getClientIP
public function getClientIP(): string { $ip = $this->getServerParam('REMOTE_ADDR'); if ($this->getServerParam('HTTP_X_FORWARDED_FOR') !== null) { $ip = $this->getServerParam('HTTP_X_FORWARDED_FOR'); } if ($this->getServerParam('HTTP_CLIENT_IP') !== null) { $...
php
public function getClientIP(): string { $ip = $this->getServerParam('REMOTE_ADDR'); if ($this->getServerParam('HTTP_X_FORWARDED_FOR') !== null) { $ip = $this->getServerParam('HTTP_X_FORWARDED_FOR'); } if ($this->getServerParam('HTTP_CLIENT_IP') !== null) { $...
[ "public", "function", "getClientIP", "(", ")", ":", "string", "{", "$", "ip", "=", "$", "this", "->", "getServerParam", "(", "'REMOTE_ADDR'", ")", ";", "if", "(", "$", "this", "->", "getServerParam", "(", "'HTTP_X_FORWARDED_FOR'", ")", "!==", "null", ")", ...
获得请求 IP 地址 @return string
[ "获得请求", "IP", "地址" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Request.php#L714-L735
movoin/one-swoole
src/Protocol/Message/Request.php
Request.getMediaTypeParams
public function getMediaTypeParams(): array { $contentType = $this->getContentType(); $contentTypeParams = []; if ($contentType) { $contentTypeParts = preg_split('/\s*[;,]\s*/', $contentType); $contentTypePartsLength = count($contentTypeParts); for ($i =...
php
public function getMediaTypeParams(): array { $contentType = $this->getContentType(); $contentTypeParams = []; if ($contentType) { $contentTypeParts = preg_split('/\s*[;,]\s*/', $contentType); $contentTypePartsLength = count($contentTypeParts); for ($i =...
[ "public", "function", "getMediaTypeParams", "(", ")", ":", "array", "{", "$", "contentType", "=", "$", "this", "->", "getContentType", "(", ")", ";", "$", "contentTypeParams", "=", "[", "]", ";", "if", "(", "$", "contentType", ")", "{", "$", "contentType...
获得请求内容类型参数 @return array
[ "获得请求内容类型参数" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Request.php#L772-L790
movoin/one-swoole
src/Protocol/Message/Request.php
Request.registerMediaTypeParsers
protected function registerMediaTypeParsers() { // JSON $this->registerMediaTypeParser(['application/json'], function ($input) { $result = Json::decode($input); return is_array($result) ? $result : null; }); // XML $this->registerMediaTypeParser(['app...
php
protected function registerMediaTypeParsers() { // JSON $this->registerMediaTypeParser(['application/json'], function ($input) { $result = Json::decode($input); return is_array($result) ? $result : null; }); // XML $this->registerMediaTypeParser(['app...
[ "protected", "function", "registerMediaTypeParsers", "(", ")", "{", "// JSON", "$", "this", "->", "registerMediaTypeParser", "(", "[", "'application/json'", "]", ",", "function", "(", "$", "input", ")", "{", "$", "result", "=", "Json", "::", "decode", "(", "...
注册内容解析器
[ "注册内容解析器" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Request.php#L807-L834
movoin/one-swoole
src/Protocol/Message/Request.php
Request.registerMediaTypeParser
protected function registerMediaTypeParser(array $mediaTypes, callable $parser) { if ($parser instanceof \Closure) { $parser = $parser->bindTo($this); } foreach ($mediaTypes as $mediaType) { $this->bodyParsers[$mediaType] = $parser; } }
php
protected function registerMediaTypeParser(array $mediaTypes, callable $parser) { if ($parser instanceof \Closure) { $parser = $parser->bindTo($this); } foreach ($mediaTypes as $mediaType) { $this->bodyParsers[$mediaType] = $parser; } }
[ "protected", "function", "registerMediaTypeParser", "(", "array", "$", "mediaTypes", ",", "callable", "$", "parser", ")", "{", "if", "(", "$", "parser", "instanceof", "\\", "Closure", ")", "{", "$", "parser", "=", "$", "parser", "->", "bindTo", "(", "$", ...
注册内容解析器 @param array $mediaTypes @param callable $parser
[ "注册内容解析器" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Request.php#L842-L851
dreamfactorysoftware/df-azure
src/Resources/DocumentDbTable.php
DocumentDbTable.updateRecordsByFilter
public function updateRecordsByFilter($table, $record, $filter = null, $params = [], $extras = [], $patch = false) { $record = static::validateAsArray($record, null, false, 'There are no fields in the record.'); $fields = array_get($extras, ApiOptions::FIELDS); $idFields = array_get($extras...
php
public function updateRecordsByFilter($table, $record, $filter = null, $params = [], $extras = [], $patch = false) { $record = static::validateAsArray($record, null, false, 'There are no fields in the record.'); $fields = array_get($extras, ApiOptions::FIELDS); $idFields = array_get($extras...
[ "public", "function", "updateRecordsByFilter", "(", "$", "table", ",", "$", "record", ",", "$", "filter", "=", "null", ",", "$", "params", "=", "[", "]", ",", "$", "extras", "=", "[", "]", ",", "$", "patch", "=", "false", ")", "{", "$", "record", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/DocumentDbTable.php#L48-L86
dreamfactorysoftware/df-azure
src/Resources/DocumentDbTable.php
DocumentDbTable.retrieveRecordsByFilter
public function retrieveRecordsByFilter($table, $filter = null, $params = [], $extras = []) { $fields = array_get($extras, ApiOptions::FIELDS); $includeCounts = array_get_bool($extras, ApiOptions::INCLUDE_COUNT); $limit = array_get($extras, 'limit', $this->getMaxRecordsReturnedLimit()); ...
php
public function retrieveRecordsByFilter($table, $filter = null, $params = [], $extras = []) { $fields = array_get($extras, ApiOptions::FIELDS); $includeCounts = array_get_bool($extras, ApiOptions::INCLUDE_COUNT); $limit = array_get($extras, 'limit', $this->getMaxRecordsReturnedLimit()); ...
[ "public", "function", "retrieveRecordsByFilter", "(", "$", "table", ",", "$", "filter", "=", "null", ",", "$", "params", "=", "[", "]", ",", "$", "extras", "=", "[", "]", ")", "{", "$", "fields", "=", "array_get", "(", "$", "extras", ",", "ApiOptions...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/DocumentDbTable.php#L91-L134
dreamfactorysoftware/df-azure
src/Resources/DocumentDbTable.php
DocumentDbTable.commitTransaction
protected function commitTransaction($extras = null) { if (empty($this->batchRecords) && empty($this->batchIds)) { return null; } $rollback = array_get_bool($extras, 'rollback'); $continue = array_get_bool($extras, 'continue'); $fields = array_get($extras, ApiOpti...
php
protected function commitTransaction($extras = null) { if (empty($this->batchRecords) && empty($this->batchIds)) { return null; } $rollback = array_get_bool($extras, 'rollback'); $continue = array_get_bool($extras, 'continue'); $fields = array_get($extras, ApiOpti...
[ "protected", "function", "commitTransaction", "(", "$", "extras", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "batchRecords", ")", "&&", "empty", "(", "$", "this", "->", "batchIds", ")", ")", "{", "return", "null", ";", "}", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/DocumentDbTable.php#L289-L450
dreamfactorysoftware/df-azure
src/Resources/DocumentDbTable.php
DocumentDbTable.rollbackTransaction
protected function rollbackTransaction() { if (!empty($this->rollbackRecords)) { switch ($this->getAction()) { case Verbs::POST: foreach ($this->rollbackRecords as $rr) { $id = array_get($rr, static::ID_FIELD); i...
php
protected function rollbackTransaction() { if (!empty($this->rollbackRecords)) { switch ($this->getAction()) { case Verbs::POST: foreach ($this->rollbackRecords as $rr) { $id = array_get($rr, static::ID_FIELD); i...
[ "protected", "function", "rollbackTransaction", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "rollbackRecords", ")", ")", "{", "switch", "(", "$", "this", "->", "getAction", "(", ")", ")", "{", "case", "Verbs", "::", "POST", ":", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/DocumentDbTable.php#L453-L491
dreamfactorysoftware/df-azure
src/Resources/DocumentDbTable.php
DocumentDbTable.cleanOrderBy
private function cleanOrderBy($table, $orderBy) { if (!empty($orderBy)) { $orderByArray = explode(',', $orderBy); foreach ($orderByArray as $k => $order) { $orderByArray[$k] = $table . '.' . $order; } $orderBy = implode(',', $orderByArray); ...
php
private function cleanOrderBy($table, $orderBy) { if (!empty($orderBy)) { $orderByArray = explode(',', $orderBy); foreach ($orderByArray as $k => $order) { $orderByArray[$k] = $table . '.' . $order; } $orderBy = implode(',', $orderByArray); ...
[ "private", "function", "cleanOrderBy", "(", "$", "table", ",", "$", "orderBy", ")", "{", "if", "(", "!", "empty", "(", "$", "orderBy", ")", ")", "{", "$", "orderByArray", "=", "explode", "(", "','", ",", "$", "orderBy", ")", ";", "foreach", "(", "$...
Cleans order by clause @param $table @param $orderBy @return string
[ "Cleans", "order", "by", "clause" ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/DocumentDbTable.php#L501-L512
dreamfactorysoftware/df-azure
src/Resources/DocumentDbTable.php
DocumentDbTable.handlePatch
protected function handlePatch() { if (empty($this->resource)) { // not currently supported, maybe batch opportunity? return false; } if (false === ($tableName = $this->doesTableExist($this->resource, true))) { throw new NotFoundException('Table "' . $thi...
php
protected function handlePatch() { if (empty($this->resource)) { // not currently supported, maybe batch opportunity? return false; } if (false === ($tableName = $this->doesTableExist($this->resource, true))) { throw new NotFoundException('Table "' . $thi...
[ "protected", "function", "handlePatch", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "resource", ")", ")", "{", "// not currently supported, maybe batch opportunity?", "return", "false", ";", "}", "if", "(", "false", "===", "(", "$", "tableName",...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/DocumentDbTable.php#L712-L781
dreamfactorysoftware/df-azure
src/Resources/DocumentDbTable.php
DocumentDbTable.mergeRecords
protected function mergeRecords(array $records) { foreach ($records as $key => $record) { if (null === $id = array_get($record, static::ID_FIELD)) { throw new InternalServerErrorException('No ' . static::ID_FIELD . ' field found in supplied...
php
protected function mergeRecords(array $records) { foreach ($records as $key => $record) { if (null === $id = array_get($record, static::ID_FIELD)) { throw new InternalServerErrorException('No ' . static::ID_FIELD . ' field found in supplied...
[ "protected", "function", "mergeRecords", "(", "array", "$", "records", ")", "{", "foreach", "(", "$", "records", "as", "$", "key", "=>", "$", "record", ")", "{", "if", "(", "null", "===", "$", "id", "=", "array_get", "(", "$", "record", ",", "static"...
Merges new record with existing record to perform PATCH operation @param array $records @return array @throws \DreamFactory\Core\Exceptions\InternalServerErrorException
[ "Merges", "new", "record", "with", "existing", "record", "to", "perform", "PATCH", "operation" ]
train
https://github.com/dreamfactorysoftware/df-azure/blob/48dff2796dc544344c0c7badaaa6917f1bcd623f/src/Resources/DocumentDbTable.php#L791-L806
awesomite/chariot
src/Reflections/Objects.php
Objects.getProperty
public static function getProperty($object, string $propertyName) { $reflection = new \ReflectionObject($object); $property = $reflection->getProperty($propertyName); $property->setAccessible(true); return $property->getValue($object); }
php
public static function getProperty($object, string $propertyName) { $reflection = new \ReflectionObject($object); $property = $reflection->getProperty($propertyName); $property->setAccessible(true); return $property->getValue($object); }
[ "public", "static", "function", "getProperty", "(", "$", "object", ",", "string", "$", "propertyName", ")", "{", "$", "reflection", "=", "new", "\\", "ReflectionObject", "(", "$", "object", ")", ";", "$", "property", "=", "$", "reflection", "->", "getPrope...
Reads also private and protected properties @param $object @param string $propertyName @return mixed
[ "Reads", "also", "private", "and", "protected", "properties" ]
train
https://github.com/awesomite/chariot/blob/3229e38537b857be1d352308ba340dc530b12afb/src/Reflections/Objects.php#L25-L32
nick-jones/globby
lib/Globby/Tokenizer/Glob.php
Glob.parse
public function parse($pattern) { $lexer = $this->createLexer(); try { $result = $lexer->lex($pattern); } catch (LexingException $e) { $message = sprintf('Lexing failed with error: %s', $e->getMessage()); throw new TokenizeException($message, 0, $e); ...
php
public function parse($pattern) { $lexer = $this->createLexer(); try { $result = $lexer->lex($pattern); } catch (LexingException $e) { $message = sprintf('Lexing failed with error: %s', $e->getMessage()); throw new TokenizeException($message, 0, $e); ...
[ "public", "function", "parse", "(", "$", "pattern", ")", "{", "$", "lexer", "=", "$", "this", "->", "createLexer", "(", ")", ";", "try", "{", "$", "result", "=", "$", "lexer", "->", "lex", "(", "$", "pattern", ")", ";", "}", "catch", "(", "Lexing...
Parses the pattern to produce an array of token identifiers. @param string $pattern @return array @throws TokenizeException
[ "Parses", "the", "pattern", "to", "produce", "an", "array", "of", "token", "identifiers", "." ]
train
https://github.com/nick-jones/globby/blob/5bfc56fbeb0ff84d71f7144c10cc9215a34d9ea4/lib/Globby/Tokenizer/Glob.php#L46-L65
nick-jones/globby
lib/Globby/Tokenizer/Glob.php
Glob.createInitialDefinition
protected function createInitialDefinition() { return [ /* * Match against non-special characters. To explain the components of this: * * [^\\\\*\[?]+(?:\\\\.[^\\\\*\[?]*)* * - This matches non-special (\*[?) characters. If it matches one, it'...
php
protected function createInitialDefinition() { return [ /* * Match against non-special characters. To explain the components of this: * * [^\\\\*\[?]+(?:\\\\.[^\\\\*\[?]*)* * - This matches non-special (\*[?) characters. If it matches one, it'...
[ "protected", "function", "createInitialDefinition", "(", ")", "{", "return", "[", "/*\n * Match against non-special characters. To explain the components of this:\n *\n * [^\\\\\\\\*\\[?]+(?:\\\\\\\\.[^\\\\\\\\*\\[?]*)*\n * - This matches non-special ...
Initial state. This is the default state when the lexer enters the pattern. @return array
[ "Initial", "state", ".", "This", "is", "the", "default", "state", "when", "the", "lexer", "enters", "the", "pattern", "." ]
train
https://github.com/nick-jones/globby/blob/5bfc56fbeb0ff84d71f7144c10cc9215a34d9ea4/lib/Globby/Tokenizer/Glob.php#L98-L141
nick-jones/globby
lib/Globby/Tokenizer/Glob.php
Glob.createInGroupDefinition
protected function createInGroupDefinition() { return [ // Close of a grouping. Note that we avoid trouble with the "valid" inclusion of this character at the first // position by consuming it in the IN_GROUP_SPECIAL_FIRST state. Therefore, any further occurrences are // ...
php
protected function createInGroupDefinition() { return [ // Close of a grouping. Note that we avoid trouble with the "valid" inclusion of this character at the first // position by consuming it in the IN_GROUP_SPECIAL_FIRST state. Therefore, any further occurrences are // ...
[ "protected", "function", "createInGroupDefinition", "(", ")", "{", "return", "[", "// Close of a grouping. Note that we avoid trouble with the \"valid\" inclusion of this character at the first", "// position by consuming it in the IN_GROUP_SPECIAL_FIRST state. Therefore, any further occurrences a...
In group state. This looks for standard characters, ranges, and POSIX character classes. @return array
[ "In", "group", "state", ".", "This", "looks", "for", "standard", "characters", "ranges", "and", "POSIX", "character", "classes", "." ]
train
https://github.com/nick-jones/globby/blob/5bfc56fbeb0ff84d71f7144c10cc9215a34d9ea4/lib/Globby/Tokenizer/Glob.php#L148-L164
nick-jones/globby
lib/Globby/Tokenizer/Glob.php
Glob.createInGroupSpecialFirstDefinition
protected function createInGroupSpecialFirstDefinition() { return [ // Handles cases where the range start character is a "]". '\]-[^\]]' => function (Stateful $lexer) { $lexer->swapState('IN_GROUP'); return self::T_GROUP_RANGE; }, ...
php
protected function createInGroupSpecialFirstDefinition() { return [ // Handles cases where the range start character is a "]". '\]-[^\]]' => function (Stateful $lexer) { $lexer->swapState('IN_GROUP'); return self::T_GROUP_RANGE; }, ...
[ "protected", "function", "createInGroupSpecialFirstDefinition", "(", ")", "{", "return", "[", "// Handles cases where the range start character is a \"]\".", "'\\]-[^\\]]'", "=>", "function", "(", "Stateful", "$", "lexer", ")", "{", "$", "lexer", "->", "swapState", "(", ...
A state to (nastily) deal with the special-case of "]" being the first character in a grouping. When "]" is the first character of a grouping, it does not mean "close this grouping" as usual, but is to be treated as a normal character. @return array
[ "A", "state", "to", "(", "nastily", ")", "deal", "with", "the", "special", "-", "case", "of", "]", "being", "the", "first", "character", "in", "a", "grouping", ".", "When", "]", "is", "the", "first", "character", "of", "a", "grouping", "it", "does", ...
train
https://github.com/nick-jones/globby/blob/5bfc56fbeb0ff84d71f7144c10cc9215a34d9ea4/lib/Globby/Tokenizer/Glob.php#L173-L187
gregorybesson/PlaygroundCore
src/Service/Website.php
Website.getWebsiteMapper
public function getWebsiteMapper() { if (null === $this->websiteMapper) { $this->websiteMapper = $this->serviceLocator->get('playgroundcore_website_mapper'); } return $this->websiteMapper; }
php
public function getWebsiteMapper() { if (null === $this->websiteMapper) { $this->websiteMapper = $this->serviceLocator->get('playgroundcore_website_mapper'); } return $this->websiteMapper; }
[ "public", "function", "getWebsiteMapper", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "websiteMapper", ")", "{", "$", "this", "->", "websiteMapper", "=", "$", "this", "->", "serviceLocator", "->", "get", "(", "'playgroundcore_website_mapper'", ...
getWebsiteMapper @return websiteMapper
[ "getWebsiteMapper" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Website.php#L40-L47
gregorybesson/PlaygroundCore
src/Service/CKEditor.php
CKEditor.configSettings
private function configSettings($config = array(), $events = array()) { $_config = $this->config; $_events = $this->events; if (is_array($config) && !empty($config)) { $_config = array_merge($_config, $config); } if (is_array($events) && !empty($events)) { ...
php
private function configSettings($config = array(), $events = array()) { $_config = $this->config; $_events = $this->events; if (is_array($config) && !empty($config)) { $_config = array_merge($_config, $config); } if (is_array($events) && !empty($events)) { ...
[ "private", "function", "configSettings", "(", "$", "config", "=", "array", "(", ")", ",", "$", "events", "=", "array", "(", ")", ")", "{", "$", "_config", "=", "$", "this", "->", "config", ";", "$", "_events", "=", "$", "this", "->", "events", ";",...
Returns the configuration array (global and instance specific settings are merged into one array). @param $config (array) The specific configurations to apply to editor instance. @param $events (array) Event listeners for editor instance.
[ "Returns", "the", "configuration", "array", "(", "global", "and", "instance", "specific", "settings", "are", "merged", "into", "one", "array", ")", "." ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/CKEditor.php#L354-L391
JoffreyPoreeCoding/MongoDB-ODM
src/Tools/EventManager.php
EventManager.execute
public function execute($eventName, $object) { if (isset($this->events[$eventName]) && is_array(($this->events[$eventName]))) { foreach ($this->events[$eventName] as $method) { call_user_func([$object, $method]); } } }
php
public function execute($eventName, $object) { if (isset($this->events[$eventName]) && is_array(($this->events[$eventName]))) { foreach ($this->events[$eventName] as $method) { call_user_func([$object, $method]); } } }
[ "public", "function", "execute", "(", "$", "eventName", ",", "$", "object", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "events", "[", "$", "eventName", "]", ")", "&&", "is_array", "(", "(", "$", "this", "->", "events", "[", "$", "eventNa...
Execute an event @param string $eventName Name of event @param mixed $object Object on wich object will be executed @return void
[ "Execute", "an", "event" ]
train
https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Tools/EventManager.php#L48-L55
werx/forms
src/Input.php
Input.filter
protected function filter(&$value) { if (is_scalar($value)) { return htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); } elseif (is_array($value)){ array_walk_recursive($value, [$this, 'filter']); } elseif (is_object($value)) { foreach (get_object_vars($value) as $k => $v) { $value->$k...
php
protected function filter(&$value) { if (is_scalar($value)) { return htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); } elseif (is_array($value)){ array_walk_recursive($value, [$this, 'filter']); } elseif (is_object($value)) { foreach (get_object_vars($value) as $k => $v) { $value->$k...
[ "protected", "function", "filter", "(", "&", "$", "value", ")", "{", "if", "(", "is_scalar", "(", "$", "value", ")", ")", "{", "return", "htmlspecialchars", "(", "$", "value", ",", "ENT_QUOTES", "|", "ENT_SUBSTITUTE", ",", "'UTF-8'", ")", ";", "}", "el...
Filters a variable reference for XSS. @param $value @return string
[ "Filters", "a", "variable", "reference", "for", "XSS", "." ]
train
https://github.com/werx/forms/blob/e057e4890bd13541da72b3cb2d22c2c84435c16a/src/Input.php#L47-L60
movoin/one-swoole
src/Config/Commands/ShowCommand.php
ShowCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { // {{ $this->title('配置信息'); // }} $this->treeView(Config::get('')); $this->newLine(); return 0; }
php
protected function execute(InputInterface $input, OutputInterface $output) { // {{ $this->title('配置信息'); // }} $this->treeView(Config::get('')); $this->newLine(); return 0; }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "// {{", "$", "this", "->", "title", "(", "'配置信息');", "", "", "// }}", "$", "this", "->", "treeView", "(", "Config", "::", "get", "(...
执行命令 @param \Symfony\Component\Console\Input\InputInterface $input @param \Symfony\Component\Console\Output\OutputInterface $output
[ "执行命令" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Config/Commands/ShowCommand.php#L40-L50
movoin/one-swoole
src/Config/Commands/ShowCommand.php
ShowCommand.treeView
protected function treeView(array $config, int $level = 0) { foreach ($config as $name => $value) { if (is_array($value)) { $this->writeln( sprintf( '%s<info>- %s</>:', str_repeat(' ', $level * 2), ...
php
protected function treeView(array $config, int $level = 0) { foreach ($config as $name => $value) { if (is_array($value)) { $this->writeln( sprintf( '%s<info>- %s</>:', str_repeat(' ', $level * 2), ...
[ "protected", "function", "treeView", "(", "array", "$", "config", ",", "int", "$", "level", "=", "0", ")", "{", "foreach", "(", "$", "config", "as", "$", "name", "=>", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{...
输出树视图 @param array $config @param integer $level
[ "输出树视图" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Config/Commands/ShowCommand.php#L58-L95
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php
BaseSDK.setDeviceType
public function setDeviceType($deviceType = null) { switch ($deviceType) { case self::DEVICE_ANDROID : $this -> deviceType = self::DEVICE_ANDROID; break; case self::DEVICE_IOS : $this -> deviceType = self::DEVICE_IOS; break;...
php
public function setDeviceType($deviceType = null) { switch ($deviceType) { case self::DEVICE_ANDROID : $this -> deviceType = self::DEVICE_ANDROID; break; case self::DEVICE_IOS : $this -> deviceType = self::DEVICE_IOS; break;...
[ "public", "function", "setDeviceType", "(", "$", "deviceType", "=", "null", ")", "{", "switch", "(", "$", "deviceType", ")", "{", "case", "self", "::", "DEVICE_ANDROID", ":", "$", "this", "->", "deviceType", "=", "self", "::", "DEVICE_ANDROID", ";", "break...
设置一个默认的deviceType. @deprecated @param string $deviceType
[ "设置一个默认的deviceType", "." ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php#L354-L365
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php
BaseSDK.onError
protected function onError($requestId = null, $code = 0, $msg = ''){ $this -> errorMsg = $msg; $this -> errorCode = $code; $this -> requestId = $requestId; if ($code === 0) { // 无错误; return null; } if ($code > 0 && $code < 100) { ...
php
protected function onError($requestId = null, $code = 0, $msg = ''){ $this -> errorMsg = $msg; $this -> errorCode = $code; $this -> requestId = $requestId; if ($code === 0) { // 无错误; return null; } if ($code > 0 && $code < 100) { ...
[ "protected", "function", "onError", "(", "$", "requestId", "=", "null", ",", "$", "code", "=", "0", ",", "$", "msg", "=", "''", ")", "{", "$", "this", "->", "errorMsg", "=", "$", "msg", ";", "$", "this", "->", "errorCode", "=", "$", "code", ";", ...
记录当前发生的错误内容,供getErrorxxxxx相关接口使用, 同时根据是否抛出异常的配置决定是否生成并抛出一个错误. @param int $code 错误码, 非0表示有错误发生 -1 未知错误 0 表示没有错误 1 ~ 99 clientSDK错误 400 ~ 600 网络错误, http status code, 200-300为成功消息, 不可占用. 10000 ~ 20000 服务端错误 @param string $requestId 请求ID, 由服务端生成并返回 @param int $code 错误码 @param string $msg 错误消息 @return Exception
[ "记录当前发生的错误内容", "供getErrorxxxxx相关接口使用", "同时根据是否抛出异常的配置决定是否生成并抛出一个错误", "." ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php#L383-L416
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php
BaseSDK.genSign
function genSign($method, $url, $arrContent) { if ($this -> isMatchReg('/(^get$)|(^post$)/i', $method) === 0) { $this -> onError(null, 3, 'SDK: params invalid, $method must be "GET" or "POST"'); return null; } if (! $this -> isUrlFormat($url)) { ...
php
function genSign($method, $url, $arrContent) { if ($this -> isMatchReg('/(^get$)|(^post$)/i', $method) === 0) { $this -> onError(null, 3, 'SDK: params invalid, $method must be "GET" or "POST"'); return null; } if (! $this -> isUrlFormat($url)) { ...
[ "function", "genSign", "(", "$", "method", ",", "$", "url", ",", "$", "arrContent", ")", "{", "if", "(", "$", "this", "->", "isMatchReg", "(", "'/(^get$)|(^post$)/i'", ",", "$", "method", ")", "===", "0", ")", "{", "$", "this", "->", "onError", "(", ...
计算请求迁名 @param string $method GET|POST @param string $url 请求的完整url, 不含query部份 @param array $arrContent 提交的数据项,包含get及post,但不包含签名项 @return string
[ "计算请求迁名" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php#L481-L506
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php
BaseSDK.newApiQueryTpl
public function newApiQueryTpl() { $rs = array ( 'apikey' => $this -> apikey, 'timestamp' => time(), ); if ($this -> deviceType === null && BAIDU_PUSH_CONFIG::default_devicetype !== null) { $this->setDeviceType(BAIDU_PUSH_CONFIG::default_devicetype); ...
php
public function newApiQueryTpl() { $rs = array ( 'apikey' => $this -> apikey, 'timestamp' => time(), ); if ($this -> deviceType === null && BAIDU_PUSH_CONFIG::default_devicetype !== null) { $this->setDeviceType(BAIDU_PUSH_CONFIG::default_devicetype); ...
[ "public", "function", "newApiQueryTpl", "(", ")", "{", "$", "rs", "=", "array", "(", "'apikey'", "=>", "$", "this", "->", "apikey", ",", "'timestamp'", "=>", "time", "(", ")", ",", ")", ";", "if", "(", "$", "this", "->", "deviceType", "===", "null", ...
生成携带默认请求的数组对象. @return multitype:number string
[ "生成携带默认请求的数组对象", "." ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php#L512-L531
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php
BaseSDK.parse
public function parse($response) { extract($response); $this -> log -> log("Parse Response: $status, $statusMsg, $content"); $result = json_decode($content, true); if ($result !== null && array_key_exists('request_id', $result)) { if ($...
php
public function parse($response) { extract($response); $this -> log -> log("Parse Response: $status, $statusMsg, $content"); $result = json_decode($content, true); if ($result !== null && array_key_exists('request_id', $result)) { if ($...
[ "public", "function", "parse", "(", "$", "response", ")", "{", "extract", "(", "$", "response", ")", ";", "$", "this", "->", "log", "->", "log", "(", "\"Parse Response: $status, $statusMsg, $content\"", ")", ";", "$", "result", "=", "json_decode", "(", "$", ...
解析response并判断响应内容是否正确. 如果结果符合restAPI结果格式,则返回结果中包含的response_params内容, 否则依据配置中是不是压制错误产生错误或返回null @param array $response 由httpRequest对象get,post,request等方法返回的结果数组 @return mixed|NULL
[ "解析response并判断响应内容是否正确", ".", "如果结果符合restAPI结果格式", "则返回结果中包含的response_params内容", "否则依据配置中是不是压制错误产生错误或返回null" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php#L541-L596
dengyongbin/loopeer-lib
src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php
BaseSDK.sendRequest
protected function sendRequest($api, $query, $method = "POST", $header=null, $curlOpts = null){ $url = $this->http->getResourceAddress($api); $query['sign'] = $this -> genSign($method, $url, $query); if($header == null){ $header = array('User-Agent: '. $thi...
php
protected function sendRequest($api, $query, $method = "POST", $header=null, $curlOpts = null){ $url = $this->http->getResourceAddress($api); $query['sign'] = $this -> genSign($method, $url, $query); if($header == null){ $header = array('User-Agent: '. $thi...
[ "protected", "function", "sendRequest", "(", "$", "api", ",", "$", "query", ",", "$", "method", "=", "\"POST\"", ",", "$", "header", "=", "null", ",", "$", "curlOpts", "=", "null", ")", "{", "$", "url", "=", "$", "this", "->", "http", "->", "getRes...
发送一个rest Api 请求 @param string $api 请求地址 @param array<K,V> $query 请求参数 @param string $method 请求方法 目前只支持 GET, POST @param string $header http header @param string $curlOpts curl选项 @return mixed 解析结果,如果失败将返回false, 否则应返回解析后的服务端返回的json数据
[ "发送一个rest", "Api", "请求" ]
train
https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/BaseSDK.php#L606-L623
gdbots/pbjx-bundle-php
src/Command/PbjxCommand.php
PbjxCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; $curie = SchemaCurie::fromString($input->getArgument('curie')); $_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['C...
php
protected function execute(InputInterface $input, OutputInterface $output) { $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; $curie = SchemaCurie::fromString($input->getArgument('curie')); $_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['C...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "errOutput", "=", "$", "output", "instanceof", "ConsoleOutputInterface", "?", "$", "output", "->", "getErrorOutput", "(", ")", ":", "...
@param InputInterface $input @param OutputInterface $output @return null
[ "@param", "InputInterface", "$input", "@param", "OutputInterface", "$output" ]
train
https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/PbjxCommand.php#L91-L154
drunomics/service-utils
src/file/FileUsage/FileUsageTrait.php
FileUsageTrait.getFileUsage
public function getFileUsage() { if (empty($this->fileUsage)) { $this->fileUsage = \Drupal::service('file.usage'); } return $this->fileUsage; }
php
public function getFileUsage() { if (empty($this->fileUsage)) { $this->fileUsage = \Drupal::service('file.usage'); } return $this->fileUsage; }
[ "public", "function", "getFileUsage", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "fileUsage", ")", ")", "{", "$", "this", "->", "fileUsage", "=", "\\", "Drupal", "::", "service", "(", "'file.usage'", ")", ";", "}", "return", "$", "thi...
Gets file usage service. @return \Drupal\file\FileUsage\FileUsageInterface File usage service.
[ "Gets", "file", "usage", "service", "." ]
train
https://github.com/drunomics/service-utils/blob/56761750043132365ef4ae5d9e0cf4263459328f/src/file/FileUsage/FileUsageTrait.php#L38-L43
withfatpanda/illuminate-wordpress
src/WordPress/Providers/Mail/MailServiceProvider.php
MailServiceProvider.registerSwiftMailer
public function registerSwiftMailer() { $this->registerSwiftTransport(); // Once we have the transporter registered, we will register the actual Swift // mailer instance, passing in the transport instances, which allows us to // override this transporter instances during app start-u...
php
public function registerSwiftMailer() { $this->registerSwiftTransport(); // Once we have the transporter registered, we will register the actual Swift // mailer instance, passing in the transport instances, which allows us to // override this transporter instances during app start-u...
[ "public", "function", "registerSwiftMailer", "(", ")", "{", "$", "this", "->", "registerSwiftTransport", "(", ")", ";", "// Once we have the transporter registered, we will register the actual Swift", "// mailer instance, passing in the transport instances, which allows us to", "// ove...
Register the Swift Mailer instance. @return void
[ "Register", "the", "Swift", "Mailer", "instance", "." ]
train
https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Providers/Mail/MailServiceProvider.php#L90-L100
withfatpanda/illuminate-wordpress
src/WordPress/Providers/Mail/MailServiceProvider.php
MailServiceProvider.registerMarkdownRenderer
protected function registerMarkdownRenderer() { if ($this->app->runningInConsole()) { $this->publishes([ __DIR__.'/resources/views' => $this->app->resourcePath().DIRECTORY_SEPARATOR.'views/vendor/mail', ], 'laravel-mail'); } $this->app->singleton(Mark...
php
protected function registerMarkdownRenderer() { if ($this->app->runningInConsole()) { $this->publishes([ __DIR__.'/resources/views' => $this->app->resourcePath().DIRECTORY_SEPARATOR.'views/vendor/mail', ], 'laravel-mail'); } $this->app->singleton(Mark...
[ "protected", "function", "registerMarkdownRenderer", "(", ")", "{", "if", "(", "$", "this", "->", "app", "->", "runningInConsole", "(", ")", ")", "{", "$", "this", "->", "publishes", "(", "[", "__DIR__", ".", "'/resources/views'", "=>", "$", "this", "->", ...
Register the Markdown renderer instance. @return void
[ "Register", "the", "Markdown", "renderer", "instance", "." ]
train
https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Providers/Mail/MailServiceProvider.php#L119-L133
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.createImagesFromVideos
public function createImagesFromVideos($source, $target = 'step-%03d.jpg') { try { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y') ->addCommand(...
php
public function createImagesFromVideos($source, $target = 'step-%03d.jpg') { try { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y') ->addCommand(...
[ "public", "function", "createImagesFromVideos", "(", "$", "source", ",", "$", "target", "=", "'step-%03d.jpg'", ")", "{", "try", "{", "$", "this", "->", "serviceLocator", "->", "setShared", "(", "'playgroundcore_phpvideotoolkit'", ",", "false", ")", ";", "$", ...
This method create images from a video. ffmpeg -i input.mov output_%03d.png
[ "This", "method", "create", "images", "from", "a", "video", ".", "ffmpeg", "-", "i", "input", ".", "mov", "output_%03d", ".", "png" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L45-L62
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.createVideoFromImages
public function createVideoFromImages($path = 'data/etape*.jpg', $target = false, $framerate = '25', $fps = 25) { try { // don't want this service to be a singleton. I have to reset the ffmpeg parameters for each call. $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit'...
php
public function createVideoFromImages($path = 'data/etape*.jpg', $target = false, $framerate = '25', $fps = 25) { try { // don't want this service to be a singleton. I have to reset the ffmpeg parameters for each call. $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit'...
[ "public", "function", "createVideoFromImages", "(", "$", "path", "=", "'data/etape*.jpg'", ",", "$", "target", "=", "false", ",", "$", "framerate", "=", "'25'", ",", "$", "fps", "=", "25", ")", "{", "try", "{", "// don't want this service to be a singleton. I ha...
This method create a video from still images (jpg or png). ffmpeg -framerate 1/5 -i etape%01d.jpg -c:v libx264 -vf "fps=25,format=yuv420p" out.mp4
[ "This", "method", "create", "a", "video", "from", "still", "images", "(", "jpg", "or", "png", ")", ".", "ffmpeg", "-", "framerate", "1", "/", "5", "-", "i", "etape%01d", ".", "jpg", "-", "c", ":", "v", "libx264", "-", "vf", "fps", "=", "25", "for...
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L68-L91
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.mergeMpgVideos
public function mergeMpgVideos($videos = false, $target = false) { if (is_array($videos)) { try { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreIn...
php
public function mergeMpgVideos($videos = false, $target = false) { if (is_array($videos)) { try { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreIn...
[ "public", "function", "mergeMpgVideos", "(", "$", "videos", "=", "false", ",", "$", "target", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "videos", ")", ")", "{", "try", "{", "$", "this", "->", "serviceLocator", "->", "setShared", "(", "...
This method will merge videos in .mpg format with exactly the same codec and codec parameters : http://trac.ffmpeg.org/wiki/Concatenate @param array $videos @return string
[ "This", "method", "will", "merge", "videos", "in", ".", "mpg", "format", "with", "exactly", "the", "same", "codec", "and", "codec", "parameters", ":", "http", ":", "//", "trac", ".", "ffmpeg", ".", "org", "/", "wiki", "/", "Concatenate" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L177-L200
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.convertToMp3
public function convertToMp3($source, $target) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y') ->addCommand('-i', $source) ->addCommand('-v...
php
public function convertToMp3($source, $target) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y') ->addCommand('-i', $source) ->addCommand('-v...
[ "public", "function", "convertToMp3", "(", "$", "source", ",", "$", "target", ")", "{", "$", "this", "->", "serviceLocator", "->", "setShared", "(", "'playgroundcore_phpvideotoolkit'", ",", "false", ")", ";", "$", "this", "->", "serviceLocator", "->", "get", ...
ffmpeg -i sound.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 out.mp3
[ "ffmpeg", "-", "i", "sound", ".", "avi", "-", "vn", "-", "ar", "44100", "-", "ac", "2", "-", "ab", "192", "-", "f", "mp3", "out", ".", "mp3" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L229-L245
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.overlayOnMp4
public function overlayOnMp4($source, $layer, $target) { if (!is_array($layer)) { $layer = array($layer); } $overlay = ''; $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $ffmpeg = $this->serviceLocator->get('playgroundcore_phpvi...
php
public function overlayOnMp4($source, $layer, $target) { if (!is_array($layer)) { $layer = array($layer); } $overlay = ''; $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $ffmpeg = $this->serviceLocator->get('playgroundcore_phpvi...
[ "public", "function", "overlayOnMp4", "(", "$", "source", ",", "$", "layer", ",", "$", "target", ")", "{", "if", "(", "!", "is_array", "(", "$", "layer", ")", ")", "{", "$", "layer", "=", "array", "(", "$", "layer", ")", ";", "}", "$", "overlay",...
/* this method takes an image (with alpha) or a mov video (the format to keep alpha channel) and overlay this layer on a background video. ffmpeg -i in.mov -i in.png -filter_complex "[0:0][1:0]overlay=format=rgb[out]" -map [out] -vcodec qtrle out.mov
[ "/", "*", "this", "method", "takes", "an", "image", "(", "with", "alpha", ")", "or", "a", "mov", "video", "(", "the", "format", "to", "keep", "alpha", "channel", ")", "and", "overlay", "this", "layer", "on", "a", "background", "video", ".", "ffmpeg", ...
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L284-L311
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.addWavToMp4
public function addWavToMp4($video, $sound, $target) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y') ->addCommand('-i', $video, true) ->add...
php
public function addWavToMp4($video, $sound, $target) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y') ->addCommand('-i', $video, true) ->add...
[ "public", "function", "addWavToMp4", "(", "$", "video", ",", "$", "sound", ",", "$", "target", ")", "{", "$", "this", "->", "serviceLocator", "->", "setShared", "(", "'playgroundcore_phpvideotoolkit'", ",", "false", ")", ";", "$", "this", "->", "serviceLocat...
/* this method takes an image (with alpha) or a mov video (the format to keep alpha channel) and overlay this layer on a background video. ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a aac -strict experimental output.mp4
[ "/", "*", "this", "method", "takes", "an", "image", "(", "with", "alpha", ")", "or", "a", "mov", "video", "(", "the", "format", "to", "keep", "alpha", "channel", ")", "and", "overlay", "this", "layer", "on", "a", "background", "video", ".", "ffmpeg", ...
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L318-L333
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.increaseVolumeSound
public function increaseVolumeSound($source, $level, $target) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y') ->addCommand('-i', $source, true) ...
php
public function increaseVolumeSound($source, $level, $target) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y') ->addCommand('-i', $source, true) ...
[ "public", "function", "increaseVolumeSound", "(", "$", "source", ",", "$", "level", ",", "$", "target", ")", "{", "$", "this", "->", "serviceLocator", "->", "setShared", "(", "'playgroundcore_phpvideotoolkit'", ",", "false", ")", ";", "$", "this", "->", "ser...
/* this method takes an audio file and increase its level on a background video. ffmpeg -i title.wav -af "volume=4" titleok.wav
[ "/", "*", "this", "method", "takes", "an", "audio", "file", "and", "increase", "its", "level", "on", "a", "background", "video", "." ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L341-L353
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.createNullSound
public function createNullSound($duration, $target) { if (empty($duration)) { $duration = 1; } $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand...
php
public function createNullSound($duration, $target) { if (empty($duration)) { $duration = 1; } $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand...
[ "public", "function", "createNullSound", "(", "$", "duration", ",", "$", "target", ")", "{", "if", "(", "empty", "(", "$", "duration", ")", ")", "{", "$", "duration", "=", "1", ";", "}", "$", "this", "->", "serviceLocator", "->", "setShared", "(", "'...
/* this method creates an audio file of $duration seconds with no sound on a background video. ffmpeg -y -filter_complex 'aevalsrc=0:d=1.6' silence.wav
[ "/", "*", "this", "method", "creates", "an", "audio", "file", "of", "$duration", "seconds", "with", "no", "sound", "on", "a", "background", "video", ".", "ffmpeg", "-", "y", "-", "filter_complex", "aevalsrc", "=", "0", ":", "d", "=", "1", ".", "6", "...
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L360-L375
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.concatenateSounds
public function concatenateSounds($sounds, $target) { if (empty($sounds)) { $sounds = array(); } if (!is_array($sounds)) { $sounds = array($sounds); } $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $ffmpeg = $this->...
php
public function concatenateSounds($sounds, $target) { if (empty($sounds)) { $sounds = array(); } if (!is_array($sounds)) { $sounds = array($sounds); } $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $ffmpeg = $this->...
[ "public", "function", "concatenateSounds", "(", "$", "sounds", ",", "$", "target", ")", "{", "if", "(", "empty", "(", "$", "sounds", ")", ")", "{", "$", "sounds", "=", "array", "(", ")", ";", "}", "if", "(", "!", "is_array", "(", "$", "sounds", "...
This method concatenate an array of sounds ffmpeg -y -i in-1.wav -i in-2.wav -i in-3.wav -filter_complex '[0:0][1:0][2:0]concat=n=3:v=0:a=1[out]' -map '[out]' out.wav
[ "This", "method", "concatenate", "an", "array", "of", "sounds", "ffmpeg", "-", "y", "-", "i", "in", "-", "1", ".", "wav", "-", "i", "in", "-", "2", ".", "wav", "-", "i", "in", "-", "3", ".", "wav", "-", "filter_complex", "[", "0", ":", "0", "...
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L382-L408
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.overlayTextOnMp4
public function overlayTextOnMp4($source, $font, $fontSize, $fontColor, $message, $x, $y, $target) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $text = "fontfile=$font:text='". $message."':fontsize=". $fontSize .":fontcolor=" . $fontColor . ":x=".$x.":y="...
php
public function overlayTextOnMp4($source, $font, $fontSize, $fontColor, $message, $x, $y, $target) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $text = "fontfile=$font:text='". $message."':fontsize=". $fontSize .":fontcolor=" . $fontColor . ":x=".$x.":y="...
[ "public", "function", "overlayTextOnMp4", "(", "$", "source", ",", "$", "font", ",", "$", "fontSize", ",", "$", "fontColor", ",", "$", "message", ",", "$", "x", ",", "$", "y", ",", "$", "target", ")", "{", "$", "this", "->", "serviceLocator", "->", ...
/* this method takes an image (with alpha) or a mov video (the format to keep alpha channel) and overlay this layer on a background video. ffmpeg -i sub_video3.mp4 -vf drawtext="fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf: text='Text to write is this one, overlaid':fontsize=20:fontcolor=red:x=100:y=10...
[ "/", "*", "this", "method", "takes", "an", "image", "(", "with", "alpha", ")", "or", "a", "mov", "video", "(", "the", "format", "to", "keep", "alpha", "channel", ")", "and", "overlay", "this", "layer", "on", "a", "background", "video", ".", "ffmpeg", ...
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L450-L465
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.extractImage
public function extractImage($source, $target, $start = '00:00:01', $frames = 1) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $ffmpeg = $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y'); if (!empty($st...
php
public function extractImage($source, $target, $start = '00:00:01', $frames = 1) { $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $ffmpeg = $this->serviceLocator->get('playgroundcore_phpvideotoolkit') ->addPreInputCommand('-y'); if (!empty($st...
[ "public", "function", "extractImage", "(", "$", "source", ",", "$", "target", ",", "$", "start", "=", "'00:00:01'", ",", "$", "frames", "=", "1", ")", "{", "$", "this", "->", "serviceLocator", "->", "setShared", "(", "'playgroundcore_phpvideotoolkit'", ",", ...
this method extracts an image form a video at the $time second in the video. ffmpeg -ss 00:00:04 -i video.mp4 -vframes 1 out.png
[ "this", "method", "extracts", "an", "image", "form", "a", "video", "at", "the", "$time", "second", "in", "the", "video", ".", "ffmpeg", "-", "ss", "00", ":", "00", ":", "04", "-", "i", "video", ".", "mp4", "-", "vframes", "1", "out", ".", "png" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L471-L488
gregorybesson/PlaygroundCore
src/Service/Ffmpeg.php
Ffmpeg.splitVideo
public function splitVideo($source, $frames, $target) { if (empty($frames)) { $frames = array(); } $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $i=1; foreach ($frames as $frame) { $this->serviceLocator->get('playg...
php
public function splitVideo($source, $frames, $target) { if (empty($frames)) { $frames = array(); } $this->serviceLocator->setShared('playgroundcore_phpvideotoolkit', false); $i=1; foreach ($frames as $frame) { $this->serviceLocator->get('playg...
[ "public", "function", "splitVideo", "(", "$", "source", ",", "$", "frames", ",", "$", "target", ")", "{", "if", "(", "empty", "(", "$", "frames", ")", ")", "{", "$", "frames", "=", "array", "(", ")", ";", "}", "$", "this", "->", "serviceLocator", ...
this method splits a video into n chunks defined by the frames array. $frames = array(array(0, 12), array(13, 110), array(111, 200)); ffmpeg -i quickns.mov -an -vf "select=between(n\,110\,200),setpts=PTS-STARTPTS" grg.mov
[ "this", "method", "splits", "a", "video", "into", "n", "chunks", "defined", "by", "the", "frames", "array", ".", "$frames", "=", "array", "(", "array", "(", "0", "12", ")", "array", "(", "13", "110", ")", "array", "(", "111", "200", "))", ";", "ffm...
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Ffmpeg.php#L495-L515
phramework/jsonapi
src/Model/Cache.php
Cache.initializeCache
protected static function initializeCache($type) { if (self::$cache === null) { self::$cache = new \stdClass(); } if (!property_exists(self::$cache, $type)) { self::$cache->{$type} = new \stdClass(); } }
php
protected static function initializeCache($type) { if (self::$cache === null) { self::$cache = new \stdClass(); } if (!property_exists(self::$cache, $type)) { self::$cache->{$type} = new \stdClass(); } }
[ "protected", "static", "function", "initializeCache", "(", "$", "type", ")", "{", "if", "(", "self", "::", "$", "cache", "===", "null", ")", "{", "self", "::", "$", "cache", "=", "new", "\\", "stdClass", "(", ")", ";", "}", "if", "(", "!", "propert...
Initialize cache object for a resource type **NOTE** `self` MUST be used not `static` when accessing `$cache` object @param string $type Resource type
[ "Initialize", "cache", "object", "for", "a", "resource", "type", "**", "NOTE", "**", "self", "MUST", "be", "used", "not", "static", "when", "accessing", "$cache", "object" ]
train
https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Model/Cache.php#L52-L61
phramework/jsonapi
src/Model/Cache.php
Cache.getCache
protected static function getCache($id) { $type = static::getType(); $id = (string)$id; static::initializeCache($type); $collection = self::$cache->{$type}; if (!property_exists($collection, $id)) { return null; } $resource = $collection->{$id...
php
protected static function getCache($id) { $type = static::getType(); $id = (string)$id; static::initializeCache($type); $collection = self::$cache->{$type}; if (!property_exists($collection, $id)) { return null; } $resource = $collection->{$id...
[ "protected", "static", "function", "getCache", "(", "$", "id", ")", "{", "$", "type", "=", "static", "::", "getType", "(", ")", ";", "$", "id", "=", "(", "string", ")", "$", "id", ";", "static", "::", "initializeCache", "(", "$", "type", ")", ";", ...
*NOTE* Will return a clone of the resource, so any changes to it wont affect the stored in cache resource. @param string $id @return Resource|null
[ "*", "NOTE", "*", "Will", "return", "a", "clone", "of", "the", "resource", "so", "any", "changes", "to", "it", "wont", "affect", "the", "stored", "in", "cache", "resource", "." ]
train
https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Model/Cache.php#L68-L85
phramework/jsonapi
src/Model/Cache.php
Cache.invalidateCache
protected static function invalidateCache($id) { $type = static::getType(); $id = (string)$id; static::initializeCache($type); $collection = self::$cache->{$type}; unset($collection->{$id}); }
php
protected static function invalidateCache($id) { $type = static::getType(); $id = (string)$id; static::initializeCache($type); $collection = self::$cache->{$type}; unset($collection->{$id}); }
[ "protected", "static", "function", "invalidateCache", "(", "$", "id", ")", "{", "$", "type", "=", "static", "::", "getType", "(", ")", ";", "$", "id", "=", "(", "string", ")", "$", "id", ";", "static", "::", "initializeCache", "(", "$", "type", ")", ...
Remove resource from cache, used by `PUT`, `PATCH` and `DELETE` methods when changing an object @param string $id
[ "Remove", "resource", "from", "cache", "used", "by", "PUT", "PATCH", "and", "DELETE", "methods", "when", "changing", "an", "object" ]
train
https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Model/Cache.php#L115-L126
stubbles/stubbles-webapp-core
src/main/php/request/WebRequest.php
WebRequest.fromRawSource
public static function fromRawSource(): Request { if (isset($_SERVER['REQUEST_METHOD']) && strtoupper(trim($_SERVER['REQUEST_METHOD'])) === Http::POST) { $params = $_POST; } else { $params = $_GET; } return new self($params, $_SERVER, $_COOKIE...
php
public static function fromRawSource(): Request { if (isset($_SERVER['REQUEST_METHOD']) && strtoupper(trim($_SERVER['REQUEST_METHOD'])) === Http::POST) { $params = $_POST; } else { $params = $_GET; } return new self($params, $_SERVER, $_COOKIE...
[ "public", "static", "function", "fromRawSource", "(", ")", ":", "Request", "{", "if", "(", "isset", "(", "$", "_SERVER", "[", "'REQUEST_METHOD'", "]", ")", "&&", "strtoupper", "(", "trim", "(", "$", "_SERVER", "[", "'REQUEST_METHOD'", "]", ")", ")", "===...
creates an instance from raw data, meaning $_GET/$_POST, $_SERVER and $_COOKIE @api @return \stubbles\webapp\Request
[ "creates", "an", "instance", "from", "raw", "data", "meaning", "$_GET", "/", "$_POST", "$_SERVER", "and", "$_COOKIE" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L86-L96
stubbles/stubbles-webapp-core
src/main/php/request/WebRequest.php
WebRequest.id
public function id(): string { if (null !== $this->id) { return $this->id; } if ($this->headers->contain('HTTP_X_REQUEST_ID')) { $this->id = $this->readHeader('HTTP_X_REQUEST_ID') ->ifMatches('~^([a-zA-Z0-9+/=-]{20,200})$~'); } if...
php
public function id(): string { if (null !== $this->id) { return $this->id; } if ($this->headers->contain('HTTP_X_REQUEST_ID')) { $this->id = $this->readHeader('HTTP_X_REQUEST_ID') ->ifMatches('~^([a-zA-Z0-9+/=-]{20,200})$~'); } if...
[ "public", "function", "id", "(", ")", ":", "string", "{", "if", "(", "null", "!==", "$", "this", "->", "id", ")", "{", "return", "$", "this", "->", "id", ";", "}", "if", "(", "$", "this", "->", "headers", "->", "contain", "(", "'HTTP_X_REQUEST_ID'"...
returns id of the request The id of the request may come from an optional X-Request-ID header. The value must be between 20 and 200 characters, and consist of ASCII letters, digits, or the characters +, /, =, and -. Invalid or missing ids will be ignored and replaced with generated ones. @return string @since 4.2....
[ "returns", "id", "of", "the", "request" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L110-L126
stubbles/stubbles-webapp-core
src/main/php/request/WebRequest.php
WebRequest.protocolVersion
public function protocolVersion() { if (!$this->headers->contain('SERVER_PROTOCOL')) { return new HttpVersion(1, 0); } try { return HttpVersion::fromString($this->headers->value('SERVER_PROTOCOL')->value()); } catch (\InvalidArgumentException $ex) { ...
php
public function protocolVersion() { if (!$this->headers->contain('SERVER_PROTOCOL')) { return new HttpVersion(1, 0); } try { return HttpVersion::fromString($this->headers->value('SERVER_PROTOCOL')->value()); } catch (\InvalidArgumentException $ex) { ...
[ "public", "function", "protocolVersion", "(", ")", "{", "if", "(", "!", "$", "this", "->", "headers", "->", "contain", "(", "'SERVER_PROTOCOL'", ")", ")", "{", "return", "new", "HttpVersion", "(", "1", ",", "0", ")", ";", "}", "try", "{", "return", "...
returns HTTP protocol version of request If no SERVER_PROTOCOL is present it is assumed that the protocol version is HTTP/1.0. In case the SERVER_PROTOCOL does not denote a valid HTTP version according to http://tools.ietf.org/html/rfc7230#section-2.6 the return value will be null. @return \stubbles\peer\http\HttpVe...
[ "returns", "HTTP", "protocol", "version", "of", "request" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L159-L170
stubbles/stubbles-webapp-core
src/main/php/request/WebRequest.php
WebRequest.originatingIpAddress
public function originatingIpAddress() { try { if ($this->headers->contain('HTTP_X_FORWARDED_FOR')) { $remoteAddresses = explode(',', $this->headers->value('HTTP_X_FORWARDED_FOR')->value()); return new IpAddress(trim($remoteAddresses[0])); } ...
php
public function originatingIpAddress() { try { if ($this->headers->contain('HTTP_X_FORWARDED_FOR')) { $remoteAddresses = explode(',', $this->headers->value('HTTP_X_FORWARDED_FOR')->value()); return new IpAddress(trim($remoteAddresses[0])); } ...
[ "public", "function", "originatingIpAddress", "(", ")", "{", "try", "{", "if", "(", "$", "this", "->", "headers", "->", "contain", "(", "'HTTP_X_FORWARDED_FOR'", ")", ")", "{", "$", "remoteAddresses", "=", "explode", "(", "','", ",", "$", "this", "->", "...
returns the ip address which issued the request originally The originating IP address is the IP address of the client which issued the request. In case the request was routed via several proxies it will still return the real client IP, and not the IP address of the last proxy in the chain. Please note that the method...
[ "returns", "the", "ip", "address", "which", "issued", "the", "request", "originally" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L192-L208
stubbles/stubbles-webapp-core
src/main/php/request/WebRequest.php
WebRequest.userAgent
public function userAgent(array $botSignatures = []): UserAgent { return new UserAgent( $this->headers->value('HTTP_USER_AGENT')->value(), $this->cookies->count() > 0, $botSignatures ); }
php
public function userAgent(array $botSignatures = []): UserAgent { return new UserAgent( $this->headers->value('HTTP_USER_AGENT')->value(), $this->cookies->count() > 0, $botSignatures ); }
[ "public", "function", "userAgent", "(", "array", "$", "botSignatures", "=", "[", "]", ")", ":", "UserAgent", "{", "return", "new", "UserAgent", "(", "$", "this", "->", "headers", "->", "value", "(", "'HTTP_USER_AGENT'", ")", "->", "value", "(", ")", ",",...
returns the user agent which issued the request Please be aware that user agents can fake their appearance. The bot recognition will recognize Googlebot, Bing (including former msnbot), Yahoo! Slurp, Pingdom and Yandex by default. Additional signatures can be passed, they must contain a regular expression which match...
[ "returns", "the", "user", "agent", "which", "issued", "the", "request" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/request/WebRequest.php#L224-L231