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
markwatkinson/luminous
src/Luminous/Core/Utils.php
Utils.tagBlock
public static function tagBlock($type, $block, $splitMultiline = true) { if ($type === null) { return $block; } $open = '<' . $type . '>'; $close = '</' . $type . '>'; if ($splitMultiline) { return $open . str_replace("\n", $close . "\n" . $open, $bloc...
php
public static function tagBlock($type, $block, $splitMultiline = true) { if ($type === null) { return $block; } $open = '<' . $type . '>'; $close = '</' . $type . '>'; if ($splitMultiline) { return $open . str_replace("\n", $close . "\n" . $open, $bloc...
[ "public", "static", "function", "tagBlock", "(", "$", "type", ",", "$", "block", ",", "$", "splitMultiline", "=", "true", ")", "{", "if", "(", "$", "type", "===", "null", ")", "{", "return", "$", "block", ";", "}", "$", "open", "=", "'<'", ".", "...
@brief Wraps a block of text in an XML tag Tags a block of text. The block is assumed to have been escaped correctly with LuminousUtils::escape_string. @param $type the type to tag the string as, this is the token name @param $block the block of text @param $split_multiline if this is set to true, the tags are closed ...
[ "@brief", "Wraps", "a", "block", "of", "text", "in", "an", "XML", "tag" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Utils.php#L88-L99
venta/framework
src/Routing/src/Exception/MethodNotAllowedException.php
MethodNotAllowedException.buildMessage
protected function buildMessage(array $allowedMethods): string { $ending = 'Allowed method is: %s'; if (count($allowedMethods) > 1) { $ending = 'Allowed methods are: %s'; } return sprintf('Method is not allowed. ' . $ending, implode(', ', $allowedMethods)); }
php
protected function buildMessage(array $allowedMethods): string { $ending = 'Allowed method is: %s'; if (count($allowedMethods) > 1) { $ending = 'Allowed methods are: %s'; } return sprintf('Method is not allowed. ' . $ending, implode(', ', $allowedMethods)); }
[ "protected", "function", "buildMessage", "(", "array", "$", "allowedMethods", ")", ":", "string", "{", "$", "ending", "=", "'Allowed method is: %s'", ";", "if", "(", "count", "(", "$", "allowedMethods", ")", ">", "1", ")", "{", "$", "ending", "=", "'Allowe...
Builds error message @param array $allowedMethods @return string
[ "Builds", "error", "message" ]
train
https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Routing/src/Exception/MethodNotAllowedException.php#L30-L39
mimmi20/Wurfl
src/Handlers/AndroidHandler.php
AndroidHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { $tolerance = Utils::toleranceToRisDelimeter($userAgent); if ($tolerance !== false) { return $this->getDeviceIDFromRIS($userAgent, $tolerance); } //Return no match for UAs with no extractable Android version, model and t...
php
public function applyConclusiveMatch($userAgent) { $tolerance = Utils::toleranceToRisDelimeter($userAgent); if ($tolerance !== false) { return $this->getDeviceIDFromRIS($userAgent, $tolerance); } //Return no match for UAs with no extractable Android version, model and t...
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "$", "tolerance", "=", "Utils", "::", "toleranceToRisDelimeter", "(", "$", "userAgent", ")", ";", "if", "(", "$", "tolerance", "!==", "false", ")", "{", "return", "$", "this", "...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AndroidHandler.php#L98-L119
mimmi20/Wurfl
src/Handlers/AndroidHandler.php
AndroidHandler.applyRecoveryMatch
public function applyRecoveryMatch($userAgent) { if (Utils::checkIfContains($userAgent, 'Froyo')) { return 'generic_android_ver2_2'; } $androidVersion = self::getAndroidVersion($userAgent); $versionString = str_replace('.', '_', $androidVersion); $deviceID ...
php
public function applyRecoveryMatch($userAgent) { if (Utils::checkIfContains($userAgent, 'Froyo')) { return 'generic_android_ver2_2'; } $androidVersion = self::getAndroidVersion($userAgent); $versionString = str_replace('.', '_', $androidVersion); $deviceID ...
[ "public", "function", "applyRecoveryMatch", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "checkIfContains", "(", "$", "userAgent", ",", "'Froyo'", ")", ")", "{", "return", "'generic_android_ver2_2'", ";", "}", "$", "androidVersion", "=", "self", ...
@param string $userAgent @return string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AndroidHandler.php#L126-L162
mimmi20/Wurfl
src/Handlers/AndroidHandler.php
AndroidHandler.getAndroidVersion
public static function getAndroidVersion($userAgent, $useDefault = true) { // Replace Android version names with their numbers // ex: Froyo => 2.2 $userAgent = str_replace( array_keys(self::$androidReleaseMap), array_values(self::$androidReleaseMap), $user...
php
public static function getAndroidVersion($userAgent, $useDefault = true) { // Replace Android version names with their numbers // ex: Froyo => 2.2 $userAgent = str_replace( array_keys(self::$androidReleaseMap), array_values(self::$androidReleaseMap), $user...
[ "public", "static", "function", "getAndroidVersion", "(", "$", "userAgent", ",", "$", "useDefault", "=", "true", ")", "{", "// Replace Android version names with their numbers", "// ex: Froyo => 2.2", "$", "userAgent", "=", "str_replace", "(", "array_keys", "(", "self",...
Get the Android version from the User Agent, or the default Android version is it cannot be determined @param string $userAgent User Agent @param bool $useDefault Return the default version on fail, else return null @return string Android version @see self::ANDROID_DEFAULT_VERSION
[ "Get", "the", "Android", "version", "from", "the", "User", "Agent", "or", "the", "default", "Android", "version", "is", "it", "cannot", "be", "determined" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AndroidHandler.php#L225-L251
mimmi20/Wurfl
src/Handlers/AndroidHandler.php
AndroidHandler.getAndroidModel
public static function getAndroidModel($userAgent) { // Normalize spaces in UA before capturing parts $userAgent = preg_replace('|;(?! )|', '; ', $userAgent); // Logic to detect some Gionee UAs like: (must remain above the regular model name extracting regex) // Mozilla/5.0 (Linux; ...
php
public static function getAndroidModel($userAgent) { // Normalize spaces in UA before capturing parts $userAgent = preg_replace('|;(?! )|', '; ', $userAgent); // Logic to detect some Gionee UAs like: (must remain above the regular model name extracting regex) // Mozilla/5.0 (Linux; ...
[ "public", "static", "function", "getAndroidModel", "(", "$", "userAgent", ")", "{", "// Normalize spaces in UA before capturing parts", "$", "userAgent", "=", "preg_replace", "(", "'|;(?! )|'", ",", "'; '", ",", "$", "userAgent", ")", ";", "// Logic to detect some Gione...
Get the model name from the provided user agent or null if it cannot be determined @param string $userAgent @return null|string
[ "Get", "the", "model", "name", "from", "the", "provided", "user", "agent", "or", "null", "if", "it", "cannot", "be", "determined" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/AndroidHandler.php#L260-L351
crysalead/net
src/Http/Request.php
Request.format
public function format($format = null) { if (func_num_args()) { return parent::format($format); } if ($this->_format === null) { $this->negotiate(); } return $this->_format; }
php
public function format($format = null) { if (func_num_args()) { return parent::format($format); } if ($this->_format === null) { $this->negotiate(); } return $this->_format; }
[ "public", "function", "format", "(", "$", "format", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", ")", "{", "return", "parent", "::", "format", "(", "$", "format", ")", ";", "}", "if", "(", "$", "this", "->", "_format", "===", "null"...
Gets/sets the format of the request. @param string $format A format name. @return string|self
[ "Gets", "/", "sets", "the", "format", "of", "the", "request", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L179-L188
crysalead/net
src/Http/Request.php
Request.accepts
public function accepts() { $accepts = $this->hasHeader('Accept') ? $this->getHeader('Accept') : ['text/html']; foreach ($accepts as $i => $value) { list($mime, $q) = preg_split('/;\s*q\s*=\s*/', $value, 2) + [$value, 1.0]; $stars = substr_count($mime, '*'); $sco...
php
public function accepts() { $accepts = $this->hasHeader('Accept') ? $this->getHeader('Accept') : ['text/html']; foreach ($accepts as $i => $value) { list($mime, $q) = preg_split('/;\s*q\s*=\s*/', $value, 2) + [$value, 1.0]; $stars = substr_count($mime, '*'); $sco...
[ "public", "function", "accepts", "(", ")", "{", "$", "accepts", "=", "$", "this", "->", "hasHeader", "(", "'Accept'", ")", "?", "$", "this", "->", "getHeader", "(", "'Accept'", ")", ":", "[", "'text/html'", "]", ";", "foreach", "(", "$", "accepts", "...
Return information about the mime of content that the client is requesting. @param boolean $all If `true` lists all accepted content mimes @return mixed Returns the negotiated mime or the accepted content mimes sorted by client preference if `$all` is set to `true`.
[ "Return", "information", "about", "the", "mime", "of", "content", "that", "the", "client", "is", "requesting", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L197-L211
crysalead/net
src/Http/Request.php
Request.mode
public function mode($mode = null) { if (func_num_args() === 0) { return $this->_mode; } $this->_mode = $mode; return $this; }
php
public function mode($mode = null) { if (func_num_args() === 0) { return $this->_mode; } $this->_mode = $mode; return $this; }
[ "public", "function", "mode", "(", "$", "mode", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_mode", ";", "}", "$", "this", "->", "_mode", "=", "$", "mode", ";", "return", "$", ...
Gets/sets the request's mode. @param string $mode The mode of the message @return string|self
[ "Gets", "/", "sets", "the", "request", "s", "mode", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L219-L226
crysalead/net
src/Http/Request.php
Request.port
public function port($port = null) { if (func_num_args() === 1) { $this->_port = $port; return $this; } if ($this->_port !== null) { return $this->_port; } $scheme = $this->_classes['scheme']; $name = $this->scheme(); if ($...
php
public function port($port = null) { if (func_num_args() === 1) { $this->_port = $port; return $this; } if ($this->_port !== null) { return $this->_port; } $scheme = $this->_classes['scheme']; $name = $this->scheme(); if ($...
[ "public", "function", "port", "(", "$", "port", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "1", ")", "{", "$", "this", "->", "_port", "=", "$", "port", ";", "return", "$", "this", ";", "}", "if", "(", "$", "this", "->",...
Gets/sets the port. @param string $port The port of the message. @return string|self
[ "Gets", "/", "sets", "the", "port", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L259-L274
crysalead/net
src/Http/Request.php
Request.path
public function path($path = null) { if (!func_num_args()) { return $this->_path; } $this->_path = '/' . ltrim($path, '/'); return $this; }
php
public function path($path = null) { if (!func_num_args()) { return $this->_path; } $this->_path = '/' . ltrim($path, '/'); return $this; }
[ "public", "function", "path", "(", "$", "path", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_path", ";", "}", "$", "this", "->", "_path", "=", "'/'", ".", "ltrim", "(", "$", "path", ...
Gets/sets the path. @param string $path Absolute path of the message. @return string|self
[ "Gets", "/", "sets", "the", "path", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L282-L289
crysalead/net
src/Http/Request.php
Request.method
public function method($method = null) { if (func_num_args() === 0) { return $this->_method; } $this->_method = strtoupper($method); return $this; }
php
public function method($method = null) { if (func_num_args() === 0) { return $this->_method; } $this->_method = strtoupper($method); return $this; }
[ "public", "function", "method", "(", "$", "method", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_method", ";", "}", "$", "this", "->", "_method", "=", "strtoupper", "(", "$", "met...
Gets/sets the method. @param string $method The method name to set. @return mixed
[ "Gets", "/", "sets", "the", "method", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L297-L304
crysalead/net
src/Http/Request.php
Request.username
public function username($username = null) { if (func_num_args() === 0) { return $this->_username; } $this->_username = $username ?: null; return $this; }
php
public function username($username = null) { if (func_num_args() === 0) { return $this->_username; } $this->_username = $username ?: null; return $this; }
[ "public", "function", "username", "(", "$", "username", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_username", ";", "}", "$", "this", "->", "_username", "=", "$", "username", "?", ...
Gets/sets the username. @param string $path The username of the message. @return string|self
[ "Gets", "/", "sets", "the", "username", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L312-L319
crysalead/net
src/Http/Request.php
Request.password
public function password($password = null) { if (func_num_args() === 0) { return $this->_password; } $this->_password = $password ?: null; return $this; }
php
public function password($password = null) { if (func_num_args() === 0) { return $this->_password; } $this->_password = $password ?: null; return $this; }
[ "public", "function", "password", "(", "$", "password", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_password", ";", "}", "$", "this", "->", "_password", "=", "$", "password", "?", ...
Gets/sets the password. @param string $path The password of the message. @return string|self
[ "Gets", "/", "sets", "the", "password", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L327-L334
crysalead/net
src/Http/Request.php
Request.url
public function url() { $scheme = $this->scheme(); $scheme = $scheme ? $scheme . '://' : '//'; $query = $this->query() ? '?' . http_build_query($this->query()) : ''; $fragment = $this->fragment() ? '#' . $this->fragment() : ''; return $scheme . $this->host() . $this->path() ....
php
public function url() { $scheme = $this->scheme(); $scheme = $scheme ? $scheme . '://' : '//'; $query = $this->query() ? '?' . http_build_query($this->query()) : ''; $fragment = $this->fragment() ? '#' . $this->fragment() : ''; return $scheme . $this->host() . $this->path() ....
[ "public", "function", "url", "(", ")", "{", "$", "scheme", "=", "$", "this", "->", "scheme", "(", ")", ";", "$", "scheme", "=", "$", "scheme", "?", "$", "scheme", ".", "'://'", ":", "'//'", ";", "$", "query", "=", "$", "this", "->", "query", "(...
Returns the message URI. @return string
[ "Returns", "the", "message", "URI", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L341-L348
crysalead/net
src/Http/Request.php
Request.credential
public function credential() { if (!$username = $this->username()) { return ''; } $credentials = $username; if ($password = $this->password()) { $credentials .= ':' . $password; } return $credentials; }
php
public function credential() { if (!$username = $this->username()) { return ''; } $credentials = $username; if ($password = $this->password()) { $credentials .= ':' . $password; } return $credentials; }
[ "public", "function", "credential", "(", ")", "{", "if", "(", "!", "$", "username", "=", "$", "this", "->", "username", "(", ")", ")", "{", "return", "''", ";", "}", "$", "credentials", "=", "$", "username", ";", "if", "(", "$", "password", "=", ...
Returns the credential. @return string|null The credential string.
[ "Returns", "the", "credential", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L355-L365
crysalead/net
src/Http/Request.php
Request.host
public function host($host = null) { if (func_num_args() === 0) { $scheme = $this->_classes['scheme']; $port = $scheme::port($this->_scheme) !== $this->_port ? $this->_port : null; return ($port !== null ? "{$this->_host}:{$port}" : $this->_host); } if (st...
php
public function host($host = null) { if (func_num_args() === 0) { $scheme = $this->_classes['scheme']; $port = $scheme::port($this->_scheme) !== $this->_port ? $this->_port : null; return ($port !== null ? "{$this->_host}:{$port}" : $this->_host); } if (st...
[ "public", "function", "host", "(", "$", "host", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "$", "scheme", "=", "$", "this", "->", "_classes", "[", "'scheme'", "]", ";", "$", "port", "=", "$", "scheme", "::"...
Gets/sets the host. @param string $host The host of the message @return string|self
[ "Gets", "/", "sets", "the", "host", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L373-L388
crysalead/net
src/Http/Request.php
Request.requestTarget
public function requestTarget() { if ($this->method() === 'CONNECT' || $this->mode() === 'authority') { $credential = $this->credential(); return ($credential ? $credential. '@' : '') . $this->host(); } if ($this->mode() === 'absolute') { return $this->ur...
php
public function requestTarget() { if ($this->method() === 'CONNECT' || $this->mode() === 'authority') { $credential = $this->credential(); return ($credential ? $credential. '@' : '') . $this->host(); } if ($this->mode() === 'absolute') { return $this->ur...
[ "public", "function", "requestTarget", "(", ")", "{", "if", "(", "$", "this", "->", "method", "(", ")", "===", "'CONNECT'", "||", "$", "this", "->", "mode", "(", ")", "===", "'authority'", ")", "{", "$", "credential", "=", "$", "this", "->", "credent...
Returns the request target present in the status line. @return string
[ "Returns", "the", "request", "target", "present", "in", "the", "status", "line", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L400-L415
crysalead/net
src/Http/Request.php
Request.auth
public function auth($auth = true) { $headers = $this->headers(); if ($auth === false) { unset($headers['Authorization']); } if (!$auth) { return; } if (is_array($auth) && !empty($auth['nonce'])) { $data = ['method' => $this->method...
php
public function auth($auth = true) { $headers = $this->headers(); if ($auth === false) { unset($headers['Authorization']); } if (!$auth) { return; } if (is_array($auth) && !empty($auth['nonce'])) { $data = ['method' => $this->method...
[ "public", "function", "auth", "(", "$", "auth", "=", "true", ")", "{", "$", "headers", "=", "$", "this", "->", "headers", "(", ")", ";", "if", "(", "$", "auth", "===", "false", ")", "{", "unset", "(", "$", "headers", "[", "'Authorization'", "]", ...
Sets the request authorization. @param mixed $auth Any array with a 'nonce' attribute implies Digest authentication. Defaults to Basic authentication otherwise. If `false` the Authorization header will be removed. @return mixed
[ "Sets", "the", "request", "authorization", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L425-L444
crysalead/net
src/Http/Request.php
Request.query
public function query($qs = null) { if (func_num_args() === 0) { return $this->_query; } if (is_string($qs)) { parse_str($qs, $qs); } $this->_query = $qs + $this->_query; return $this; }
php
public function query($qs = null) { if (func_num_args() === 0) { return $this->_query; } if (is_string($qs)) { parse_str($qs, $qs); } $this->_query = $qs + $this->_query; return $this; }
[ "public", "function", "query", "(", "$", "qs", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_query", ";", "}", "if", "(", "is_string", "(", "$", "qs", ")", ")", "{", "parse_str",...
Gets/sets the query string. @param string|array $qs The query string to set or none to get the defined one. @return string
[ "Gets", "/", "sets", "the", "query", "string", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L452-L462
crysalead/net
src/Http/Request.php
Request.fragment
public function fragment($fragment = null) { if (func_num_args() === 0) { return $this->_fragment; } $this->_fragment = $fragment; return $this; }
php
public function fragment($fragment = null) { if (func_num_args() === 0) { return $this->_fragment; } $this->_fragment = $fragment; return $this; }
[ "public", "function", "fragment", "(", "$", "fragment", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_fragment", ";", "}", "$", "this", "->", "_fragment", "=", "$", "fragment", ";", ...
Gets/sets the fragment string. @param string $fragment The fragment string to set or none to get the defined one. @return string
[ "Gets", "/", "sets", "the", "fragment", "string", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L470-L477
crysalead/net
src/Http/Request.php
Request.applyCookies
public function applyCookies($cookies) { $values = []; foreach ($cookies as $cookie) { if ($cookie->matches($this->url())) { $values[$cookie->path()] = $cookie->name() . '=' . $cookie->value(); } } $keys = array_map('strlen', array_keys($value...
php
public function applyCookies($cookies) { $values = []; foreach ($cookies as $cookie) { if ($cookie->matches($this->url())) { $values[$cookie->path()] = $cookie->name() . '=' . $cookie->value(); } } $keys = array_map('strlen', array_keys($value...
[ "public", "function", "applyCookies", "(", "$", "cookies", ")", "{", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "cookies", "as", "$", "cookie", ")", "{", "if", "(", "$", "cookie", "->", "matches", "(", "$", "this", "->", "url", "(", ...
Set the Cookie header @param array $cookies The cookies. @return self
[ "Set", "the", "Cookie", "header" ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L498-L516
crysalead/net
src/Http/Request.php
Request.cookieValues
public function cookieValues() { $headers = $request->headers(); return isset($headers['Cookie']) ? CookieValues::toArray($headers['Cookie']->value()) : []; }
php
public function cookieValues() { $headers = $request->headers(); return isset($headers['Cookie']) ? CookieValues::toArray($headers['Cookie']->value()) : []; }
[ "public", "function", "cookieValues", "(", ")", "{", "$", "headers", "=", "$", "request", "->", "headers", "(", ")", ";", "return", "isset", "(", "$", "headers", "[", "'Cookie'", "]", ")", "?", "CookieValues", "::", "toArray", "(", "$", "headers", "[",...
Extract cookies value. @return array The cookies value.
[ "Extract", "cookies", "value", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L523-L527
crysalead/net
src/Http/Request.php
Request.export
public function export($options = []) { $this->_setContentLength(); return [ 'method' => $this->method(), 'scheme' => $this->scheme(), 'version' => $this->version(), 'hostname' => $this->hostname(), 'port' => $this->port(), ...
php
public function export($options = []) { $this->_setContentLength(); return [ 'method' => $this->method(), 'scheme' => $this->scheme(), 'version' => $this->version(), 'hostname' => $this->hostname(), 'port' => $this->port(), ...
[ "public", "function", "export", "(", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "_setContentLength", "(", ")", ";", "return", "[", "'method'", "=>", "$", "this", "->", "method", "(", ")", ",", "'scheme'", "=>", "$", "this", "->", "...
Exports a `Request` instance to an array. @param mixed $request A `Request` instance. @param array $options Options. @return array The export array.
[ "Exports", "a", "Request", "instance", "to", "an", "array", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L536-L553
crysalead/net
src/Http/Request.php
Request.create
public static function create($method = 'GET', $url = null, $config = []) { if (func_num_args()) { if(!preg_match('~^(?:[a-z]+:)?//~i', $url) || !$defaults = parse_url($url)) { throw new NetException("Invalid url: `'{$url}'`."); } $defaults['username'] = i...
php
public static function create($method = 'GET', $url = null, $config = []) { if (func_num_args()) { if(!preg_match('~^(?:[a-z]+:)?//~i', $url) || !$defaults = parse_url($url)) { throw new NetException("Invalid url: `'{$url}'`."); } $defaults['username'] = i...
[ "public", "static", "function", "create", "(", "$", "method", "=", "'GET'", ",", "$", "url", "=", "null", ",", "$", "config", "=", "[", "]", ")", "{", "if", "(", "func_num_args", "(", ")", ")", "{", "if", "(", "!", "preg_match", "(", "'~^(?:[a-z]+:...
Creates a request instance using an absolute URL. @param string $url An absolute URL. @param array $config The config array. @return self
[ "Creates", "a", "request", "instance", "using", "an", "absolute", "URL", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Request.php#L562-L573
crysalead/net
src/Mime/Message.php
Message.version
public function version($version = null) { if (func_num_args() === 0) { return $this->_version; } $headers = $this->headers(); $headers->prepend('MIME-Version', $version); $this->_version = $version; return $this; }
php
public function version($version = null) { if (func_num_args() === 0) { return $this->_version; } $headers = $this->headers(); $headers->prepend('MIME-Version', $version); $this->_version = $version; return $this; }
[ "public", "function", "version", "(", "$", "version", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_version", ";", "}", "$", "headers", "=", "$", "this", "->", "headers", "(", ")",...
Gets/sets the MIME protocol version number. @param string The version number. @return string|self
[ "Gets", "/", "sets", "the", "MIME", "protocol", "version", "number", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L126-L135
crysalead/net
src/Mime/Message.php
Message.client
public function client($client = null) { if (!func_num_args()) { return $this->_client; } $this->_client = $client; return $this; }
php
public function client($client = null) { if (!func_num_args()) { return $this->_client; } $this->_client = $client; return $this; }
[ "public", "function", "client", "(", "$", "client", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_client", ";", "}", "$", "this", "->", "_client", "=", "$", "client", ";", "return", "$", ...
Get/set the client hostname. @param string $client The client hostname @return string|self
[ "Get", "/", "set", "the", "client", "hostname", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L143-L150
crysalead/net
src/Mime/Message.php
Message.headers
public function headers($headers = null) { if (!func_num_args()) { return $this->_stream->headers(); } $this->_stream->headers($headers); return $this; }
php
public function headers($headers = null) { if (!func_num_args()) { return $this->_stream->headers(); } $this->_stream->headers($headers); return $this; }
[ "public", "function", "headers", "(", "$", "headers", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_stream", "->", "headers", "(", ")", ";", "}", "$", "this", "->", "_stream", "->", "head...
Get/set the headers instance @param string $headers The headers instance @return string
[ "Get", "/", "set", "the", "headers", "instance" ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L158-L165
crysalead/net
src/Mime/Message.php
Message.mime
public function mime($mime = null) { if (!func_num_args()) { return $this->_stream->mime(); } $this->_stream->mime($mime); return $this; }
php
public function mime($mime = null) { if (!func_num_args()) { return $this->_stream->mime(); } $this->_stream->mime($mime); return $this; }
[ "public", "function", "mime", "(", "$", "mime", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_stream", "->", "mime", "(", ")", ";", "}", "$", "this", "->", "_stream", "->", "mime", "(",...
Get/set the mime. @param string $mime @return string The mime.
[ "Get", "/", "set", "the", "mime", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L173-L180
crysalead/net
src/Mime/Message.php
Message.charset
public function charset($charset = null) { if (!func_num_args()) { return $this->_stream->charset(); } $this->_stream->charset($charset); return $this; }
php
public function charset($charset = null) { if (!func_num_args()) { return $this->_stream->charset(); } $this->_stream->charset($charset); return $this; }
[ "public", "function", "charset", "(", "$", "charset", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_stream", "->", "charset", "(", ")", ";", "}", "$", "this", "->", "_stream", "->", "char...
Get/set the charset. @param string $charset @return string The charset.
[ "Get", "/", "set", "the", "charset", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L188-L195
crysalead/net
src/Mime/Message.php
Message.encoding
public function encoding($encoding = null) { if (!func_num_args()) { return $this->_stream->encoding(); } $this->_stream->encoding($encoding); return $this; }
php
public function encoding($encoding = null) { if (!func_num_args()) { return $this->_stream->encoding(); } $this->_stream->encoding($encoding); return $this; }
[ "public", "function", "encoding", "(", "$", "encoding", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_stream", "->", "encoding", "(", ")", ";", "}", "$", "this", "->", "_stream", "->", "e...
Get/set the encoding. @param string $encoding @return string The encoding.
[ "Get", "/", "set", "the", "encoding", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L203-L210
crysalead/net
src/Mime/Message.php
Message.priority
public function priority($priority = null) { $headers = $this->headers(); if (!func_num_args()) { return $headers['X-Priority']; } $headers['X-Priority'] = (string) $priority; return $this; }
php
public function priority($priority = null) { $headers = $this->headers(); if (!func_num_args()) { return $headers['X-Priority']; } $headers['X-Priority'] = (string) $priority; return $this; }
[ "public", "function", "priority", "(", "$", "priority", "=", "null", ")", "{", "$", "headers", "=", "$", "this", "->", "headers", "(", ")", ";", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "headers", "[", "'X-Priority'", "]", ...
Get/set email priority. @param integer $priority. @return mixed
[ "Get", "/", "set", "email", "priority", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L218-L226
crysalead/net
src/Mime/Message.php
Message.wordWrap
public function wordWrap($wordWrap = null) { if (!func_num_args()) { return $this->_wordWrap; } $this->_wordWrap = !!$wordWrap; return $this; }
php
public function wordWrap($wordWrap = null) { if (!func_num_args()) { return $this->_wordWrap; } $this->_wordWrap = !!$wordWrap; return $this; }
[ "public", "function", "wordWrap", "(", "$", "wordWrap", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_wordWrap", ";", "}", "$", "this", "->", "_wordWrap", "=", "!", "!", "$", "wordWrap", ...
Get/set the word wrap mode. @param boolean $wordWrap Enabling or not the word wrapping @return boolean|self
[ "Get", "/", "set", "the", "word", "wrap", "mode", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L234-L241
crysalead/net
src/Mime/Message.php
Message.from
public function from($address = null, $name = null) { if (!func_num_args()) { return $this->_from; } $class = $this->_classes['address']; $this->_from = new $class($address, $name); $headers = $this->headers(); $headers['From'] = $this->_from->toString();...
php
public function from($address = null, $name = null) { if (!func_num_args()) { return $this->_from; } $class = $this->_classes['address']; $this->_from = new $class($address, $name); $headers = $this->headers(); $headers['From'] = $this->_from->toString();...
[ "public", "function", "from", "(", "$", "address", "=", "null", ",", "$", "name", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_from", ";", "}", "$", "class", "=", "$", "this", "->", ...
Get/Set the sender email. @param string $address The sender email address. @param mixed $name The sender name. @return self
[ "Get", "/", "Set", "the", "sender", "email", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L250-L261
crysalead/net
src/Mime/Message.php
Message.subject
public function subject($subject = null) { $headers = $this->headers(); if (!func_num_args()) { return $headers['Subject']; } $headers['Subject'] = Mime::encodeValue($subject, 998, "\r\n "); return $this; }
php
public function subject($subject = null) { $headers = $this->headers(); if (!func_num_args()) { return $headers['Subject']; } $headers['Subject'] = Mime::encodeValue($subject, 998, "\r\n "); return $this; }
[ "public", "function", "subject", "(", "$", "subject", "=", "null", ")", "{", "$", "headers", "=", "$", "this", "->", "headers", "(", ")", ";", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "headers", "[", "'Subject'", "]", ";"...
Get/Set the subject of the message. @param string $subject The subject. @return self
[ "Get", "/", "Set", "the", "subject", "of", "the", "message", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L269-L277
crysalead/net
src/Mime/Message.php
Message.returnPath
public function returnPath($returnPath = null) { if (!func_num_args()) { return $this->_returnPath; } $this->_returnPath = $returnPath; $headers = $this->headers(); $headers['Return-Path'] = '<' . Mime::encodeEmail($returnPath) .'>'; return $this; }
php
public function returnPath($returnPath = null) { if (!func_num_args()) { return $this->_returnPath; } $this->_returnPath = $returnPath; $headers = $this->headers(); $headers['Return-Path'] = '<' . Mime::encodeEmail($returnPath) .'>'; return $this; }
[ "public", "function", "returnPath", "(", "$", "returnPath", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_returnPath", ";", "}", "$", "this", "->", "_returnPath", "=", "$", "returnPath", ";",...
Get/set the Return-Path header of the message. @param string $returnPath The sender email address. @return mixed
[ "Get", "/", "set", "the", "Return", "-", "Path", "header", "of", "the", "message", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L285-L294
crysalead/net
src/Mime/Message.php
Message.addTo
public function addTo($address, $name = null) { $address = $this->_addRecipient('To', $address, $name); $this->_recipients[$address->email()] = $address; return $this; }
php
public function addTo($address, $name = null) { $address = $this->_addRecipient('To', $address, $name); $this->_recipients[$address->email()] = $address; return $this; }
[ "public", "function", "addTo", "(", "$", "address", ",", "$", "name", "=", "null", ")", "{", "$", "address", "=", "$", "this", "->", "_addRecipient", "(", "'To'", ",", "$", "address", ",", "$", "name", ")", ";", "$", "this", "->", "_recipients", "[...
Add an email recipient. @param string $address The email address. @param mixed $name The name. @return self
[ "Add", "an", "email", "recipient", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L316-L321
crysalead/net
src/Mime/Message.php
Message.addCc
public function addCc($address, $name = null) { $address = $this->_addRecipient('Cc', $address, $name); $this->_recipients[$address->email()] = $address; return $this; }
php
public function addCc($address, $name = null) { $address = $this->_addRecipient('Cc', $address, $name); $this->_recipients[$address->email()] = $address; return $this; }
[ "public", "function", "addCc", "(", "$", "address", ",", "$", "name", "=", "null", ")", "{", "$", "address", "=", "$", "this", "->", "_addRecipient", "(", "'Cc'", ",", "$", "address", ",", "$", "name", ")", ";", "$", "this", "->", "_recipients", "[...
Adds carbon copy email recipient. @param string $address The email address. @param mixed $name The name. @return self
[ "Adds", "carbon", "copy", "email", "recipient", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L330-L335
crysalead/net
src/Mime/Message.php
Message.addBcc
public function addBcc($address, $name = null) { $class = $this->_classes['address']; $bcc = new $class($address, $name); $this->_recipients[$bcc->email()] = $bcc; return $this; }
php
public function addBcc($address, $name = null) { $class = $this->_classes['address']; $bcc = new $class($address, $name); $this->_recipients[$bcc->email()] = $bcc; return $this; }
[ "public", "function", "addBcc", "(", "$", "address", ",", "$", "name", "=", "null", ")", "{", "$", "class", "=", "$", "this", "->", "_classes", "[", "'address'", "]", ";", "$", "bcc", "=", "new", "$", "class", "(", "$", "address", ",", "$", "name...
Adds blind carbon copy email recipient. @param string $address The sender email address. @param mixed $name The sender name. @return self
[ "Adds", "blind", "carbon", "copy", "email", "recipient", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L344-L350
crysalead/net
src/Mime/Message.php
Message._addRecipient
protected function _addRecipient($type, $address, $name = null) { $classes = $this->_classes; $headers = $this->headers(); if (!isset($headers[$type])) { $addresses = $classes['addresses']; $headers[$type] = new $addresses(); } $class = $classes['addre...
php
protected function _addRecipient($type, $address, $name = null) { $classes = $this->_classes; $headers = $this->headers(); if (!isset($headers[$type])) { $addresses = $classes['addresses']; $headers[$type] = new $addresses(); } $class = $classes['addre...
[ "protected", "function", "_addRecipient", "(", "$", "type", ",", "$", "address", ",", "$", "name", "=", "null", ")", "{", "$", "classes", "=", "$", "this", "->", "_classes", ";", "$", "headers", "=", "$", "this", "->", "headers", "(", ")", ";", "if...
Add a recipient to a specific type section. @param string $type The type of recipient. @param string $address The email address. @param mixed $name The name. @return objedt The created address.
[ "Add", "a", "recipient", "to", "a", "specific", "type", "section", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L360-L372
crysalead/net
src/Mime/Message.php
Message.addInline
public function addInline($path, $name = null, $mime = true, $encoding = true) { $cid = static::generateId($this->client()); $filename = basename($path); $this->_inlines[$path] = [ 'filename' => $name ?: $filename, 'disposition' => 'attachment', 'mime' ...
php
public function addInline($path, $name = null, $mime = true, $encoding = true) { $cid = static::generateId($this->client()); $filename = basename($path); $this->_inlines[$path] = [ 'filename' => $name ?: $filename, 'disposition' => 'attachment', 'mime' ...
[ "public", "function", "addInline", "(", "$", "path", ",", "$", "name", "=", "null", ",", "$", "mime", "=", "true", ",", "$", "encoding", "=", "true", ")", "{", "$", "cid", "=", "static", "::", "generateId", "(", "$", "this", "->", "client", "(", ...
Add an embedded file.
[ "Add", "an", "embedded", "file", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L407-L418
crysalead/net
src/Mime/Message.php
Message.addAttachment
public function addAttachment($path, $name = null, $mime = true, $encoding = true) { $cid = static::generateId($this->client()); $filename = basename($path); $this->_attachments[$path] = [ 'filename' => $name ?: $filename, 'disposition' => 'attachment', ...
php
public function addAttachment($path, $name = null, $mime = true, $encoding = true) { $cid = static::generateId($this->client()); $filename = basename($path); $this->_attachments[$path] = [ 'filename' => $name ?: $filename, 'disposition' => 'attachment', ...
[ "public", "function", "addAttachment", "(", "$", "path", ",", "$", "name", "=", "null", ",", "$", "mime", "=", "true", ",", "$", "encoding", "=", "true", ")", "{", "$", "cid", "=", "static", "::", "generateId", "(", "$", "this", "->", "client", "("...
Add an attachment.
[ "Add", "an", "attachment", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L423-L434
crysalead/net
src/Mime/Message.php
Message.body
public function body($value = null) { if (!func_num_args()) { return $this->_body; } $this->_body = (string) $value; return $this; }
php
public function body($value = null) { if (!func_num_args()) { return $this->_body; } $this->_body = (string) $value; return $this; }
[ "public", "function", "body", "(", "$", "value", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_body", ";", "}", "$", "this", "->", "_body", "=", "(", "string", ")", "$", "value", ";", ...
Get/set the alt body message. @param string $value. @return string|self
[ "Get", "/", "set", "the", "alt", "body", "message", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L442-L449
crysalead/net
src/Mime/Message.php
Message.altBody
public function altBody($value = null) { if (!func_num_args()) { return $this->_altBody; } $this->_altBody = (string) $value; return $this; }
php
public function altBody($value = null) { if (!func_num_args()) { return $this->_altBody; } $this->_altBody = (string) $value; return $this; }
[ "public", "function", "altBody", "(", "$", "value", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_altBody", ";", "}", "$", "this", "->", "_altBody", "=", "(", "string", ")", "$", "value",...
Get/set the alt body message. @param string $value. @return string|self
[ "Get", "/", "set", "the", "alt", "body", "message", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L457-L464
crysalead/net
src/Mime/Message.php
Message.html
public function html($body, $basePath = null) { if (!func_num_args()) { return $this->_body; } if ($basePath) { $cids = []; $hasInline = preg_match_all('~ (<img[^<>]*\s src\s*=\s* |<body[^<>]*\s background\s*=\s* ...
php
public function html($body, $basePath = null) { if (!func_num_args()) { return $this->_body; } if ($basePath) { $cids = []; $hasInline = preg_match_all('~ (<img[^<>]*\s src\s*=\s* |<body[^<>]*\s background\s*=\s* ...
[ "public", "function", "html", "(", "$", "body", ",", "$", "basePath", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_body", ";", "}", "if", "(", "$", "basePath", ")", "{", "$", "cids", ...
Set the HTML body message with an optionnal alternative body. @param string $body The HTML body message. @param string $altBody The alt body. @return string|self
[ "Set", "the", "HTML", "body", "message", "with", "an", "optionnal", "alternative", "body", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L473-L507
crysalead/net
src/Mime/Message.php
Message.toMessage
public function toMessage() { $message = clone $this; $altBody = $message->altBody(); $attachments = $message->attachments(); $inlines = $message->inlines(); $root = $cursor = $message->stream(); $body = $message->body(); $bodyMime = $cursor->mime() ?: 'tex...
php
public function toMessage() { $message = clone $this; $altBody = $message->altBody(); $attachments = $message->attachments(); $inlines = $message->inlines(); $root = $cursor = $message->stream(); $body = $message->body(); $bodyMime = $cursor->mime() ?: 'tex...
[ "public", "function", "toMessage", "(", ")", "{", "$", "message", "=", "clone", "$", "this", ";", "$", "altBody", "=", "$", "message", "->", "altBody", "(", ")", ";", "$", "attachments", "=", "$", "message", "->", "attachments", "(", ")", ";", "$", ...
Magic method to convert the instance into an HTTP message string. @return string
[ "Magic", "method", "to", "convert", "the", "instance", "into", "an", "HTTP", "message", "string", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L524-L581
crysalead/net
src/Mime/Message.php
Message.stripTags
public static function stripTags($html, $charset = 'UTF-8') { $patterns = [ '~<(style|script|head).*</\\1>~Uis' => '', '~<t[dh][ >]~i' => ' $0', '~<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>~is' => '$2 &lt;$1&gt;', '~[\r\n ]+~' => ' ', ...
php
public static function stripTags($html, $charset = 'UTF-8') { $patterns = [ '~<(style|script|head).*</\\1>~Uis' => '', '~<t[dh][ >]~i' => ' $0', '~<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>~is' => '$2 &lt;$1&gt;', '~[\r\n ]+~' => ' ', ...
[ "public", "static", "function", "stripTags", "(", "$", "html", ",", "$", "charset", "=", "'UTF-8'", ")", "{", "$", "patterns", "=", "[", "'~<(style|script|head).*</\\\\1>~Uis'", "=>", "''", ",", "'~<t[dh][ >]~i'", "=>", "' $0'", ",", "'~<a\\s[^>]*href=(?|\"([^\"]+...
Strip HTML tags @param string $html The html content @return string
[ "Strip", "HTML", "tags" ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Message.php#L632-L646
mimmi20/Wurfl
src/Handlers/OperaHandler.php
OperaHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { $operaIndex = strpos($userAgent, 'Opera'); $tolerance = Utils::indexOfOrLength($userAgent, '.', $operaIndex); return $this->getDeviceIDFromRIS($userAgent, $tolerance); }
php
public function applyConclusiveMatch($userAgent) { $operaIndex = strpos($userAgent, 'Opera'); $tolerance = Utils::indexOfOrLength($userAgent, '.', $operaIndex); return $this->getDeviceIDFromRIS($userAgent, $tolerance); }
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "$", "operaIndex", "=", "strpos", "(", "$", "userAgent", ",", "'Opera'", ")", ";", "$", "tolerance", "=", "Utils", "::", "indexOfOrLength", "(", "$", "userAgent", ",", "'.'", ",...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/OperaHandler.php#L79-L85
mimmi20/Wurfl
src/Handlers/OperaHandler.php
OperaHandler.applyRecoveryMatch
public function applyRecoveryMatch($userAgent) { $operaVersion = self::getOperaVersion($userAgent); if ($operaVersion === null) { return 'opera'; } $majorVersion = floor($operaVersion); $id = 'opera_' . $majorVersion; if (in_array($id, self::$...
php
public function applyRecoveryMatch($userAgent) { $operaVersion = self::getOperaVersion($userAgent); if ($operaVersion === null) { return 'opera'; } $majorVersion = floor($operaVersion); $id = 'opera_' . $majorVersion; if (in_array($id, self::$...
[ "public", "function", "applyRecoveryMatch", "(", "$", "userAgent", ")", "{", "$", "operaVersion", "=", "self", "::", "getOperaVersion", "(", "$", "userAgent", ")", ";", "if", "(", "$", "operaVersion", "===", "null", ")", "{", "return", "'opera'", ";", "}",...
@param string $userAgent @return string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/OperaHandler.php#L92-L108
sifophp/sifo-common-instance
controllers/home/index.php
HomeIndexController.buildCommon
public function buildCommon() { $filtering_post = \Sifo\FilterPost::getInstance(); // EXAMPLE OF HOW MODULES WORK. Add an advertising module: $this->addModule( 'ads_google_skyscrapper' , 'SharedAdvertising' ); // TEST FORM SENT if ( $filtering_post->isSent( 'testform' ) ) { $form = \Sifo\Form::getIns...
php
public function buildCommon() { $filtering_post = \Sifo\FilterPost::getInstance(); // EXAMPLE OF HOW MODULES WORK. Add an advertising module: $this->addModule( 'ads_google_skyscrapper' , 'SharedAdvertising' ); // TEST FORM SENT if ( $filtering_post->isSent( 'testform' ) ) { $form = \Sifo\Form::getIns...
[ "public", "function", "buildCommon", "(", ")", "{", "$", "filtering_post", "=", "\\", "Sifo", "\\", "FilterPost", "::", "getInstance", "(", ")", ";", "// EXAMPLE OF HOW MODULES WORK. Add an advertising module:", "$", "this", "->", "addModule", "(", "'ads_google_skyscr...
Because this class is extending from SharedFirstLevelController instead of Controller, some modules are executed in first place, like: head, header or footer. See template for inclusion.
[ "Because", "this", "class", "is", "extending", "from", "SharedFirstLevelController", "instead", "of", "Controller", "some", "modules", "are", "executed", "in", "first", "place", "like", ":", "head", "header", "or", "footer", "." ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/home/index.php#L21-L134
antarestupin/Accessible
lib/Accessible/AutoConstructTrait.php
AutoConstructTrait.initializeProperties
protected function initializeProperties($properties = null) { $this->getPropertiesInfo(); // Initialize the properties that were defined using the Initialize / InitializeObject annotations $initializeValueValidationEnabled = Configuration::isInitializeValuesValidationEnabled(); fore...
php
protected function initializeProperties($properties = null) { $this->getPropertiesInfo(); // Initialize the properties that were defined using the Initialize / InitializeObject annotations $initializeValueValidationEnabled = Configuration::isInitializeValuesValidationEnabled(); fore...
[ "protected", "function", "initializeProperties", "(", "$", "properties", "=", "null", ")", "{", "$", "this", "->", "getPropertiesInfo", "(", ")", ";", "// Initialize the properties that were defined using the Initialize / InitializeObject annotations", "$", "initializeValueVali...
Initializes the object according to its class specification and given arguments. @param array $properties The values to give to the properties.
[ "Initializes", "the", "object", "according", "to", "its", "class", "specification", "and", "given", "arguments", "." ]
train
https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/AutoConstructTrait.php#L22-L63
antarestupin/Accessible
lib/Accessible/AutoConstructTrait.php
AutoConstructTrait.updateInitializedPropertyValue
private function updateInitializedPropertyValue($propertyName, $value) { if (empty($this->_collectionsItemNames['byProperty'][$propertyName])) { $this->updatePropertyAssociation($propertyName, array("oldValue" => null, "newValue" => $value)); } else { foreach ($value as $newV...
php
private function updateInitializedPropertyValue($propertyName, $value) { if (empty($this->_collectionsItemNames['byProperty'][$propertyName])) { $this->updatePropertyAssociation($propertyName, array("oldValue" => null, "newValue" => $value)); } else { foreach ($value as $newV...
[ "private", "function", "updateInitializedPropertyValue", "(", "$", "propertyName", ",", "$", "value", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "_collectionsItemNames", "[", "'byProperty'", "]", "[", "$", "propertyName", "]", ")", ")", "{", "$", ...
Update an initialized value. @param string $propertyName @param mixed $value
[ "Update", "an", "initialized", "value", "." ]
train
https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/AutoConstructTrait.php#L71-L80
ssnepenthe/soter
src/class-upgrader.php
Upgrader.delete_vulnerabilities
protected function delete_vulnerabilities() { $query = new WP_Query( [ 'fields' => 'ids', 'no_found_rows' => true, 'post_type' => 'soter_vulnerability', 'post_status' => 'private', // @todo Vulnerabilities were previously garbage collected on a daily // basis so it shouldn't be a problem to get all ...
php
protected function delete_vulnerabilities() { $query = new WP_Query( [ 'fields' => 'ids', 'no_found_rows' => true, 'post_type' => 'soter_vulnerability', 'post_status' => 'private', // @todo Vulnerabilities were previously garbage collected on a daily // basis so it shouldn't be a problem to get all ...
[ "protected", "function", "delete_vulnerabilities", "(", ")", "{", "$", "query", "=", "new", "WP_Query", "(", "[", "'fields'", "=>", "'ids'", ",", "'no_found_rows'", "=>", "true", ",", "'post_type'", "=>", "'soter_vulnerability'", ",", "'post_status'", "=>", "'pr...
Deletes any lingering soter_vulnerability posts. @return void
[ "Deletes", "any", "lingering", "soter_vulnerability", "posts", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-upgrader.php#L51-L68
ssnepenthe/soter
src/class-upgrader.php
Upgrader.prepare_ignored_plugins
protected function prepare_ignored_plugins( array $plugins ) { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $valid_slugs = array_map( function( $file ) { if ( false === strpos( $file, '/' ) ) { $slug = basename( $file, '.php' ); } else { $s...
php
protected function prepare_ignored_plugins( array $plugins ) { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $valid_slugs = array_map( function( $file ) { if ( false === strpos( $file, '/' ) ) { $slug = basename( $file, '.php' ); } else { $s...
[ "protected", "function", "prepare_ignored_plugins", "(", "array", "$", "plugins", ")", "{", "if", "(", "!", "function_exists", "(", "'get_plugins'", ")", ")", "{", "require_once", "ABSPATH", ".", "'wp-admin/includes/plugin.php'", ";", "}", "$", "valid_slugs", "=",...
Ensure ignored plugins setting only contains currently installed plugins. @param array $plugins List of ignored plugins. @return array
[ "Ensure", "ignored", "plugins", "setting", "only", "contains", "currently", "installed", "plugins", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-upgrader.php#L77-L93
ssnepenthe/soter
src/class-upgrader.php
Upgrader.prepare_ignored_themes
protected function prepare_ignored_themes( array $themes ) { $valid_slugs = array_values( wp_list_pluck( wp_get_themes(), 'stylesheet' ) ); return array_values( array_intersect( $valid_slugs, $themes ) ); }
php
protected function prepare_ignored_themes( array $themes ) { $valid_slugs = array_values( wp_list_pluck( wp_get_themes(), 'stylesheet' ) ); return array_values( array_intersect( $valid_slugs, $themes ) ); }
[ "protected", "function", "prepare_ignored_themes", "(", "array", "$", "themes", ")", "{", "$", "valid_slugs", "=", "array_values", "(", "wp_list_pluck", "(", "wp_get_themes", "(", ")", ",", "'stylesheet'", ")", ")", ";", "return", "array_values", "(", "array_int...
Ensure ignored themes setting only contains currently installed themes. @param array $themes List of ignored themes. @return array
[ "Ensure", "ignored", "themes", "setting", "only", "contains", "currently", "installed", "themes", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-upgrader.php#L102-L109
ssnepenthe/soter
src/class-upgrader.php
Upgrader.upgrade_to_050
protected function upgrade_to_050() { if ( $this->options->installed_version ) { return; } $this->upgrade_cron(); $this->upgrade_options(); $this->upgrade_results(); $this->delete_vulnerabilities(); // Set installed version so upgrader does not run again. $this->options->get_store()->set( 'install...
php
protected function upgrade_to_050() { if ( $this->options->installed_version ) { return; } $this->upgrade_cron(); $this->upgrade_options(); $this->upgrade_results(); $this->delete_vulnerabilities(); // Set installed version so upgrader does not run again. $this->options->get_store()->set( 'install...
[ "protected", "function", "upgrade_to_050", "(", ")", "{", "if", "(", "$", "this", "->", "options", "->", "installed_version", ")", "{", "return", ";", "}", "$", "this", "->", "upgrade_cron", "(", ")", ";", "$", "this", "->", "upgrade_options", "(", ")", ...
Required logic for upgrading to v0.5.0. @return void
[ "Required", "logic", "for", "upgrading", "to", "v0", ".", "5", ".", "0", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-upgrader.php#L116-L129
ssnepenthe/soter
src/class-upgrader.php
Upgrader.upgrade_options
protected function upgrade_options() { // Pre-0.4.0 options array to 0.5.0+ individual option entries. $old_options = (array) $this->options->get_store()->get( 'settings', [] ); if ( isset( $old_options['email_address'] ) ) { $sanitized = sanitize_email( $old_options['email_address'] ); if ( $sanitized ) ...
php
protected function upgrade_options() { // Pre-0.4.0 options array to 0.5.0+ individual option entries. $old_options = (array) $this->options->get_store()->get( 'settings', [] ); if ( isset( $old_options['email_address'] ) ) { $sanitized = sanitize_email( $old_options['email_address'] ); if ( $sanitized ) ...
[ "protected", "function", "upgrade_options", "(", ")", "{", "// Pre-0.4.0 options array to 0.5.0+ individual option entries.", "$", "old_options", "=", "(", "array", ")", "$", "this", "->", "options", "->", "get_store", "(", ")", "->", "get", "(", "'settings'", ",", ...
Upgrade to latest options implementation. @return void
[ "Upgrade", "to", "latest", "options", "implementation", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-upgrader.php#L153-L200
serverdensity/sd-php-wrapper
lib/serverdensity/Api/Devices.php
Devices.create
public function create($device, array $tagNames = array()){ if (!empty($tagNames)){ $tagEndpoint = new Tags($this->client); $tags = $tagEndpoint->findAll($tagNames); if(!empty($tags['notFound'])){ foreach($tags['notFound'] as $name){ $tags[...
php
public function create($device, array $tagNames = array()){ if (!empty($tagNames)){ $tagEndpoint = new Tags($this->client); $tags = $tagEndpoint->findAll($tagNames); if(!empty($tags['notFound'])){ foreach($tags['notFound'] as $name){ $tags[...
[ "public", "function", "create", "(", "$", "device", ",", "array", "$", "tagNames", "=", "array", "(", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "tagNames", ")", ")", "{", "$", "tagEndpoint", "=", "new", "Tags", "(", "$", "this", "->", "cl...
Create a device @link https://developer.serverdensity.com/v2.0/docs/creating-a-device @param array $device with all its attributes. @return an array that is the device.
[ "Create", "a", "device" ]
train
https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Devices.php#L13-L29
pantera-digital/yii2-seo
models/SeoSearch.php
SeoSearch.search
public function search($params) { $query = Seo::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => [ 'defaultOrder' => ['id' => SORT_DESC], ], ]); $this->load($params); if (!$this->validate()) { ...
php
public function search($params) { $query = Seo::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => [ 'defaultOrder' => ['id' => SORT_DESC], ], ]); $this->load($params); if (!$this->validate()) { ...
[ "public", "function", "search", "(", "$", "params", ")", "{", "$", "query", "=", "Seo", "::", "find", "(", ")", ";", "$", "dataProvider", "=", "new", "ActiveDataProvider", "(", "[", "'query'", "=>", "$", "query", ",", "'sort'", "=>", "[", "'defaultOrde...
Creates data provider instance with search query applied @param array $params @return ActiveDataProvider
[ "Creates", "data", "provider", "instance", "with", "search", "query", "applied" ]
train
https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/models/SeoSearch.php#L37-L55
mimmi20/Wurfl
src/Handlers/OperaMiniOnAndroidHandler.php
OperaMiniOnAndroidHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { if (Utils::checkIfContains($userAgent, ' Build/')) { return $this->getDeviceIDFromRIS($userAgent, Utils::indexOfOrLength($userAgent, ' Build/')); } $prefixes = array( 'Opera/9.80 (J2ME/MIDP; Opera Mini/5' => 'uabait_o...
php
public function applyConclusiveMatch($userAgent) { if (Utils::checkIfContains($userAgent, ' Build/')) { return $this->getDeviceIDFromRIS($userAgent, Utils::indexOfOrLength($userAgent, ' Build/')); } $prefixes = array( 'Opera/9.80 (J2ME/MIDP; Opera Mini/5' => 'uabait_o...
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "checkIfContains", "(", "$", "userAgent", ",", "' Build/'", ")", ")", "{", "return", "$", "this", "->", "getDeviceIDFromRIS", "(", "$", "userAgent", ",",...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/OperaMiniOnAndroidHandler.php#L61-L86
reinvanoyen/aegis
lib/Aegis/Lexer.php
Lexer.tokenize
public function tokenize(string $input) : TokenStream { $this->prepare($input); // Loop each character while ($this->cursor < $this->end) { $this->currentChar = $this->input[$this->cursor]; if (preg_match('@'.Token::REGEX_T_EOL.'@', $this->currentChar)) { ...
php
public function tokenize(string $input) : TokenStream { $this->prepare($input); // Loop each character while ($this->cursor < $this->end) { $this->currentChar = $this->input[$this->cursor]; if (preg_match('@'.Token::REGEX_T_EOL.'@', $this->currentChar)) { ...
[ "public", "function", "tokenize", "(", "string", "$", "input", ")", ":", "TokenStream", "{", "$", "this", "->", "prepare", "(", "$", "input", ")", ";", "// Loop each character", "while", "(", "$", "this", "->", "cursor", "<", "$", "this", "->", "end", ...
Tokenizes a string into a TokenStream @param $input @return TokenStream
[ "Tokenizes", "a", "string", "into", "a", "TokenStream" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Lexer.php#L92-L134
reinvanoyen/aegis
lib/Aegis/Lexer.php
Lexer.prepare
private function prepare(string $input) { $this->input = str_replace(["\n\r", "\r"], "\n", $input); // Create new token stream $this->stream = new TokenStream(); $this->cursor = 0; $this->line = 1; $this->lineOffset = 0; $this->end = strlen($this->input); ...
php
private function prepare(string $input) { $this->input = str_replace(["\n\r", "\r"], "\n", $input); // Create new token stream $this->stream = new TokenStream(); $this->cursor = 0; $this->line = 1; $this->lineOffset = 0; $this->end = strlen($this->input); ...
[ "private", "function", "prepare", "(", "string", "$", "input", ")", "{", "$", "this", "->", "input", "=", "str_replace", "(", "[", "\"\\n\\r\"", ",", "\"\\r\"", "]", ",", "\"\\n\"", ",", "$", "input", ")", ";", "// Create new token stream", "$", "this", ...
Prepares the Lexer for tokenizing a string @param string $input
[ "Prepares", "the", "Lexer", "for", "tokenizing", "a", "string" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Lexer.php#L141-L162
reinvanoyen/aegis
lib/Aegis/Lexer.php
Lexer.lexIdent
private function lexIdent() { if (!preg_match('@'.Token::REGEX_T_IDENT.'@', $this->currentChar)) { $this->stream->addToken(new Token(Token::T_IDENT, $this->currentValue, $this->currentValue, $this->line, $this->line, $this->modeStartPosition, $this->getCurrentLinePosition())); $this-...
php
private function lexIdent() { if (!preg_match('@'.Token::REGEX_T_IDENT.'@', $this->currentChar)) { $this->stream->addToken(new Token(Token::T_IDENT, $this->currentValue, $this->currentValue, $this->line, $this->line, $this->modeStartPosition, $this->getCurrentLinePosition())); $this-...
[ "private", "function", "lexIdent", "(", ")", "{", "if", "(", "!", "preg_match", "(", "'@'", ".", "Token", "::", "REGEX_T_IDENT", ".", "'@'", ",", "$", "this", "->", "currentChar", ")", ")", "{", "$", "this", "->", "stream", "->", "addToken", "(", "ne...
MODE IDENT
[ "MODE", "IDENT" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Lexer.php#L248-L260
reinvanoyen/aegis
lib/Aegis/Lexer.php
Lexer.lexString
private function lexString() { if ($this->currentChar === $this->modeStartChar) { $this->advanceCursor(); $this->stream->addToken(new Token(Token::T_STRING, $this->currentValue, $this->modeStartChar.$this->currentValue.$this->modeStartChar, $this->modeStartLine, $this->line, $this->m...
php
private function lexString() { if ($this->currentChar === $this->modeStartChar) { $this->advanceCursor(); $this->stream->addToken(new Token(Token::T_STRING, $this->currentValue, $this->modeStartChar.$this->currentValue.$this->modeStartChar, $this->modeStartLine, $this->line, $this->m...
[ "private", "function", "lexString", "(", ")", "{", "if", "(", "$", "this", "->", "currentChar", "===", "$", "this", "->", "modeStartChar", ")", "{", "$", "this", "->", "advanceCursor", "(", ")", ";", "$", "this", "->", "stream", "->", "addToken", "(", ...
MODE STRING
[ "MODE", "STRING" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Lexer.php#L263-L276
reinvanoyen/aegis
lib/Aegis/Lexer.php
Lexer.lexNumber
private function lexNumber() { if (!preg_match('@'.Token::REGEX_T_NUMBER.'@', $this->currentChar)) { $this->stream->addToken(new Token(Token::T_NUMBER, $this->currentValue, $this->currentValue, $this->modeStartLine, $this->line, $this->modeStartPosition, $this->getCurrentLinePosition())); ...
php
private function lexNumber() { if (!preg_match('@'.Token::REGEX_T_NUMBER.'@', $this->currentChar)) { $this->stream->addToken(new Token(Token::T_NUMBER, $this->currentValue, $this->currentValue, $this->modeStartLine, $this->line, $this->modeStartPosition, $this->getCurrentLinePosition())); ...
[ "private", "function", "lexNumber", "(", ")", "{", "if", "(", "!", "preg_match", "(", "'@'", ".", "Token", "::", "REGEX_T_NUMBER", ".", "'@'", ",", "$", "this", "->", "currentChar", ")", ")", "{", "$", "this", "->", "stream", "->", "addToken", "(", "...
MODE NUMBER
[ "MODE", "NUMBER" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Lexer.php#L279-L291
reinvanoyen/aegis
lib/Aegis/Lexer.php
Lexer.lexVar
private function lexVar() { if (preg_match('@'.Token::REGEX_T_VAR.'@', substr($this->input, $this->cursor), $matches)) { $variableName = $matches[ 0 ]; $this->stream->addToken(new Token(Token::T_VAR, $variableName, '@' . $variableName, $this->modeStartLine, $this->line, $this->modeSt...
php
private function lexVar() { if (preg_match('@'.Token::REGEX_T_VAR.'@', substr($this->input, $this->cursor), $matches)) { $variableName = $matches[ 0 ]; $this->stream->addToken(new Token(Token::T_VAR, $variableName, '@' . $variableName, $this->modeStartLine, $this->line, $this->modeSt...
[ "private", "function", "lexVar", "(", ")", "{", "if", "(", "preg_match", "(", "'@'", ".", "Token", "::", "REGEX_T_VAR", ".", "'@'", ",", "substr", "(", "$", "this", "->", "input", ",", "$", "this", "->", "cursor", ")", ",", "$", "matches", ")", ")"...
MODE VAR
[ "MODE", "VAR" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Lexer.php#L294-L304
reinvanoyen/aegis
lib/Aegis/Lexer.php
Lexer.lexOperator
private function lexOperator() { if (!preg_match('@'.Token::REGEX_T_OP.'@', $this->currentChar)) { $this->stream->addToken(new Token(Token::T_OP, $this->currentValue, $this->currentValue, $this->modeStartLine, $this->line, $this->getCurrentLinePosition(), $this->getCurrentLinePosition() + 1)); ...
php
private function lexOperator() { if (!preg_match('@'.Token::REGEX_T_OP.'@', $this->currentChar)) { $this->stream->addToken(new Token(Token::T_OP, $this->currentValue, $this->currentValue, $this->modeStartLine, $this->line, $this->getCurrentLinePosition(), $this->getCurrentLinePosition() + 1)); ...
[ "private", "function", "lexOperator", "(", ")", "{", "if", "(", "!", "preg_match", "(", "'@'", ".", "Token", "::", "REGEX_T_OP", ".", "'@'", ",", "$", "this", "->", "currentChar", ")", ")", "{", "$", "this", "->", "stream", "->", "addToken", "(", "ne...
MODE OPERATOR
[ "MODE", "OPERATOR" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Lexer.php#L307-L319
reinvanoyen/aegis
lib/Aegis/Lexer.php
Lexer.setMode
private function setMode(int $mode) { $this->mode = $mode; $this->modeStartLine = $this->line; $this->modeStartPosition = $this->getCurrentLinePosition(); }
php
private function setMode(int $mode) { $this->mode = $mode; $this->modeStartLine = $this->line; $this->modeStartPosition = $this->getCurrentLinePosition(); }
[ "private", "function", "setMode", "(", "int", "$", "mode", ")", "{", "$", "this", "->", "mode", "=", "$", "mode", ";", "$", "this", "->", "modeStartLine", "=", "$", "this", "->", "line", ";", "$", "this", "->", "modeStartPosition", "=", "$", "this", ...
Sets the lexing mode @param int $mode
[ "Sets", "the", "lexing", "mode" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Lexer.php#L336-L341
kriskbx/mikado
src/Providers/MikadoServiceProvider.php
MikadoServiceProvider.register
public function register() { $this->setConfigPath(); $this->assertConfigDir(); $mikado = new Mikado(); foreach (new DirectoryIterator($this->configPath) as $fileInfo) { if ($fileInfo->isDot()) { continue; } $this->addManager($file...
php
public function register() { $this->setConfigPath(); $this->assertConfigDir(); $mikado = new Mikado(); foreach (new DirectoryIterator($this->configPath) as $fileInfo) { if ($fileInfo->isDot()) { continue; } $this->addManager($file...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "setConfigPath", "(", ")", ";", "$", "this", "->", "assertConfigDir", "(", ")", ";", "$", "mikado", "=", "new", "Mikado", "(", ")", ";", "foreach", "(", "new", "DirectoryIterator", "("...
Register bindings in the container.
[ "Register", "bindings", "in", "the", "container", "." ]
train
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Providers/MikadoServiceProvider.php#L31-L48
kriskbx/mikado
src/Providers/MikadoServiceProvider.php
MikadoServiceProvider.addManager
protected function addManager($fileInfo, &$mikado) { $manager = new Manager(); $pathParts = pathinfo($fileInfo->getBasename()); $model = $pathParts['filename']; $this->addFormatter($manager, $model, 'MetaFormatter'); $this->addFormatter($manager, $model, 'RemapFormatter'); ...
php
protected function addManager($fileInfo, &$mikado) { $manager = new Manager(); $pathParts = pathinfo($fileInfo->getBasename()); $model = $pathParts['filename']; $this->addFormatter($manager, $model, 'MetaFormatter'); $this->addFormatter($manager, $model, 'RemapFormatter'); ...
[ "protected", "function", "addManager", "(", "$", "fileInfo", ",", "&", "$", "mikado", ")", "{", "$", "manager", "=", "new", "Manager", "(", ")", ";", "$", "pathParts", "=", "pathinfo", "(", "$", "fileInfo", "->", "getBasename", "(", ")", ")", ";", "$...
Add manager to mikado. @param DirectoryIterator $fileInfo @param Mikado $mikado
[ "Add", "manager", "to", "mikado", "." ]
train
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Providers/MikadoServiceProvider.php#L56-L68
kriskbx/mikado
src/Providers/MikadoServiceProvider.php
MikadoServiceProvider.addFormatter
protected function addFormatter(&$manager, $model, $formatter) { // Get the config $config = (include $this->configPath . '/' . $model . '.php'); if(!isset($config[$formatter])) return; $formatterClass = 'kriskbx\mikado\Formatters\\' . $formatter; if (is_array(...
php
protected function addFormatter(&$manager, $model, $formatter) { // Get the config $config = (include $this->configPath . '/' . $model . '.php'); if(!isset($config[$formatter])) return; $formatterClass = 'kriskbx\mikado\Formatters\\' . $formatter; if (is_array(...
[ "protected", "function", "addFormatter", "(", "&", "$", "manager", ",", "$", "model", ",", "$", "formatter", ")", "{", "// Get the config", "$", "config", "=", "(", "include", "$", "this", "->", "configPath", ".", "'/'", ".", "$", "model", ".", "'.php'",...
Add formatter to manager. @param Manager $manager @param string $model @param string $formatter
[ "Add", "formatter", "to", "manager", "." ]
train
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Providers/MikadoServiceProvider.php#L77-L90
mimmi20/Wurfl
src/Handlers/OperaMiniHandler.php
OperaMiniHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { $tolerance = Utils::toleranceToRisDelimeter($userAgent); if ($tolerance !== false) { return $this->getDeviceIDFromRIS($userAgent, $tolerance); } $operaMiniIndex = Utils::indexOfOrLength($userAgent, 'Opera Mini'); ...
php
public function applyConclusiveMatch($userAgent) { $tolerance = Utils::toleranceToRisDelimeter($userAgent); if ($tolerance !== false) { return $this->getDeviceIDFromRIS($userAgent, $tolerance); } $operaMiniIndex = Utils::indexOfOrLength($userAgent, 'Opera Mini'); ...
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "$", "tolerance", "=", "Utils", "::", "toleranceToRisDelimeter", "(", "$", "userAgent", ")", ";", "if", "(", "$", "tolerance", "!==", "false", ")", "{", "return", "$", "this", "...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/OperaMiniHandler.php#L63-L85
mimmi20/Wurfl
src/Handlers/OperaMiniHandler.php
OperaMiniHandler.applyRecoveryMatch
public function applyRecoveryMatch($userAgent) { foreach (self::$constantIDs as $keyword => $deviceId) { if (Utils::checkIfContains($userAgent, $keyword)) { return $deviceId; } } if (Utils::checkIfContains($userAgent, 'Opera Mobi')) { retu...
php
public function applyRecoveryMatch($userAgent) { foreach (self::$constantIDs as $keyword => $deviceId) { if (Utils::checkIfContains($userAgent, $keyword)) { return $deviceId; } } if (Utils::checkIfContains($userAgent, 'Opera Mobi')) { retu...
[ "public", "function", "applyRecoveryMatch", "(", "$", "userAgent", ")", "{", "foreach", "(", "self", "::", "$", "constantIDs", "as", "$", "keyword", "=>", "$", "deviceId", ")", "{", "if", "(", "Utils", "::", "checkIfContains", "(", "$", "userAgent", ",", ...
@param string $userAgent @return string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/OperaMiniHandler.php#L92-L105
delatbabel/site-config
src/Models/Config.php
Config.isJson
protected function isJson($string) { // json_decode a numeric string doesn't throw an error, so we have to check it manually if (! is_string($string) || is_numeric($string)) { return false; } $result = @json_decode($string); return (json_last_error() == JSON_ERROR_NON...
php
protected function isJson($string) { // json_decode a numeric string doesn't throw an error, so we have to check it manually if (! is_string($string) || is_numeric($string)) { return false; } $result = @json_decode($string); return (json_last_error() == JSON_ERROR_NON...
[ "protected", "function", "isJson", "(", "$", "string", ")", "{", "// json_decode a numeric string doesn't throw an error, so we have to check it manually", "if", "(", "!", "is_string", "(", "$", "string", ")", "||", "is_numeric", "(", "$", "string", ")", ")", "{", "...
Check to see if a string is JSON. @param $string @return bool
[ "Check", "to", "see", "if", "a", "string", "is", "JSON", "." ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Config.php#L44-L51
delatbabel/site-config
src/Models/Config.php
Config.getValueAttribute
public function getValueAttribute($value) { if ($this->isJson($value)) { return json_decode($value); } if ($this->isSerialized($value)) { return unserialize($value); } return $value; }
php
public function getValueAttribute($value) { if ($this->isJson($value)) { return json_decode($value); } if ($this->isSerialized($value)) { return unserialize($value); } return $value; }
[ "public", "function", "getValueAttribute", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "isJson", "(", "$", "value", ")", ")", "{", "return", "json_decode", "(", "$", "value", ")", ";", "}", "if", "(", "$", "this", "->", "isSerialized",...
Accessor function @return mixed, but should always return an array for an array type field.
[ "Accessor", "function" ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Config.php#L73-L81
delatbabel/site-config
src/Models/Config.php
Config.setValueAttribute
public function setValueAttribute($value) { if ($this->isJson($value)) { $value = serialize(json_decode($value, true)); } elseif (is_array($value)) { $value = serialize($value); } $this->attributes['value'] = $value; }
php
public function setValueAttribute($value) { if ($this->isJson($value)) { $value = serialize(json_decode($value, true)); } elseif (is_array($value)) { $value = serialize($value); } $this->attributes['value'] = $value; }
[ "public", "function", "setValueAttribute", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "isJson", "(", "$", "value", ")", ")", "{", "$", "value", "=", "serialize", "(", "json_decode", "(", "$", "value", ",", "true", ")", ")", ";", "}"...
Mutator function Always stores the serialized version of an array or JSON string. @param $value @return void
[ "Mutator", "function" ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Config.php#L91-L98
delatbabel/site-config
src/Models/Config.php
Config.fetchSettings
public static function fetchSettings($environment = null, $website_id = null, $group = 'config') { $model = static::where('group', '=', $group); // Environment can be null, or must match or use the null wildcard. $model->where(function ($query) use ($environment) { if (empty($en...
php
public static function fetchSettings($environment = null, $website_id = null, $group = 'config') { $model = static::where('group', '=', $group); // Environment can be null, or must match or use the null wildcard. $model->where(function ($query) use ($environment) { if (empty($en...
[ "public", "static", "function", "fetchSettings", "(", "$", "environment", "=", "null", ",", "$", "website_id", "=", "null", ",", "$", "group", "=", "'config'", ")", "{", "$", "model", "=", "static", "::", "where", "(", "'group'", ",", "'='", ",", "$", ...
Return the configuration data for a specific environment & group. What this function tries to achieve is to return the configuration for a given environment and group, The configuration table contains 2 limiting columns, which are website_id and environment. The way that the limiting columns work is that if there is...
[ "Return", "the", "configuration", "data", "for", "a", "specific", "environment", "&", "group", "." ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Config.php#L166-L206
delatbabel/site-config
src/Models/Config.php
Config.fetchExactSettings
public static function fetchExactSettings($environment = null, $website_id = null, $group = 'config') { $model = static::where('group', '=', $group); // Environment can be null, or must match or use the null wildcard. $model->where(function ($query) use ($environment) { if (empt...
php
public static function fetchExactSettings($environment = null, $website_id = null, $group = 'config') { $model = static::where('group', '=', $group); // Environment can be null, or must match or use the null wildcard. $model->where(function ($query) use ($environment) { if (empt...
[ "public", "static", "function", "fetchExactSettings", "(", "$", "environment", "=", "null", ",", "$", "website_id", "=", "null", ",", "$", "group", "=", "'config'", ")", "{", "$", "model", "=", "static", "::", "where", "(", "'group'", ",", "'='", ",", ...
Return the exact configuration data for a specific environment & group. This function returns the exact configuration data for a specific environment and group, ignoring any wildcard (NULL) values. As an example here are some table entries: <code> id host env key value 1 NULL NULL fruit apple...
[ "Return", "the", "exact", "configuration", "data", "for", "a", "specific", "environment", "&", "group", "." ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Config.php#L249-L279
delatbabel/site-config
src/Models/Config.php
Config.normaliseCollection
protected static function normaliseCollection(Collection $collection) { $result = []; /** @var Config $item */ foreach ($collection as $item) { if (empty($result[$item->key])) { switch (strtolower($item->type)) { case 'string': ...
php
protected static function normaliseCollection(Collection $collection) { $result = []; /** @var Config $item */ foreach ($collection as $item) { if (empty($result[$item->key])) { switch (strtolower($item->type)) { case 'string': ...
[ "protected", "static", "function", "normaliseCollection", "(", "Collection", "$", "collection", ")", "{", "$", "result", "=", "[", "]", ";", "/** @var Config $item */", "foreach", "(", "$", "collection", "as", "$", "item", ")", "{", "if", "(", "empty", "(", ...
Normalise a Collection (a result from model->get()) Normalise a Collection (a result from model->get()) to a key => value array, picking only the first result in the array. The above queries will produce a collection where the most relevant results happen before the least relevant results, so we just pick the first ke...
[ "Normalise", "a", "Collection", "(", "a", "result", "from", "model", "-", ">", "get", "()", ")" ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Config.php#L293-L327
delatbabel/site-config
src/Models/Config.php
Config.fetchAllGroups
public static function fetchAllGroups() { $model = new self; $result = []; try { foreach ($model->select('group')->distinct()->get() as $row) { $result[] = $row->group; } } catch (\Exception $e) { // Do nothing. } ...
php
public static function fetchAllGroups() { $model = new self; $result = []; try { foreach ($model->select('group')->distinct()->get() as $row) { $result[] = $row->group; } } catch (\Exception $e) { // Do nothing. } ...
[ "public", "static", "function", "fetchAllGroups", "(", ")", "{", "$", "model", "=", "new", "self", ";", "$", "result", "=", "[", "]", ";", "try", "{", "foreach", "(", "$", "model", "->", "select", "(", "'group'", ")", "->", "distinct", "(", ")", "-...
Return an array of all groups. @return array
[ "Return", "an", "array", "of", "all", "groups", "." ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Config.php#L334-L348
delatbabel/site-config
src/Models/Config.php
Config.set
public static function set($key, $value, $group = 'config', $environment = null, $website_id = null, $type = 'string') { // Let's check if we are doing special array handling $arrayHandling = false; $keyExploded = explode('.', $key); if (count($keyExploded) > 1) { $arra...
php
public static function set($key, $value, $group = 'config', $environment = null, $website_id = null, $type = 'string') { // Let's check if we are doing special array handling $arrayHandling = false; $keyExploded = explode('.', $key); if (count($keyExploded) > 1) { $arra...
[ "public", "static", "function", "set", "(", "$", "key", ",", "$", "value", ",", "$", "group", "=", "'config'", ",", "$", "environment", "=", "null", ",", "$", "website_id", "=", "null", ",", "$", "type", "=", "'string'", ")", "{", "// Let's check if we...
Store a group of settings into the database. @param string $key @param mixed $value @param string $group @param string $environment @param integer $website_id @param string $type "array"|"string"|"integer" @return Config
[ "Store", "a", "group", "of", "settings", "into", "the", "database", "." ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Config.php#L361-L436
delatbabel/site-config
src/Models/Config.php
Config.buildArrayPath
protected static function buildArrayPath($map, $value, &$array) { $key = array_shift($map); if (count($map) !== 0) { $array[$key] = []; self::buildArrayPath($map, $value, $array[$key]); } else { $array[$key] = $value; } }
php
protected static function buildArrayPath($map, $value, &$array) { $key = array_shift($map); if (count($map) !== 0) { $array[$key] = []; self::buildArrayPath($map, $value, $array[$key]); } else { $array[$key] = $value; } }
[ "protected", "static", "function", "buildArrayPath", "(", "$", "map", ",", "$", "value", ",", "&", "$", "array", ")", "{", "$", "key", "=", "array_shift", "(", "$", "map", ")", ";", "if", "(", "count", "(", "$", "map", ")", "!==", "0", ")", "{", ...
This inserts a value into an array at a point in the array path. ### Example <code> $map = [1, 2]; $value = 'hello'; $array = []; buildArrayPath($map, $value, $array); // $array is now [1 => [2 => 'hello']] </code> @param array $map @param mixed $value @param $array @return void
[ "This", "inserts", "a", "value", "into", "an", "array", "at", "a", "point", "in", "the", "array", "path", "." ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/src/Models/Config.php#L457-L466
webbuilders-group/silverstripe-gridfield-deleted-items
src/Forms/GridFieldDeletedDeleteAction.php
GridFieldDeletedDeleteAction.getColumnContent
public function getColumnContent($gridField, $record, $columnName) { if(!DataObject::has_extension($gridField->getModelClass(), Versioned::class)) { user_error($gridField->getModelClass().' does not have the Versioned extension', E_USER_WARNING); return; } ...
php
public function getColumnContent($gridField, $record, $columnName) { if(!DataObject::has_extension($gridField->getModelClass(), Versioned::class)) { user_error($gridField->getModelClass().' does not have the Versioned extension', E_USER_WARNING); return; } ...
[ "public", "function", "getColumnContent", "(", "$", "gridField", ",", "$", "record", ",", "$", "columnName", ")", "{", "if", "(", "!", "DataObject", "::", "has_extension", "(", "$", "gridField", "->", "getModelClass", "(", ")", ",", "Versioned", "::", "cla...
Gets the content for the column, this basically says if it's deleted from the stage you can't delete it @param GridField $gridField Grid Field Reference @param DataObject $record Current data object being rendered @param string $columnName Name of the column @return string The HTML for the column
[ "Gets", "the", "content", "for", "the", "column", "this", "basically", "says", "if", "it", "s", "deleted", "from", "the", "stage", "you", "can", "t", "delete", "it" ]
train
https://github.com/webbuilders-group/silverstripe-gridfield-deleted-items/blob/fd4e90701357de00acf06f4b820b745817f4ce9c/src/Forms/GridFieldDeletedDeleteAction.php#L16-L29
ptlis/conneg
src/Parser/FieldTokenizer.php
FieldTokenizer.tokenize
public function tokenize($httpField, $fromField) { $quoteSeparators = array('"', "'"); $tokenList = array(); $stringAccumulator = ''; $lastQuote = ''; // Iterate through field, character-by-character for ($i = 0; $i < strlen($httpField); $i++) { $chr = su...
php
public function tokenize($httpField, $fromField) { $quoteSeparators = array('"', "'"); $tokenList = array(); $stringAccumulator = ''; $lastQuote = ''; // Iterate through field, character-by-character for ($i = 0; $i < strlen($httpField); $i++) { $chr = su...
[ "public", "function", "tokenize", "(", "$", "httpField", ",", "$", "fromField", ")", "{", "$", "quoteSeparators", "=", "array", "(", "'\"'", ",", "\"'\"", ")", ";", "$", "tokenList", "=", "array", "(", ")", ";", "$", "stringAccumulator", "=", "''", ";"...
Tokenize the HTTP field for subsequent processing. Note: we don't need to worry about multi-byte characters; HTTP fields must be ISO-8859-1 encoded. @param string $httpField @param string $fromField @return array<string>
[ "Tokenize", "the", "HTTP", "field", "for", "subsequent", "processing", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Parser/FieldTokenizer.php#L28-L84
sifophp/sifo-common-instance
controllers/scripts/sendLog.php
ScriptsSendLogController._groupErrors
private function _groupErrors( $date_time = 0 ) { $error_log_path = ROOT_PATH . '/logs/errors.log'; $error_lines = file( $error_log_path, FILE_SKIP_EMPTY_LINES); if ( is_array( $error_lines ) ) { foreach ( $error_lines as $line ) { if ( preg_match( "/\[(.+)\]\sPHP\s([Notice|Warning|Error].* )/", $line...
php
private function _groupErrors( $date_time = 0 ) { $error_log_path = ROOT_PATH . '/logs/errors.log'; $error_lines = file( $error_log_path, FILE_SKIP_EMPTY_LINES); if ( is_array( $error_lines ) ) { foreach ( $error_lines as $line ) { if ( preg_match( "/\[(.+)\]\sPHP\s([Notice|Warning|Error].* )/", $line...
[ "private", "function", "_groupErrors", "(", "$", "date_time", "=", "0", ")", "{", "$", "error_log_path", "=", "ROOT_PATH", ".", "'/logs/errors.log'", ";", "$", "error_lines", "=", "file", "(", "$", "error_log_path", ",", "FILE_SKIP_EMPTY_LINES", ")", ";", "if"...
/\[(.+)\]\sPHP\s([Notice|Warning|Error].* )/
[ "/", "\\", "[", "(", ".", "+", ")", "\\", "]", "\\", "sPHP", "\\", "s", "(", "[", "Notice|Warning|Error", "]", ".", "*", ")", "/" ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/scripts/sendLog.php#L25-L57
sifophp/sifo-common-instance
controllers/manager/templateLauncher.php
ManagerTemplateLauncherController._getRequiredVars
private function _getRequiredVars( $template_identifier ) { if ( !( isset( $this->_available_templates[$template_identifier] ) ) ) { trigger_error( "Template identifier not found.", E_USER_ERROR ); } $template_path = ROOT_PATH.'/'.$this->_available_templates[$template_identifier]; if ( !( $template_sour...
php
private function _getRequiredVars( $template_identifier ) { if ( !( isset( $this->_available_templates[$template_identifier] ) ) ) { trigger_error( "Template identifier not found.", E_USER_ERROR ); } $template_path = ROOT_PATH.'/'.$this->_available_templates[$template_identifier]; if ( !( $template_sour...
[ "private", "function", "_getRequiredVars", "(", "$", "template_identifier", ")", "{", "if", "(", "!", "(", "isset", "(", "$", "this", "->", "_available_templates", "[", "$", "template_identifier", "]", ")", ")", ")", "{", "trigger_error", "(", "\"Template iden...
Return the found in use vars in tpl. @param $template_identifier @return array
[ "Return", "the", "found", "in", "use", "vars", "in", "tpl", "." ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/manager/templateLauncher.php#L17-L42
joomla-projects/jorobo
src/Tasks/Build/Package.php
Package.run
public function run() { $this->say('Building package'); // Build language files for the package $language = $this->buildLanguage("pkg_" . $this->getExtensionName()); $language->run(); // Update XML and script.php $this->createInstaller(); return true; }
php
public function run() { $this->say('Building package'); // Build language files for the package $language = $this->buildLanguage("pkg_" . $this->getExtensionName()); $language->run(); // Update XML and script.php $this->createInstaller(); return true; }
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "say", "(", "'Building package'", ")", ";", "// Build language files for the package", "$", "language", "=", "$", "this", "->", "buildLanguage", "(", "\"pkg_\"", ".", "$", "this", "->", "getExtensi...
Build the package @return bool @since 1.0
[ "Build", "the", "package" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Package.php#L51-L63
joomla-projects/jorobo
src/Tasks/Build/Package.php
Package.createInstaller
private function createInstaller() { $this->say("Creating package installer"); // Copy XML and script.php $sourceFolder = $this->getSourceFolder() . "/administrator/manifests/packages"; $targetFolder = $this->getBuildFolder() . "/administrator/manifests/packages"; $xmlFile = $targetFolder . "/pkg_" . $...
php
private function createInstaller() { $this->say("Creating package installer"); // Copy XML and script.php $sourceFolder = $this->getSourceFolder() . "/administrator/manifests/packages"; $targetFolder = $this->getBuildFolder() . "/administrator/manifests/packages"; $xmlFile = $targetFolder . "/pkg_" . $...
[ "private", "function", "createInstaller", "(", ")", "{", "$", "this", "->", "say", "(", "\"Creating package installer\"", ")", ";", "// Copy XML and script.php", "$", "sourceFolder", "=", "$", "this", "->", "getSourceFolder", "(", ")", ".", "\"/administrator/manifes...
Generate the installer xml file for the package @return void @since 1.0
[ "Generate", "the", "installer", "xml", "file", "for", "the", "package" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Package.php#L72-L107
itrnka/ha-framework
src/ha/App/Builder/AppBuilderDefault.php
AppBuilderDefault.buildApp
public function buildApp(string $environmentName) : App { // create IoC container with middleware instances $middleware = new IoCContainerFromConfigArray($this->cfg->get('middleware')); // create IoC container with modules $modules = new IoCContainerFromConfigArray($this->cfg->get('...
php
public function buildApp(string $environmentName) : App { // create IoC container with middleware instances $middleware = new IoCContainerFromConfigArray($this->cfg->get('middleware')); // create IoC container with modules $modules = new IoCContainerFromConfigArray($this->cfg->get('...
[ "public", "function", "buildApp", "(", "string", "$", "environmentName", ")", ":", "App", "{", "// create IoC container with middleware instances", "$", "middleware", "=", "new", "IoCContainerFromConfigArray", "(", "$", "this", "->", "cfg", "->", "get", "(", "'middl...
Function buildApp @param string $environmentName @return App
[ "Function", "buildApp" ]
train
https://github.com/itrnka/ha-framework/blob/a72b09c28f8e966c37f98a0004e4fbbce80df42c/src/ha/App/Builder/AppBuilderDefault.php#L41-L52
FWidm/dwd-hourly-crawler
src/fwidm/dwdHourlyCrawler/DWDConfiguration.php
DWDConfiguration.getConfiguration
public static function getConfiguration() { if (self::$configuration === null && file_exists(self::$configFilePath)) { // $jsonConfig = file_get_contents(self::$configFilePath_depr); // self::$configuration = json_decode($jsonConfig); $settings = include __DIR__ . '/../../...
php
public static function getConfiguration() { if (self::$configuration === null && file_exists(self::$configFilePath)) { // $jsonConfig = file_get_contents(self::$configFilePath_depr); // self::$configuration = json_decode($jsonConfig); $settings = include __DIR__ . '/../../...
[ "public", "static", "function", "getConfiguration", "(", ")", "{", "if", "(", "self", "::", "$", "configuration", "===", "null", "&&", "file_exists", "(", "self", "::", "$", "configFilePath", ")", ")", "{", "// $jsonConfig = file_get_contents(self::$confi...
Returns the complete configuration file to the callee @return mixed
[ "Returns", "the", "complete", "configuration", "file", "to", "the", "callee" ]
train
https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/DWDConfiguration.php#L48-L63
sebastiaanluca/laravel-validator
src/Validators/Validator.php
Validator.getValidInput
public function getValidInput($clean = false) { $input = array_dot($this->all()); $rules = array_keys($this->rules()); $keys = collect($rules)->map(function (string $rule) use ($input) { // Transform each rule to a regex string while supporting // the wildcard (*) ch...
php
public function getValidInput($clean = false) { $input = array_dot($this->all()); $rules = array_keys($this->rules()); $keys = collect($rules)->map(function (string $rule) use ($input) { // Transform each rule to a regex string while supporting // the wildcard (*) ch...
[ "public", "function", "getValidInput", "(", "$", "clean", "=", "false", ")", "{", "$", "input", "=", "array_dot", "(", "$", "this", "->", "all", "(", ")", ")", ";", "$", "rules", "=", "array_keys", "(", "$", "this", "->", "rules", "(", ")", ")", ...
Get validated user input. Check if input corresponds with fields under validation. @param bool $clean Remove the input fields whose values are empty. @return array
[ "Get", "validated", "user", "input", "." ]
train
https://github.com/sebastiaanluca/laravel-validator/blob/931b60cfeb2fd4d93a4525d8575ae72825a73fa9/src/Validators/Validator.php#L35-L64
sebastiaanluca/laravel-validator
src/Validators/Validator.php
Validator.sanitizeInput
public function sanitizeInput(array $input) { return $input = collect($input)->reject(function ($value) { return is_null($value) || empty($value); })->toArray(); }
php
public function sanitizeInput(array $input) { return $input = collect($input)->reject(function ($value) { return is_null($value) || empty($value); })->toArray(); }
[ "public", "function", "sanitizeInput", "(", "array", "$", "input", ")", "{", "return", "$", "input", "=", "collect", "(", "$", "input", ")", "->", "reject", "(", "function", "(", "$", "value", ")", "{", "return", "is_null", "(", "$", "value", ")", "|...
Remove null and empty values from the input. @param array $input @return array
[ "Remove", "null", "and", "empty", "values", "from", "the", "input", "." ]
train
https://github.com/sebastiaanluca/laravel-validator/blob/931b60cfeb2fd4d93a4525d8575ae72825a73fa9/src/Validators/Validator.php#L87-L92
Im0rtality/Underscore
src/Registry.php
Registry.instance
public function instance($name) { if (empty($this->instances[$name])) { if (empty($this->aliases[$name])) { $this->aliasDefault($name); } $this->instances[$name] = new $this->aliases[$name]; } return $this->instances[$name]; }
php
public function instance($name) { if (empty($this->instances[$name])) { if (empty($this->aliases[$name])) { $this->aliasDefault($name); } $this->instances[$name] = new $this->aliases[$name]; } return $this->instances[$name]; }
[ "public", "function", "instance", "(", "$", "name", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "instances", "[", "$", "name", "]", ")", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "aliases", "[", "$", "name", "]", ")", ")",...
Get the callable for an Underscore method alias. @param string $name @return callable
[ "Get", "the", "callable", "for", "an", "Underscore", "method", "alias", "." ]
train
https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Registry.php#L52-L62
Im0rtality/Underscore
src/Registry.php
Registry.alias
public function alias($name, $spec) { if (is_callable($spec)) { $this->instances[$name] = $spec; } else { $this->aliases[$name] = $spec; // Ensure that the new alias will be used when called. unset($this->instances[$name]); } }
php
public function alias($name, $spec) { if (is_callable($spec)) { $this->instances[$name] = $spec; } else { $this->aliases[$name] = $spec; // Ensure that the new alias will be used when called. unset($this->instances[$name]); } }
[ "public", "function", "alias", "(", "$", "name", ",", "$", "spec", ")", "{", "if", "(", "is_callable", "(", "$", "spec", ")", ")", "{", "$", "this", "->", "instances", "[", "$", "name", "]", "=", "$", "spec", ";", "}", "else", "{", "$", "this",...
Alias method name to a callable. @param string $name @param callable $spec @return void
[ "Alias", "method", "name", "to", "a", "callable", "." ]
train
https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Registry.php#L71-L81
Im0rtality/Underscore
src/Registry.php
Registry.aliasDefault
private function aliasDefault($name) { $spec = sprintf('\Underscore\Mutator\%sMutator', ucfirst($name)); if (!class_exists($spec)) { $spec = sprintf('\Underscore\Accessor\%sAccessor', ucfirst($name)); } if (!class_exists($spec)) { $spec = sprintf('\Underscor...
php
private function aliasDefault($name) { $spec = sprintf('\Underscore\Mutator\%sMutator', ucfirst($name)); if (!class_exists($spec)) { $spec = sprintf('\Underscore\Accessor\%sAccessor', ucfirst($name)); } if (!class_exists($spec)) { $spec = sprintf('\Underscor...
[ "private", "function", "aliasDefault", "(", "$", "name", ")", "{", "$", "spec", "=", "sprintf", "(", "'\\Underscore\\Mutator\\%sMutator'", ",", "ucfirst", "(", "$", "name", ")", ")", ";", "if", "(", "!", "class_exists", "(", "$", "spec", ")", ")", "{", ...
Define a default mutator, accessor, or initializer for a method name. @throws \BadMethodCallException If no default can be located. @param string $name @return void
[ "Define", "a", "default", "mutator", "accessor", "or", "initializer", "for", "a", "method", "name", "." ]
train
https://github.com/Im0rtality/Underscore/blob/2deb95cfd340761d00ecd0f033e67ce600f2b535/src/Registry.php#L90-L107
ahmad-sa3d/saad-image
src/ImageServiceProvider.php
ImageServiceProvider.boot
public function boot(){ // Publish Config File $this->publishes([ __DIR__ .DIRECTORY_SEPARATOR. '..' .DIRECTORY_SEPARATOR. 'config' .DIRECTORY_SEPARATOR. $this->package_name . '.php' => config_path($this->package_name . '.php'), ], 'config'); // Publish fonts $this->publishes([ __DIR__ .DIRECTORY_SEPA...
php
public function boot(){ // Publish Config File $this->publishes([ __DIR__ .DIRECTORY_SEPARATOR. '..' .DIRECTORY_SEPARATOR. 'config' .DIRECTORY_SEPARATOR. $this->package_name . '.php' => config_path($this->package_name . '.php'), ], 'config'); // Publish fonts $this->publishes([ __DIR__ .DIRECTORY_SEPA...
[ "public", "function", "boot", "(", ")", "{", "// Publish Config File", "$", "this", "->", "publishes", "(", "[", "__DIR__", ".", "DIRECTORY_SEPARATOR", ".", "'..'", ".", "DIRECTORY_SEPARATOR", ".", "'config'", ".", "DIRECTORY_SEPARATOR", ".", "$", "this", "->", ...
Boot Package @return Void
[ "Boot", "Package" ]
train
https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/ImageServiceProvider.php#L18-L29
attm2x/m2x-php
src/Command.php
Command.refresh
public function refresh() { $response = $this->client->get($this->path()); $this->setData($response->json()); }
php
public function refresh() { $response = $this->client->get($this->path()); $this->setData($response->json()); }
[ "public", "function", "refresh", "(", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "get", "(", "$", "this", "->", "path", "(", ")", ")", ";", "$", "this", "->", "setData", "(", "$", "response", "->", "json", "(", ")", ")", ...
Refresh the Command Info
[ "Refresh", "the", "Command", "Info" ]
train
https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/Command.php#L41-L44
rinvex/renamed-tenants
database/migrations/2017_04_09_225804_create_tenants_table.php
CreateTenantsTable.up
public function up(): void { Schema::create(config('rinvex.tenants.tables.tenants'), function (Blueprint $table) { // Columns $table->increments('id'); $table->string('slug'); $table->{$this->jsonable()}('name'); $table->{$this->jsonable()}('descri...
php
public function up(): void { Schema::create(config('rinvex.tenants.tables.tenants'), function (Blueprint $table) { // Columns $table->increments('id'); $table->string('slug'); $table->{$this->jsonable()}('name'); $table->{$this->jsonable()}('descri...
[ "public", "function", "up", "(", ")", ":", "void", "{", "Schema", "::", "create", "(", "config", "(", "'rinvex.tenants.tables.tenants'", ")", ",", "function", "(", "Blueprint", "$", "table", ")", "{", "// Columns", "$", "table", "->", "increments", "(", "'...
Run the migrations. @return void
[ "Run", "the", "migrations", "." ]
train
https://github.com/rinvex/renamed-tenants/blob/2608656011a55547909251f3667699e1932cfc28/database/migrations/2017_04_09_225804_create_tenants_table.php#L16-L44
psecio/propauth
src/Policy.php
Policy.addCheck
protected function addCheck($name, $type, $args) { $func = $type.'Check'; if (method_exists($this, $func)) { $type = strtolower(str_replace($type, '', $name)); $this->$func($type, $name, $args); } else { throw new \InvalidArgumentException('Invalid check ty...
php
protected function addCheck($name, $type, $args) { $func = $type.'Check'; if (method_exists($this, $func)) { $type = strtolower(str_replace($type, '', $name)); $this->$func($type, $name, $args); } else { throw new \InvalidArgumentException('Invalid check ty...
[ "protected", "function", "addCheck", "(", "$", "name", ",", "$", "type", ",", "$", "args", ")", "{", "$", "func", "=", "$", "type", ".", "'Check'", ";", "if", "(", "method_exists", "(", "$", "this", ",", "$", "func", ")", ")", "{", "$", "type", ...
Add a new check to the set @param string $name Function name @param string $type Check type @param array $args Check arguments @throws \InvalidArgumentException If check type is invalid
[ "Add", "a", "new", "check", "to", "the", "set" ]
train
https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Policy.php#L94-L104
psecio/propauth
src/Policy.php
Policy.load
public static function load($dslString) { $policy = self::instance(); $parts = explode('||', $dslString); foreach ($parts as $match) { $args = []; list($method, $value) = explode(':', $match); // if we have data following the ":" inside (), array it ...
php
public static function load($dslString) { $policy = self::instance(); $parts = explode('||', $dslString); foreach ($parts as $match) { $args = []; list($method, $value) = explode(':', $match); // if we have data following the ":" inside (), array it ...
[ "public", "static", "function", "load", "(", "$", "dslString", ")", "{", "$", "policy", "=", "self", "::", "instance", "(", ")", ";", "$", "parts", "=", "explode", "(", "'||'", ",", "$", "dslString", ")", ";", "foreach", "(", "$", "parts", "as", "$...
Load a policy from a string DSL See the README for formatting @param string $dslString DSL formatted string
[ "Load", "a", "policy", "from", "a", "string", "DSL", "See", "the", "README", "for", "formatting" ]
train
https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Policy.php#L122-L150