repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
inphinit/framework
src/Experimental/Form.php
Form.combo
public static function combo($name, array $options, $value = null, array $attributes = array()) { $input = self::setAttr($attributes, '<select{{attr}}>', $name, 'select'); foreach ($options as $key => $val) { $input .= '<option value="' . self::entities($val) . '"'; if ($value === $val) { $input .= ' selected'; } $input .= '>' . $key . '</option>'; } return $input . '</select>'; }
php
public static function combo($name, array $options, $value = null, array $attributes = array()) { $input = self::setAttr($attributes, '<select{{attr}}>', $name, 'select'); foreach ($options as $key => $val) { $input .= '<option value="' . self::entities($val) . '"'; if ($value === $val) { $input .= ' selected'; } $input .= '>' . $key . '</option>'; } return $input . '</select>'; }
[ "public", "static", "function", "combo", "(", "$", "name", ",", "array", "$", "options", ",", "$", "value", "=", "null", ",", "array", "$", "attributes", "=", "array", "(", ")", ")", "{", "$", "input", "=", "self", "::", "setAttr", "(", "$", "attri...
Create a select combo based in an array @param string $name @param array $options @param string|null $value @param array $attributes @return string
[ "Create", "a", "select", "combo", "based", "in", "an", "array" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Form.php#L87-L102
train
inphinit/framework
src/Experimental/Form.php
Form.input
public static function input($type, $name, $value = null, array $attributes = array()) { if ($type === 'textarea') { $input = '<textarea{{attr}}>'; if ($value !== null) { $input .= self::entities($value); } $input .= '</textarea>'; } elseif (preg_match('#^(' . self::$alloweds . ')$#', $type)) { $input = '<input type="' . $type . '" value="'; if ($value !== null) { $input .= self::entities($value); } $input .= '"{{attr}}' . self::$useXhtml . '>'; } else { throw new Exception('Invalid type'); } return self::setAttr($attributes, $input, $name, $type); }
php
public static function input($type, $name, $value = null, array $attributes = array()) { if ($type === 'textarea') { $input = '<textarea{{attr}}>'; if ($value !== null) { $input .= self::entities($value); } $input .= '</textarea>'; } elseif (preg_match('#^(' . self::$alloweds . ')$#', $type)) { $input = '<input type="' . $type . '" value="'; if ($value !== null) { $input .= self::entities($value); } $input .= '"{{attr}}' . self::$useXhtml . '>'; } else { throw new Exception('Invalid type'); } return self::setAttr($attributes, $input, $name, $type); }
[ "public", "static", "function", "input", "(", "$", "type", ",", "$", "name", ",", "$", "value", "=", "null", ",", "array", "$", "attributes", "=", "array", "(", ")", ")", "{", "if", "(", "$", "type", "===", "'textarea'", ")", "{", "$", "input", "...
Create a input or textarea @param string $type @param string $name @param string|null $value @param array $attributes @return string
[ "Create", "a", "input", "or", "textarea" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Form.php#L113-L136
train
inphinit/framework
src/Experimental/Form.php
Form.setAttr
private static function setAttr(array $attributes, $field, $name, $type) { $attrs = ''; if (in_array($type, array_keys(self::$preAttrs))) { $attributes = self::$preAttrs[$type] + $attributes; } if ($name !== null) { $attributes = array( 'name' => $name ) + $attributes; } if ($type !== 'select' && $type !== 'textarea' && $type !== 'form') { $attributes = array( 'type' => $type ) + $attributes; } foreach ($attributes as $key => $val) { $attrs .= ' ' . $key . '="' . self::entities($val) . '"'; } return str_replace('{{attr}}', $attrs, $field); }
php
private static function setAttr(array $attributes, $field, $name, $type) { $attrs = ''; if (in_array($type, array_keys(self::$preAttrs))) { $attributes = self::$preAttrs[$type] + $attributes; } if ($name !== null) { $attributes = array( 'name' => $name ) + $attributes; } if ($type !== 'select' && $type !== 'textarea' && $type !== 'form') { $attributes = array( 'type' => $type ) + $attributes; } foreach ($attributes as $key => $val) { $attrs .= ' ' . $key . '="' . self::entities($val) . '"'; } return str_replace('{{attr}}', $attrs, $field); }
[ "private", "static", "function", "setAttr", "(", "array", "$", "attributes", ",", "$", "field", ",", "$", "name", ",", "$", "type", ")", "{", "$", "attrs", "=", "''", ";", "if", "(", "in_array", "(", "$", "type", ",", "array_keys", "(", "self", "::...
set attributes in an element @param array $attributes @param string $field @param string $name @param string $type @return string
[ "set", "attributes", "in", "an", "element" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Form.php#L147-L168
train
agilov/yii2-seo-behavior
components/SeoPatternHelper.php
SeoPatternHelper.isCallbackPattern
protected static function isCallbackPattern($patternKey) { $patternKeyPrefix = self::getPatternKeyPrefix($patternKey); $patternPrefixesOptions = self::getFunctionalPatternPrefixesOptions(); return ArrayHelper::keyExists($patternKeyPrefix, $patternPrefixesOptions); }
php
protected static function isCallbackPattern($patternKey) { $patternKeyPrefix = self::getPatternKeyPrefix($patternKey); $patternPrefixesOptions = self::getFunctionalPatternPrefixesOptions(); return ArrayHelper::keyExists($patternKeyPrefix, $patternPrefixesOptions); }
[ "protected", "static", "function", "isCallbackPattern", "(", "$", "patternKey", ")", "{", "$", "patternKeyPrefix", "=", "self", "::", "getPatternKeyPrefix", "(", "$", "patternKey", ")", ";", "$", "patternPrefixesOptions", "=", "self", "::", "getFunctionalPatternPref...
Returns true if its functional pattern key that need to run callback function. @param $patternKey @return bool
[ "Returns", "true", "if", "its", "functional", "pattern", "key", "that", "need", "to", "run", "callback", "function", "." ]
b4ad117a19ac2400c15eda54bf514c9a2cbf0a14
https://github.com/agilov/yii2-seo-behavior/blob/b4ad117a19ac2400c15eda54bf514c9a2cbf0a14/components/SeoPatternHelper.php#L139-L143
train
agilov/yii2-seo-behavior
components/SeoPatternHelper.php
SeoPatternHelper.replace
public static function replace($patternString, $model) { //$patternString = '%%model_title%% %%sep%% %%appParam_contactEmail%% %%viewParam_titleSeparator%% %%appConfig_name%%'; $replacedString = ''; $patterns = self::findPatterns($patternString); $replacements = []; foreach ($patterns as $patternKey) { if (self::isCallbackPattern($patternKey)) { $replacement = self::callbackRetrievedStaticFunction($patternKey, $model); } if (self::isSeparatorPattern($patternKey)) { $replacement = self::retrieveSeparator(); } // Replacement retrievals can return null if no replacement can be determined, root those outs. if (isset($replacement)) { $patternKey = self::addPatternDelimeter($patternKey); $replacements[$patternKey] = $replacement; } unset($replacement); } // Do the actual replacements. $replacedString = (is_array($replacements) && $replacements !== []) ? str_replace(array_keys($replacements), array_values($replacements), $patternString) : $patternString; $replacedString = self::sanitizeReplacedString($replacedString); return $replacedString; }
php
public static function replace($patternString, $model) { //$patternString = '%%model_title%% %%sep%% %%appParam_contactEmail%% %%viewParam_titleSeparator%% %%appConfig_name%%'; $replacedString = ''; $patterns = self::findPatterns($patternString); $replacements = []; foreach ($patterns as $patternKey) { if (self::isCallbackPattern($patternKey)) { $replacement = self::callbackRetrievedStaticFunction($patternKey, $model); } if (self::isSeparatorPattern($patternKey)) { $replacement = self::retrieveSeparator(); } // Replacement retrievals can return null if no replacement can be determined, root those outs. if (isset($replacement)) { $patternKey = self::addPatternDelimeter($patternKey); $replacements[$patternKey] = $replacement; } unset($replacement); } // Do the actual replacements. $replacedString = (is_array($replacements) && $replacements !== []) ? str_replace(array_keys($replacements), array_values($replacements), $patternString) : $patternString; $replacedString = self::sanitizeReplacedString($replacedString); return $replacedString; }
[ "public", "static", "function", "replace", "(", "$", "patternString", ",", "$", "model", ")", "{", "//$patternString = '%%model_title%% %%sep%% %%appParam_contactEmail%% %%viewParam_titleSeparator%% %%appConfig_name%%';", "$", "replacedString", "=", "''", ";", "$", "patterns", ...
Function that replace patterns with theirs values. @param $patternString @param Model $model @return mixed|string
[ "Function", "that", "replace", "patterns", "with", "theirs", "values", "." ]
b4ad117a19ac2400c15eda54bf514c9a2cbf0a14
https://github.com/agilov/yii2-seo-behavior/blob/b4ad117a19ac2400c15eda54bf514c9a2cbf0a14/components/SeoPatternHelper.php#L166-L197
train
agilov/yii2-seo-behavior
components/SeoPatternHelper.php
SeoPatternHelper.findPatterns
protected static function findPatterns($patternString) { $patternString = self::sanitizePatternString($patternString); $patternRegExp = self::getPatternRegExp(); return (preg_match_all($patternRegExp, $patternString, $patternsMatches)) ? $patternsMatches[1] : []; }
php
protected static function findPatterns($patternString) { $patternString = self::sanitizePatternString($patternString); $patternRegExp = self::getPatternRegExp(); return (preg_match_all($patternRegExp, $patternString, $patternsMatches)) ? $patternsMatches[1] : []; }
[ "protected", "static", "function", "findPatterns", "(", "$", "patternString", ")", "{", "$", "patternString", "=", "self", "::", "sanitizePatternString", "(", "$", "patternString", ")", ";", "$", "patternRegExp", "=", "self", "::", "getPatternRegExp", "(", ")", ...
Returns array with patterns finded in string. @param $patternString @return array
[ "Returns", "array", "with", "patterns", "finded", "in", "string", "." ]
b4ad117a19ac2400c15eda54bf514c9a2cbf0a14
https://github.com/agilov/yii2-seo-behavior/blob/b4ad117a19ac2400c15eda54bf514c9a2cbf0a14/components/SeoPatternHelper.php#L208-L214
train
agilov/yii2-seo-behavior
components/SeoPatternHelper.php
SeoPatternHelper.callbackRetrievedStaticFunction
protected static function callbackRetrievedStaticFunction($patternKey, $model) { $patternPrefixesOptions = self::getFunctionalPatternPrefixesOptions(); $patternKeyPrefix = self::getPatternKeyPrefix($patternKey); $patternKeyValue = self::getPatternKeyValue($patternKey); $patternPrefixFunctionName = ArrayHelper::getValue($patternPrefixesOptions, $patternKeyPrefix); if (!method_exists(__CLASS__, $patternPrefixFunctionName)) { throw new InvalidConfigException('"'.__CLASS__.'" does not exist function with name "'.$patternPrefixFunctionName.'"'); } return call_user_func([__CLASS__, $patternPrefixFunctionName], $patternKeyValue, $model); }
php
protected static function callbackRetrievedStaticFunction($patternKey, $model) { $patternPrefixesOptions = self::getFunctionalPatternPrefixesOptions(); $patternKeyPrefix = self::getPatternKeyPrefix($patternKey); $patternKeyValue = self::getPatternKeyValue($patternKey); $patternPrefixFunctionName = ArrayHelper::getValue($patternPrefixesOptions, $patternKeyPrefix); if (!method_exists(__CLASS__, $patternPrefixFunctionName)) { throw new InvalidConfigException('"'.__CLASS__.'" does not exist function with name "'.$patternPrefixFunctionName.'"'); } return call_user_func([__CLASS__, $patternPrefixFunctionName], $patternKeyValue, $model); }
[ "protected", "static", "function", "callbackRetrievedStaticFunction", "(", "$", "patternKey", ",", "$", "model", ")", "{", "$", "patternPrefixesOptions", "=", "self", "::", "getFunctionalPatternPrefixesOptions", "(", ")", ";", "$", "patternKeyPrefix", "=", "self", "...
Callback retrieved function based on callback pattern key prefix. @param $patternKey @param $model @return mixed @throws InvalidConfigException
[ "Callback", "retrieved", "function", "based", "on", "callback", "pattern", "key", "prefix", "." ]
b4ad117a19ac2400c15eda54bf514c9a2cbf0a14
https://github.com/agilov/yii2-seo-behavior/blob/b4ad117a19ac2400c15eda54bf514c9a2cbf0a14/components/SeoPatternHelper.php#L225-L236
train
agilov/yii2-seo-behavior
components/SeoPatternHelper.php
SeoPatternHelper.retrieveAppConfigValue
public static function retrieveAppConfigValue($patternKeyValue, $model) { return (property_exists(Yii::$app, $patternKeyValue) || Yii::$app->canGetProperty($patternKeyValue)) ? Yii::$app->{$patternKeyValue} : ''; }
php
public static function retrieveAppConfigValue($patternKeyValue, $model) { return (property_exists(Yii::$app, $patternKeyValue) || Yii::$app->canGetProperty($patternKeyValue)) ? Yii::$app->{$patternKeyValue} : ''; }
[ "public", "static", "function", "retrieveAppConfigValue", "(", "$", "patternKeyValue", ",", "$", "model", ")", "{", "return", "(", "property_exists", "(", "Yii", "::", "$", "app", ",", "$", "patternKeyValue", ")", "||", "Yii", "::", "$", "app", "->", "canG...
Returns application global config value compared with pattern key. @param $patternKey @param $model @return mixed|string
[ "Returns", "application", "global", "config", "value", "compared", "with", "pattern", "key", "." ]
b4ad117a19ac2400c15eda54bf514c9a2cbf0a14
https://github.com/agilov/yii2-seo-behavior/blob/b4ad117a19ac2400c15eda54bf514c9a2cbf0a14/components/SeoPatternHelper.php#L274-L276
train
agilov/yii2-seo-behavior
components/SeoPatternHelper.php
SeoPatternHelper.retrieveViewParamValue
public static function retrieveViewParamValue($patternKeyValue, $model) { return ArrayHelper::getValue(Yii::$app->view->params, $patternKeyValue); }
php
public static function retrieveViewParamValue($patternKeyValue, $model) { return ArrayHelper::getValue(Yii::$app->view->params, $patternKeyValue); }
[ "public", "static", "function", "retrieveViewParamValue", "(", "$", "patternKeyValue", ",", "$", "model", ")", "{", "return", "ArrayHelper", "::", "getValue", "(", "Yii", "::", "$", "app", "->", "view", "->", "params", ",", "$", "patternKeyValue", ")", ";", ...
Returns view parameter value compared with pattern key. @param $patternKey @param $model @return mixed|string
[ "Returns", "view", "parameter", "value", "compared", "with", "pattern", "key", "." ]
b4ad117a19ac2400c15eda54bf514c9a2cbf0a14
https://github.com/agilov/yii2-seo-behavior/blob/b4ad117a19ac2400c15eda54bf514c9a2cbf0a14/components/SeoPatternHelper.php#L286-L288
train
agilov/yii2-seo-behavior
components/SeoPatternHelper.php
SeoPatternHelper.retrieveSeparator
public static function retrieveSeparator() { $separatorViewParamKey = self::SEPARATOR_VIEW_PARAMETER_KEY; return (ArrayHelper::keyExists($separatorViewParamKey, Yii::$app->view->params)) ? Yii::$app->view->params[$separatorViewParamKey] : self::SEPARATOR_DEFAULT; }
php
public static function retrieveSeparator() { $separatorViewParamKey = self::SEPARATOR_VIEW_PARAMETER_KEY; return (ArrayHelper::keyExists($separatorViewParamKey, Yii::$app->view->params)) ? Yii::$app->view->params[$separatorViewParamKey] : self::SEPARATOR_DEFAULT; }
[ "public", "static", "function", "retrieveSeparator", "(", ")", "{", "$", "separatorViewParamKey", "=", "self", "::", "SEPARATOR_VIEW_PARAMETER_KEY", ";", "return", "(", "ArrayHelper", "::", "keyExists", "(", "$", "separatorViewParamKey", ",", "Yii", "::", "$", "ap...
Returns separator. If yii parameters don`t have parameter with such key returns empty string. If yii parameters don`t have parameter with such key returns empty string. @return mixed|string
[ "Returns", "separator", ".", "If", "yii", "parameters", "don", "t", "have", "parameter", "with", "such", "key", "returns", "empty", "string", ".", "If", "yii", "parameters", "don", "t", "have", "parameter", "with", "such", "key", "returns", "empty", "string"...
b4ad117a19ac2400c15eda54bf514c9a2cbf0a14
https://github.com/agilov/yii2-seo-behavior/blob/b4ad117a19ac2400c15eda54bf514c9a2cbf0a14/components/SeoPatternHelper.php#L297-L300
train
Riimu/Kit-UrlParser
src/ExtendedUriTrait.php
ExtendedUriTrait.getStandardPort
public function getStandardPort() { $scheme = $this->getScheme(); if (isset(self::$standardPorts[$scheme])) { return self::$standardPorts[$scheme]; } return null; }
php
public function getStandardPort() { $scheme = $this->getScheme(); if (isset(self::$standardPorts[$scheme])) { return self::$standardPorts[$scheme]; } return null; }
[ "public", "function", "getStandardPort", "(", ")", "{", "$", "scheme", "=", "$", "this", "->", "getScheme", "(", ")", ";", "if", "(", "isset", "(", "self", "::", "$", "standardPorts", "[", "$", "scheme", "]", ")", ")", "{", "return", "self", "::", ...
Returns the standard port for the current scheme. The known ports are: - ftp : 21 - http : 80 - https : 443 @return int|null The standard port for the current scheme or null if not known
[ "Returns", "the", "standard", "port", "for", "the", "current", "scheme", "." ]
6fdc2dd57915425720a874ee697911c6b144808c
https://github.com/Riimu/Kit-UrlParser/blob/6fdc2dd57915425720a874ee697911c6b144808c/src/ExtendedUriTrait.php#L42-L51
train
Riimu/Kit-UrlParser
src/ExtendedUriTrait.php
ExtendedUriTrait.getUsername
public function getUsername() { $info = $this->getUserInfo(); $username = strstr($info, ':', true); return rawurldecode($username === false ? $info : $username); }
php
public function getUsername() { $info = $this->getUserInfo(); $username = strstr($info, ':', true); return rawurldecode($username === false ? $info : $username); }
[ "public", "function", "getUsername", "(", ")", "{", "$", "info", "=", "$", "this", "->", "getUserInfo", "(", ")", ";", "$", "username", "=", "strstr", "(", "$", "info", ",", "':'", ",", "true", ")", ";", "return", "rawurldecode", "(", "$", "username"...
Returns the decoded username from the URI. @return string The decoded username
[ "Returns", "the", "decoded", "username", "from", "the", "URI", "." ]
6fdc2dd57915425720a874ee697911c6b144808c
https://github.com/Riimu/Kit-UrlParser/blob/6fdc2dd57915425720a874ee697911c6b144808c/src/ExtendedUriTrait.php#L63-L69
train
Riimu/Kit-UrlParser
src/ExtendedUriTrait.php
ExtendedUriTrait.getPassword
public function getPassword() { $password = strstr($this->getUserInfo(), ':'); return $password === false ? '' : rawurldecode(substr($password, 1)); }
php
public function getPassword() { $password = strstr($this->getUserInfo(), ':'); return $password === false ? '' : rawurldecode(substr($password, 1)); }
[ "public", "function", "getPassword", "(", ")", "{", "$", "password", "=", "strstr", "(", "$", "this", "->", "getUserInfo", "(", ")", ",", "':'", ")", ";", "return", "$", "password", "===", "false", "?", "''", ":", "rawurldecode", "(", "substr", "(", ...
Returns the decoded password from the URI. @return string The decoded password
[ "Returns", "the", "decoded", "password", "from", "the", "URI", "." ]
6fdc2dd57915425720a874ee697911c6b144808c
https://github.com/Riimu/Kit-UrlParser/blob/6fdc2dd57915425720a874ee697911c6b144808c/src/ExtendedUriTrait.php#L75-L80
train
Riimu/Kit-UrlParser
src/ExtendedUriTrait.php
ExtendedUriTrait.getIpAddress
public function getIpAddress() { $pattern = new UriPattern(); $pattern->matchHost($this->getHost(), $match); if (isset($match['IPv4address'])) { return $match['IPv4address']; } elseif (isset($match['IP_literal'])) { return preg_replace('/^\\[(v[^.]+\\.)?([^\\]]+)\\]$/', '$2', $match['IP_literal']); } return null; }
php
public function getIpAddress() { $pattern = new UriPattern(); $pattern->matchHost($this->getHost(), $match); if (isset($match['IPv4address'])) { return $match['IPv4address']; } elseif (isset($match['IP_literal'])) { return preg_replace('/^\\[(v[^.]+\\.)?([^\\]]+)\\]$/', '$2', $match['IP_literal']); } return null; }
[ "public", "function", "getIpAddress", "(", ")", "{", "$", "pattern", "=", "new", "UriPattern", "(", ")", ";", "$", "pattern", "->", "matchHost", "(", "$", "this", "->", "getHost", "(", ")", ",", "$", "match", ")", ";", "if", "(", "isset", "(", "$",...
Returns the IP address from the host component. @return string|null IP address from the host or null if the host is not an IP address
[ "Returns", "the", "IP", "address", "from", "the", "host", "component", "." ]
6fdc2dd57915425720a874ee697911c6b144808c
https://github.com/Riimu/Kit-UrlParser/blob/6fdc2dd57915425720a874ee697911c6b144808c/src/ExtendedUriTrait.php#L92-L104
train
Riimu/Kit-UrlParser
src/ExtendedUriTrait.php
ExtendedUriTrait.getTopLevelDomain
public function getTopLevelDomain() { if ($this->getIpAddress() !== null) { return ''; } $host = rawurldecode($this->getHost()); $tld = strrchr($host, '.'); if ($tld === '.') { $host = substr($host, 0, -1); $tld = strrchr($host, '.'); } return $tld === false ? $host : substr($tld, 1); }
php
public function getTopLevelDomain() { if ($this->getIpAddress() !== null) { return ''; } $host = rawurldecode($this->getHost()); $tld = strrchr($host, '.'); if ($tld === '.') { $host = substr($host, 0, -1); $tld = strrchr($host, '.'); } return $tld === false ? $host : substr($tld, 1); }
[ "public", "function", "getTopLevelDomain", "(", ")", "{", "if", "(", "$", "this", "->", "getIpAddress", "(", ")", "!==", "null", ")", "{", "return", "''", ";", "}", "$", "host", "=", "rawurldecode", "(", "$", "this", "->", "getHost", "(", ")", ")", ...
Returns the top level domain from the host component. Note that if the host component represents an IP address, an empty string will be returned instead. Additionally, if the host component ends in a period, the section prior that period will be returned instead. If no period is present in the host component, the entire host component will be returned. @return string The top level domain or an empty string, if no TLD is present
[ "Returns", "the", "top", "level", "domain", "from", "the", "host", "component", "." ]
6fdc2dd57915425720a874ee697911c6b144808c
https://github.com/Riimu/Kit-UrlParser/blob/6fdc2dd57915425720a874ee697911c6b144808c/src/ExtendedUriTrait.php#L117-L132
train
Riimu/Kit-UrlParser
src/ExtendedUriTrait.php
ExtendedUriTrait.getPathExtension
public function getPathExtension() { $segments = $this->getPathSegments(); $filename = array_pop($segments); $extension = strrchr($filename, '.'); if ($extension === false) { return ''; } return substr($extension, 1); }
php
public function getPathExtension() { $segments = $this->getPathSegments(); $filename = array_pop($segments); $extension = strrchr($filename, '.'); if ($extension === false) { return ''; } return substr($extension, 1); }
[ "public", "function", "getPathExtension", "(", ")", "{", "$", "segments", "=", "$", "this", "->", "getPathSegments", "(", ")", ";", "$", "filename", "=", "array_pop", "(", "$", "segments", ")", ";", "$", "extension", "=", "strrchr", "(", "$", "filename",...
Returns the file extension for the last segment in the path. @return string The file extension from the last non empty segment
[ "Returns", "the", "file", "extension", "for", "the", "last", "segment", "in", "the", "path", "." ]
6fdc2dd57915425720a874ee697911c6b144808c
https://github.com/Riimu/Kit-UrlParser/blob/6fdc2dd57915425720a874ee697911c6b144808c/src/ExtendedUriTrait.php#L156-L167
train
harmonycms/sdk
Theme/Theme.php
Theme.getName
final public function getName(): string { try { $reflexionConstant = new ReflectionClassConstant($this, 'NAME'); $this->name = $reflexionConstant->getValue(); } catch (Exception $e) { } return $this->name; }
php
final public function getName(): string { try { $reflexionConstant = new ReflectionClassConstant($this, 'NAME'); $this->name = $reflexionConstant->getValue(); } catch (Exception $e) { } return $this->name; }
[ "final", "public", "function", "getName", "(", ")", ":", "string", "{", "try", "{", "$", "reflexionConstant", "=", "new", "ReflectionClassConstant", "(", "$", "this", ",", "'NAME'", ")", ";", "$", "this", "->", "name", "=", "$", "reflexionConstant", "->", ...
Returns the theme name. @return string The Theme name
[ "Returns", "the", "theme", "name", "." ]
108f9d7a05118a367efd28d1096258da9270cb6d
https://github.com/harmonycms/sdk/blob/108f9d7a05118a367efd28d1096258da9270cb6d/Theme/Theme.php#L113-L123
train
harmonycms/sdk
Theme/Theme.php
Theme.getDescription
final public function getDescription(): string { try { $reflexionConstant = new ReflectionClassConstant($this, 'DESCRIPTION'); $this->description = $reflexionConstant->getValue(); } catch (Exception $e) { } return $this->description; }
php
final public function getDescription(): string { try { $reflexionConstant = new ReflectionClassConstant($this, 'DESCRIPTION'); $this->description = $reflexionConstant->getValue(); } catch (Exception $e) { } return $this->description; }
[ "final", "public", "function", "getDescription", "(", ")", ":", "string", "{", "try", "{", "$", "reflexionConstant", "=", "new", "ReflectionClassConstant", "(", "$", "this", ",", "'DESCRIPTION'", ")", ";", "$", "this", "->", "description", "=", "$", "reflexi...
Returns the theme description. @return string The Theme description
[ "Returns", "the", "theme", "description", "." ]
108f9d7a05118a367efd28d1096258da9270cb6d
https://github.com/harmonycms/sdk/blob/108f9d7a05118a367efd28d1096258da9270cb6d/Theme/Theme.php#L130-L140
train
harmonycms/sdk
Theme/Theme.php
Theme.getPreview
public function getPreview(): ?string { $array = glob($this->getPath() . '/assets/images/preview.{jpg,jpeg,png,gif}', GLOB_BRACE); if (isset($array[0])) { return sprintf('/themes/%s/images/%s', $this->shortName, (new SplFileInfo($array[0]))->getBasename()); } return null; }
php
public function getPreview(): ?string { $array = glob($this->getPath() . '/assets/images/preview.{jpg,jpeg,png,gif}', GLOB_BRACE); if (isset($array[0])) { return sprintf('/themes/%s/images/%s', $this->shortName, (new SplFileInfo($array[0]))->getBasename()); } return null; }
[ "public", "function", "getPreview", "(", ")", ":", "?", "string", "{", "$", "array", "=", "glob", "(", "$", "this", "->", "getPath", "(", ")", ".", "'/assets/images/preview.{jpg,jpeg,png,gif}'", ",", "GLOB_BRACE", ")", ";", "if", "(", "isset", "(", "$", ...
Returns the theme preview image. @return null|string The theme preview image
[ "Returns", "the", "theme", "preview", "image", "." ]
108f9d7a05118a367efd28d1096258da9270cb6d
https://github.com/harmonycms/sdk/blob/108f9d7a05118a367efd28d1096258da9270cb6d/Theme/Theme.php#L218-L226
train
cafe-latte/framework
src/Core/Config.php
Config.doPathValidate
public function doPathValidate(string $pathValue = null, $isWritable = true) { if ($pathValue != null) { if (!is_dir($pathValue)) { throw new ConfigSettingFailException("`{$pathValue}` does NOT existed", '400'); } if ($isWritable == true) { if (!is_writable($pathValue)) { throw new ConfigSettingFailException("`{$pathValue}`is NOT writable", '400'); } } } }
php
public function doPathValidate(string $pathValue = null, $isWritable = true) { if ($pathValue != null) { if (!is_dir($pathValue)) { throw new ConfigSettingFailException("`{$pathValue}` does NOT existed", '400'); } if ($isWritable == true) { if (!is_writable($pathValue)) { throw new ConfigSettingFailException("`{$pathValue}`is NOT writable", '400'); } } } }
[ "public", "function", "doPathValidate", "(", "string", "$", "pathValue", "=", "null", ",", "$", "isWritable", "=", "true", ")", "{", "if", "(", "$", "pathValue", "!=", "null", ")", "{", "if", "(", "!", "is_dir", "(", "$", "pathValue", ")", ")", "{", ...
to do validate config params. @param string|null $pathValue @param bool $isWritable
[ "to", "do", "validate", "config", "params", "." ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/Config.php#L78-L92
train
inphinit/framework
src/Inphinit/Uri.php
Uri.encodepath
public static function encodepath($text, $type = null) { $text = preg_replace('#[`\'"\^~{}\[\]()]#', '', $text); $text = preg_replace('#[\n\s\/\p{P}]#u', '-', $text); if ($type === self::UNICODE) { $text = preg_replace('#[^\d\p{L}\p{N}\-]#u', '', $text); } elseif ($type === self::ASCII) { $text = preg_replace('#[^\d\p{L}\-]#u', '', $text); $text = self::encodepath($text); } else { $text = Helper::toAscii($text); $text = preg_replace('#[^a-z\d\-]#i', '', $text); } return trim(preg_replace('#--+#', '-', $text), '-'); }
php
public static function encodepath($text, $type = null) { $text = preg_replace('#[`\'"\^~{}\[\]()]#', '', $text); $text = preg_replace('#[\n\s\/\p{P}]#u', '-', $text); if ($type === self::UNICODE) { $text = preg_replace('#[^\d\p{L}\p{N}\-]#u', '', $text); } elseif ($type === self::ASCII) { $text = preg_replace('#[^\d\p{L}\-]#u', '', $text); $text = self::encodepath($text); } else { $text = Helper::toAscii($text); $text = preg_replace('#[^a-z\d\-]#i', '', $text); } return trim(preg_replace('#--+#', '-', $text), '-'); }
[ "public", "static", "function", "encodepath", "(", "$", "text", ",", "$", "type", "=", "null", ")", "{", "$", "text", "=", "preg_replace", "(", "'#[`\\'\"\\^~{}\\[\\]()]#'", ",", "''", ",", "$", "text", ")", ";", "$", "text", "=", "preg_replace", "(", ...
Convert text to URL format @param string $text @param int $type @return string
[ "Convert", "text", "to", "URL", "format" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Inphinit/Uri.php#L47-L63
train
inphinit/framework
src/Inphinit/Uri.php
Uri.normalize
public static function normalize($url) { $u = parse_url(preg_replace('#^file:/+([a-z]+:)#i', '$1', $url)); if ($u === false) { return $url; } if (empty($u['scheme'])) { $u = null; return false; } $scheme = strtolower($u['scheme']); if (strlen($scheme) > 1) { $normalized = $scheme . '://'; } else { $normalized = strtoupper($scheme) . ':'; } if (isset($u['user'])) { $normalized .= $u['user']; $normalized .= isset($u['pass']) ? (':' . $u['pass']) : ''; $normalized .= '@'; } if (isset($u['host'])) { if (in_array($scheme, static::$defaultSchemes)) { $host = urldecode($u['host']); $normalized .= mb_strtolower($host, mb_detect_encoding($host)); } else { $normalized .= $u['host']; } } if (isset($u['port']) && !in_array($scheme . ':' . $u['port'], static::$defaultPorts)) { $normalized .= ':' . $u['port']; } if (empty($u['path']) || $u['path'] === '/') { $normalized .= '/'; } else { $normalized .= '/' . ltrim(self::canonpath($u['path']), '/'); } if (isset($u['query'])) { $normalized .= self::canonquery($u['query'], '?'); } if (isset($u['fragment'])) { $normalized .= '#' . $u['fragment']; } $u = null; return $normalized; }
php
public static function normalize($url) { $u = parse_url(preg_replace('#^file:/+([a-z]+:)#i', '$1', $url)); if ($u === false) { return $url; } if (empty($u['scheme'])) { $u = null; return false; } $scheme = strtolower($u['scheme']); if (strlen($scheme) > 1) { $normalized = $scheme . '://'; } else { $normalized = strtoupper($scheme) . ':'; } if (isset($u['user'])) { $normalized .= $u['user']; $normalized .= isset($u['pass']) ? (':' . $u['pass']) : ''; $normalized .= '@'; } if (isset($u['host'])) { if (in_array($scheme, static::$defaultSchemes)) { $host = urldecode($u['host']); $normalized .= mb_strtolower($host, mb_detect_encoding($host)); } else { $normalized .= $u['host']; } } if (isset($u['port']) && !in_array($scheme . ':' . $u['port'], static::$defaultPorts)) { $normalized .= ':' . $u['port']; } if (empty($u['path']) || $u['path'] === '/') { $normalized .= '/'; } else { $normalized .= '/' . ltrim(self::canonpath($u['path']), '/'); } if (isset($u['query'])) { $normalized .= self::canonquery($u['query'], '?'); } if (isset($u['fragment'])) { $normalized .= '#' . $u['fragment']; } $u = null; return $normalized; }
[ "public", "static", "function", "normalize", "(", "$", "url", ")", "{", "$", "u", "=", "parse_url", "(", "preg_replace", "(", "'#^file:/+([a-z]+:)#i'", ",", "'$1'", ",", "$", "url", ")", ")", ";", "if", "(", "$", "u", "===", "false", ")", "{", "retur...
Normalize URL, include canonicalized path @param string $url @return string|bool
[ "Normalize", "URL", "include", "canonicalized", "path" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Inphinit/Uri.php#L104-L160
train
debesha/DoctrineProfileExtraBundle
ORM/HydrationLogger.php
HydrationLogger.start
public function start($type) { if ($this->enabled) { $this->start = microtime(true); $this->hydrations[++$this->currentHydration]['type'] = $type; } }
php
public function start($type) { if ($this->enabled) { $this->start = microtime(true); $this->hydrations[++$this->currentHydration]['type'] = $type; } }
[ "public", "function", "start", "(", "$", "type", ")", "{", "if", "(", "$", "this", "->", "enabled", ")", "{", "$", "this", "->", "start", "=", "microtime", "(", "true", ")", ";", "$", "this", "->", "hydrations", "[", "++", "$", "this", "->", "cur...
Marks a hydration as started. Timing is started @param string $type type of hydration
[ "Marks", "a", "hydration", "as", "started", ".", "Timing", "is", "started" ]
fe06a2c3cfebb8943ca08c926ae542dcdb2d579a
https://github.com/debesha/DoctrineProfileExtraBundle/blob/fe06a2c3cfebb8943ca08c926ae542dcdb2d579a/ORM/HydrationLogger.php#L51-L58
train
debesha/DoctrineProfileExtraBundle
ORM/HydrationLogger.php
HydrationLogger.stop
public function stop($resultNum, $aliasMap) { if ($this->enabled) { $this->hydrations[$this->currentHydration]['executionMS'] = microtime(true) - $this->start; $this->hydrations[$this->currentHydration]['resultNum'] = $resultNum; $this->hydrations[$this->currentHydration]['aliasMap'] = $aliasMap; } }
php
public function stop($resultNum, $aliasMap) { if ($this->enabled) { $this->hydrations[$this->currentHydration]['executionMS'] = microtime(true) - $this->start; $this->hydrations[$this->currentHydration]['resultNum'] = $resultNum; $this->hydrations[$this->currentHydration]['aliasMap'] = $aliasMap; } }
[ "public", "function", "stop", "(", "$", "resultNum", ",", "$", "aliasMap", ")", "{", "if", "(", "$", "this", "->", "enabled", ")", "{", "$", "this", "->", "hydrations", "[", "$", "this", "->", "currentHydration", "]", "[", "'executionMS'", "]", "=", ...
Marks a hydration as stopped. Number of hydrated entities and alias map is passed to method. @param int $resultNum @param array $aliasMap
[ "Marks", "a", "hydration", "as", "stopped", ".", "Number", "of", "hydrated", "entities", "and", "alias", "map", "is", "passed", "to", "method", "." ]
fe06a2c3cfebb8943ca08c926ae542dcdb2d579a
https://github.com/debesha/DoctrineProfileExtraBundle/blob/fe06a2c3cfebb8943ca08c926ae542dcdb2d579a/ORM/HydrationLogger.php#L67-L74
train
cafe-latte/framework
src/Core/BenchMark.php
BenchMark.getRuntime
public function getRuntime(int $precision = 10) { if ($this->startTime == $this::NOT_INITIALIZED || $this->endTime == $this::NOT_INITIALIZED) { return FALSE; } $runTime = round($this->endTime - $this->startTime, $precision); return $runTime; }
php
public function getRuntime(int $precision = 10) { if ($this->startTime == $this::NOT_INITIALIZED || $this->endTime == $this::NOT_INITIALIZED) { return FALSE; } $runTime = round($this->endTime - $this->startTime, $precision); return $runTime; }
[ "public", "function", "getRuntime", "(", "int", "$", "precision", "=", "10", ")", "{", "if", "(", "$", "this", "->", "startTime", "==", "$", "this", "::", "NOT_INITIALIZED", "||", "$", "this", "->", "endTime", "==", "$", "this", "::", "NOT_INITIALIZED", ...
to get the runtime. @param int $precision @return boolean
[ "to", "get", "the", "runtime", "." ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/BenchMark.php#L62-L71
train
cafe-latte/framework
src/Core/BenchMark.php
BenchMark.checkNow
private function checkNow(string $storeVarName) : bool { $now = $this->microtimeFloat(); $this->{$storeVarName} = $now; return true; }
php
private function checkNow(string $storeVarName) : bool { $now = $this->microtimeFloat(); $this->{$storeVarName} = $now; return true; }
[ "private", "function", "checkNow", "(", "string", "$", "storeVarName", ")", ":", "bool", "{", "$", "now", "=", "$", "this", "->", "microtimeFloat", "(", ")", ";", "$", "this", "->", "{", "$", "storeVarName", "}", "=", "$", "now", ";", "return", "true...
to set the current micro time. @param string $storeVarName @return bool
[ "to", "set", "the", "current", "micro", "time", "." ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/BenchMark.php#L79-L84
train
romainbessugesmeusy/php-sql-query
lib/RBM/SqlQuery/Renderer/SqlServer.php
SqlServer._renderFunc
protected function _renderFunc(Func $func) { if($func->getName() != 'CONCAT') return parent::_renderFunc($func); $args = $func->getArgs(); array_walk($args, function(&$arg){ $arg = $this->_renderValue($arg); }); return implode(' + ', $args); }
php
protected function _renderFunc(Func $func) { if($func->getName() != 'CONCAT') return parent::_renderFunc($func); $args = $func->getArgs(); array_walk($args, function(&$arg){ $arg = $this->_renderValue($arg); }); return implode(' + ', $args); }
[ "protected", "function", "_renderFunc", "(", "Func", "$", "func", ")", "{", "if", "(", "$", "func", "->", "getName", "(", ")", "!=", "'CONCAT'", ")", "return", "parent", "::", "_renderFunc", "(", "$", "func", ")", ";", "$", "args", "=", "$", "func", ...
Override in order to get the string concatenation right @param Func $func @return string
[ "Override", "in", "order", "to", "get", "the", "string", "concatenation", "right" ]
9c94bc38b1031b0358d9f3a4bc35cbe076d4581b
https://github.com/romainbessugesmeusy/php-sql-query/blob/9c94bc38b1031b0358d9f3a4bc35cbe076d4581b/lib/RBM/SqlQuery/Renderer/SqlServer.php#L164-L174
train
swoft-cloud/swoft-rpc
src/Packer/ServicePacker.php
ServicePacker.formatData
public function formatData(string $interface, string $version, string $method, array $params): array { return [ 'interface' => $interface, 'version' => $version, 'method' => $method, 'params' => $params, 'logid' => RequestContext::getLogid(), 'spanid' => RequestContext::getSpanid() + 1, ]; }
php
public function formatData(string $interface, string $version, string $method, array $params): array { return [ 'interface' => $interface, 'version' => $version, 'method' => $method, 'params' => $params, 'logid' => RequestContext::getLogid(), 'spanid' => RequestContext::getSpanid() + 1, ]; }
[ "public", "function", "formatData", "(", "string", "$", "interface", ",", "string", "$", "version", ",", "string", "$", "method", ",", "array", "$", "params", ")", ":", "array", "{", "return", "[", "'interface'", "=>", "$", "interface", ",", "'version'", ...
Format the data for packer @param string $interface @param string $version @param string $method @param array $params @return array
[ "Format", "the", "data", "for", "packer" ]
e782bc15cd72b710131bda795e4871b5606ea4a0
https://github.com/swoft-cloud/swoft-rpc/blob/e782bc15cd72b710131bda795e4871b5606ea4a0/src/Packer/ServicePacker.php#L88-L98
train
harmonycms/sdk
Extension/ContainerExtensionTrait.php
ContainerExtensionTrait.getNamespace
final public function getNamespace(): string { if (null === $this->namespace) { $pos = strrpos(static::class, '\\'); $this->namespace = false === $pos ? '' : substr(static::class, 0, $pos); } return $this->namespace; }
php
final public function getNamespace(): string { if (null === $this->namespace) { $pos = strrpos(static::class, '\\'); $this->namespace = false === $pos ? '' : substr(static::class, 0, $pos); } return $this->namespace; }
[ "final", "public", "function", "getNamespace", "(", ")", ":", "string", "{", "if", "(", "null", "===", "$", "this", "->", "namespace", ")", "{", "$", "pos", "=", "strrpos", "(", "static", "::", "class", ",", "'\\\\'", ")", ";", "$", "this", "->", "...
Gets the Extension namespace. @return string The Extension namespace
[ "Gets", "the", "Extension", "namespace", "." ]
108f9d7a05118a367efd28d1096258da9270cb6d
https://github.com/harmonycms/sdk/blob/108f9d7a05118a367efd28d1096258da9270cb6d/Extension/ContainerExtensionTrait.php#L27-L35
train
harmonycms/sdk
Extension/ContainerExtensionTrait.php
ContainerExtensionTrait.getContainerExtension
public function getContainerExtension(): ?ExtensionInterface { if (null === $this->extension) { $extension = $this->createContainerExtension(); if (null !== $extension) { if (!$extension instanceof ExtensionInterface) { throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', \get_class($extension))); } // check naming convention $basename = str_replace(['Component', 'Module', 'Plugin'], ['', '', ''], $this->getIdentifier()); $expectedAlias = Container::underscore($basename); if ($expectedAlias != $extension->getAlias()) { throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias())); } $this->extension = $extension; } } return $this->extension; }
php
public function getContainerExtension(): ?ExtensionInterface { if (null === $this->extension) { $extension = $this->createContainerExtension(); if (null !== $extension) { if (!$extension instanceof ExtensionInterface) { throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', \get_class($extension))); } // check naming convention $basename = str_replace(['Component', 'Module', 'Plugin'], ['', '', ''], $this->getIdentifier()); $expectedAlias = Container::underscore($basename); if ($expectedAlias != $extension->getAlias()) { throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias())); } $this->extension = $extension; } } return $this->extension; }
[ "public", "function", "getContainerExtension", "(", ")", ":", "?", "ExtensionInterface", "{", "if", "(", "null", "===", "$", "this", "->", "extension", ")", "{", "$", "extension", "=", "$", "this", "->", "createContainerExtension", "(", ")", ";", "if", "("...
Returns the container extension that should be implicitly loaded. @return ExtensionInterface|null The default extension or null if there is none
[ "Returns", "the", "container", "extension", "that", "should", "be", "implicitly", "loaded", "." ]
108f9d7a05118a367efd28d1096258da9270cb6d
https://github.com/harmonycms/sdk/blob/108f9d7a05118a367efd28d1096258da9270cb6d/Extension/ContainerExtensionTrait.php#L42-L67
train
inphinit/framework
src/Experimental/Http/Redirect.php
Redirect.only
public static function only($path, $code = 302, $trigger = true) { self::$debuglvl = 3; self::to($path, $code, $trigger); Response::dispatch(); exit; }
php
public static function only($path, $code = 302, $trigger = true) { self::$debuglvl = 3; self::to($path, $code, $trigger); Response::dispatch(); exit; }
[ "public", "static", "function", "only", "(", "$", "path", ",", "$", "code", "=", "302", ",", "$", "trigger", "=", "true", ")", "{", "self", "::", "$", "debuglvl", "=", "3", ";", "self", "::", "to", "(", "$", "path", ",", "$", "code", ",", "$", ...
Redirect and stop application execution @param string $path @param int $code @param bool $trigger @throws \Inphinit\Experimental\Exception @return void
[ "Redirect", "and", "stop", "application", "execution" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Http/Redirect.php#L30-L39
train
inphinit/framework
src/Experimental/Http/Redirect.php
Redirect.to
public static function to($path, $code = 302, $trigger = true) { $debuglvl = self::$debuglvl; self::$debuglvl = 2; if (headers_sent()) { throw new Exception('Headers already sent', $debuglvl); } elseif ($code < 300 || $code > 399) { throw new Exception('Invalid redirect HTTP status', $debuglvl); } elseif (empty($path)) { throw new Exception('Path is not defined', $debuglvl); } elseif (strpos($path, '/') === 0) { $path = Uri::root($path); } Response::status($code, $trigger); Response::putHeader('Location', $path); }
php
public static function to($path, $code = 302, $trigger = true) { $debuglvl = self::$debuglvl; self::$debuglvl = 2; if (headers_sent()) { throw new Exception('Headers already sent', $debuglvl); } elseif ($code < 300 || $code > 399) { throw new Exception('Invalid redirect HTTP status', $debuglvl); } elseif (empty($path)) { throw new Exception('Path is not defined', $debuglvl); } elseif (strpos($path, '/') === 0) { $path = Uri::root($path); } Response::status($code, $trigger); Response::putHeader('Location', $path); }
[ "public", "static", "function", "to", "(", "$", "path", ",", "$", "code", "=", "302", ",", "$", "trigger", "=", "true", ")", "{", "$", "debuglvl", "=", "self", "::", "$", "debuglvl", ";", "self", "::", "$", "debuglvl", "=", "2", ";", "if", "(", ...
Redirects to a valid path within the application @param string $path @param int $code @param bool $trigger @throws \Inphinit\Experimental\Exception @return void
[ "Redirects", "to", "a", "valid", "path", "within", "the", "application" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Http/Redirect.php#L50-L67
train
inphinit/framework
src/Experimental/Http/Redirect.php
Redirect.back
public static function back($only = false, $trigger = true) { $referer = Request::header('referer'); if ($referer === false) { return false; } self::$debuglvl = 3; if ($only) { static::only($referer, 302, $trigger); } else { static::to($referer, 302, $trigger); } }
php
public static function back($only = false, $trigger = true) { $referer = Request::header('referer'); if ($referer === false) { return false; } self::$debuglvl = 3; if ($only) { static::only($referer, 302, $trigger); } else { static::to($referer, 302, $trigger); } }
[ "public", "static", "function", "back", "(", "$", "only", "=", "false", ",", "$", "trigger", "=", "true", ")", "{", "$", "referer", "=", "Request", "::", "header", "(", "'referer'", ")", ";", "if", "(", "$", "referer", "===", "false", ")", "{", "re...
Return to redirect to new path @param bool $only @param bool $trigger @return bool|void
[ "Return", "to", "redirect", "to", "new", "path" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Http/Redirect.php#L76-L91
train
inphinit/framework
src/Experimental/Routing/Group.php
Group.domain
public function domain($domain) { if (empty($domain) || trim($domain) !== $domain) { throw new Exception('Invalid domain "' . $domain . '"', 2); } else { $this->domain = $domain; } return $this; }
php
public function domain($domain) { if (empty($domain) || trim($domain) !== $domain) { throw new Exception('Invalid domain "' . $domain . '"', 2); } else { $this->domain = $domain; } return $this; }
[ "public", "function", "domain", "(", "$", "domain", ")", "{", "if", "(", "empty", "(", "$", "domain", ")", "||", "trim", "(", "$", "domain", ")", "!==", "$", "domain", ")", "{", "throw", "new", "Exception", "(", "'Invalid domain \"'", ".", "$", "doma...
Define domain for group @param string $domain @throws \Inphinit\Experimental\Exception @return \Inphinit\Experimental\Routing\Group
[ "Define", "domain", "for", "group" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Routing/Group.php#L68-L77
train
inphinit/framework
src/Experimental/Routing/Group.php
Group.path
public function path($path) { if ($path !== '/' . trim($path, '/') . '/') { throw new Exception('Invalid path "' . $path . '", use like this /foo/', 2); } $this->path = $path; return $this; }
php
public function path($path) { if ($path !== '/' . trim($path, '/') . '/') { throw new Exception('Invalid path "' . $path . '", use like this /foo/', 2); } $this->path = $path; return $this; }
[ "public", "function", "path", "(", "$", "path", ")", "{", "if", "(", "$", "path", "!==", "'/'", ".", "trim", "(", "$", "path", ",", "'/'", ")", ".", "'/'", ")", "{", "throw", "new", "Exception", "(", "'Invalid path \"'", ".", "$", "path", ".", "'...
Define path for group @param string $path @throws \Inphinit\Experimental\Exception @return \Inphinit\Experimental\Routing\Group
[ "Define", "path", "for", "group" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Routing/Group.php#L86-L95
train
inphinit/framework
src/Experimental/Routing/Group.php
Group.secure
public function secure($level) { if ($level < 1 || $level > 3) { throw new Exception('Invalid security level', 2); } $this->levelSecure = (int) $level; return $this; }
php
public function secure($level) { if ($level < 1 || $level > 3) { throw new Exception('Invalid security level', 2); } $this->levelSecure = (int) $level; return $this; }
[ "public", "function", "secure", "(", "$", "level", ")", "{", "if", "(", "$", "level", "<", "1", "||", "$", "level", ">", "3", ")", "{", "throw", "new", "Exception", "(", "'Invalid security level'", ",", "2", ")", ";", "}", "$", "this", "->", "level...
Access only with HTTPS, or only HTTP, or both @param int $level @throws \Inphinit\Experimental\Exception @return \Inphinit\Experimental\Routing\Group
[ "Access", "only", "with", "HTTPS", "or", "only", "HTTP", "or", "both" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Routing/Group.php#L104-L113
train
inphinit/framework
src/Experimental/Routing/Group.php
Group.then
public function then(\Closure $callback) { if ($this->ready) { return null; } $this->ready = true; if (!$this->checkDomain() || !$this->checkPath() || !$this->checkSecurity()) { return null; } $oNS = parent::$prefixNS; $oPP = parent::$prefixPath; if ($this->ns) { parent::$prefixNS = $this->ns; } if ($this->path) { parent::$prefixPath = rtrim($this->currentPrefixPath, '/'); } call_user_func_array($callback, $this->arguments); parent::$prefixNS = $oNS; parent::$prefixPath = $oPP; }
php
public function then(\Closure $callback) { if ($this->ready) { return null; } $this->ready = true; if (!$this->checkDomain() || !$this->checkPath() || !$this->checkSecurity()) { return null; } $oNS = parent::$prefixNS; $oPP = parent::$prefixPath; if ($this->ns) { parent::$prefixNS = $this->ns; } if ($this->path) { parent::$prefixPath = rtrim($this->currentPrefixPath, '/'); } call_user_func_array($callback, $this->arguments); parent::$prefixNS = $oNS; parent::$prefixPath = $oPP; }
[ "public", "function", "then", "(", "\\", "Closure", "$", "callback", ")", "{", "if", "(", "$", "this", "->", "ready", ")", "{", "return", "null", ";", "}", "$", "this", "->", "ready", "=", "true", ";", "if", "(", "!", "$", "this", "->", "checkDom...
Define callback for group, this callback is executed if the request meets the group settings @param \Closure @return void
[ "Define", "callback", "for", "group", "this", "callback", "is", "executed", "if", "the", "request", "meets", "the", "group", "settings" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Routing/Group.php#L122-L149
train
inphinit/framework
src/Experimental/Routing/Group.php
Group.checkSecurity
protected function checkSecurity() { if (!$this->levelSecure || $this->levelSecure === self::BOTH) { return true; } $secure = Request::is('secure'); return ($this->levelSecure === self::SECURE && $secure) || ($this->levelSecure === self::NONSECURE && !$secure); }
php
protected function checkSecurity() { if (!$this->levelSecure || $this->levelSecure === self::BOTH) { return true; } $secure = Request::is('secure'); return ($this->levelSecure === self::SECURE && $secure) || ($this->levelSecure === self::NONSECURE && !$secure); }
[ "protected", "function", "checkSecurity", "(", ")", "{", "if", "(", "!", "$", "this", "->", "levelSecure", "||", "$", "this", "->", "levelSecure", "===", "self", "::", "BOTH", ")", "{", "return", "true", ";", "}", "$", "secure", "=", "Request", "::", ...
Method is used for check if HTTPS or HTTP or both @return bool
[ "Method", "is", "used", "for", "check", "if", "HTTPS", "or", "HTTP", "or", "both" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Routing/Group.php#L156-L166
train
inphinit/framework
src/Experimental/Routing/Group.php
Group.checkDomain
protected function checkDomain() { if ($this->domain === null) { return true; } if (self::$cachehost !== null) { $host = self::$cachehost; } else { $fhost = Request::header('Host'); $host = strstr($fhost, ':', true); $host = $host ? $host : $fhost; self::$cachehost = $host; } if ($host === $this->domain) { return true; } elseif ($host) { $re = Regex::parse($this->domain); if ($re === false || preg_match('#^' . $re . '$#', $host, $matches) === 0) { return false; } array_shift($matches); $this->arguments = array_merge($this->arguments, $matches); return true; } return false; }
php
protected function checkDomain() { if ($this->domain === null) { return true; } if (self::$cachehost !== null) { $host = self::$cachehost; } else { $fhost = Request::header('Host'); $host = strstr($fhost, ':', true); $host = $host ? $host : $fhost; self::$cachehost = $host; } if ($host === $this->domain) { return true; } elseif ($host) { $re = Regex::parse($this->domain); if ($re === false || preg_match('#^' . $re . '$#', $host, $matches) === 0) { return false; } array_shift($matches); $this->arguments = array_merge($this->arguments, $matches); return true; } return false; }
[ "protected", "function", "checkDomain", "(", ")", "{", "if", "(", "$", "this", "->", "domain", "===", "null", ")", "{", "return", "true", ";", "}", "if", "(", "self", "::", "$", "cachehost", "!==", "null", ")", "{", "$", "host", "=", "self", "::", ...
Method is used for check domain and return arguments if using regex @return bool
[ "Method", "is", "used", "for", "check", "domain", "and", "return", "arguments", "if", "using", "regex" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Routing/Group.php#L173-L206
train
inphinit/framework
src/Experimental/Routing/Group.php
Group.checkPath
protected function checkPath() { if ($this->path === null) { return true; } $pathinfo = \UtilsPath(); if (strpos($pathinfo, $this->path) === 0) { $this->currentPrefixPath = $this->path; return true; } else { $re = Regex::parse($this->path); if ($re !== false && preg_match('#^' . $re . '#', $pathinfo, $matches)) { $this->currentPrefixPath = $matches[0]; array_shift($matches); $this->arguments = array_merge($this->arguments, $matches); return true; } } return false; }
php
protected function checkPath() { if ($this->path === null) { return true; } $pathinfo = \UtilsPath(); if (strpos($pathinfo, $this->path) === 0) { $this->currentPrefixPath = $this->path; return true; } else { $re = Regex::parse($this->path); if ($re !== false && preg_match('#^' . $re . '#', $pathinfo, $matches)) { $this->currentPrefixPath = $matches[0]; array_shift($matches); $this->arguments = array_merge($this->arguments, $matches); return true; } } return false; }
[ "protected", "function", "checkPath", "(", ")", "{", "if", "(", "$", "this", "->", "path", "===", "null", ")", "{", "return", "true", ";", "}", "$", "pathinfo", "=", "\\", "UtilsPath", "(", ")", ";", "if", "(", "strpos", "(", "$", "pathinfo", ",", ...
Method is used for check path @return bool
[ "Method", "is", "used", "for", "check", "path" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Routing/Group.php#L213-L239
train
gopeak/hornet-framework
src/framework/HornetEngine.php
HornetEngine.getProperty
public function getProperty($name) { if (isset($this->$name)) { return $this->$name; } if (isset(static::$name)) { return static::$name; } return null; }
php
public function getProperty($name) { if (isset($this->$name)) { return $this->$name; } if (isset(static::$name)) { return static::$name; } return null; }
[ "public", "function", "getProperty", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "$", "name", ")", ")", "{", "return", "$", "this", "->", "$", "name", ";", "}", "if", "(", "isset", "(", "static", "::", "$", "name", "...
fetch current property value @param $name @return mixed
[ "fetch", "current", "property", "value" ]
1b784662224ef657cb60a7b018b7d941b2993794
https://github.com/gopeak/hornet-framework/blob/1b784662224ef657cb60a7b018b7d941b2993794/src/framework/HornetEngine.php#L315-L324
train
gopeak/hornet-framework
src/framework/HornetEngine.php
HornetEngine.underlineToUppercase
private function underlineToUppercase($str) { $fnc = function ($matches) { return strtoupper($matches[1]); }; $str = preg_replace_callback('/_+([a-z])/', $fnc, $str); return $str; }
php
private function underlineToUppercase($str) { $fnc = function ($matches) { return strtoupper($matches[1]); }; $str = preg_replace_callback('/_+([a-z])/', $fnc, $str); return $str; }
[ "private", "function", "underlineToUppercase", "(", "$", "str", ")", "{", "$", "fnc", "=", "function", "(", "$", "matches", ")", "{", "return", "strtoupper", "(", "$", "matches", "[", "1", "]", ")", ";", "}", ";", "$", "str", "=", "preg_replace_callbac...
Underline to uppercase @param string $str string @return string
[ "Underline", "to", "uppercase" ]
1b784662224ef657cb60a7b018b7d941b2993794
https://github.com/gopeak/hornet-framework/blob/1b784662224ef657cb60a7b018b7d941b2993794/src/framework/HornetEngine.php#L707-L714
train
gopeak/hornet-framework
src/framework/HornetEngine.php
HornetEngine.handleCtrlResult
private function handleCtrlResult($ret) { if ($ret === null) { return; } register_shutdown_function("closeResources"); if (isset($_GET['format']) && $_GET['format'] == 'xml') { header('Content-type: application/xml; charset=utf-8'); $ret = (object)$ret; echo $this->objectToXml($ret); die; } header('Content-type: application/json; charset=utf-8'); echo json_encode($ret); die; }
php
private function handleCtrlResult($ret) { if ($ret === null) { return; } register_shutdown_function("closeResources"); if (isset($_GET['format']) && $_GET['format'] == 'xml') { header('Content-type: application/xml; charset=utf-8'); $ret = (object)$ret; echo $this->objectToXml($ret); die; } header('Content-type: application/json; charset=utf-8'); echo json_encode($ret); die; }
[ "private", "function", "handleCtrlResult", "(", "$", "ret", ")", "{", "if", "(", "$", "ret", "===", "null", ")", "{", "return", ";", "}", "register_shutdown_function", "(", "\"closeResources\"", ")", ";", "if", "(", "isset", "(", "$", "_GET", "[", "'form...
Handle controller's result @param string $ret result @return void
[ "Handle", "controller", "s", "result" ]
1b784662224ef657cb60a7b018b7d941b2993794
https://github.com/gopeak/hornet-framework/blob/1b784662224ef657cb60a7b018b7d941b2993794/src/framework/HornetEngine.php#L754-L769
train
archfizz/slotmachine
src/SlotMachine.php
SlotMachine.initialize
private function initialize() { $this->undefinedCardResolution = isset($this->config['options']['undefined_card']) ? static::translateUndefinedCardResolution($this->config['options']['undefined_card']) : UndefinedCardResolution::DEFAULT_CARD; if (isset($this->config['options']['delimiter'])) { $this->delimiter = $this->config['options']['delimiter']; } foreach ($this->config['slots'] as $slotName => &$slotData) { $slotData['name'] = $slotName; if (is_string($slotData['reel'])) { $slotData['reel'] = $this->config['reels'][$slotData['reel']]; } if (!isset($slotData['nested'])) { $slotData['nested'] = array(); } $slotData['undefined_card'] = (!isset($slotData['undefined_card'])) ? $this->undefinedCardResolution : static::translateUndefinedCardResolution($slotData['undefined_card']); $this->offsetSet($slotName, function () use ($slotData) { return new Slot($slotData); }); } }
php
private function initialize() { $this->undefinedCardResolution = isset($this->config['options']['undefined_card']) ? static::translateUndefinedCardResolution($this->config['options']['undefined_card']) : UndefinedCardResolution::DEFAULT_CARD; if (isset($this->config['options']['delimiter'])) { $this->delimiter = $this->config['options']['delimiter']; } foreach ($this->config['slots'] as $slotName => &$slotData) { $slotData['name'] = $slotName; if (is_string($slotData['reel'])) { $slotData['reel'] = $this->config['reels'][$slotData['reel']]; } if (!isset($slotData['nested'])) { $slotData['nested'] = array(); } $slotData['undefined_card'] = (!isset($slotData['undefined_card'])) ? $this->undefinedCardResolution : static::translateUndefinedCardResolution($slotData['undefined_card']); $this->offsetSet($slotName, function () use ($slotData) { return new Slot($slotData); }); } }
[ "private", "function", "initialize", "(", ")", "{", "$", "this", "->", "undefinedCardResolution", "=", "isset", "(", "$", "this", "->", "config", "[", "'options'", "]", "[", "'undefined_card'", "]", ")", "?", "static", "::", "translateUndefinedCardResolution", ...
Set up the SlotMachine in a ready to use state
[ "Set", "up", "the", "SlotMachine", "in", "a", "ready", "to", "use", "state" ]
9707b9e60d16f4ac214964f5b1db973df623e9c5
https://github.com/archfizz/slotmachine/blob/9707b9e60d16f4ac214964f5b1db973df623e9c5/src/SlotMachine.php#L79-L108
train
archfizz/slotmachine
src/SlotMachine.php
SlotMachine.interpolate
public static function interpolate($card, array $nestedCards = array(), array $delimiter = array('{', '}')) { if (2 > $tokens = count($delimiter)) { throw new \LengthException('Number of delimiter tokens too short. Method requires exactly 2.'); } // SlotMachine can still function with more than two delimiter tokens, // but will generate a warning. if ($tokens > 2) { trigger_error('Too many delimiter tokens given', E_USER_WARNING); } // build a replacement array with braces around the context keys $replace = array(); foreach ($nestedCards as $slot => $nestedCard) { $replace[$delimiter[0] . $slot . $delimiter[1]] = $nestedCard; } // interpolate replacement values into the message and return return strtr($card, $replace); }
php
public static function interpolate($card, array $nestedCards = array(), array $delimiter = array('{', '}')) { if (2 > $tokens = count($delimiter)) { throw new \LengthException('Number of delimiter tokens too short. Method requires exactly 2.'); } // SlotMachine can still function with more than two delimiter tokens, // but will generate a warning. if ($tokens > 2) { trigger_error('Too many delimiter tokens given', E_USER_WARNING); } // build a replacement array with braces around the context keys $replace = array(); foreach ($nestedCards as $slot => $nestedCard) { $replace[$delimiter[0] . $slot . $delimiter[1]] = $nestedCard; } // interpolate replacement values into the message and return return strtr($card, $replace); }
[ "public", "static", "function", "interpolate", "(", "$", "card", ",", "array", "$", "nestedCards", "=", "array", "(", ")", ",", "array", "$", "delimiter", "=", "array", "(", "'{'", ",", "'}'", ")", ")", "{", "if", "(", "2", ">", "$", "tokens", "=",...
Interpolates cards values into the cards nested slot placeholders. Based on the example given in the PSR-3 specification. @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md PSR-3 specification @param string $card @param array $nestedCards @param array $delimiter @throws \LengthException if less than two delimiter tokens are giving. @return string
[ "Interpolates", "cards", "values", "into", "the", "cards", "nested", "slot", "placeholders", ".", "Based", "on", "the", "example", "given", "in", "the", "PSR", "-", "3", "specification", "." ]
9707b9e60d16f4ac214964f5b1db973df623e9c5
https://github.com/archfizz/slotmachine/blob/9707b9e60d16f4ac214964f5b1db973df623e9c5/src/SlotMachine.php#L137-L157
train
archfizz/slotmachine
src/SlotMachine.php
SlotMachine.count
public function count() { $c = 0; // Using Pimple::$values will return the Closures, so instead get the // values in the container via ArrayAccess. foreach ($this->keys() as $valueName) { if ($this[$valueName] instanceof Slot) { ++$c; } } return $c; }
php
public function count() { $c = 0; // Using Pimple::$values will return the Closures, so instead get the // values in the container via ArrayAccess. foreach ($this->keys() as $valueName) { if ($this[$valueName] instanceof Slot) { ++$c; } } return $c; }
[ "public", "function", "count", "(", ")", "{", "$", "c", "=", "0", ";", "// Using Pimple::$values will return the Closures, so instead get the", "// values in the container via ArrayAccess.", "foreach", "(", "$", "this", "->", "keys", "(", ")", "as", "$", "valueName", ...
The number of Slots in the machine @return integer
[ "The", "number", "of", "Slots", "in", "the", "machine" ]
9707b9e60d16f4ac214964f5b1db973df623e9c5
https://github.com/archfizz/slotmachine/blob/9707b9e60d16f4ac214964f5b1db973df623e9c5/src/SlotMachine.php#L257-L268
train
archfizz/slotmachine
src/SlotMachine.php
SlotMachine.all
public function all() { $all = array(); // Pimple::keys() foreach ($this->keys() as $slotName) { $all[$slotName] = $this->get($slotName); } return $all; }
php
public function all() { $all = array(); // Pimple::keys() foreach ($this->keys() as $slotName) { $all[$slotName] = $this->get($slotName); } return $all; }
[ "public", "function", "all", "(", ")", "{", "$", "all", "=", "array", "(", ")", ";", "// Pimple::keys()", "foreach", "(", "$", "this", "->", "keys", "(", ")", "as", "$", "slotName", ")", "{", "$", "all", "[", "$", "slotName", "]", "=", "$", "this...
Return all the slots. @return array
[ "Return", "all", "the", "slots", "." ]
9707b9e60d16f4ac214964f5b1db973df623e9c5
https://github.com/archfizz/slotmachine/blob/9707b9e60d16f4ac214964f5b1db973df623e9c5/src/SlotMachine.php#L275-L285
train
KodiCMS/laravel-assets
src/Traits/Styles.php
Styles.addCss
public function addCss($handle = null, $src = null, $dependency = null, array $attributes = []) { // Set default media attribute if (!isset($attributes['media'])) { $attributes['media'] = 'all'; } return $this->styles[$handle] = new Css($handle, $src, $dependency, $attributes); }
php
public function addCss($handle = null, $src = null, $dependency = null, array $attributes = []) { // Set default media attribute if (!isset($attributes['media'])) { $attributes['media'] = 'all'; } return $this->styles[$handle] = new Css($handle, $src, $dependency, $attributes); }
[ "public", "function", "addCss", "(", "$", "handle", "=", "null", ",", "$", "src", "=", "null", ",", "$", "dependency", "=", "null", ",", "array", "$", "attributes", "=", "[", "]", ")", "{", "// Set default media attribute", "if", "(", "!", "isset", "("...
CSS wrapper. Gets or sets CSS assets @param string $handle Asset name. @param string $src Asset source @param array|string $dependency Dependencies @param array $attributes Attributes for the <link /> element @return AssetElementInterface Setting returns asset array, getting returns asset HTML
[ "CSS", "wrapper", "." ]
734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0
https://github.com/KodiCMS/laravel-assets/blob/734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0/src/Traits/Styles.php#L27-L35
train
KodiCMS/laravel-assets
src/Traits/Styles.php
Styles.removeCss
public function removeCss($handle = null) { if (is_null($handle)) { return $this->styles = []; } unset($this->styles[$handle]); }
php
public function removeCss($handle = null) { if (is_null($handle)) { return $this->styles = []; } unset($this->styles[$handle]); }
[ "public", "function", "removeCss", "(", "$", "handle", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "handle", ")", ")", "{", "return", "$", "this", "->", "styles", "=", "[", "]", ";", "}", "unset", "(", "$", "this", "->", "styles", "[",...
Remove a CSS asset, or all. @param string|null $handle Asset name, or `NULL` to remove all @return mixed Empty array or void
[ "Remove", "a", "CSS", "asset", "or", "all", "." ]
734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0
https://github.com/KodiCMS/laravel-assets/blob/734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0/src/Traits/Styles.php#L68-L75
train
KodiCMS/laravel-assets
src/Traits/Styles.php
Styles.renderStyles
public function renderStyles() { $this->loadPackageCss(); if (empty($this->styles)) { return PHP_EOL; } $assets = []; foreach ($this->sort($this->styles) as $handle => $data) { $assets[] = $this->getCss($handle); } return implode(PHP_EOL, $assets); }
php
public function renderStyles() { $this->loadPackageCss(); if (empty($this->styles)) { return PHP_EOL; } $assets = []; foreach ($this->sort($this->styles) as $handle => $data) { $assets[] = $this->getCss($handle); } return implode(PHP_EOL, $assets); }
[ "public", "function", "renderStyles", "(", ")", "{", "$", "this", "->", "loadPackageCss", "(", ")", ";", "if", "(", "empty", "(", "$", "this", "->", "styles", ")", ")", "{", "return", "PHP_EOL", ";", "}", "$", "assets", "=", "[", "]", ";", "foreach...
Get all CSS assets, sorted by dependencies. @return string Asset HTML
[ "Get", "all", "CSS", "assets", "sorted", "by", "dependencies", "." ]
734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0
https://github.com/KodiCMS/laravel-assets/blob/734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0/src/Traits/Styles.php#L94-L109
train
BluesparkLabs/spark
src/Robo/Plugin/Commands/ContainerCommands.php
ContainerCommands.containersStart
public function containersStart($container = NULL) { $this->validateConfig(); $this->title('Starting containers'); $command = $this->taskDockerComposeUp(); if ($container) { $this->limitComposeContainer($command, $container); } $command->file($this->dockerComposeFile) ->projectName($this->config->get('name')) ->detachedMode() ->run(); }
php
public function containersStart($container = NULL) { $this->validateConfig(); $this->title('Starting containers'); $command = $this->taskDockerComposeUp(); if ($container) { $this->limitComposeContainer($command, $container); } $command->file($this->dockerComposeFile) ->projectName($this->config->get('name')) ->detachedMode() ->run(); }
[ "public", "function", "containersStart", "(", "$", "container", "=", "NULL", ")", "{", "$", "this", "->", "validateConfig", "(", ")", ";", "$", "this", "->", "title", "(", "'Starting containers'", ")", ";", "$", "command", "=", "$", "this", "->", "taskDo...
Compose all the docker containers. @param string $container Container name, when not provided all containers are started.
[ "Compose", "all", "the", "docker", "containers", "." ]
c7beb4d47ba808c1ee0c40820e1b4c0e772f576e
https://github.com/BluesparkLabs/spark/blob/c7beb4d47ba808c1ee0c40820e1b4c0e772f576e/src/Robo/Plugin/Commands/ContainerCommands.php#L22-L35
train
BluesparkLabs/spark
src/Robo/Plugin/Commands/ContainerCommands.php
ContainerCommands.containersDestroy
public function containersDestroy() { $this->validateConfig(); $this->title('Destroying containers'); $this->taskDockerComposeDown() ->file($this->dockerComposeFile) ->projectName($this->config->get('name')) ->removeOrphans() ->rmi('all') ->run(); }
php
public function containersDestroy() { $this->validateConfig(); $this->title('Destroying containers'); $this->taskDockerComposeDown() ->file($this->dockerComposeFile) ->projectName($this->config->get('name')) ->removeOrphans() ->rmi('all') ->run(); }
[ "public", "function", "containersDestroy", "(", ")", "{", "$", "this", "->", "validateConfig", "(", ")", ";", "$", "this", "->", "title", "(", "'Destroying containers'", ")", ";", "$", "this", "->", "taskDockerComposeDown", "(", ")", "->", "file", "(", "$"...
Destroy docker containers.
[ "Destroy", "docker", "containers", "." ]
c7beb4d47ba808c1ee0c40820e1b4c0e772f576e
https://github.com/BluesparkLabs/spark/blob/c7beb4d47ba808c1ee0c40820e1b4c0e772f576e/src/Robo/Plugin/Commands/ContainerCommands.php#L40-L49
train
BluesparkLabs/spark
src/Robo/Plugin/Commands/ContainerCommands.php
ContainerCommands.containersExec
public function containersExec($container, $execute_command) { $this->validateConfig(); $this->title('Executing in container: ' . $container, FALSE); $this->taskDockerComposeExecute() ->file($this->dockerComposeFile) ->projectName($this->config->get('name')) ->disablePseudoTty() ->setContainer(' ' . $container) ->exec($execute_command) ->run(); }
php
public function containersExec($container, $execute_command) { $this->validateConfig(); $this->title('Executing in container: ' . $container, FALSE); $this->taskDockerComposeExecute() ->file($this->dockerComposeFile) ->projectName($this->config->get('name')) ->disablePseudoTty() ->setContainer(' ' . $container) ->exec($execute_command) ->run(); }
[ "public", "function", "containersExec", "(", "$", "container", ",", "$", "execute_command", ")", "{", "$", "this", "->", "validateConfig", "(", ")", ";", "$", "this", "->", "title", "(", "'Executing in container: '", ".", "$", "container", ",", "FALSE", ")",...
Execute a command on a given container. @param string $container Container name. @param string $execute_command Command to execute.
[ "Execute", "a", "command", "on", "a", "given", "container", "." ]
c7beb4d47ba808c1ee0c40820e1b4c0e772f576e
https://github.com/BluesparkLabs/spark/blob/c7beb4d47ba808c1ee0c40820e1b4c0e772f576e/src/Robo/Plugin/Commands/ContainerCommands.php#L59-L69
train
BluesparkLabs/spark
src/Robo/Plugin/Commands/ContainerCommands.php
ContainerCommands.containersActive
public function containersActive() { $ps = $this->taskDockerComposePs() ->file($this->dockerComposeFile) ->projectName($this->config->get('name')) ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_DEBUG) ->printOutput(FALSE) ->run() ->getMessage(); $this->say("$ps"); }
php
public function containersActive() { $ps = $this->taskDockerComposePs() ->file($this->dockerComposeFile) ->projectName($this->config->get('name')) ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_DEBUG) ->printOutput(FALSE) ->run() ->getMessage(); $this->say("$ps"); }
[ "public", "function", "containersActive", "(", ")", "{", "$", "ps", "=", "$", "this", "->", "taskDockerComposePs", "(", ")", "->", "file", "(", "$", "this", "->", "dockerComposeFile", ")", "->", "projectName", "(", "$", "this", "->", "config", "->", "get...
Lists the currently active containers.
[ "Lists", "the", "currently", "active", "containers", "." ]
c7beb4d47ba808c1ee0c40820e1b4c0e772f576e
https://github.com/BluesparkLabs/spark/blob/c7beb4d47ba808c1ee0c40820e1b4c0e772f576e/src/Robo/Plugin/Commands/ContainerCommands.php#L74-L83
train
inphinit/framework
src/Inphinit/Cache.php
Cache.allowHeaders
protected static function allowHeaders() { if (self::$needHeaders !== null) { return self::$needHeaders; } return self::$needHeaders = Request::is('GET') || Request::is('HEAD'); }
php
protected static function allowHeaders() { if (self::$needHeaders !== null) { return self::$needHeaders; } return self::$needHeaders = Request::is('GET') || Request::is('HEAD'); }
[ "protected", "static", "function", "allowHeaders", "(", ")", "{", "if", "(", "self", "::", "$", "needHeaders", "!==", "null", ")", "{", "return", "self", "::", "$", "needHeaders", ";", "}", "return", "self", "::", "$", "needHeaders", "=", "Request", "::"...
Check if is HEAD or GET, you can overwrite this method @return bool
[ "Check", "if", "is", "HEAD", "or", "GET", "you", "can", "overwrite", "this", "method" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Inphinit/Cache.php#L108-L115
train
inphinit/framework
src/Inphinit/Cache.php
Cache.match
public static function match($modified, $etag = null) { $modifiedsince = Request::header('If-Modified-Since'); if ($modifiedsince && preg_match('#^[a-z]{3}[,] \d{2} [a-z]{3} \d{4} \d{2}[:]\d{2}[:]\d{2} GMT$#i', $modifiedsince) !== 0 && strtotime($modifiedsince) == $modified) { return true; } $nonematch = Request::header('If-None-Match'); return $nonematch && trim($nonematch) === $etag; }
php
public static function match($modified, $etag = null) { $modifiedsince = Request::header('If-Modified-Since'); if ($modifiedsince && preg_match('#^[a-z]{3}[,] \d{2} [a-z]{3} \d{4} \d{2}[:]\d{2}[:]\d{2} GMT$#i', $modifiedsince) !== 0 && strtotime($modifiedsince) == $modified) { return true; } $nonematch = Request::header('If-None-Match'); return $nonematch && trim($nonematch) === $etag; }
[ "public", "static", "function", "match", "(", "$", "modified", ",", "$", "etag", "=", "null", ")", "{", "$", "modifiedsince", "=", "Request", "::", "header", "(", "'If-Modified-Since'", ")", ";", "if", "(", "$", "modifiedsince", "&&", "preg_match", "(", ...
Check `HTTP_IF_MODIFIED_SINCE` and `HTTP_IF_NONE_MATCH` from server If true you can send `304 Not Modified` @param string $modified @param string $etag @return bool
[ "Check", "HTTP_IF_MODIFIED_SINCE", "and", "HTTP_IF_NONE_MATCH", "from", "server", "If", "true", "you", "can", "send", "304", "Not", "Modified" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Inphinit/Cache.php#L173-L186
train
brick/std
src/Json/JsonDecoder.php
JsonDecoder.decode
public function decode(string $json) { // max depth is 0+ for json_encode(), and 1+ for json_decode() $result = json_decode($json, $this->decodeObjectAsArray, $this->maxDepth + 1, $this->options); $this->checkLastError(); return $result; }
php
public function decode(string $json) { // max depth is 0+ for json_encode(), and 1+ for json_decode() $result = json_decode($json, $this->decodeObjectAsArray, $this->maxDepth + 1, $this->options); $this->checkLastError(); return $result; }
[ "public", "function", "decode", "(", "string", "$", "json", ")", "{", "// max depth is 0+ for json_encode(), and 1+ for json_decode()", "$", "result", "=", "json_decode", "(", "$", "json", ",", "$", "this", "->", "decodeObjectAsArray", ",", "$", "this", "->", "max...
Decodes data in JSON format. @param string $json The JSON string to decode. @return mixed The decoded data. @throws JsonException If the data cannot be decoded.
[ "Decodes", "data", "in", "JSON", "format", "." ]
d19162fcefcce457eeaa27904c797f76f9f49007
https://github.com/brick/std/blob/d19162fcefcce457eeaa27904c797f76f9f49007/src/Json/JsonDecoder.php#L28-L36
train
Calendart/CalendArt
src/UserPermission.php
UserPermission.grant
public function grant($flag) { if (is_string($flag) && defined('static::' . strtoupper($flag))) { $flag = constant('static::' . strtoupper($flag)); } $this->mask |= $flag; return $this; }
php
public function grant($flag) { if (is_string($flag) && defined('static::' . strtoupper($flag))) { $flag = constant('static::' . strtoupper($flag)); } $this->mask |= $flag; return $this; }
[ "public", "function", "grant", "(", "$", "flag", ")", "{", "if", "(", "is_string", "(", "$", "flag", ")", "&&", "defined", "(", "'static::'", ".", "strtoupper", "(", "$", "flag", ")", ")", ")", "{", "$", "flag", "=", "constant", "(", "'static::'", ...
Grant a permission on this calendar @param integer $flag Flag to activate @return $this
[ "Grant", "a", "permission", "on", "this", "calendar" ]
46a6642c49b1dee345f6bbe86a6318d73615e954
https://github.com/Calendart/CalendArt/blob/46a6642c49b1dee345f6bbe86a6318d73615e954/src/UserPermission.php#L68-L77
train
Calendart/CalendArt
src/UserPermission.php
UserPermission.revoke
public function revoke($flag) { if (is_string($flag) && defined('static::' . strtoupper($flag))) { $flag = constant('static::' . strtoupper($flag)); } $this->mask &= ~$flag; return $this; }
php
public function revoke($flag) { if (is_string($flag) && defined('static::' . strtoupper($flag))) { $flag = constant('static::' . strtoupper($flag)); } $this->mask &= ~$flag; return $this; }
[ "public", "function", "revoke", "(", "$", "flag", ")", "{", "if", "(", "is_string", "(", "$", "flag", ")", "&&", "defined", "(", "'static::'", ".", "strtoupper", "(", "$", "flag", ")", ")", ")", "{", "$", "flag", "=", "constant", "(", "'static::'", ...
Revoke a permission on this calendar @param integer $flag Flag to deactivate @return $this
[ "Revoke", "a", "permission", "on", "this", "calendar" ]
46a6642c49b1dee345f6bbe86a6318d73615e954
https://github.com/Calendart/CalendArt/blob/46a6642c49b1dee345f6bbe86a6318d73615e954/src/UserPermission.php#L86-L95
train
KodiCMS/laravel-assets
src/Assets.php
Assets.sort
protected function sort($assets) { $original = $assets; $sorted = []; while (count($assets) > 0) { foreach ($assets as $handle => $asset) { // No dependencies anymore, add it to sorted if (!$asset->hasDependency()) { $sorted[$handle] = $asset; unset($assets[$handle]); } else { foreach ($asset->getDependency() as $dep) { // Remove dependency if doesn't exist, if its dependent on itself, // or if the dependent is dependent on it if (!isset($original[$dep]) or $dep === $handle or (isset($assets[$dep]) and $assets[$dep]->hasDependency($handle))) { $assets[$handle]->removeDependency($dep); continue; } // This dependency hasn't been sorted yet if (!isset($sorted[$dep])) { continue; } // This dependency is taken care of, remove from list $assets[$handle]->removeDependency($dep); } } } } return $sorted; }
php
protected function sort($assets) { $original = $assets; $sorted = []; while (count($assets) > 0) { foreach ($assets as $handle => $asset) { // No dependencies anymore, add it to sorted if (!$asset->hasDependency()) { $sorted[$handle] = $asset; unset($assets[$handle]); } else { foreach ($asset->getDependency() as $dep) { // Remove dependency if doesn't exist, if its dependent on itself, // or if the dependent is dependent on it if (!isset($original[$dep]) or $dep === $handle or (isset($assets[$dep]) and $assets[$dep]->hasDependency($handle))) { $assets[$handle]->removeDependency($dep); continue; } // This dependency hasn't been sorted yet if (!isset($sorted[$dep])) { continue; } // This dependency is taken care of, remove from list $assets[$handle]->removeDependency($dep); } } } } return $sorted; }
[ "protected", "function", "sort", "(", "$", "assets", ")", "{", "$", "original", "=", "$", "assets", ";", "$", "sorted", "=", "[", "]", ";", "while", "(", "count", "(", "$", "assets", ")", ">", "0", ")", "{", "foreach", "(", "$", "assets", "as", ...
Sorts assets based on dependencies. @param AssetElementInterface[] $assets Array of assets @return AssetElementInterface[] Sorted array of assets
[ "Sorts", "assets", "based", "on", "dependencies", "." ]
734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0
https://github.com/KodiCMS/laravel-assets/blob/734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0/src/Assets.php#L69-L102
train
civicrm/civicrm-cxn-rpc
src/CA.php
CA.createAppCSR
public static function createAppCSR($keyPair, $dn) { $privKey = new \Crypt_RSA(); $privKey->loadKey($keyPair['privatekey']); $pubKey = new \Crypt_RSA(); $pubKey->loadKey($keyPair['publickey']); $pubKey->setPublicKey(); $x509 = new \File_X509(); $x509->setPrivateKey($privKey); $x509->setDN($dn); $x509->loadCSR($x509->saveCSR($x509->signCSR(Constants::CERT_SIGNATURE_ALGORITHM))); $x509->setExtension('id-ce-keyUsage', array('keyEncipherment')); $csrData = $x509->signCSR(Constants::CERT_SIGNATURE_ALGORITHM); return $x509->saveCSR($csrData); }
php
public static function createAppCSR($keyPair, $dn) { $privKey = new \Crypt_RSA(); $privKey->loadKey($keyPair['privatekey']); $pubKey = new \Crypt_RSA(); $pubKey->loadKey($keyPair['publickey']); $pubKey->setPublicKey(); $x509 = new \File_X509(); $x509->setPrivateKey($privKey); $x509->setDN($dn); $x509->loadCSR($x509->saveCSR($x509->signCSR(Constants::CERT_SIGNATURE_ALGORITHM))); $x509->setExtension('id-ce-keyUsage', array('keyEncipherment')); $csrData = $x509->signCSR(Constants::CERT_SIGNATURE_ALGORITHM); return $x509->saveCSR($csrData); }
[ "public", "static", "function", "createAppCSR", "(", "$", "keyPair", ",", "$", "dn", ")", "{", "$", "privKey", "=", "new", "\\", "Crypt_RSA", "(", ")", ";", "$", "privKey", "->", "loadKey", "(", "$", "keyPair", "[", "'privatekey'", "]", ")", ";", "$"...
Create a CSR for a CiviConnect application. @param array $keyPair Array with elements: - privatekey: string. - publickey: string. @param string $dn Distinguished name. @return string CSR data.
[ "Create", "a", "CSR", "for", "a", "CiviConnect", "application", "." ]
5a142bc4d24b7f8c830f59768b405ec74d582f22
https://github.com/civicrm/civicrm-cxn-rpc/blob/5a142bc4d24b7f8c830f59768b405ec74d582f22/src/CA.php#L87-L104
train
civicrm/civicrm-cxn-rpc
src/CA.php
CA.createCrlDistCSR
public static function createCrlDistCSR($keyPair, $dn) { $privKey = new \Crypt_RSA(); $privKey->loadKey($keyPair['privatekey']); $pubKey = new \Crypt_RSA(); $pubKey->loadKey($keyPair['publickey']); $pubKey->setPublicKey(); $csr = new \File_X509(); $csr->setPrivateKey($privKey); $csr->setPublicKey($pubKey); $csr->setDN($dn); $csr->loadCSR($csr->saveCSR($csr->signCSR(Constants::CERT_SIGNATURE_ALGORITHM))); $csr->setExtension('id-ce-keyUsage', array('cRLSign')); $csrData = $csr->signCSR(Constants::CERT_SIGNATURE_ALGORITHM); return $csr->saveCSR($csrData); }
php
public static function createCrlDistCSR($keyPair, $dn) { $privKey = new \Crypt_RSA(); $privKey->loadKey($keyPair['privatekey']); $pubKey = new \Crypt_RSA(); $pubKey->loadKey($keyPair['publickey']); $pubKey->setPublicKey(); $csr = new \File_X509(); $csr->setPrivateKey($privKey); $csr->setPublicKey($pubKey); $csr->setDN($dn); $csr->loadCSR($csr->saveCSR($csr->signCSR(Constants::CERT_SIGNATURE_ALGORITHM))); $csr->setExtension('id-ce-keyUsage', array('cRLSign')); $csrData = $csr->signCSR(Constants::CERT_SIGNATURE_ALGORITHM); return $csr->saveCSR($csrData); }
[ "public", "static", "function", "createCrlDistCSR", "(", "$", "keyPair", ",", "$", "dn", ")", "{", "$", "privKey", "=", "new", "\\", "Crypt_RSA", "(", ")", ";", "$", "privKey", "->", "loadKey", "(", "$", "keyPair", "[", "'privatekey'", "]", ")", ";", ...
Create a CSR for an authority that can issue CRLs. @param array $keyPair @param string $dn @return string PEM-encoded CSR.
[ "Create", "a", "CSR", "for", "an", "authority", "that", "can", "issue", "CRLs", "." ]
5a142bc4d24b7f8c830f59768b405ec74d582f22
https://github.com/civicrm/civicrm-cxn-rpc/blob/5a142bc4d24b7f8c830f59768b405ec74d582f22/src/CA.php#L146-L163
train
cafe-latte/framework
src/Helpers/Util.php
Util.localDelete
public static function localDelete(string $path, string $fileName) : bool { if (is_file($path . $fileName)) { unlink($path . $fileName); } else { return false; } return true; }
php
public static function localDelete(string $path, string $fileName) : bool { if (is_file($path . $fileName)) { unlink($path . $fileName); } else { return false; } return true; }
[ "public", "static", "function", "localDelete", "(", "string", "$", "path", ",", "string", "$", "fileName", ")", ":", "bool", "{", "if", "(", "is_file", "(", "$", "path", ".", "$", "fileName", ")", ")", "{", "unlink", "(", "$", "path", ".", "$", "fi...
delete local file and return bool type @param string $path file's full path @param string $fileName file's full name @return bool
[ "delete", "local", "file", "and", "return", "bool", "type" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Helpers/Util.php#L38-L46
train
cafe-latte/framework
src/Helpers/Util.php
Util.getUUID
public static function getUUID() : string { mt_srand((double) microtime() * 10000); $charId = strtolower(md5(uniqid(rand(), true))); $hyphen = chr(45); return substr($charId, 0, 8) . $hyphen . substr($charId, 8, 4) . $hyphen . substr($charId, 12, 4) . $hyphen . substr($charId, 16, 4) . $hyphen . substr($charId, 20, 12); }
php
public static function getUUID() : string { mt_srand((double) microtime() * 10000); $charId = strtolower(md5(uniqid(rand(), true))); $hyphen = chr(45); return substr($charId, 0, 8) . $hyphen . substr($charId, 8, 4) . $hyphen . substr($charId, 12, 4) . $hyphen . substr($charId, 16, 4) . $hyphen . substr($charId, 20, 12); }
[ "public", "static", "function", "getUUID", "(", ")", ":", "string", "{", "mt_srand", "(", "(", "double", ")", "microtime", "(", ")", "*", "10000", ")", ";", "$", "charId", "=", "strtolower", "(", "md5", "(", "uniqid", "(", "rand", "(", ")", ",", "t...
create uuid and return it @return string
[ "create", "uuid", "and", "return", "it" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Helpers/Util.php#L53-L59
train
cafe-latte/framework
src/Helpers/Util.php
Util.getRandomString
public static function getRandomString(int $length = 64) : string { $characters = "01234567890123456789"; $characters .= "abcdefghijklmnopqrstuvwxyz"; $string_generated = ""; while ($length--) { $string_generated .= $characters[mt_rand(0, 45)]; } return $string_generated; }
php
public static function getRandomString(int $length = 64) : string { $characters = "01234567890123456789"; $characters .= "abcdefghijklmnopqrstuvwxyz"; $string_generated = ""; while ($length--) { $string_generated .= $characters[mt_rand(0, 45)]; } return $string_generated; }
[ "public", "static", "function", "getRandomString", "(", "int", "$", "length", "=", "64", ")", ":", "string", "{", "$", "characters", "=", "\"01234567890123456789\"", ";", "$", "characters", ".=", "\"abcdefghijklmnopqrstuvwxyz\"", ";", "$", "string_generated", "=",...
create random string and return it @param int $length @return string
[ "create", "random", "string", "and", "return", "it" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Helpers/Util.php#L68-L80
train
cafe-latte/framework
src/Helpers/Parser.php
Parser.arrayToXml
public static function arrayToXml($arr, $num_prefix = "num_") : string { if (!is_array($arr)) return $arr; $result = ''; foreach ($arr as $key => $val) { $key = (is_numeric($key) ? $num_prefix . $key : $key); $result .= '<' . $key . '>' . self::arrayToXml($val, $num_prefix) . '</' . $key . '>'; } return $result; }
php
public static function arrayToXml($arr, $num_prefix = "num_") : string { if (!is_array($arr)) return $arr; $result = ''; foreach ($arr as $key => $val) { $key = (is_numeric($key) ? $num_prefix . $key : $key); $result .= '<' . $key . '>' . self::arrayToXml($val, $num_prefix) . '</' . $key . '>'; } return $result; }
[ "public", "static", "function", "arrayToXml", "(", "$", "arr", ",", "$", "num_prefix", "=", "\"num_\"", ")", ":", "string", "{", "if", "(", "!", "is_array", "(", "$", "arr", ")", ")", "return", "$", "arr", ";", "$", "result", "=", "''", ";", "forea...
convert data from array to xml @param $arr @param string $num_prefix @return string
[ "convert", "data", "from", "array", "to", "xml" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Helpers/Parser.php#L63-L73
train
bluestatedigital/bsd-api-php
src/Blue/Tools/Api/Client.php
Client.get
public function get($apiPath, $queryParams = []) { $response = $this->guzzleClient->get( $this->baseUrl . $apiPath, [ 'query' => $queryParams, 'future' => false, 'auth' => [ $this->id, $this->secret, self::$AUTH_TYPE ], ] ); return $this->resolve($response); }
php
public function get($apiPath, $queryParams = []) { $response = $this->guzzleClient->get( $this->baseUrl . $apiPath, [ 'query' => $queryParams, 'future' => false, 'auth' => [ $this->id, $this->secret, self::$AUTH_TYPE ], ] ); return $this->resolve($response); }
[ "public", "function", "get", "(", "$", "apiPath", ",", "$", "queryParams", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "guzzleClient", "->", "get", "(", "$", "this", "->", "baseUrl", ".", "$", "apiPath", ",", "[", "'query'", "...
Execute a GET request against the API @param string $apiPath @param array $queryParams @return ResponseInterface
[ "Execute", "a", "GET", "request", "against", "the", "API" ]
d0e7a80443a9738c8b8756b5c4319a9eb00cdac2
https://github.com/bluestatedigital/bsd-api-php/blob/d0e7a80443a9738c8b8756b5c4319a9eb00cdac2/src/Blue/Tools/Api/Client.php#L97-L113
train
KodiCMS/laravel-assets
src/AssetsServiceProvider.php
AssetsServiceProvider.compiles
public static function compiles() { return [ base_path('vendor\kodicms\laravel-assets\src\Contracts\MetaInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\AssetsInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\PackageManagerInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\AssetElementInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\PackageInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\SocialMediaTagsInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Groups.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Vars.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Packages.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Styles.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Scripts.php'), base_path('vendor\kodicms\laravel-assets\src\AssetElement.php'), base_path('vendor\kodicms\laravel-assets\src\Css.php'), base_path('vendor\kodicms\laravel-assets\src\Javascript.php'), base_path('vendor\kodicms\laravel-assets\src\Html.php'), base_path('vendor\kodicms\laravel-assets\src\Meta.php'), base_path('vendor\kodicms\laravel-assets\src\Package.php'), base_path('vendor\kodicms\laravel-assets\src\PackageManager.php'), base_path('vendor\kodicms\laravel-assets\src\Assets.php'), base_path('vendor\kodicms\laravel-assets\src\Facades\Meta.php'), ]; }
php
public static function compiles() { return [ base_path('vendor\kodicms\laravel-assets\src\Contracts\MetaInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\AssetsInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\PackageManagerInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\AssetElementInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\PackageInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\SocialMediaTagsInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Groups.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Vars.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Packages.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Styles.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Scripts.php'), base_path('vendor\kodicms\laravel-assets\src\AssetElement.php'), base_path('vendor\kodicms\laravel-assets\src\Css.php'), base_path('vendor\kodicms\laravel-assets\src\Javascript.php'), base_path('vendor\kodicms\laravel-assets\src\Html.php'), base_path('vendor\kodicms\laravel-assets\src\Meta.php'), base_path('vendor\kodicms\laravel-assets\src\Package.php'), base_path('vendor\kodicms\laravel-assets\src\PackageManager.php'), base_path('vendor\kodicms\laravel-assets\src\Assets.php'), base_path('vendor\kodicms\laravel-assets\src\Facades\Meta.php'), ]; }
[ "public", "static", "function", "compiles", "(", ")", "{", "return", "[", "base_path", "(", "'vendor\\kodicms\\laravel-assets\\src\\Contracts\\MetaInterface.php'", ")", ",", "base_path", "(", "'vendor\\kodicms\\laravel-assets\\src\\Contracts\\AssetsInterface.php'", ")", ",", "b...
Get a list of files that should be compiled for the package. @return array
[ "Get", "a", "list", "of", "files", "that", "should", "be", "compiled", "for", "the", "package", "." ]
734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0
https://github.com/KodiCMS/laravel-assets/blob/734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0/src/AssetsServiceProvider.php#L51-L75
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setSecurityLevel
public function setSecurityLevel($rawData) { switch ($this->securityLevel) { case "low": break; case "normal": $rawData = \str_replace("<", "&lt;", $rawData); $rawData = \str_replace(">", "&gt;", $rawData); $rawData = \str_replace("\"", "&quot;", $rawData); $rawData = \str_replace("'", "&apos;", $rawData); break; case "high": $rawData = \str_replace("<", "", $rawData); $rawData = \str_replace(">", "", $rawData); $rawData = \str_replace("\"", "", $rawData); $rawData = \str_replace("'", "", $rawData); break; } return $rawData; }
php
public function setSecurityLevel($rawData) { switch ($this->securityLevel) { case "low": break; case "normal": $rawData = \str_replace("<", "&lt;", $rawData); $rawData = \str_replace(">", "&gt;", $rawData); $rawData = \str_replace("\"", "&quot;", $rawData); $rawData = \str_replace("'", "&apos;", $rawData); break; case "high": $rawData = \str_replace("<", "", $rawData); $rawData = \str_replace(">", "", $rawData); $rawData = \str_replace("\"", "", $rawData); $rawData = \str_replace("'", "", $rawData); break; } return $rawData; }
[ "public", "function", "setSecurityLevel", "(", "$", "rawData", ")", "{", "switch", "(", "$", "this", "->", "securityLevel", ")", "{", "case", "\"low\"", ":", "break", ";", "case", "\"normal\"", ":", "$", "rawData", "=", "\\", "str_replace", "(", "\"<\"", ...
to make more security @param $rawData @return mixed
[ "to", "make", "more", "security" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L221-L241
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setGet
private function setGet() { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ GET Params ]" . $k . ": " . $v, []); $this->get->$k = $this->setSecurityLevel($v); $this->parameters["get"][$k] = $this->setSecurityLevel($v); } unset($_GET); } }
php
private function setGet() { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ GET Params ]" . $k . ": " . $v, []); $this->get->$k = $this->setSecurityLevel($v); $this->parameters["get"][$k] = $this->setSecurityLevel($v); } unset($_GET); } }
[ "private", "function", "setGet", "(", ")", "{", "if", "(", "isset", "(", "$", "_GET", ")", ")", "{", "foreach", "(", "$", "_GET", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "this", "->", "log", "->", "debug", "(", "\"[ GET Params ]\"", ".", ...
GET Method and Parameter Information and assign via for framework
[ "GET", "Method", "and", "Parameter", "Information", "and", "assign", "via", "for", "framework" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L247-L257
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setConfig
private function setConfig($config) { $this->securityLevel = $config->config['project']['security_level']; if ($config->config['config']) { foreach ($config->config['config'] as $k => $v) { $this->log->debug("[ CONFIG Params ]" . $k . ": " . $v, []); $this->config->$k = $this->setSecurityLevel($v); $this->parameters["config"][$k] = $this->setSecurityLevel($v); } } }
php
private function setConfig($config) { $this->securityLevel = $config->config['project']['security_level']; if ($config->config['config']) { foreach ($config->config['config'] as $k => $v) { $this->log->debug("[ CONFIG Params ]" . $k . ": " . $v, []); $this->config->$k = $this->setSecurityLevel($v); $this->parameters["config"][$k] = $this->setSecurityLevel($v); } } }
[ "private", "function", "setConfig", "(", "$", "config", ")", "{", "$", "this", "->", "securityLevel", "=", "$", "config", "->", "config", "[", "'project'", "]", "[", "'security_level'", "]", ";", "if", "(", "$", "config", "->", "config", "[", "'config'",...
Add Option Data @param $config
[ "Add", "Option", "Data" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L265-L276
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setPost
private function setPost() { if ($this->parameters['header']["Content-Type"] == "application/x-www-form-urlencoded") { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ _POST Params ]" . $k . ": " . $v, []); $this->post->$k = $this->setSecurityLevel($v); $this->parameters["post"][$k] = $this->setSecurityLevel($v); } unset($_GET); } } if (isset($_POST)) { foreach ($_POST as $k => $v) { if (is_array($v) == true) { $this->log->debug("[ _POST Params ]" . $k . ": " . json_encode($v), []); } else { $this->log->debug("[ _POST Params ]" . $k . ": " . $v, []); } $this->post->$k = $this->setSecurityLevel($v); $this->parameters["post"][$k] = $this->setSecurityLevel($v); } $rawData = file_get_contents("php://input"); if (isset($rawData)) { $this->log->debug("[ POST RawData ] : " . $rawData, []); $this->parameters["post"]["raw"] = $rawData; $this->post->raw = $rawData; } unset($_POST); } }
php
private function setPost() { if ($this->parameters['header']["Content-Type"] == "application/x-www-form-urlencoded") { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ _POST Params ]" . $k . ": " . $v, []); $this->post->$k = $this->setSecurityLevel($v); $this->parameters["post"][$k] = $this->setSecurityLevel($v); } unset($_GET); } } if (isset($_POST)) { foreach ($_POST as $k => $v) { if (is_array($v) == true) { $this->log->debug("[ _POST Params ]" . $k . ": " . json_encode($v), []); } else { $this->log->debug("[ _POST Params ]" . $k . ": " . $v, []); } $this->post->$k = $this->setSecurityLevel($v); $this->parameters["post"][$k] = $this->setSecurityLevel($v); } $rawData = file_get_contents("php://input"); if (isset($rawData)) { $this->log->debug("[ POST RawData ] : " . $rawData, []); $this->parameters["post"]["raw"] = $rawData; $this->post->raw = $rawData; } unset($_POST); } }
[ "private", "function", "setPost", "(", ")", "{", "if", "(", "$", "this", "->", "parameters", "[", "'header'", "]", "[", "\"Content-Type\"", "]", "==", "\"application/x-www-form-urlencoded\"", ")", "{", "if", "(", "isset", "(", "$", "_GET", ")", ")", "{", ...
POST Method and Parameter Information and assign via for framework
[ "POST", "Method", "and", "Parameter", "Information", "and", "assign", "via", "for", "framework" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L281-L315
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setPut
private function setPut() { if ($this->parameters['header']["Content-Type"] == "application/x-www-form-urlencoded") { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ PUT Params ]" . $k . ": " . $v, []); $this->put->$k = $this->setSecurityLevel($v); $this->parameters["put"][$k] = $this->setSecurityLevel($v); } unset($_GET); } $rawData = file_get_contents("php://input"); parse_str($rawData, $_PUT); foreach ($_PUT as $k => $v) { $this->log->debug("[ PUT Params ]" . $k . ": " . $v, []); $this->put->$k = $this->setSecurityLevel($v); $this->parameters["put"][$k] = $this->setSecurityLevel($v); } if ($rawData) { $this->parameters["put"]['raw'] = $rawData; $this->log->debug("[ PUT RawData ] raw: " . $rawData, []); } } }
php
private function setPut() { if ($this->parameters['header']["Content-Type"] == "application/x-www-form-urlencoded") { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ PUT Params ]" . $k . ": " . $v, []); $this->put->$k = $this->setSecurityLevel($v); $this->parameters["put"][$k] = $this->setSecurityLevel($v); } unset($_GET); } $rawData = file_get_contents("php://input"); parse_str($rawData, $_PUT); foreach ($_PUT as $k => $v) { $this->log->debug("[ PUT Params ]" . $k . ": " . $v, []); $this->put->$k = $this->setSecurityLevel($v); $this->parameters["put"][$k] = $this->setSecurityLevel($v); } if ($rawData) { $this->parameters["put"]['raw'] = $rawData; $this->log->debug("[ PUT RawData ] raw: " . $rawData, []); } } }
[ "private", "function", "setPut", "(", ")", "{", "if", "(", "$", "this", "->", "parameters", "[", "'header'", "]", "[", "\"Content-Type\"", "]", "==", "\"application/x-www-form-urlencoded\"", ")", "{", "if", "(", "isset", "(", "$", "_GET", ")", ")", "{", ...
PUT Method and Parameter Information and assign via for framework
[ "PUT", "Method", "and", "Parameter", "Information", "and", "assign", "via", "for", "framework" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L320-L344
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setDelete
private function setDelete() { if ($this->parameters['header']["Content-Type"] == "application/x-www-form-urlencoded") { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ DELETE Params ]" . $k . ": " . $v, []); $this->delete->$k = $this->setSecurityLevel($v); $this->parameters["delete"][$k] = $this->setSecurityLevel($v); } unset($_GET); } $rawData = file_get_contents("php://input"); parse_str($rawData, $_DELETE); foreach ($_DELETE as $k => $v) { $this->log->debug("[ DELETE Params ]" . $k . ": " . $v, []); $this->delete->$k = $this->setSecurityLevel($v); $this->parameters["delete"][$k] = $this->setSecurityLevel($v); } if ($rawData) { $this->parameters["delete"]['raw'] = $rawData; $this->log->debug("[ DELETE RawData ] raw: " . $rawData, []); } } }
php
private function setDelete() { if ($this->parameters['header']["Content-Type"] == "application/x-www-form-urlencoded") { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ DELETE Params ]" . $k . ": " . $v, []); $this->delete->$k = $this->setSecurityLevel($v); $this->parameters["delete"][$k] = $this->setSecurityLevel($v); } unset($_GET); } $rawData = file_get_contents("php://input"); parse_str($rawData, $_DELETE); foreach ($_DELETE as $k => $v) { $this->log->debug("[ DELETE Params ]" . $k . ": " . $v, []); $this->delete->$k = $this->setSecurityLevel($v); $this->parameters["delete"][$k] = $this->setSecurityLevel($v); } if ($rawData) { $this->parameters["delete"]['raw'] = $rawData; $this->log->debug("[ DELETE RawData ] raw: " . $rawData, []); } } }
[ "private", "function", "setDelete", "(", ")", "{", "if", "(", "$", "this", "->", "parameters", "[", "'header'", "]", "[", "\"Content-Type\"", "]", "==", "\"application/x-www-form-urlencoded\"", ")", "{", "if", "(", "isset", "(", "$", "_GET", ")", ")", "{",...
DELETE Method and Parameter Information and assign via for framework
[ "DELETE", "Method", "and", "Parameter", "Information", "and", "assign", "via", "for", "framework" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L350-L374
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setCookie
private function setCookie() { if (isset($_COOKIE)) { foreach ($_COOKIE as $k => $v) { $this->log->debug("[ COOKIE Params ]" . $k . ": " . $v, []); $this->cookie->$k = $this->setSecurityLevel($v); $this->parameters["cookie"][$k] = $this->setSecurityLevel($v); } unset($_COOKIE); } }
php
private function setCookie() { if (isset($_COOKIE)) { foreach ($_COOKIE as $k => $v) { $this->log->debug("[ COOKIE Params ]" . $k . ": " . $v, []); $this->cookie->$k = $this->setSecurityLevel($v); $this->parameters["cookie"][$k] = $this->setSecurityLevel($v); } unset($_COOKIE); } }
[ "private", "function", "setCookie", "(", ")", "{", "if", "(", "isset", "(", "$", "_COOKIE", ")", ")", "{", "foreach", "(", "$", "_COOKIE", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "this", "->", "log", "->", "debug", "(", "\"[ COOKIE Params ]\...
Set Cookie Info
[ "Set", "Cookie", "Info" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L400-L410
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setHeader
private function setHeader() { foreach (getallheaders() as $k => $v) { $this->log->debug("[ HEADER Params ]" . $k . ": " . $v, []); $this->header->$k = $this->setSecurityLevel($v); $this->parameters["header"][$k] = $this->setSecurityLevel($v); } }
php
private function setHeader() { foreach (getallheaders() as $k => $v) { $this->log->debug("[ HEADER Params ]" . $k . ": " . $v, []); $this->header->$k = $this->setSecurityLevel($v); $this->parameters["header"][$k] = $this->setSecurityLevel($v); } }
[ "private", "function", "setHeader", "(", ")", "{", "foreach", "(", "getallheaders", "(", ")", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "this", "->", "log", "->", "debug", "(", "\"[ HEADER Params ]\"", ".", "$", "k", ".", "\": \"", ".", "$", "...
Set Header Info
[ "Set", "Header", "Info" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L415-L422
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setServer
private function setServer() { if (isset($_SERVER)) { foreach ($_SERVER as $k => $v) { $this->log->debug("[ SERVER Params ]" . $k . ": " . $v, []); $this->server->$k = $v; $this->parameters["server"][$k] = $v; } unset($_SERVER); } }
php
private function setServer() { if (isset($_SERVER)) { foreach ($_SERVER as $k => $v) { $this->log->debug("[ SERVER Params ]" . $k . ": " . $v, []); $this->server->$k = $v; $this->parameters["server"][$k] = $v; } unset($_SERVER); } }
[ "private", "function", "setServer", "(", ")", "{", "if", "(", "isset", "(", "$", "_SERVER", ")", ")", "{", "foreach", "(", "$", "_SERVER", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "this", "->", "log", "->", "debug", "(", "\"[ SERVER Params ]\...
Set _SERVER info
[ "Set", "_SERVER", "info" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L427-L437
train
cafe-latte/framework
src/Core/HttpRequest.php
HttpRequest.setSession
private function setSession() { if (isset($_SESSION)) { foreach ($_SESSION as $k => $v) { $this->log->debug("[ SESSION Params ]" . $k . ": " . $v, []); $this->session->$k = $this->setSecurityLevel($v); $this->parameters["session"][$k] = $this->setSecurityLevel($v); } } }
php
private function setSession() { if (isset($_SESSION)) { foreach ($_SESSION as $k => $v) { $this->log->debug("[ SESSION Params ]" . $k . ": " . $v, []); $this->session->$k = $this->setSecurityLevel($v); $this->parameters["session"][$k] = $this->setSecurityLevel($v); } } }
[ "private", "function", "setSession", "(", ")", "{", "if", "(", "isset", "(", "$", "_SESSION", ")", ")", "{", "foreach", "(", "$", "_SESSION", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "this", "->", "log", "->", "debug", "(", "\"[ SESSION Param...
Set _SESSION Info
[ "Set", "_SESSION", "Info" ]
2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da
https://github.com/cafe-latte/framework/blob/2a2a88ad09b05ec1d03f3fc6fefb280d171fa2da/src/Core/HttpRequest.php#L443-L452
train
KodiCMS/laravel-assets
src/Traits/Scripts.php
Scripts.addJs
public function addJs($handle = false, $src = null, $dependency = null, $footer = false) { return $this->scripts[$handle] = new Javascript($handle, $src, $dependency, $footer); }
php
public function addJs($handle = false, $src = null, $dependency = null, $footer = false) { return $this->scripts[$handle] = new Javascript($handle, $src, $dependency, $footer); }
[ "public", "function", "addJs", "(", "$", "handle", "=", "false", ",", "$", "src", "=", "null", ",", "$", "dependency", "=", "null", ",", "$", "footer", "=", "false", ")", "{", "return", "$", "this", "->", "scripts", "[", "$", "handle", "]", "=", ...
Javascript wrapper. Gets or sets javascript assets @param bool|string $handle @param string $src Asset source @param array|string $dependency Dependencies @param bool $footer Whether to show in header or footer @return AssetElementInterface Setting returns asset array, getting returns asset HTML
[ "Javascript", "wrapper", "." ]
734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0
https://github.com/KodiCMS/laravel-assets/blob/734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0/src/Traits/Scripts.php#L27-L30
train
KodiCMS/laravel-assets
src/Traits/Scripts.php
Scripts.removeJs
public function removeJs($handle = null) { if (is_null($handle)) { return $this->scripts = []; } if (is_bool($handle)) { foreach ($this->scripts as $i => $javaScript) { if ($javaScript->isFooter() === $handle) { unset($this->scripts[$i]); } } return; } unset($this->scripts[$handle]); }
php
public function removeJs($handle = null) { if (is_null($handle)) { return $this->scripts = []; } if (is_bool($handle)) { foreach ($this->scripts as $i => $javaScript) { if ($javaScript->isFooter() === $handle) { unset($this->scripts[$i]); } } return; } unset($this->scripts[$handle]); }
[ "public", "function", "removeJs", "(", "$", "handle", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "handle", ")", ")", "{", "return", "$", "this", "->", "scripts", "=", "[", "]", ";", "}", "if", "(", "is_bool", "(", "$", "handle", ")", ...
Remove a javascript asset, or all. @param string|null $handle Remove all if `NULL`, section if `TRUE` or `FALSE`, asset if `string` @return mixed Empty array or void
[ "Remove", "a", "javascript", "asset", "or", "all", "." ]
734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0
https://github.com/KodiCMS/laravel-assets/blob/734b1f77f19bd4d5cbbad64d6cfc69c1a7482db0/src/Traits/Scripts.php#L75-L92
train
inphinit/framework
src/Inphinit/Viewing/View.php
View.data
public static function data($key, $value) { if ($value === null) { unset(self::$shared[$key]); } else { self::$shared[$key] = $value; } }
php
public static function data($key, $value) { if ($value === null) { unset(self::$shared[$key]); } else { self::$shared[$key] = $value; } }
[ "public", "static", "function", "data", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "unset", "(", "self", "::", "$", "shared", "[", "$", "key", "]", ")", ";", "}", "else", "{", "self", "::", ...
Share or remove shared data to Views, shared variables will be added as variables to the views that will be executed later @param string $key @param mixed $value @return void
[ "Share", "or", "remove", "shared", "data", "to", "Views", "shared", "variables", "will", "be", "added", "as", "variables", "to", "the", "views", "that", "will", "be", "executed", "later" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Inphinit/Viewing/View.php#L58-L65
train
inphinit/framework
src/Inphinit/Viewing/View.php
View.render
public static function render($view, array $data = array()) { if (self::$force || App::state() > 2) { \UtilsSandboxLoader('application/View/' . strtr($view, '.', '/') . '.php', self::$shared + $data); return $data = null; } return array_push(self::$views, array(strtr($view, '.', '/'), $data)) - 1; }
php
public static function render($view, array $data = array()) { if (self::$force || App::state() > 2) { \UtilsSandboxLoader('application/View/' . strtr($view, '.', '/') . '.php', self::$shared + $data); return $data = null; } return array_push(self::$views, array(strtr($view, '.', '/'), $data)) - 1; }
[ "public", "static", "function", "render", "(", "$", "view", ",", "array", "$", "data", "=", "array", "(", ")", ")", "{", "if", "(", "self", "::", "$", "force", "||", "App", "::", "state", "(", ")", ">", "2", ")", "{", "\\", "UtilsSandboxLoader", ...
Register or render a View. If View is registered this method returns the index number from View @param string $view @param array $data @return int|null
[ "Register", "or", "render", "a", "View", ".", "If", "View", "is", "registered", "this", "method", "returns", "the", "index", "number", "from", "View" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Inphinit/Viewing/View.php#L86-L95
train
inphinit/framework
src/Inphinit/Viewing/View.php
View.remove
public static function remove($index) { if (isset(self::$views[$index])) { self::$views[$index] = null; } }
php
public static function remove($index) { if (isset(self::$views[$index])) { self::$views[$index] = null; } }
[ "public", "static", "function", "remove", "(", "$", "index", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "views", "[", "$", "index", "]", ")", ")", "{", "self", "::", "$", "views", "[", "$", "index", "]", "=", "null", ";", "}", "}" ]
Remove a registered View by index @param int $index @return void
[ "Remove", "a", "registered", "View", "by", "index" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Inphinit/Viewing/View.php#L103-L108
train
BluesparkLabs/spark
src/Robo/Commands.php
Commands.getContainerName
protected function getContainerName($container) { $this->validateConfig(); // Project name is defined in a nice, human-readable style, so lowercase it // first. $project_lowercase = strtolower($this->config->get('name')); // Replace all spaces to match the behavior of Docker Compose. Then finally // append container name. return str_replace(' ', '', $project_lowercase) . '_' . $container; }
php
protected function getContainerName($container) { $this->validateConfig(); // Project name is defined in a nice, human-readable style, so lowercase it // first. $project_lowercase = strtolower($this->config->get('name')); // Replace all spaces to match the behavior of Docker Compose. Then finally // append container name. return str_replace(' ', '', $project_lowercase) . '_' . $container; }
[ "protected", "function", "getContainerName", "(", "$", "container", ")", "{", "$", "this", "->", "validateConfig", "(", ")", ";", "// Project name is defined in a nice, human-readable style, so lowercase it", "// first.", "$", "project_lowercase", "=", "strtolower", "(", ...
Returns Docker Compose-style container name with project name as prefix.
[ "Returns", "Docker", "Compose", "-", "style", "container", "name", "with", "project", "name", "as", "prefix", "." ]
c7beb4d47ba808c1ee0c40820e1b4c0e772f576e
https://github.com/BluesparkLabs/spark/blob/c7beb4d47ba808c1ee0c40820e1b4c0e772f576e/src/Robo/Commands.php#L176-L184
train
BluesparkLabs/spark
src/Robo/Commands.php
Commands.cleanFileName
protected function cleanFileName($identifier) { // Convert or strip certain special characters, by convention. $filter = [ ' ' => '-', '_' => '-', '/' => '-', '[' => '-', ']' => '', ]; $identifier = strtr($identifier, $filter); // Valid characters in a clean filename identifier are: // - the hyphen (U+002D) // - the period (U+002E) // - a-z (U+0030 - U+0039) // - A-Z (U+0041 - U+005A) // - the underscore (U+005F) // - 0-9 (U+0061 - U+007A) // - ISO 10646 characters U+00A1 and higher // We strip out any character not in the above list $identifier = preg_replace('/[^\\x{002D}\\x{002E}\\x{0030}-\\x{0039}\\x{0041}-\\x{005A}\\x{005F}\\x{0061}-\\x{007A}\\x{00A1}-\\x{FFFF}]/u', '', $identifier); // Convert everything to lowercase return strtolower($identifier); }
php
protected function cleanFileName($identifier) { // Convert or strip certain special characters, by convention. $filter = [ ' ' => '-', '_' => '-', '/' => '-', '[' => '-', ']' => '', ]; $identifier = strtr($identifier, $filter); // Valid characters in a clean filename identifier are: // - the hyphen (U+002D) // - the period (U+002E) // - a-z (U+0030 - U+0039) // - A-Z (U+0041 - U+005A) // - the underscore (U+005F) // - 0-9 (U+0061 - U+007A) // - ISO 10646 characters U+00A1 and higher // We strip out any character not in the above list $identifier = preg_replace('/[^\\x{002D}\\x{002E}\\x{0030}-\\x{0039}\\x{0041}-\\x{005A}\\x{005F}\\x{0061}-\\x{007A}\\x{00A1}-\\x{FFFF}]/u', '', $identifier); // Convert everything to lowercase return strtolower($identifier); }
[ "protected", "function", "cleanFileName", "(", "$", "identifier", ")", "{", "// Convert or strip certain special characters, by convention.", "$", "filter", "=", "[", "' '", "=>", "'-'", ",", "'_'", "=>", "'-'", ",", "'/'", "=>", "'-'", ",", "'['", "=>", "'-'", ...
Converts random strings to clean filenames. The cleanups are loosly based on drupal_clean_css_identifier(). - prefer dash-separated words. - strip special characters. - down-case alphabetical letters.
[ "Converts", "random", "strings", "to", "clean", "filenames", "." ]
c7beb4d47ba808c1ee0c40820e1b4c0e772f576e
https://github.com/BluesparkLabs/spark/blob/c7beb4d47ba808c1ee0c40820e1b4c0e772f576e/src/Robo/Commands.php#L194-L219
train
bluestatedigital/bsd-api-php
src/Blue/Tools/Api/MessageFactory.php
MessageFactory.createRequest
public function createRequest($method, $url, array $options = []) { $request = parent::createRequest($method, $url, $options); $query = $request->getQuery(); $auth = $request->getConfig()->get('auth'); // The 'auth' configuration must be valid if ((!is_array($auth)) || (count($auth) < 3) || ($auth[2] != Client::$AUTH_TYPE)) { throw new RuntimeException("Authorization information not provided"); } $id = $auth[0]; $secret = $auth[1]; // Add API User ID to the query $query->set('api_id', $id); // Add timestamp to the query if (!$query->hasKey('api_ts')) { $query->set('api_ts', time()); } // Add version to the query $query->set('api_ver', '2'); // Add hash to the query $hash = $this->generateMac($request->getUrl(), $request->getQuery()->toArray(), $secret); $query->set('api_mac', $hash); return $request; }
php
public function createRequest($method, $url, array $options = []) { $request = parent::createRequest($method, $url, $options); $query = $request->getQuery(); $auth = $request->getConfig()->get('auth'); // The 'auth' configuration must be valid if ((!is_array($auth)) || (count($auth) < 3) || ($auth[2] != Client::$AUTH_TYPE)) { throw new RuntimeException("Authorization information not provided"); } $id = $auth[0]; $secret = $auth[1]; // Add API User ID to the query $query->set('api_id', $id); // Add timestamp to the query if (!$query->hasKey('api_ts')) { $query->set('api_ts', time()); } // Add version to the query $query->set('api_ver', '2'); // Add hash to the query $hash = $this->generateMac($request->getUrl(), $request->getQuery()->toArray(), $secret); $query->set('api_mac', $hash); return $request; }
[ "public", "function", "createRequest", "(", "$", "method", ",", "$", "url", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "request", "=", "parent", "::", "createRequest", "(", "$", "method", ",", "$", "url", ",", "$", "options", ")", ...
Create a new request based on the HTTP method. This method accepts an associative array of request options. Below is a brief description of each parameter. See http://docs.guzzlephp.org/clients.html#request-options for a much more in-depth description of each parameter. - headers: Associative array of headers to add to the request - body: string|resource|array|StreamInterface request body to send - json: mixed Uploads JSON encoded data using an application/json Content-Type header. - query: Associative array of query string values to add to the request - auth: array|string HTTP auth settings (user, pass[, type="basic"]) - version: The HTTP protocol version to use with the request - cookies: true|false|CookieJarInterface To enable or disable cookies - allow_redirects: true|false|array Controls HTTP redirects - save_to: string|resource|StreamInterface Where the response is saved - events: Associative array of event names to callables or arrays - subscribers: Array of event subscribers to add to the request - exceptions: Specifies whether or not exceptions are thrown for HTTP protocol errors - timeout: Timeout of the request in seconds. Use 0 to wait indefinitely - connect_timeout: Number of seconds to wait while trying to connect. (0 to wait indefinitely) - verify: SSL validation. True/False or the path to a PEM file - cert: Path a SSL cert or array of (path, pwd) - ssl_key: Path to a private SSL key or array of (path, pwd) - proxy: Specify an HTTP proxy or hash of protocols to proxies - debug: Set to true or a resource to view handler specific debug info - stream: Set to true to stream a response body rather than download it all up front - expect: true/false/integer Controls the "Expect: 100-Continue" header - config: Associative array of request config collection options - decode_content: true/false/string to control decoding content-encoding responses @param string $method HTTP method (GET, POST, PUT, etc.) @param string|Url $url HTTP URL to connect to @param array $options Array of options to apply to the request @return RequestInterface @link http://docs.guzzlephp.org/clients.html#request-options
[ "Create", "a", "new", "request", "based", "on", "the", "HTTP", "method", "." ]
d0e7a80443a9738c8b8756b5c4319a9eb00cdac2
https://github.com/bluestatedigital/bsd-api-php/blob/d0e7a80443a9738c8b8756b5c4319a9eb00cdac2/src/Blue/Tools/Api/MessageFactory.php#L51-L83
train
bluestatedigital/bsd-api-php
src/Blue/Tools/Api/MessageFactory.php
MessageFactory.generateMac
private function generateMac($url, $query, $secret) { // break URL into parts to get the path $urlParts = parse_url($url); // trim double slashes in the path if (substr($urlParts['path'], 0, 2) == '//') { $urlParts['path'] = substr($urlParts['path'], 1); } // build query string from given parameters $queryString = urldecode(http_build_query($query)); // combine strings to build the signing string $signingString = $query['api_id'] . "\n" . $query['api_ts'] . "\n" . $urlParts['path'] . "\n" . $queryString; $mac = hash_hmac('sha1', $signingString, $secret); return $mac; }
php
private function generateMac($url, $query, $secret) { // break URL into parts to get the path $urlParts = parse_url($url); // trim double slashes in the path if (substr($urlParts['path'], 0, 2) == '//') { $urlParts['path'] = substr($urlParts['path'], 1); } // build query string from given parameters $queryString = urldecode(http_build_query($query)); // combine strings to build the signing string $signingString = $query['api_id'] . "\n" . $query['api_ts'] . "\n" . $urlParts['path'] . "\n" . $queryString; $mac = hash_hmac('sha1', $signingString, $secret); return $mac; }
[ "private", "function", "generateMac", "(", "$", "url", ",", "$", "query", ",", "$", "secret", ")", "{", "// break URL into parts to get the path", "$", "urlParts", "=", "parse_url", "(", "$", "url", ")", ";", "// trim double slashes in the path", "if", "(", "sub...
Creates a hash based on request parameters @param string $url @param array $query @param string $secret @return string
[ "Creates", "a", "hash", "based", "on", "request", "parameters" ]
d0e7a80443a9738c8b8756b5c4319a9eb00cdac2
https://github.com/bluestatedigital/bsd-api-php/blob/d0e7a80443a9738c8b8756b5c4319a9eb00cdac2/src/Blue/Tools/Api/MessageFactory.php#L94-L117
train
bluestatedigital/bsd-api-php
src/Blue/Tools/Api/MessageFactory.php
MessageFactory.createResponse
public function createResponse( $statusCode, array $headers = [], $body = null, array $options = [] ) { return parent::createResponse($statusCode, $headers, $body, $options); }
php
public function createResponse( $statusCode, array $headers = [], $body = null, array $options = [] ) { return parent::createResponse($statusCode, $headers, $body, $options); }
[ "public", "function", "createResponse", "(", "$", "statusCode", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "body", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "return", "parent", "::", "createResponse", "(", "$", "...
Creates a response @param string $statusCode HTTP status code @param array $headers Response headers @param mixed $body Response body @param array $options Response options - protocol_version: HTTP protocol version - header_factory: Factory used to create headers - And any other options used by a concrete message implementation @return ResponseInterface
[ "Creates", "a", "response" ]
d0e7a80443a9738c8b8756b5c4319a9eb00cdac2
https://github.com/bluestatedigital/bsd-api-php/blob/d0e7a80443a9738c8b8756b5c4319a9eb00cdac2/src/Blue/Tools/Api/MessageFactory.php#L133-L140
train
brick/std
src/Json/Common.php
Common.setMaxDepth
public function setMaxDepth(int $maxDepth) : void { if ($maxDepth < 0 || $maxDepth >= 0x7fffffff) { // max depth + 1 must not be greater than this limit throw new \InvalidArgumentException('Invalid max depth.'); } $this->maxDepth = $maxDepth; }
php
public function setMaxDepth(int $maxDepth) : void { if ($maxDepth < 0 || $maxDepth >= 0x7fffffff) { // max depth + 1 must not be greater than this limit throw new \InvalidArgumentException('Invalid max depth.'); } $this->maxDepth = $maxDepth; }
[ "public", "function", "setMaxDepth", "(", "int", "$", "maxDepth", ")", ":", "void", "{", "if", "(", "$", "maxDepth", "<", "0", "||", "$", "maxDepth", ">=", "0x7fffffff", ")", "{", "// max depth + 1 must not be greater than this limit\r", "throw", "new", "\\", ...
Sets the max recursion depth. Defaults to `512`. Every nested array or object adds one level of recursion. If the max depth is zero, only scalars can be encoded/decoded. @param int $maxDepth @return void @throws \InvalidArgumentException If the max depth is out of range.
[ "Sets", "the", "max", "recursion", "depth", ".", "Defaults", "to", "512", "." ]
d19162fcefcce457eeaa27904c797f76f9f49007
https://github.com/brick/std/blob/d19162fcefcce457eeaa27904c797f76f9f49007/src/Json/Common.php#L38-L45
train
brick/std
src/Json/Common.php
Common.setOption
protected function setOption(int $option, bool $bool) : void { if ($bool) { $this->options |= $option; } else { $this->options &= ~ $option; } }
php
protected function setOption(int $option, bool $bool) : void { if ($bool) { $this->options |= $option; } else { $this->options &= ~ $option; } }
[ "protected", "function", "setOption", "(", "int", "$", "option", ",", "bool", "$", "bool", ")", ":", "void", "{", "if", "(", "$", "bool", ")", "{", "$", "this", "->", "options", "|=", "$", "option", ";", "}", "else", "{", "$", "this", "->", "opti...
Sets or resets a bitmask option. @param int $option A JSON_* constant. @param bool $bool The boolean value. @return void
[ "Sets", "or", "resets", "a", "bitmask", "option", "." ]
d19162fcefcce457eeaa27904c797f76f9f49007
https://github.com/brick/std/blob/d19162fcefcce457eeaa27904c797f76f9f49007/src/Json/Common.php#L69-L76
train
JiSoft/yii2-sypexgeo
Sypexgeo.php
Sypexgeo.get
public function get($ip='') { if (empty($ip)) $this->getIP(); else if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { return false; } else { $this->ip = $ip; $this->ipAsLong = sprintf('%u', ip2long($ip)); } $this->getSypexGeo(); $data = $this->_sypex->getCityFull($this->ip); if (isset($data['city'])) $this->city = $data['city']; if (isset($data['region'])) $this->region = $data['region']; if (isset($data['country'])) $this->country = $data['country']; return empty($data) ? false : $data; }
php
public function get($ip='') { if (empty($ip)) $this->getIP(); else if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { return false; } else { $this->ip = $ip; $this->ipAsLong = sprintf('%u', ip2long($ip)); } $this->getSypexGeo(); $data = $this->_sypex->getCityFull($this->ip); if (isset($data['city'])) $this->city = $data['city']; if (isset($data['region'])) $this->region = $data['region']; if (isset($data['country'])) $this->country = $data['country']; return empty($data) ? false : $data; }
[ "public", "function", "get", "(", "$", "ip", "=", "''", ")", "{", "if", "(", "empty", "(", "$", "ip", ")", ")", "$", "this", "->", "getIP", "(", ")", ";", "else", "if", "(", "!", "filter_var", "(", "$", "ip", ",", "FILTER_VALIDATE_IP", ",", "FI...
Get full geo info by remote IP-address @param string $ip source ip, if empty then determine @return array geo info|false if error result array example: ```php [ 'city' => [ 'id' => 709717, 'lat' => 48.023000000000003, 'lon' => 37.802239999999998, 'name_ru' => 'Донецк', 'name_en' => 'Donets\'k', 'okato' => '14101', ], 'region' => [ 'id' => 709716, 'lat' => 48, 'lon' => 37.5, 'name_ru' => 'Донецкая область', 'name_en' => 'Donets\'ka Oblast\'', 'iso' => 'UA-14', 'timezone' => 'Europe/Zaporozhye', 'okato' => '14', ], 'country' => [ 'id' => 222, 'iso' => 'UA', 'continent' => 'EU', 'lat' => 49, 'lon' => 32, 'name_ru' => 'Украина', 'name_en' => 'Ukraine', 'timezone' => 'Europe/Kiev', ], ] ```
[ "Get", "full", "geo", "info", "by", "remote", "IP", "-", "address" ]
faa8930cbebc183014cb653827508e9b187ed4c1
https://github.com/JiSoft/yii2-sypexgeo/blob/faa8930cbebc183014cb653827508e9b187ed4c1/Sypexgeo.php#L82-L102
train
inphinit/framework
src/Experimental/Debug.php
Debug.unregister
public static function unregister() { $nc = '\\' . get_called_class(); App::off('error', array( $nc, 'renderError' )); App::off('terminate', array( $nc, 'renderPerformance' )); App::off('terminate', array( $nc, 'renderClasses' )); if (false === empty(self::$displayErrors)) { function_exists('init_set') && ini_set('display_errors', self::$displayErrors); self::$displayErrors = null; } }
php
public static function unregister() { $nc = '\\' . get_called_class(); App::off('error', array( $nc, 'renderError' )); App::off('terminate', array( $nc, 'renderPerformance' )); App::off('terminate', array( $nc, 'renderClasses' )); if (false === empty(self::$displayErrors)) { function_exists('init_set') && ini_set('display_errors', self::$displayErrors); self::$displayErrors = null; } }
[ "public", "static", "function", "unregister", "(", ")", "{", "$", "nc", "=", "'\\\\'", ".", "get_called_class", "(", ")", ";", "App", "::", "off", "(", "'error'", ",", "array", "(", "$", "nc", ",", "'renderError'", ")", ")", ";", "App", "::", "off", ...
Unregister debug events @return void
[ "Unregister", "debug", "events" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Debug.php#L30-L43
train
inphinit/framework
src/Experimental/Debug.php
Debug.renderError
public static function renderError($type, $message, $file, $line) { if (empty(self::$views['error'])) { return null; } elseif (preg_match('#allowed\s+memory\s+size\s+of\s+\d+\s+bytes\s+exhausted\s+\(tried\s+to\s+allocate\s+\d+\s+bytes\)#i', $message)) { die('<br><strong>Fatal error:</strong> ' . $message . ' in <strong>' . $file . '</strong> on line <strong>' . $line . '</strong>'); } $data = self::details($type, $message, $file, $line); if (!headers_sent() && strcasecmp(Request::header('accept'), 'application/json') === 0) { ob_start(); self::unregister(); Response::cache(0); Response::type('application/json'); echo json_encode($data); App::stop(500); } if (in_array($type, self::$fatal)) { View::dispatch(); } self::render(self::$views['error'], $data); }
php
public static function renderError($type, $message, $file, $line) { if (empty(self::$views['error'])) { return null; } elseif (preg_match('#allowed\s+memory\s+size\s+of\s+\d+\s+bytes\s+exhausted\s+\(tried\s+to\s+allocate\s+\d+\s+bytes\)#i', $message)) { die('<br><strong>Fatal error:</strong> ' . $message . ' in <strong>' . $file . '</strong> on line <strong>' . $line . '</strong>'); } $data = self::details($type, $message, $file, $line); if (!headers_sent() && strcasecmp(Request::header('accept'), 'application/json') === 0) { ob_start(); self::unregister(); Response::cache(0); Response::type('application/json'); echo json_encode($data); App::stop(500); } if (in_array($type, self::$fatal)) { View::dispatch(); } self::render(self::$views['error'], $data); }
[ "public", "static", "function", "renderError", "(", "$", "type", ",", "$", "message", ",", "$", "file", ",", "$", "line", ")", "{", "if", "(", "empty", "(", "self", "::", "$", "views", "[", "'error'", "]", ")", ")", "{", "return", "null", ";", "}...
Render a View to error @param int $type @param string $message @param string $file @param int $line @return void
[ "Render", "a", "View", "to", "error" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Debug.php#L54-L82
train
inphinit/framework
src/Experimental/Debug.php
Debug.renderPerformance
public static function renderPerformance() { if (!empty(self::$views['performance'])) { self::render(self::$views['performance'], self::performance()); } }
php
public static function renderPerformance() { if (!empty(self::$views['performance'])) { self::render(self::$views['performance'], self::performance()); } }
[ "public", "static", "function", "renderPerformance", "(", ")", "{", "if", "(", "!", "empty", "(", "self", "::", "$", "views", "[", "'performance'", "]", ")", ")", "{", "self", "::", "render", "(", "self", "::", "$", "views", "[", "'performance'", "]", ...
Render a View to show performance, memory and time to display page @return void
[ "Render", "a", "View", "to", "show", "performance", "memory", "and", "time", "to", "display", "page" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Debug.php#L89-L94
train
inphinit/framework
src/Experimental/Debug.php
Debug.renderClasses
public static function renderClasses() { if (!empty(self::$views['classes'])) { self::render(self::$views['classes'], array( 'classes' => self::classes() )); } }
php
public static function renderClasses() { if (!empty(self::$views['classes'])) { self::render(self::$views['classes'], array( 'classes' => self::classes() )); } }
[ "public", "static", "function", "renderClasses", "(", ")", "{", "if", "(", "!", "empty", "(", "self", "::", "$", "views", "[", "'classes'", "]", ")", ")", "{", "self", "::", "render", "(", "self", "::", "$", "views", "[", "'classes'", "]", ",", "ar...
Render a View to show performance and show declared classes @return void
[ "Render", "a", "View", "to", "show", "performance", "and", "show", "declared", "classes" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Debug.php#L101-L108
train
inphinit/framework
src/Experimental/Debug.php
Debug.view
public static function view($type, $view) { if ($view !== null && View::exists($view) === false) { throw new Exception($view . ' view is not found', 2); } $callRender = array( '\\' . get_called_class(), 'render' . ucfirst($type) ); switch ($type) { case 'error': self::$views[$type] = $view; App::on('error', $callRender); if (empty(self::$displayErrors)) { self::$displayErrors = ini_get('display_errors'); function_exists('ini_set') && ini_set('display_errors', '0'); } break; case 'classes': case 'performance': self::$views[$type] = $view; App::on('terminate', $callRender); break; case 'before': self::$views[$type] = $view; break; default: throw new Exception($type . ' is not valid event', 2); } }
php
public static function view($type, $view) { if ($view !== null && View::exists($view) === false) { throw new Exception($view . ' view is not found', 2); } $callRender = array( '\\' . get_called_class(), 'render' . ucfirst($type) ); switch ($type) { case 'error': self::$views[$type] = $view; App::on('error', $callRender); if (empty(self::$displayErrors)) { self::$displayErrors = ini_get('display_errors'); function_exists('ini_set') && ini_set('display_errors', '0'); } break; case 'classes': case 'performance': self::$views[$type] = $view; App::on('terminate', $callRender); break; case 'before': self::$views[$type] = $view; break; default: throw new Exception($type . ' is not valid event', 2); } }
[ "public", "static", "function", "view", "(", "$", "type", ",", "$", "view", ")", "{", "if", "(", "$", "view", "!==", "null", "&&", "View", "::", "exists", "(", "$", "view", ")", "===", "false", ")", "{", "throw", "new", "Exception", "(", "$", "vi...
Register a debug views @param string $type @param string $view @return void
[ "Register", "a", "debug", "views" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Debug.php#L118-L151
train
inphinit/framework
src/Experimental/Debug.php
Debug.classes
public static function classes() { $objs = array(); foreach (get_declared_classes() as $value) { $value = ltrim($value, '\\'); $cname = new \ReflectionClass($value); if (false === $cname->isInternal()) { $objs[$value] = $cname->getDefaultProperties(); } $cname = null; } return $objs; }
php
public static function classes() { $objs = array(); foreach (get_declared_classes() as $value) { $value = ltrim($value, '\\'); $cname = new \ReflectionClass($value); if (false === $cname->isInternal()) { $objs[$value] = $cname->getDefaultProperties(); } $cname = null; } return $objs; }
[ "public", "static", "function", "classes", "(", ")", "{", "$", "objs", "=", "array", "(", ")", ";", "foreach", "(", "get_declared_classes", "(", ")", "as", "$", "value", ")", "{", "$", "value", "=", "ltrim", "(", "$", "value", ",", "'\\\\'", ")", "...
Get declared classes @return array
[ "Get", "declared", "classes" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Debug.php#L221-L237
train
inphinit/framework
src/Experimental/Debug.php
Debug.source
public static function source($file, $line) { if ($line <= 0 || is_file($file) === false) { return null; } elseif ($line > 5) { $init = $line - 5; $end = $line + 5; $breakpoint = 6; } else { $init = 0; $end = 5; $breakpoint = $line; } return array( 'breakpoint' => $breakpoint, 'preview' => preg_split('#\r\n|\n#', trim( File::portion($file, $init, $end, true), "\r\n") ) ); }
php
public static function source($file, $line) { if ($line <= 0 || is_file($file) === false) { return null; } elseif ($line > 5) { $init = $line - 5; $end = $line + 5; $breakpoint = 6; } else { $init = 0; $end = 5; $breakpoint = $line; } return array( 'breakpoint' => $breakpoint, 'preview' => preg_split('#\r\n|\n#', trim( File::portion($file, $init, $end, true), "\r\n") ) ); }
[ "public", "static", "function", "source", "(", "$", "file", ",", "$", "line", ")", "{", "if", "(", "$", "line", "<=", "0", "||", "is_file", "(", "$", "file", ")", "===", "false", ")", "{", "return", "null", ";", "}", "elseif", "(", "$", "line", ...
Get snippet from a file @param string $file @param int $line @return array|null
[ "Get", "snippet", "from", "a", "file" ]
81eddb711e0225116a1ced91ed65e71437b7288c
https://github.com/inphinit/framework/blob/81eddb711e0225116a1ced91ed65e71437b7288c/src/Experimental/Debug.php#L246-L266
train
brick/std
src/Iterator/CsvFileIterator.php
CsvFileIterator.readCurrent
private function readCurrent() : void { $row = $this->readRow(); if ($this->columns === null || $row === null) { $this->current = $row; } else { $this->current = []; foreach ($this->columns as $key => $name) { $this->current[$name] = isset($row[$key]) ? $row[$key] : null; } } }
php
private function readCurrent() : void { $row = $this->readRow(); if ($this->columns === null || $row === null) { $this->current = $row; } else { $this->current = []; foreach ($this->columns as $key => $name) { $this->current[$name] = isset($row[$key]) ? $row[$key] : null; } } }
[ "private", "function", "readCurrent", "(", ")", ":", "void", "{", "$", "row", "=", "$", "this", "->", "readRow", "(", ")", ";", "if", "(", "$", "this", "->", "columns", "===", "null", "||", "$", "row", "===", "null", ")", "{", "$", "this", "->", ...
Reads the current CSV row. @return void
[ "Reads", "the", "current", "CSV", "row", "." ]
d19162fcefcce457eeaa27904c797f76f9f49007
https://github.com/brick/std/blob/d19162fcefcce457eeaa27904c797f76f9f49007/src/Iterator/CsvFileIterator.php#L142-L155
train
brick/std
src/ObjectStorage.php
ObjectStorage.has
public function has($object) : bool { $hash = spl_object_hash($object); return isset($this->objects[$hash]); }
php
public function has($object) : bool { $hash = spl_object_hash($object); return isset($this->objects[$hash]); }
[ "public", "function", "has", "(", "$", "object", ")", ":", "bool", "{", "$", "hash", "=", "spl_object_hash", "(", "$", "object", ")", ";", "return", "isset", "(", "$", "this", "->", "objects", "[", "$", "hash", "]", ")", ";", "}" ]
Returns whether this storage contains the given object. @param object $object The object to test. @return bool True if this storage contains the object, false otherwise.
[ "Returns", "whether", "this", "storage", "contains", "the", "given", "object", "." ]
d19162fcefcce457eeaa27904c797f76f9f49007
https://github.com/brick/std/blob/d19162fcefcce457eeaa27904c797f76f9f49007/src/ObjectStorage.php#L38-L43
train