id
int32
0
241k
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
19,300
joomlatools/joomlatools-platform-legacy
code/exception/exception.php
JException.getProperties
public function getProperties($public = true) { JLog::add('JException::getProperties is deprecated.', JLog::WARNING, 'deprecated'); $vars = get_object_vars($this); if ($public) { foreach ($vars as $key => $value) { if ('_' == substr($key, 0, 1)) { unset($vars[$key]); } } } return $vars; }
php
public function getProperties($public = true) { JLog::add('JException::getProperties is deprecated.', JLog::WARNING, 'deprecated'); $vars = get_object_vars($this); if ($public) { foreach ($vars as $key => $value) { if ('_' == substr($key, 0, 1)) { unset($vars[$key]); } } } return $vars; }
[ "public", "function", "getProperties", "(", "$", "public", "=", "true", ")", "{", "JLog", "::", "add", "(", "'JException::getProperties is deprecated.'", ",", "JLog", "::", "WARNING", ",", "'deprecated'", ")", ";", "$", "vars", "=", "get_object_vars", "(", "$", "this", ")", ";", "if", "(", "$", "public", ")", "{", "foreach", "(", "$", "vars", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "'_'", "==", "substr", "(", "$", "key", ",", "0", ",", "1", ")", ")", "{", "unset", "(", "$", "vars", "[", "$", "key", "]", ")", ";", "}", "}", "}", "return", "$", "vars", ";", "}" ]
Returns an associative array of object properties @param boolean $public If true, returns only the public properties @return array Object properties @deprecated 12.1 @see JException::get() @since 11.1
[ "Returns", "an", "associative", "array", "of", "object", "properties" ]
3a76944e2f2c415faa6504754c75321a3b478c06
https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/exception/exception.php#L242-L260
19,301
ChadSikorra/php-simple-enum
src/Enums/EnumTrait.php
EnumTrait.isValidValue
public static function isValidValue($value, $strict = false) { static::initialize(); return (array_search($value, static::$constants, $strict) !== false); }
php
public static function isValidValue($value, $strict = false) { static::initialize(); return (array_search($value, static::$constants, $strict) !== false); }
[ "public", "static", "function", "isValidValue", "(", "$", "value", ",", "$", "strict", "=", "false", ")", "{", "static", "::", "initialize", "(", ")", ";", "return", "(", "array_search", "(", "$", "value", ",", "static", "::", "$", "constants", ",", "$", "strict", ")", "!==", "false", ")", ";", "}" ]
Check if a specific enum exists by value. @param $value @param bool $strict @return bool
[ "Check", "if", "a", "specific", "enum", "exists", "by", "value", "." ]
781f87ae9f4cc75fb2edab6517c6471c0181e93b
https://github.com/ChadSikorra/php-simple-enum/blob/781f87ae9f4cc75fb2edab6517c6471c0181e93b/src/Enums/EnumTrait.php#L101-L106
19,302
ChadSikorra/php-simple-enum
src/Enums/EnumTrait.php
EnumTrait.getValueName
public static function getValueName($value, $strict = false) { if (!static::isValidValue($value)) { throw new \InvalidArgumentException('No enum name was found for the value supplied.'); } return array_search($value, static::$constants, $strict); }
php
public static function getValueName($value, $strict = false) { if (!static::isValidValue($value)) { throw new \InvalidArgumentException('No enum name was found for the value supplied.'); } return array_search($value, static::$constants, $strict); }
[ "public", "static", "function", "getValueName", "(", "$", "value", ",", "$", "strict", "=", "false", ")", "{", "if", "(", "!", "static", "::", "isValidValue", "(", "$", "value", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'No enum name was found for the value supplied.'", ")", ";", "}", "return", "array_search", "(", "$", "value", ",", "static", "::", "$", "constants", ",", "$", "strict", ")", ";", "}" ]
Get the enum name from its value. @param mixed $value @param bool $strict @return string
[ "Get", "the", "enum", "name", "from", "its", "value", "." ]
781f87ae9f4cc75fb2edab6517c6471c0181e93b
https://github.com/ChadSikorra/php-simple-enum/blob/781f87ae9f4cc75fb2edab6517c6471c0181e93b/src/Enums/EnumTrait.php#L115-L122
19,303
ChadSikorra/php-simple-enum
src/Enums/EnumTrait.php
EnumTrait.getNameValue
public static function getNameValue($name) { static::initialize(); if (!static::isValidName($name)) { throw new \InvalidArgumentException(sprintf( 'The enum name "%s" is not valid. Expected one of: %s', $name, implode(', ', static::names()) )); } return static::$constants[static::$lcKeyMap[strtolower($name)]]; }
php
public static function getNameValue($name) { static::initialize(); if (!static::isValidName($name)) { throw new \InvalidArgumentException(sprintf( 'The enum name "%s" is not valid. Expected one of: %s', $name, implode(', ', static::names()) )); } return static::$constants[static::$lcKeyMap[strtolower($name)]]; }
[ "public", "static", "function", "getNameValue", "(", "$", "name", ")", "{", "static", "::", "initialize", "(", ")", ";", "if", "(", "!", "static", "::", "isValidName", "(", "$", "name", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'The enum name \"%s\" is not valid. Expected one of: %s'", ",", "$", "name", ",", "implode", "(", "', '", ",", "static", "::", "names", "(", ")", ")", ")", ")", ";", "}", "return", "static", "::", "$", "constants", "[", "static", "::", "$", "lcKeyMap", "[", "strtolower", "(", "$", "name", ")", "]", "]", ";", "}" ]
Get the enum value from its name. @param string $name @return mixed
[ "Get", "the", "enum", "value", "from", "its", "name", "." ]
781f87ae9f4cc75fb2edab6517c6471c0181e93b
https://github.com/ChadSikorra/php-simple-enum/blob/781f87ae9f4cc75fb2edab6517c6471c0181e93b/src/Enums/EnumTrait.php#L130-L143
19,304
ChadSikorra/php-simple-enum
src/Enums/EnumTrait.php
EnumTrait.initialize
protected static function initialize() { $class = static::class; if (static::$constants === null) { static::$constants = (new \ReflectionClass($class))->getConstants(); foreach (static::names() as $name) { static::$lcKeyMap[strtolower($name)] = $name; } } }
php
protected static function initialize() { $class = static::class; if (static::$constants === null) { static::$constants = (new \ReflectionClass($class))->getConstants(); foreach (static::names() as $name) { static::$lcKeyMap[strtolower($name)] = $name; } } }
[ "protected", "static", "function", "initialize", "(", ")", "{", "$", "class", "=", "static", "::", "class", ";", "if", "(", "static", "::", "$", "constants", "===", "null", ")", "{", "static", "::", "$", "constants", "=", "(", "new", "\\", "ReflectionClass", "(", "$", "class", ")", ")", "->", "getConstants", "(", ")", ";", "foreach", "(", "static", "::", "names", "(", ")", "as", "$", "name", ")", "{", "static", "::", "$", "lcKeyMap", "[", "strtolower", "(", "$", "name", ")", "]", "=", "$", "name", ";", "}", "}", "}" ]
Cache the enum array statically so we only have to do reflection a single time.
[ "Cache", "the", "enum", "array", "statically", "so", "we", "only", "have", "to", "do", "reflection", "a", "single", "time", "." ]
781f87ae9f4cc75fb2edab6517c6471c0181e93b
https://github.com/ChadSikorra/php-simple-enum/blob/781f87ae9f4cc75fb2edab6517c6471c0181e93b/src/Enums/EnumTrait.php#L148-L159
19,305
barebone-php/barebone-core
lib/View.php
View.instance
public static function instance() { if (null === self::$_instance) { self::$_instance = new Blade( APP_ROOT . 'views', PROJECT_ROOT . 'tmp' . DS . 'cache' ); } return self::$_instance; }
php
public static function instance() { if (null === self::$_instance) { self::$_instance = new Blade( APP_ROOT . 'views', PROJECT_ROOT . 'tmp' . DS . 'cache' ); } return self::$_instance; }
[ "public", "static", "function", "instance", "(", ")", "{", "if", "(", "null", "===", "self", "::", "$", "_instance", ")", "{", "self", "::", "$", "_instance", "=", "new", "Blade", "(", "APP_ROOT", ".", "'views'", ",", "PROJECT_ROOT", ".", "'tmp'", ".", "DS", ".", "'cache'", ")", ";", "}", "return", "self", "::", "$", "_instance", ";", "}" ]
Instantiate Blade Renderer @return Blade
[ "Instantiate", "Blade", "Renderer" ]
7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc
https://github.com/barebone-php/barebone-core/blob/7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc/lib/View.php#L46-L55
19,306
barebone-php/barebone-core
lib/View.php
View.render
public static function render($template, $data = []) { // @var \Illuminate\View\Factory $factory $factory = self::instance()->view(); // @var \Illuminate\Contracts\View\View $view $view = $factory->make($template, $data); return $view->render(); }
php
public static function render($template, $data = []) { // @var \Illuminate\View\Factory $factory $factory = self::instance()->view(); // @var \Illuminate\Contracts\View\View $view $view = $factory->make($template, $data); return $view->render(); }
[ "public", "static", "function", "render", "(", "$", "template", ",", "$", "data", "=", "[", "]", ")", "{", "// @var \\Illuminate\\View\\Factory $factory", "$", "factory", "=", "self", "::", "instance", "(", ")", "->", "view", "(", ")", ";", "// @var \\Illuminate\\Contracts\\View\\View $view", "$", "view", "=", "$", "factory", "->", "make", "(", "$", "template", ",", "$", "data", ")", ";", "return", "$", "view", "->", "render", "(", ")", ";", "}" ]
Render Blade template file with Data @param string $template Relative path to a ".blade.php" file @param array $data Associative array of variables names and values. @return string HTML string
[ "Render", "Blade", "template", "file", "with", "Data" ]
7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc
https://github.com/barebone-php/barebone-core/blob/7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc/lib/View.php#L65-L74
19,307
barebone-php/barebone-core
lib/View.php
View.renderJSON
public static function renderJSON($data = [], $flags = null) { if (is_null($flags)) { $flags = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES; } json_encode(null); // clear json_last_error() $result = json_encode($data, $flags); if (JSON_ERROR_NONE !== json_last_error()) { throw new InvalidArgumentException( sprintf( 'Unable to encode data to JSON in %s: %s', __CLASS__, json_last_error_msg() ) ); } return $result; }
php
public static function renderJSON($data = [], $flags = null) { if (is_null($flags)) { $flags = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES; } json_encode(null); // clear json_last_error() $result = json_encode($data, $flags); if (JSON_ERROR_NONE !== json_last_error()) { throw new InvalidArgumentException( sprintf( 'Unable to encode data to JSON in %s: %s', __CLASS__, json_last_error_msg() ) ); } return $result; }
[ "public", "static", "function", "renderJSON", "(", "$", "data", "=", "[", "]", ",", "$", "flags", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "flags", ")", ")", "{", "$", "flags", "=", "JSON_HEX_TAG", "|", "JSON_HEX_APOS", "|", "JSON_HEX_AMP", "|", "JSON_HEX_QUOT", "|", "JSON_UNESCAPED_SLASHES", ";", "}", "json_encode", "(", "null", ")", ";", "// clear json_last_error()", "$", "result", "=", "json_encode", "(", "$", "data", ",", "$", "flags", ")", ";", "if", "(", "JSON_ERROR_NONE", "!==", "json_last_error", "(", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'Unable to encode data to JSON in %s: %s'", ",", "__CLASS__", ",", "json_last_error_msg", "(", ")", ")", ")", ";", "}", "return", "$", "result", ";", "}" ]
Json Encode String with given flags @param array $data Associative array of variables names and values. @param integer $flags json_encode options @throws InvalidArgumentException @return string JSON string
[ "Json", "Encode", "String", "with", "given", "flags" ]
7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc
https://github.com/barebone-php/barebone-core/blob/7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc/lib/View.php#L85-L106
19,308
PortaText/php-sdk
src/PortaText/Command/Api/Contacts.php
Contacts.setAll
public function setAll($variables) { $vars = array(); foreach ($variables as $k => $v) { $vars[] = array('key' => $k, 'value' => $v); } return $this->setArgument("variables", $vars); }
php
public function setAll($variables) { $vars = array(); foreach ($variables as $k => $v) { $vars[] = array('key' => $k, 'value' => $v); } return $this->setArgument("variables", $vars); }
[ "public", "function", "setAll", "(", "$", "variables", ")", "{", "$", "vars", "=", "array", "(", ")", ";", "foreach", "(", "$", "variables", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "vars", "[", "]", "=", "array", "(", "'key'", "=>", "$", "k", ",", "'value'", "=>", "$", "v", ")", ";", "}", "return", "$", "this", "->", "setArgument", "(", "\"variables\"", ",", "$", "vars", ")", ";", "}" ]
Sets all the given variables. @param array $variables variables. @return PortaText\Command\ICommand
[ "Sets", "all", "the", "given", "variables", "." ]
dbe04ef043db5b251953f9de57aa4d0f1785dfcc
https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Contacts.php#L87-L94
19,309
atkrad/data-tables
src/Extension/ColVis.php
ColVis.setStateChange
public function setStateChange($stateChange) { $hash = sha1($stateChange); $this->properties['stateChange'] = $hash; $this->callbacks[$hash] = $stateChange; return $this; }
php
public function setStateChange($stateChange) { $hash = sha1($stateChange); $this->properties['stateChange'] = $hash; $this->callbacks[$hash] = $stateChange; return $this; }
[ "public", "function", "setStateChange", "(", "$", "stateChange", ")", "{", "$", "hash", "=", "sha1", "(", "$", "stateChange", ")", ";", "$", "this", "->", "properties", "[", "'stateChange'", "]", "=", "$", "hash", ";", "$", "this", "->", "callbacks", "[", "$", "hash", "]", "=", "$", "stateChange", ";", "return", "$", "this", ";", "}" ]
Set callback function to let you know when the state has changed. @param callback $stateChange Callback function to let you know when the state has changed. @return ColVis @see http://datatables.net/extensions/colvis/options
[ "Set", "callback", "function", "to", "let", "you", "know", "when", "the", "state", "has", "changed", "." ]
5afcc337ab624ca626e29d9674459c5105982b16
https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Extension/ColVis.php#L167-L174
19,310
phug-php/formatter
src/Phug/Formatter/Element/AbstractMarkupElement.php
AbstractMarkupElement.belongsTo
public function belongsTo(array $tagList) { if (is_string($this->getName())) { return in_array(strtolower($this->getName()), $tagList); } return false; }
php
public function belongsTo(array $tagList) { if (is_string($this->getName())) { return in_array(strtolower($this->getName()), $tagList); } return false; }
[ "public", "function", "belongsTo", "(", "array", "$", "tagList", ")", "{", "if", "(", "is_string", "(", "$", "this", "->", "getName", "(", ")", ")", ")", "{", "return", "in_array", "(", "strtolower", "(", "$", "this", "->", "getName", "(", ")", ")", ",", "$", "tagList", ")", ";", "}", "return", "false", ";", "}" ]
Return true if the tag name is in the given list. @param array $tagList @return bool
[ "Return", "true", "if", "the", "tag", "name", "is", "in", "the", "given", "list", "." ]
3f9286a169a0d45b8b8acc1fae64e880ebdb567e
https://github.com/phug-php/formatter/blob/3f9286a169a0d45b8b8acc1fae64e880ebdb567e/src/Phug/Formatter/Element/AbstractMarkupElement.php#L19-L26
19,311
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseApiLog.php
BaseApiLog.setRemoteApp
public function setRemoteApp(RemoteApp $v = null) { if ($v === null) { $this->setRemoteAppId(NULL); } else { $this->setRemoteAppId($v->getId()); } $this->aRemoteApp = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the RemoteApp object, it will not be re-added. if ($v !== null) { $v->addApiLog($this); } return $this; }
php
public function setRemoteApp(RemoteApp $v = null) { if ($v === null) { $this->setRemoteAppId(NULL); } else { $this->setRemoteAppId($v->getId()); } $this->aRemoteApp = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the RemoteApp object, it will not be re-added. if ($v !== null) { $v->addApiLog($this); } return $this; }
[ "public", "function", "setRemoteApp", "(", "RemoteApp", "$", "v", "=", "null", ")", "{", "if", "(", "$", "v", "===", "null", ")", "{", "$", "this", "->", "setRemoteAppId", "(", "NULL", ")", ";", "}", "else", "{", "$", "this", "->", "setRemoteAppId", "(", "$", "v", "->", "getId", "(", ")", ")", ";", "}", "$", "this", "->", "aRemoteApp", "=", "$", "v", ";", "// Add binding for other direction of this n:n relationship.", "// If this object has already been added to the RemoteApp object, it will not be re-added.", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "->", "addApiLog", "(", "$", "this", ")", ";", "}", "return", "$", "this", ";", "}" ]
Declares an association between this object and a RemoteApp object. @param RemoteApp $v @return ApiLog The current object (for fluent API support) @throws PropelException
[ "Declares", "an", "association", "between", "this", "object", "and", "a", "RemoteApp", "object", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseApiLog.php#L1056-L1074
19,312
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseApiLog.php
BaseApiLog.getRemoteApp
public function getRemoteApp(PropelPDO $con = null, $doQuery = true) { if ($this->aRemoteApp === null && ($this->remote_app_id !== null) && $doQuery) { $this->aRemoteApp = RemoteAppQuery::create()->findPk($this->remote_app_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aRemoteApp->addApiLogs($this); */ } return $this->aRemoteApp; }
php
public function getRemoteApp(PropelPDO $con = null, $doQuery = true) { if ($this->aRemoteApp === null && ($this->remote_app_id !== null) && $doQuery) { $this->aRemoteApp = RemoteAppQuery::create()->findPk($this->remote_app_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aRemoteApp->addApiLogs($this); */ } return $this->aRemoteApp; }
[ "public", "function", "getRemoteApp", "(", "PropelPDO", "$", "con", "=", "null", ",", "$", "doQuery", "=", "true", ")", "{", "if", "(", "$", "this", "->", "aRemoteApp", "===", "null", "&&", "(", "$", "this", "->", "remote_app_id", "!==", "null", ")", "&&", "$", "doQuery", ")", "{", "$", "this", "->", "aRemoteApp", "=", "RemoteAppQuery", "::", "create", "(", ")", "->", "findPk", "(", "$", "this", "->", "remote_app_id", ",", "$", "con", ")", ";", "/* The following can be used additionally to\n guarantee the related object contains a reference\n to this object. This level of coupling may, however, be\n undesirable since it could result in an only partially populated collection\n in the referenced object.\n $this->aRemoteApp->addApiLogs($this);\n */", "}", "return", "$", "this", "->", "aRemoteApp", ";", "}" ]
Get the associated RemoteApp object @param PropelPDO $con Optional Connection object. @param $doQuery Executes a query to get the object if required @return RemoteApp The associated RemoteApp object. @throws PropelException
[ "Get", "the", "associated", "RemoteApp", "object" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseApiLog.php#L1085-L1099
19,313
apioo/psx-sandbox
src/Parser.php
Parser.parse
public function parse($code) { $parser = $this->parserFactory->create($this->parserType); try { $ast = $parser->parse($code); } catch (Error $error) { throw new ParseException($error->getMessage(), 0, $error); } $printer = new Printer($this->securityManager); return $printer->prettyPrintFile($ast); }
php
public function parse($code) { $parser = $this->parserFactory->create($this->parserType); try { $ast = $parser->parse($code); } catch (Error $error) { throw new ParseException($error->getMessage(), 0, $error); } $printer = new Printer($this->securityManager); return $printer->prettyPrintFile($ast); }
[ "public", "function", "parse", "(", "$", "code", ")", "{", "$", "parser", "=", "$", "this", "->", "parserFactory", "->", "create", "(", "$", "this", "->", "parserType", ")", ";", "try", "{", "$", "ast", "=", "$", "parser", "->", "parse", "(", "$", "code", ")", ";", "}", "catch", "(", "Error", "$", "error", ")", "{", "throw", "new", "ParseException", "(", "$", "error", "->", "getMessage", "(", ")", ",", "0", ",", "$", "error", ")", ";", "}", "$", "printer", "=", "new", "Printer", "(", "$", "this", "->", "securityManager", ")", ";", "return", "$", "printer", "->", "prettyPrintFile", "(", "$", "ast", ")", ";", "}" ]
Parses untrusted PHP code and returns a secure version which only contains safe calls. Throws an exception in case the code contains untrusted calls @throws \PSX\Sandbox\SecurityException @throws \PSX\Sandbox\ParseException @param string $code @return string
[ "Parses", "untrusted", "PHP", "code", "and", "returns", "a", "secure", "version", "which", "only", "contains", "safe", "calls", ".", "Throws", "an", "exception", "in", "case", "the", "code", "contains", "untrusted", "calls" ]
5d136a398da375056e6526bbbc85d7f5d3df9441
https://github.com/apioo/psx-sandbox/blob/5d136a398da375056e6526bbbc85d7f5d3df9441/src/Parser.php#L67-L79
19,314
fubhy/graphql-php
src/Language/Lexer.php
Lexer.positionAfterWhitespace
protected function positionAfterWhitespace($start) { $position = $start; $length = $this->source->getLength(); while ($start < $length) { $code = $this->charCodeAt($position); // Skip whitespace. if ( $code === 32 || // space $code === 44 || // comma $code === 160 || // '\xa0' $code === 0x2028 || // line separator $code === 0x2029 || // paragraph separator $code > 8 && $code < 14 // whitespace ) { ++$position; // Skip comments. } elseif ($code === 35) { // # ++$position; while ( $position < $length && ($code = $this->charCodeAt($position)) && $code !== 10 && $code !== 13 && $code !== 0x2028 && $code !== 0x2029 ) { ++$position; } } else { break; } } return $position; }
php
protected function positionAfterWhitespace($start) { $position = $start; $length = $this->source->getLength(); while ($start < $length) { $code = $this->charCodeAt($position); // Skip whitespace. if ( $code === 32 || // space $code === 44 || // comma $code === 160 || // '\xa0' $code === 0x2028 || // line separator $code === 0x2029 || // paragraph separator $code > 8 && $code < 14 // whitespace ) { ++$position; // Skip comments. } elseif ($code === 35) { // # ++$position; while ( $position < $length && ($code = $this->charCodeAt($position)) && $code !== 10 && $code !== 13 && $code !== 0x2028 && $code !== 0x2029 ) { ++$position; } } else { break; } } return $position; }
[ "protected", "function", "positionAfterWhitespace", "(", "$", "start", ")", "{", "$", "position", "=", "$", "start", ";", "$", "length", "=", "$", "this", "->", "source", "->", "getLength", "(", ")", ";", "while", "(", "$", "start", "<", "$", "length", ")", "{", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "$", "position", ")", ";", "// Skip whitespace.", "if", "(", "$", "code", "===", "32", "||", "// space", "$", "code", "===", "44", "||", "// comma", "$", "code", "===", "160", "||", "// '\\xa0'", "$", "code", "===", "0x2028", "||", "// line separator", "$", "code", "===", "0x2029", "||", "// paragraph separator", "$", "code", ">", "8", "&&", "$", "code", "<", "14", "// whitespace", ")", "{", "++", "$", "position", ";", "// Skip comments.", "}", "elseif", "(", "$", "code", "===", "35", ")", "{", "// #", "++", "$", "position", ";", "while", "(", "$", "position", "<", "$", "length", "&&", "(", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "$", "position", ")", ")", "&&", "$", "code", "!==", "10", "&&", "$", "code", "!==", "13", "&&", "$", "code", "!==", "0x2028", "&&", "$", "code", "!==", "0x2029", ")", "{", "++", "$", "position", ";", "}", "}", "else", "{", "break", ";", "}", "}", "return", "$", "position", ";", "}" ]
Reads from body starting at startPosition until it finds a non-whitespace or commented character, then returns the position of that character for lexing. @param int $start @return int
[ "Reads", "from", "body", "starting", "at", "startPosition", "until", "it", "finds", "a", "non", "-", "whitespace", "or", "commented", "character", "then", "returns", "the", "position", "of", "that", "character", "for", "lexing", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Lexer.php#L28-L63
19,315
fubhy/graphql-php
src/Language/Lexer.php
Lexer.readNumber
protected function readNumber($start, $code) { $position = $start; $type = Token::INT_TYPE; if ($code === 45) { // - $code = $this->charCodeAt(++$position); } if ($code === 48) { // 0 $code = $this->charCodeAt(++$position); } elseif ($code >= 49 && $code <= 57) { // 1 - 9 do { $code = $this->charCodeAt(++$position); } while ($code >= 48 && $code <= 57); // 0 - 9 } else { // @todo Throw proper exception. throw new \Exception('Invalid number.'); } if ($code === 46) { // . $type = Token::FLOAT_TYPE; $code = $this->charCodeAt(++$position); if ($code >= 48 && $code <= 57) { // 0 - 9 do { $code = $this->charCodeAt(++$position); } while ($code >= 48 && $code <= 57); // 0 - 9 } else { // @todo Throw proper exception. throw new \Exception('Invalid number.'); } if ($code === 69 || $code === 101) { // E e $code = $this->charCodeAt(++$position); if ($code === 43 || $code === 45) { // + - $code = $this->charCodeAt(++$position); } if ($code >= 48 && $code <= 57) { // 0 - 9 do { $code = $this->charCodeAt(++$position); } while ($code >= 48 && $code <= 57); // 0 - 9 } else { // @todo Throw proper exception. throw new \Exception('Invalid number.'); } } } $body = $this->source->getBody(); $value = mb_substr($body, $start, $position - $start, 'UTF-8'); return new Token($type, $start, $position, $value); }
php
protected function readNumber($start, $code) { $position = $start; $type = Token::INT_TYPE; if ($code === 45) { // - $code = $this->charCodeAt(++$position); } if ($code === 48) { // 0 $code = $this->charCodeAt(++$position); } elseif ($code >= 49 && $code <= 57) { // 1 - 9 do { $code = $this->charCodeAt(++$position); } while ($code >= 48 && $code <= 57); // 0 - 9 } else { // @todo Throw proper exception. throw new \Exception('Invalid number.'); } if ($code === 46) { // . $type = Token::FLOAT_TYPE; $code = $this->charCodeAt(++$position); if ($code >= 48 && $code <= 57) { // 0 - 9 do { $code = $this->charCodeAt(++$position); } while ($code >= 48 && $code <= 57); // 0 - 9 } else { // @todo Throw proper exception. throw new \Exception('Invalid number.'); } if ($code === 69 || $code === 101) { // E e $code = $this->charCodeAt(++$position); if ($code === 43 || $code === 45) { // + - $code = $this->charCodeAt(++$position); } if ($code >= 48 && $code <= 57) { // 0 - 9 do { $code = $this->charCodeAt(++$position); } while ($code >= 48 && $code <= 57); // 0 - 9 } else { // @todo Throw proper exception. throw new \Exception('Invalid number.'); } } } $body = $this->source->getBody(); $value = mb_substr($body, $start, $position - $start, 'UTF-8'); return new Token($type, $start, $position, $value); }
[ "protected", "function", "readNumber", "(", "$", "start", ",", "$", "code", ")", "{", "$", "position", "=", "$", "start", ";", "$", "type", "=", "Token", "::", "INT_TYPE", ";", "if", "(", "$", "code", "===", "45", ")", "{", "// -", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "++", "$", "position", ")", ";", "}", "if", "(", "$", "code", "===", "48", ")", "{", "// 0", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "++", "$", "position", ")", ";", "}", "elseif", "(", "$", "code", ">=", "49", "&&", "$", "code", "<=", "57", ")", "{", "// 1 - 9", "do", "{", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "++", "$", "position", ")", ";", "}", "while", "(", "$", "code", ">=", "48", "&&", "$", "code", "<=", "57", ")", ";", "// 0 - 9", "}", "else", "{", "// @todo Throw proper exception.", "throw", "new", "\\", "Exception", "(", "'Invalid number.'", ")", ";", "}", "if", "(", "$", "code", "===", "46", ")", "{", "// .", "$", "type", "=", "Token", "::", "FLOAT_TYPE", ";", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "++", "$", "position", ")", ";", "if", "(", "$", "code", ">=", "48", "&&", "$", "code", "<=", "57", ")", "{", "// 0 - 9", "do", "{", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "++", "$", "position", ")", ";", "}", "while", "(", "$", "code", ">=", "48", "&&", "$", "code", "<=", "57", ")", ";", "// 0 - 9", "}", "else", "{", "// @todo Throw proper exception.", "throw", "new", "\\", "Exception", "(", "'Invalid number.'", ")", ";", "}", "if", "(", "$", "code", "===", "69", "||", "$", "code", "===", "101", ")", "{", "// E e", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "++", "$", "position", ")", ";", "if", "(", "$", "code", "===", "43", "||", "$", "code", "===", "45", ")", "{", "// + -", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "++", "$", "position", ")", ";", "}", "if", "(", "$", "code", ">=", "48", "&&", "$", "code", "<=", "57", ")", "{", "// 0 - 9", "do", "{", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "++", "$", "position", ")", ";", "}", "while", "(", "$", "code", ">=", "48", "&&", "$", "code", "<=", "57", ")", ";", "// 0 - 9", "}", "else", "{", "// @todo Throw proper exception.", "throw", "new", "\\", "Exception", "(", "'Invalid number.'", ")", ";", "}", "}", "}", "$", "body", "=", "$", "this", "->", "source", "->", "getBody", "(", ")", ";", "$", "value", "=", "mb_substr", "(", "$", "body", ",", "$", "start", ",", "$", "position", "-", "$", "start", ",", "'UTF-8'", ")", ";", "return", "new", "Token", "(", "$", "type", ",", "$", "start", ",", "$", "position", ",", "$", "value", ")", ";", "}" ]
Reads a number token from the source file, either a float or an int depending on whether a decimal point appears. Int: -?(0|[1-9][0-9]*) Float: -?(0|[1-9][0-9]*)\.[0-9]+(e-?[0-9]+)? @param int $start @param int $code @return \Fubhy\GraphQL\Language\Token @throws \Exception
[ "Reads", "a", "number", "token", "from", "the", "source", "file", "either", "a", "float", "or", "an", "int", "depending", "on", "whether", "a", "decimal", "point", "appears", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Lexer.php#L168-L220
19,316
fubhy/graphql-php
src/Language/Lexer.php
Lexer.readName
protected function readName($position) { $end = $position + 1; $length = $this->source->getLength(); $body = $this->source->getBody(); while ( $end < $length && ($code = $this->charCodeAt($end)) && ( $code === 95 || // _ $code >= 48 && $code <= 57 || // 0-9 $code >= 65 && $code <= 90 || // A-Z $code >= 97 && $code <= 122 // a-z ) ) { ++$end; } $value = mb_substr($body, $position, $end - $position, 'UTF-8'); return new Token(Token::NAME_TYPE, $position, $end, $value); }
php
protected function readName($position) { $end = $position + 1; $length = $this->source->getLength(); $body = $this->source->getBody(); while ( $end < $length && ($code = $this->charCodeAt($end)) && ( $code === 95 || // _ $code >= 48 && $code <= 57 || // 0-9 $code >= 65 && $code <= 90 || // A-Z $code >= 97 && $code <= 122 // a-z ) ) { ++$end; } $value = mb_substr($body, $position, $end - $position, 'UTF-8'); return new Token(Token::NAME_TYPE, $position, $end, $value); }
[ "protected", "function", "readName", "(", "$", "position", ")", "{", "$", "end", "=", "$", "position", "+", "1", ";", "$", "length", "=", "$", "this", "->", "source", "->", "getLength", "(", ")", ";", "$", "body", "=", "$", "this", "->", "source", "->", "getBody", "(", ")", ";", "while", "(", "$", "end", "<", "$", "length", "&&", "(", "$", "code", "=", "$", "this", "->", "charCodeAt", "(", "$", "end", ")", ")", "&&", "(", "$", "code", "===", "95", "||", "// _", "$", "code", ">=", "48", "&&", "$", "code", "<=", "57", "||", "// 0-9", "$", "code", ">=", "65", "&&", "$", "code", "<=", "90", "||", "// A-Z", "$", "code", ">=", "97", "&&", "$", "code", "<=", "122", "// a-z", ")", ")", "{", "++", "$", "end", ";", "}", "$", "value", "=", "mb_substr", "(", "$", "body", ",", "$", "position", ",", "$", "end", "-", "$", "position", ",", "'UTF-8'", ")", ";", "return", "new", "Token", "(", "Token", "::", "NAME_TYPE", ",", "$", "position", ",", "$", "end", ",", "$", "value", ")", ";", "}" ]
Reads an alphanumeric + underscore name from the source. [_A-Za-z][_0-9A-Za-z]* @param int $position @return \Fubhy\GraphQL\Language\Token
[ "Reads", "an", "alphanumeric", "+", "underscore", "name", "from", "the", "source", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Lexer.php#L319-L340
19,317
fubhy/graphql-php
src/Language/Lexer.php
Lexer.charCodeAt
protected function charCodeAt($index) { $body = $this->source->getBody(); $char = mb_substr($body, $index, 1, 'UTF-8'); if (mb_check_encoding($char, 'UTF-8')) { return hexdec(bin2hex(mb_convert_encoding($char, 'UTF-32BE', 'UTF-8'))); } else { return NULL; } }
php
protected function charCodeAt($index) { $body = $this->source->getBody(); $char = mb_substr($body, $index, 1, 'UTF-8'); if (mb_check_encoding($char, 'UTF-8')) { return hexdec(bin2hex(mb_convert_encoding($char, 'UTF-32BE', 'UTF-8'))); } else { return NULL; } }
[ "protected", "function", "charCodeAt", "(", "$", "index", ")", "{", "$", "body", "=", "$", "this", "->", "source", "->", "getBody", "(", ")", ";", "$", "char", "=", "mb_substr", "(", "$", "body", ",", "$", "index", ",", "1", ",", "'UTF-8'", ")", ";", "if", "(", "mb_check_encoding", "(", "$", "char", ",", "'UTF-8'", ")", ")", "{", "return", "hexdec", "(", "bin2hex", "(", "mb_convert_encoding", "(", "$", "char", ",", "'UTF-32BE'", ",", "'UTF-8'", ")", ")", ")", ";", "}", "else", "{", "return", "NULL", ";", "}", "}" ]
Implementation of JavaScript's String.prototype.charCodeAt function. @param int $index @return null|number
[ "Implementation", "of", "JavaScript", "s", "String", ".", "prototype", ".", "charCodeAt", "function", "." ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Lexer.php#L349-L359
19,318
fubhy/graphql-php
src/Language/Lexer.php
Lexer.char2hex
protected function char2hex($a) { return $a >= 48 && $a <= 57 ? $a - 48 : // 0-9 ($a >= 65 && $a <= 70 ? $a - 55 : // A-F ($a >= 97 && $a <= 102 ? $a - 87 : -1)); // a-f }
php
protected function char2hex($a) { return $a >= 48 && $a <= 57 ? $a - 48 : // 0-9 ($a >= 65 && $a <= 70 ? $a - 55 : // A-F ($a >= 97 && $a <= 102 ? $a - 87 : -1)); // a-f }
[ "protected", "function", "char2hex", "(", "$", "a", ")", "{", "return", "$", "a", ">=", "48", "&&", "$", "a", "<=", "57", "?", "$", "a", "-", "48", ":", "// 0-9", "(", "$", "a", ">=", "65", "&&", "$", "a", "<=", "70", "?", "$", "a", "-", "55", ":", "// A-F", "(", "$", "a", ">=", "97", "&&", "$", "a", "<=", "102", "?", "$", "a", "-", "87", ":", "-", "1", ")", ")", ";", "// a-f", "}" ]
Converts a hex character to its integer value. '0' becomes 0, '9' becomes 9 'A' becomes 10, 'F' becomes 15 'a' becomes 10, 'f' becomes 15 Returns -1 on error. @param $a @return int
[ "Converts", "a", "hex", "character", "to", "its", "integer", "value", ".", "0", "becomes", "0", "9", "becomes", "9", "A", "becomes", "10", "F", "becomes", "15", "a", "becomes", "10", "f", "becomes", "15" ]
c1de2233c731ca29e5c5db4c43f3b9db36478c83
https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Language/Lexer.php#L408-L414
19,319
webforge-labs/psc-cms
lib/Psc/Doctrine/NestedSetFixture.php
NestedSetFixture.convertNodes
protected function convertNodes(Array $nodes, $em) { // our test project (this) is defined to have only de as i18n but dont get confused, these are english wordings $navigationNodes = array(); foreach ($nodes as $node) { $node = (object) $node; $navigationNode = $this->createNode(array('de'=>$node->title)); $navigationNode->setContext($this->context); $navigationNode->generateSlugs(); $page = $this->createPage($navigationNode->getSlug('de')); $page->setActive(TRUE); $em->persist($page); $navigationNode->setPage($page); $navigationNodes[$navigationNode->getTitle('de')] = $navigationNode; } foreach ($nodes as $node) { $node = (object) $node; if (isset($node->parent)) { $navigationNodes[$node->title]->setParent($navigationNodes[$node->parent]); } } return $navigationNodes; }
php
protected function convertNodes(Array $nodes, $em) { // our test project (this) is defined to have only de as i18n but dont get confused, these are english wordings $navigationNodes = array(); foreach ($nodes as $node) { $node = (object) $node; $navigationNode = $this->createNode(array('de'=>$node->title)); $navigationNode->setContext($this->context); $navigationNode->generateSlugs(); $page = $this->createPage($navigationNode->getSlug('de')); $page->setActive(TRUE); $em->persist($page); $navigationNode->setPage($page); $navigationNodes[$navigationNode->getTitle('de')] = $navigationNode; } foreach ($nodes as $node) { $node = (object) $node; if (isset($node->parent)) { $navigationNodes[$node->title]->setParent($navigationNodes[$node->parent]); } } return $navigationNodes; }
[ "protected", "function", "convertNodes", "(", "Array", "$", "nodes", ",", "$", "em", ")", "{", "// our test project (this) is defined to have only de as i18n but dont get confused, these are english wordings", "$", "navigationNodes", "=", "array", "(", ")", ";", "foreach", "(", "$", "nodes", "as", "$", "node", ")", "{", "$", "node", "=", "(", "object", ")", "$", "node", ";", "$", "navigationNode", "=", "$", "this", "->", "createNode", "(", "array", "(", "'de'", "=>", "$", "node", "->", "title", ")", ")", ";", "$", "navigationNode", "->", "setContext", "(", "$", "this", "->", "context", ")", ";", "$", "navigationNode", "->", "generateSlugs", "(", ")", ";", "$", "page", "=", "$", "this", "->", "createPage", "(", "$", "navigationNode", "->", "getSlug", "(", "'de'", ")", ")", ";", "$", "page", "->", "setActive", "(", "TRUE", ")", ";", "$", "em", "->", "persist", "(", "$", "page", ")", ";", "$", "navigationNode", "->", "setPage", "(", "$", "page", ")", ";", "$", "navigationNodes", "[", "$", "navigationNode", "->", "getTitle", "(", "'de'", ")", "]", "=", "$", "navigationNode", ";", "}", "foreach", "(", "$", "nodes", "as", "$", "node", ")", "{", "$", "node", "=", "(", "object", ")", "$", "node", ";", "if", "(", "isset", "(", "$", "node", "->", "parent", ")", ")", "{", "$", "navigationNodes", "[", "$", "node", "->", "title", "]", "->", "setParent", "(", "$", "navigationNodes", "[", "$", "node", "->", "parent", "]", ")", ";", "}", "}", "return", "$", "navigationNodes", ";", "}" ]
we elevate every node to an entity and set parent pointers
[ "we", "elevate", "every", "node", "to", "an", "entity", "and", "set", "parent", "pointers" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/NestedSetFixture.php#L47-L75
19,320
vorbind/influx-analytics
src/Mapper/AnalyticsMapper.php
AnalyticsMapper.getRpPoints
public function getRpPoints($rp, $metric, $tags, $granularity, $startDt = null, $endDt = null, $timezone = 'utc') { if (null == $rp || null == $metric) { return []; } $where = []; $query = $this->db->getQueryBuilder() ->retentionPolicy($rp) ->sum('value') ->from($metric); if (isset($endDt)) { $where[] = "time <= '" . $endDt . "'"; } if (isset($startDt)) { $where[] = "time >= '" . $startDt . "'"; } foreach ($tags as $key => $val) { $where[] = "$key = '" . $val . "'"; } $query->where($where); $groupBy = "time(1d) tz('" . $timezone . "')"; if ($granularity == self::GRANULARITY_HOURLY) { //timeoffset doesn't work hourly $groupBy = "time(1h) tz('" . $timezone . "')"; } else if ($granularity == self::GRANULARITY_DAILY) { $groupBy = "time(1d) tz('" . $timezone . "')"; } else if ($granularity == self::GRANULARITY_WEEKLY) { $groupBy = "time(1w) tz('" . $timezone . "')"; } $query->groupBy($groupBy); return $query->getResultSet()->getPoints(); }
php
public function getRpPoints($rp, $metric, $tags, $granularity, $startDt = null, $endDt = null, $timezone = 'utc') { if (null == $rp || null == $metric) { return []; } $where = []; $query = $this->db->getQueryBuilder() ->retentionPolicy($rp) ->sum('value') ->from($metric); if (isset($endDt)) { $where[] = "time <= '" . $endDt . "'"; } if (isset($startDt)) { $where[] = "time >= '" . $startDt . "'"; } foreach ($tags as $key => $val) { $where[] = "$key = '" . $val . "'"; } $query->where($where); $groupBy = "time(1d) tz('" . $timezone . "')"; if ($granularity == self::GRANULARITY_HOURLY) { //timeoffset doesn't work hourly $groupBy = "time(1h) tz('" . $timezone . "')"; } else if ($granularity == self::GRANULARITY_DAILY) { $groupBy = "time(1d) tz('" . $timezone . "')"; } else if ($granularity == self::GRANULARITY_WEEKLY) { $groupBy = "time(1w) tz('" . $timezone . "')"; } $query->groupBy($groupBy); return $query->getResultSet()->getPoints(); }
[ "public", "function", "getRpPoints", "(", "$", "rp", ",", "$", "metric", ",", "$", "tags", ",", "$", "granularity", ",", "$", "startDt", "=", "null", ",", "$", "endDt", "=", "null", ",", "$", "timezone", "=", "'utc'", ")", "{", "if", "(", "null", "==", "$", "rp", "||", "null", "==", "$", "metric", ")", "{", "return", "[", "]", ";", "}", "$", "where", "=", "[", "]", ";", "$", "query", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "retentionPolicy", "(", "$", "rp", ")", "->", "sum", "(", "'value'", ")", "->", "from", "(", "$", "metric", ")", ";", "if", "(", "isset", "(", "$", "endDt", ")", ")", "{", "$", "where", "[", "]", "=", "\"time <= '\"", ".", "$", "endDt", ".", "\"'\"", ";", "}", "if", "(", "isset", "(", "$", "startDt", ")", ")", "{", "$", "where", "[", "]", "=", "\"time >= '\"", ".", "$", "startDt", ".", "\"'\"", ";", "}", "foreach", "(", "$", "tags", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "where", "[", "]", "=", "\"$key = '\"", ".", "$", "val", ".", "\"'\"", ";", "}", "$", "query", "->", "where", "(", "$", "where", ")", ";", "$", "groupBy", "=", "\"time(1d) tz('\"", ".", "$", "timezone", ".", "\"')\"", ";", "if", "(", "$", "granularity", "==", "self", "::", "GRANULARITY_HOURLY", ")", "{", "//timeoffset doesn't work hourly", "$", "groupBy", "=", "\"time(1h) tz('\"", ".", "$", "timezone", ".", "\"')\"", ";", "}", "else", "if", "(", "$", "granularity", "==", "self", "::", "GRANULARITY_DAILY", ")", "{", "$", "groupBy", "=", "\"time(1d) tz('\"", ".", "$", "timezone", ".", "\"')\"", ";", "}", "else", "if", "(", "$", "granularity", "==", "self", "::", "GRANULARITY_WEEKLY", ")", "{", "$", "groupBy", "=", "\"time(1w) tz('\"", ".", "$", "timezone", ".", "\"')\"", ";", "}", "$", "query", "->", "groupBy", "(", "$", "groupBy", ")", ";", "return", "$", "query", "->", "getResultSet", "(", ")", "->", "getPoints", "(", ")", ";", "}" ]
Get points from retention policy @param string $rp @param string $metric @param array $tags @param string $granularity @param string $startDt @param string $endDt @param string $timezone @return array
[ "Get", "points", "from", "retention", "policy" ]
8c0c150351f045ccd3d57063f2b3b50a2c926e3e
https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Mapper/AnalyticsMapper.php#L57-L96
19,321
vorbind/influx-analytics
src/Mapper/AnalyticsMapper.php
AnalyticsMapper.getPoints
public function getPoints($metric, $tags, $granularity, $endDt, $timezone = 'utc') { if ( null == $metric ) { return []; } $where = []; $now = $this->normalizeUTC(date("Y-m-d H:i:s")); $min = intval(date('i')); $minutes = $min > 45 ? 45 : ( $min > 30 ? 30 : ( $min > 15 ? 15 : '00') ); $lastHourDt = date("Y-m-d") . "T" . date('H') . ":$minutes:00Z"; if (strtotime($endDt) < strtotime($lastHourDt)) { return []; } $where[] = "time >= '" . $lastHourDt . "' AND time <= '" . $now . "'"; foreach ($tags as $key => $val) { $where[] = "$key = '" . $val . "'"; } $query = $this->db->getQueryBuilder() ->sum('value') ->from($metric) ->where($where); $groupBy = "time(1d) tz('" . $timezone . "')"; if ($granularity == self::GRANULARITY_HOURLY) { $groupBy = "time(1h) tz('" . $timezone . "')"; } else if ($granularity == self::GRANULARITY_DAILY) { $groupBy = "time(1d) tz('" . $timezone . "')"; } else if ($granularity == self::GRANULARITY_WEEKLY) { $groupBy = "time(1w) tz('" . $timezone . "')"; } $query->groupBy($groupBy); return $query->getResultSet()->getPoints(); }
php
public function getPoints($metric, $tags, $granularity, $endDt, $timezone = 'utc') { if ( null == $metric ) { return []; } $where = []; $now = $this->normalizeUTC(date("Y-m-d H:i:s")); $min = intval(date('i')); $minutes = $min > 45 ? 45 : ( $min > 30 ? 30 : ( $min > 15 ? 15 : '00') ); $lastHourDt = date("Y-m-d") . "T" . date('H') . ":$minutes:00Z"; if (strtotime($endDt) < strtotime($lastHourDt)) { return []; } $where[] = "time >= '" . $lastHourDt . "' AND time <= '" . $now . "'"; foreach ($tags as $key => $val) { $where[] = "$key = '" . $val . "'"; } $query = $this->db->getQueryBuilder() ->sum('value') ->from($metric) ->where($where); $groupBy = "time(1d) tz('" . $timezone . "')"; if ($granularity == self::GRANULARITY_HOURLY) { $groupBy = "time(1h) tz('" . $timezone . "')"; } else if ($granularity == self::GRANULARITY_DAILY) { $groupBy = "time(1d) tz('" . $timezone . "')"; } else if ($granularity == self::GRANULARITY_WEEKLY) { $groupBy = "time(1w) tz('" . $timezone . "')"; } $query->groupBy($groupBy); return $query->getResultSet()->getPoints(); }
[ "public", "function", "getPoints", "(", "$", "metric", ",", "$", "tags", ",", "$", "granularity", ",", "$", "endDt", ",", "$", "timezone", "=", "'utc'", ")", "{", "if", "(", "null", "==", "$", "metric", ")", "{", "return", "[", "]", ";", "}", "$", "where", "=", "[", "]", ";", "$", "now", "=", "$", "this", "->", "normalizeUTC", "(", "date", "(", "\"Y-m-d H:i:s\"", ")", ")", ";", "$", "min", "=", "intval", "(", "date", "(", "'i'", ")", ")", ";", "$", "minutes", "=", "$", "min", ">", "45", "?", "45", ":", "(", "$", "min", ">", "30", "?", "30", ":", "(", "$", "min", ">", "15", "?", "15", ":", "'00'", ")", ")", ";", "$", "lastHourDt", "=", "date", "(", "\"Y-m-d\"", ")", ".", "\"T\"", ".", "date", "(", "'H'", ")", ".", "\":$minutes:00Z\"", ";", "if", "(", "strtotime", "(", "$", "endDt", ")", "<", "strtotime", "(", "$", "lastHourDt", ")", ")", "{", "return", "[", "]", ";", "}", "$", "where", "[", "]", "=", "\"time >= '\"", ".", "$", "lastHourDt", ".", "\"' AND time <= '\"", ".", "$", "now", ".", "\"'\"", ";", "foreach", "(", "$", "tags", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "where", "[", "]", "=", "\"$key = '\"", ".", "$", "val", ".", "\"'\"", ";", "}", "$", "query", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "sum", "(", "'value'", ")", "->", "from", "(", "$", "metric", ")", "->", "where", "(", "$", "where", ")", ";", "$", "groupBy", "=", "\"time(1d) tz('\"", ".", "$", "timezone", ".", "\"')\"", ";", "if", "(", "$", "granularity", "==", "self", "::", "GRANULARITY_HOURLY", ")", "{", "$", "groupBy", "=", "\"time(1h) tz('\"", ".", "$", "timezone", ".", "\"')\"", ";", "}", "else", "if", "(", "$", "granularity", "==", "self", "::", "GRANULARITY_DAILY", ")", "{", "$", "groupBy", "=", "\"time(1d) tz('\"", ".", "$", "timezone", ".", "\"')\"", ";", "}", "else", "if", "(", "$", "granularity", "==", "self", "::", "GRANULARITY_WEEKLY", ")", "{", "$", "groupBy", "=", "\"time(1w) tz('\"", ".", "$", "timezone", ".", "\"')\"", ";", "}", "$", "query", "->", "groupBy", "(", "$", "groupBy", ")", ";", "return", "$", "query", "->", "getResultSet", "(", ")", "->", "getPoints", "(", ")", ";", "}" ]
Get points from default retention policy @param string $metric @param array $tags @param string $granularity @param string $endDt @param string $timezone @return array
[ "Get", "points", "from", "default", "retention", "policy" ]
8c0c150351f045ccd3d57063f2b3b50a2c926e3e
https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Mapper/AnalyticsMapper.php#L108-L147
19,322
vorbind/influx-analytics
src/Mapper/AnalyticsMapper.php
AnalyticsMapper.getRpSum
public function getRpSum($rp, $metric, $tags, $startDt = null, $endDt = null) { if (null == $rp || null == $metric) { return 0; } $where = []; if (isset($startDt)) { $where[] = "time >= '" . $startDt . "'"; } if (!isset($endDt)) { $endDt = '2100-01-01T00:00:00Z'; } $where[] = "time <= '" . $endDt . "'"; foreach ($tags as $key => $val) { $where[] = "$key = '" . $val . "'"; } $points = $this->db->getQueryBuilder() ->retentionPolicy($rp) ->from($metric) ->where($where) ->sum('value') ->getResultSet() ->getPoints(); return isset($points[0]) && isset($points[0]["sum"]) ? $points[0]["sum"] : 0; }
php
public function getRpSum($rp, $metric, $tags, $startDt = null, $endDt = null) { if (null == $rp || null == $metric) { return 0; } $where = []; if (isset($startDt)) { $where[] = "time >= '" . $startDt . "'"; } if (!isset($endDt)) { $endDt = '2100-01-01T00:00:00Z'; } $where[] = "time <= '" . $endDt . "'"; foreach ($tags as $key => $val) { $where[] = "$key = '" . $val . "'"; } $points = $this->db->getQueryBuilder() ->retentionPolicy($rp) ->from($metric) ->where($where) ->sum('value') ->getResultSet() ->getPoints(); return isset($points[0]) && isset($points[0]["sum"]) ? $points[0]["sum"] : 0; }
[ "public", "function", "getRpSum", "(", "$", "rp", ",", "$", "metric", ",", "$", "tags", ",", "$", "startDt", "=", "null", ",", "$", "endDt", "=", "null", ")", "{", "if", "(", "null", "==", "$", "rp", "||", "null", "==", "$", "metric", ")", "{", "return", "0", ";", "}", "$", "where", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "startDt", ")", ")", "{", "$", "where", "[", "]", "=", "\"time >= '\"", ".", "$", "startDt", ".", "\"'\"", ";", "}", "if", "(", "!", "isset", "(", "$", "endDt", ")", ")", "{", "$", "endDt", "=", "'2100-01-01T00:00:00Z'", ";", "}", "$", "where", "[", "]", "=", "\"time <= '\"", ".", "$", "endDt", ".", "\"'\"", ";", "foreach", "(", "$", "tags", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "where", "[", "]", "=", "\"$key = '\"", ".", "$", "val", ".", "\"'\"", ";", "}", "$", "points", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "retentionPolicy", "(", "$", "rp", ")", "->", "from", "(", "$", "metric", ")", "->", "where", "(", "$", "where", ")", "->", "sum", "(", "'value'", ")", "->", "getResultSet", "(", ")", "->", "getPoints", "(", ")", ";", "return", "isset", "(", "$", "points", "[", "0", "]", ")", "&&", "isset", "(", "$", "points", "[", "0", "]", "[", "\"sum\"", "]", ")", "?", "$", "points", "[", "0", "]", "[", "\"sum\"", "]", ":", "0", ";", "}" ]
Get total from retention policy @param string $rp @param string $metric @param array $tags @param string $startDt @param string $endDt @return int
[ "Get", "total", "from", "retention", "policy" ]
8c0c150351f045ccd3d57063f2b3b50a2c926e3e
https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Mapper/AnalyticsMapper.php#L159-L188
19,323
vorbind/influx-analytics
src/Mapper/AnalyticsMapper.php
AnalyticsMapper.getSum
public function getSum($metric, $tags, $endDt = null) { if (null == $metric) { return 0; } $min = intval(date('i')); $minutes = $min > 45 ? 45 : ( $min > 30 ? 30 : ( $min > 15 ? 15 : '00') ); $lastHourDt = date("Y-m-d") . "T" . date('H') . ":$minutes:00Z"; $where = []; if (!isset($endDt)) { $endDt = '2100-01-01T00:00:00Z'; } if (strtotime($endDt) < strtotime($lastHourDt)) { return 0; } $where[] = "time >= '" . $lastHourDt . "' AND time <= '" . $endDt . "'"; foreach ($tags as $key => $val) { $where[] = "$key = '" . $val . "'"; } $points = $this->db->getQueryBuilder() ->from($metric) ->where($where) ->sum('value') ->getResultSet() ->getPoints(); return isset($points[0]) && isset($points[0]["sum"]) ? $points[0]["sum"] : 0; }
php
public function getSum($metric, $tags, $endDt = null) { if (null == $metric) { return 0; } $min = intval(date('i')); $minutes = $min > 45 ? 45 : ( $min > 30 ? 30 : ( $min > 15 ? 15 : '00') ); $lastHourDt = date("Y-m-d") . "T" . date('H') . ":$minutes:00Z"; $where = []; if (!isset($endDt)) { $endDt = '2100-01-01T00:00:00Z'; } if (strtotime($endDt) < strtotime($lastHourDt)) { return 0; } $where[] = "time >= '" . $lastHourDt . "' AND time <= '" . $endDt . "'"; foreach ($tags as $key => $val) { $where[] = "$key = '" . $val . "'"; } $points = $this->db->getQueryBuilder() ->from($metric) ->where($where) ->sum('value') ->getResultSet() ->getPoints(); return isset($points[0]) && isset($points[0]["sum"]) ? $points[0]["sum"] : 0; }
[ "public", "function", "getSum", "(", "$", "metric", ",", "$", "tags", ",", "$", "endDt", "=", "null", ")", "{", "if", "(", "null", "==", "$", "metric", ")", "{", "return", "0", ";", "}", "$", "min", "=", "intval", "(", "date", "(", "'i'", ")", ")", ";", "$", "minutes", "=", "$", "min", ">", "45", "?", "45", ":", "(", "$", "min", ">", "30", "?", "30", ":", "(", "$", "min", ">", "15", "?", "15", ":", "'00'", ")", ")", ";", "$", "lastHourDt", "=", "date", "(", "\"Y-m-d\"", ")", ".", "\"T\"", ".", "date", "(", "'H'", ")", ".", "\":$minutes:00Z\"", ";", "$", "where", "=", "[", "]", ";", "if", "(", "!", "isset", "(", "$", "endDt", ")", ")", "{", "$", "endDt", "=", "'2100-01-01T00:00:00Z'", ";", "}", "if", "(", "strtotime", "(", "$", "endDt", ")", "<", "strtotime", "(", "$", "lastHourDt", ")", ")", "{", "return", "0", ";", "}", "$", "where", "[", "]", "=", "\"time >= '\"", ".", "$", "lastHourDt", ".", "\"' AND time <= '\"", ".", "$", "endDt", ".", "\"'\"", ";", "foreach", "(", "$", "tags", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "where", "[", "]", "=", "\"$key = '\"", ".", "$", "val", ".", "\"'\"", ";", "}", "$", "points", "=", "$", "this", "->", "db", "->", "getQueryBuilder", "(", ")", "->", "from", "(", "$", "metric", ")", "->", "where", "(", "$", "where", ")", "->", "sum", "(", "'value'", ")", "->", "getResultSet", "(", ")", "->", "getPoints", "(", ")", ";", "return", "isset", "(", "$", "points", "[", "0", "]", ")", "&&", "isset", "(", "$", "points", "[", "0", "]", "[", "\"sum\"", "]", ")", "?", "$", "points", "[", "0", "]", "[", "\"sum\"", "]", ":", "0", ";", "}" ]
Get total from default retention policy @param string $metric @param array $tags @param string $endDt @return int
[ "Get", "total", "from", "default", "retention", "policy" ]
8c0c150351f045ccd3d57063f2b3b50a2c926e3e
https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Mapper/AnalyticsMapper.php#L198-L231
19,324
ppetermann/king23
src/Http/Application.php
Application.run
public function run() { /** @var ResponseInterface $response */ $response = $this->queue->handle($this->request); // http status $reasonPhrase = $response->getReasonPhrase(); $reasonPhrase = ($reasonPhrase ? ' '.$reasonPhrase : ''); header(sprintf('HTTP/%s %d%s', $response->getProtocolVersion(), $response->getStatusCode(), $reasonPhrase)); // additional headers foreach ($response->getHeaders() as $header => $values) { $first = true; foreach ($values as $value) { header(sprintf('%s: %s', $header, $value), $first); $first = false; } } echo $response->getBody(); }
php
public function run() { /** @var ResponseInterface $response */ $response = $this->queue->handle($this->request); // http status $reasonPhrase = $response->getReasonPhrase(); $reasonPhrase = ($reasonPhrase ? ' '.$reasonPhrase : ''); header(sprintf('HTTP/%s %d%s', $response->getProtocolVersion(), $response->getStatusCode(), $reasonPhrase)); // additional headers foreach ($response->getHeaders() as $header => $values) { $first = true; foreach ($values as $value) { header(sprintf('%s: %s', $header, $value), $first); $first = false; } } echo $response->getBody(); }
[ "public", "function", "run", "(", ")", "{", "/** @var ResponseInterface $response */", "$", "response", "=", "$", "this", "->", "queue", "->", "handle", "(", "$", "this", "->", "request", ")", ";", "// http status", "$", "reasonPhrase", "=", "$", "response", "->", "getReasonPhrase", "(", ")", ";", "$", "reasonPhrase", "=", "(", "$", "reasonPhrase", "?", "' '", ".", "$", "reasonPhrase", ":", "''", ")", ";", "header", "(", "sprintf", "(", "'HTTP/%s %d%s'", ",", "$", "response", "->", "getProtocolVersion", "(", ")", ",", "$", "response", "->", "getStatusCode", "(", ")", ",", "$", "reasonPhrase", ")", ")", ";", "// additional headers", "foreach", "(", "$", "response", "->", "getHeaders", "(", ")", "as", "$", "header", "=>", "$", "values", ")", "{", "$", "first", "=", "true", ";", "foreach", "(", "$", "values", "as", "$", "value", ")", "{", "header", "(", "sprintf", "(", "'%s: %s'", ",", "$", "header", ",", "$", "value", ")", ",", "$", "first", ")", ";", "$", "first", "=", "false", ";", "}", "}", "echo", "$", "response", "->", "getBody", "(", ")", ";", "}" ]
run a http based application
[ "run", "a", "http", "based", "application" ]
603896083ec89f5ac4d744abd3b1b4db3e914c95
https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Http/Application.php#L66-L85
19,325
RobinDumontChaponet/TransitiveCore
src/simple/View.php
View.cacheBust
public static function cacheBust(string $src): string { if(!file_exists($src)) return $src; $path = pathinfo($src); return $path['dirname'].'/'.$path['filename'].'.'.filemtime($src).'.'.$path['extension']; }
php
public static function cacheBust(string $src): string { if(!file_exists($src)) return $src; $path = pathinfo($src); return $path['dirname'].'/'.$path['filename'].'.'.filemtime($src).'.'.$path['extension']; }
[ "public", "static", "function", "cacheBust", "(", "string", "$", "src", ")", ":", "string", "{", "if", "(", "!", "file_exists", "(", "$", "src", ")", ")", "return", "$", "src", ";", "$", "path", "=", "pathinfo", "(", "$", "src", ")", ";", "return", "$", "path", "[", "'dirname'", "]", ".", "'/'", ".", "$", "path", "[", "'filename'", "]", ".", "'.'", ".", "filemtime", "(", "$", "src", ")", ".", "'.'", ".", "$", "path", "[", "'extension'", "]", ";", "}" ]
cacheBust function. @param string $src @return string
[ "cacheBust", "function", "." ]
b83dd6fe0e49b8773de0f60861e5a5c306e2a38d
https://github.com/RobinDumontChaponet/TransitiveCore/blob/b83dd6fe0e49b8773de0f60861e5a5c306e2a38d/src/simple/View.php#L37-L45
19,326
RobinDumontChaponet/TransitiveCore
src/simple/View.php
View.getTitle
public function getTitle(string $prefix = '', string $separator = ' | ', string $sufix = ''): string { if(empty($this->getTitleValue())) $separator = ''; return $prefix.$separator.$this->getTitleValue().$sufix; }
php
public function getTitle(string $prefix = '', string $separator = ' | ', string $sufix = ''): string { if(empty($this->getTitleValue())) $separator = ''; return $prefix.$separator.$this->getTitleValue().$sufix; }
[ "public", "function", "getTitle", "(", "string", "$", "prefix", "=", "''", ",", "string", "$", "separator", "=", "' | '", ",", "string", "$", "sufix", "=", "''", ")", ":", "string", "{", "if", "(", "empty", "(", "$", "this", "->", "getTitleValue", "(", ")", ")", ")", "$", "separator", "=", "''", ";", "return", "$", "prefix", ".", "$", "separator", ".", "$", "this", "->", "getTitleValue", "(", ")", ".", "$", "sufix", ";", "}" ]
Get the view's title.
[ "Get", "the", "view", "s", "title", "." ]
b83dd6fe0e49b8773de0f60861e5a5c306e2a38d
https://github.com/RobinDumontChaponet/TransitiveCore/blob/b83dd6fe0e49b8773de0f60861e5a5c306e2a38d/src/simple/View.php#L78-L84
19,327
leedavis81/altr-ego
library/AltrEgo/Adapter/Php53.php
Php53.getReflectionProperty
protected function getReflectionProperty($name) { do { $reflClass = (!isset($reflClass)) ? new \ReflectionClass($this->getObject()) : $reflClass; $property = $reflClass->getProperty($name); if (isset($property)) { break; } } while (($reflClass = $reflClass->getParentClass()) !== null); if ($property instanceof \ReflectionProperty) { $property->setAccessible(true); return $property; } else { throw new \Exception('Property ' . $name . ' doesn\'t exist on object of class ' . get_class($this->getObject())); } }
php
protected function getReflectionProperty($name) { do { $reflClass = (!isset($reflClass)) ? new \ReflectionClass($this->getObject()) : $reflClass; $property = $reflClass->getProperty($name); if (isset($property)) { break; } } while (($reflClass = $reflClass->getParentClass()) !== null); if ($property instanceof \ReflectionProperty) { $property->setAccessible(true); return $property; } else { throw new \Exception('Property ' . $name . ' doesn\'t exist on object of class ' . get_class($this->getObject())); } }
[ "protected", "function", "getReflectionProperty", "(", "$", "name", ")", "{", "do", "{", "$", "reflClass", "=", "(", "!", "isset", "(", "$", "reflClass", ")", ")", "?", "new", "\\", "ReflectionClass", "(", "$", "this", "->", "getObject", "(", ")", ")", ":", "$", "reflClass", ";", "$", "property", "=", "$", "reflClass", "->", "getProperty", "(", "$", "name", ")", ";", "if", "(", "isset", "(", "$", "property", ")", ")", "{", "break", ";", "}", "}", "while", "(", "(", "$", "reflClass", "=", "$", "reflClass", "->", "getParentClass", "(", ")", ")", "!==", "null", ")", ";", "if", "(", "$", "property", "instanceof", "\\", "ReflectionProperty", ")", "{", "$", "property", "->", "setAccessible", "(", "true", ")", ";", "return", "$", "property", ";", "}", "else", "{", "throw", "new", "\\", "Exception", "(", "'Property '", ".", "$", "name", ".", "' doesn\\'t exist on object of class '", ".", "get_class", "(", "$", "this", "->", "getObject", "(", ")", ")", ")", ";", "}", "}" ]
Get a reflection property - may need to iterate through class parents @param string $name
[ "Get", "a", "reflection", "property", "-", "may", "need", "to", "iterate", "through", "class", "parents" ]
1556556a33c2b6caddef94444522c5bbffc217c7
https://github.com/leedavis81/altr-ego/blob/1556556a33c2b6caddef94444522c5bbffc217c7/library/AltrEgo/Adapter/Php53.php#L142-L162
19,328
php-rise/rise
src/Template.php
Template.render
public function render($template = '', $data = []) { if (!isset($this->blocks[$template])) { $this->blocks[$template] = $this->blockFactory->create($template); } $block = $this->blocks[$template]; $block->setData($data); return $block->render(); }
php
public function render($template = '', $data = []) { if (!isset($this->blocks[$template])) { $this->blocks[$template] = $this->blockFactory->create($template); } $block = $this->blocks[$template]; $block->setData($data); return $block->render(); }
[ "public", "function", "render", "(", "$", "template", "=", "''", ",", "$", "data", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "blocks", "[", "$", "template", "]", ")", ")", "{", "$", "this", "->", "blocks", "[", "$", "template", "]", "=", "$", "this", "->", "blockFactory", "->", "create", "(", "$", "template", ")", ";", "}", "$", "block", "=", "$", "this", "->", "blocks", "[", "$", "template", "]", ";", "$", "block", "->", "setData", "(", "$", "data", ")", ";", "return", "$", "block", "->", "render", "(", ")", ";", "}" ]
Render a block. @param string $template @param array $data @return string
[ "Render", "a", "block", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Template.php#L32-L39
19,329
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php
BaseLicenseQuery.create
public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof LicenseQuery) { return $criteria; } $query = new LicenseQuery(null, null, $modelAlias); if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
php
public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof LicenseQuery) { return $criteria; } $query = new LicenseQuery(null, null, $modelAlias); if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
[ "public", "static", "function", "create", "(", "$", "modelAlias", "=", "null", ",", "$", "criteria", "=", "null", ")", "{", "if", "(", "$", "criteria", "instanceof", "LicenseQuery", ")", "{", "return", "$", "criteria", ";", "}", "$", "query", "=", "new", "LicenseQuery", "(", "null", ",", "null", ",", "$", "modelAlias", ")", ";", "if", "(", "$", "criteria", "instanceof", "Criteria", ")", "{", "$", "query", "->", "mergeWith", "(", "$", "criteria", ")", ";", "}", "return", "$", "query", ";", "}" ]
Returns a new LicenseQuery object. @param string $modelAlias The alias of a model in the query @param LicenseQuery|Criteria $criteria Optional Criteria to build the query from @return LicenseQuery
[ "Returns", "a", "new", "LicenseQuery", "object", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php#L76-L88
19,330
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php
BaseLicenseQuery.filterByMaxClients
public function filterByMaxClients($maxClients = null, $comparison = null) { if (is_array($maxClients)) { $useMinMax = false; if (isset($maxClients['min'])) { $this->addUsingAlias(LicensePeer::MAX_CLIENTS, $maxClients['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($maxClients['max'])) { $this->addUsingAlias(LicensePeer::MAX_CLIENTS, $maxClients['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(LicensePeer::MAX_CLIENTS, $maxClients, $comparison); }
php
public function filterByMaxClients($maxClients = null, $comparison = null) { if (is_array($maxClients)) { $useMinMax = false; if (isset($maxClients['min'])) { $this->addUsingAlias(LicensePeer::MAX_CLIENTS, $maxClients['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($maxClients['max'])) { $this->addUsingAlias(LicensePeer::MAX_CLIENTS, $maxClients['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(LicensePeer::MAX_CLIENTS, $maxClients, $comparison); }
[ "public", "function", "filterByMaxClients", "(", "$", "maxClients", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "maxClients", ")", ")", "{", "$", "useMinMax", "=", "false", ";", "if", "(", "isset", "(", "$", "maxClients", "[", "'min'", "]", ")", ")", "{", "$", "this", "->", "addUsingAlias", "(", "LicensePeer", "::", "MAX_CLIENTS", ",", "$", "maxClients", "[", "'min'", "]", ",", "Criteria", "::", "GREATER_EQUAL", ")", ";", "$", "useMinMax", "=", "true", ";", "}", "if", "(", "isset", "(", "$", "maxClients", "[", "'max'", "]", ")", ")", "{", "$", "this", "->", "addUsingAlias", "(", "LicensePeer", "::", "MAX_CLIENTS", ",", "$", "maxClients", "[", "'max'", "]", ",", "Criteria", "::", "LESS_EQUAL", ")", ";", "$", "useMinMax", "=", "true", ";", "}", "if", "(", "$", "useMinMax", ")", "{", "return", "$", "this", ";", "}", "if", "(", "null", "===", "$", "comparison", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "LicensePeer", "::", "MAX_CLIENTS", ",", "$", "maxClients", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the max_clients column Example usage: <code> $query->filterByMaxClients(1234); // WHERE max_clients = 1234 $query->filterByMaxClients(array(12, 34)); // WHERE max_clients IN (12, 34) $query->filterByMaxClients(array('min' => 12)); // WHERE max_clients >= 12 $query->filterByMaxClients(array('max' => 12)); // WHERE max_clients <= 12 </code> @param mixed $maxClients The value to use as filter. Use scalar values for equality. Use array values for in_array() equivalent. Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return LicenseQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "max_clients", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php#L302-L323
19,331
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php
BaseLicenseQuery.filterByDomain
public function filterByDomain($domain = null, $comparison = null) { if (null === $comparison) { if (is_array($domain)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $domain)) { $domain = str_replace('*', '%', $domain); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(LicensePeer::DOMAIN, $domain, $comparison); }
php
public function filterByDomain($domain = null, $comparison = null) { if (null === $comparison) { if (is_array($domain)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $domain)) { $domain = str_replace('*', '%', $domain); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(LicensePeer::DOMAIN, $domain, $comparison); }
[ "public", "function", "filterByDomain", "(", "$", "domain", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "domain", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "domain", ")", ")", "{", "$", "domain", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "domain", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "LicensePeer", "::", "DOMAIN", ",", "$", "domain", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the domain column Example usage: <code> $query->filterByDomain('fooValue'); // WHERE domain = 'fooValue' $query->filterByDomain('%fooValue%'); // WHERE domain LIKE '%fooValue%' </code> @param string $domain The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return LicenseQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "domain", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php#L340-L352
19,332
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php
BaseLicenseQuery.filterByValidUntil
public function filterByValidUntil($validUntil = null, $comparison = null) { if (null === $comparison) { if (is_array($validUntil)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $validUntil)) { $validUntil = str_replace('*', '%', $validUntil); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(LicensePeer::VALID_UNTIL, $validUntil, $comparison); }
php
public function filterByValidUntil($validUntil = null, $comparison = null) { if (null === $comparison) { if (is_array($validUntil)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $validUntil)) { $validUntil = str_replace('*', '%', $validUntil); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(LicensePeer::VALID_UNTIL, $validUntil, $comparison); }
[ "public", "function", "filterByValidUntil", "(", "$", "validUntil", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "validUntil", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "validUntil", ")", ")", "{", "$", "validUntil", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "validUntil", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "LicensePeer", "::", "VALID_UNTIL", ",", "$", "validUntil", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the valid_until column Example usage: <code> $query->filterByValidUntil('fooValue'); // WHERE valid_until = 'fooValue' $query->filterByValidUntil('%fooValue%'); // WHERE valid_until LIKE '%fooValue%' </code> @param string $validUntil The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return LicenseQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "valid_until", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php#L369-L381
19,333
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php
BaseLicenseQuery.filterBySerial
public function filterBySerial($serial = null, $comparison = null) { if (null === $comparison) { if (is_array($serial)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $serial)) { $serial = str_replace('*', '%', $serial); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(LicensePeer::SERIAL, $serial, $comparison); }
php
public function filterBySerial($serial = null, $comparison = null) { if (null === $comparison) { if (is_array($serial)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $serial)) { $serial = str_replace('*', '%', $serial); $comparison = Criteria::LIKE; } } return $this->addUsingAlias(LicensePeer::SERIAL, $serial, $comparison); }
[ "public", "function", "filterBySerial", "(", "$", "serial", "=", "null", ",", "$", "comparison", "=", "null", ")", "{", "if", "(", "null", "===", "$", "comparison", ")", "{", "if", "(", "is_array", "(", "$", "serial", ")", ")", "{", "$", "comparison", "=", "Criteria", "::", "IN", ";", "}", "elseif", "(", "preg_match", "(", "'/[\\%\\*]/'", ",", "$", "serial", ")", ")", "{", "$", "serial", "=", "str_replace", "(", "'*'", ",", "'%'", ",", "$", "serial", ")", ";", "$", "comparison", "=", "Criteria", "::", "LIKE", ";", "}", "}", "return", "$", "this", "->", "addUsingAlias", "(", "LicensePeer", "::", "SERIAL", ",", "$", "serial", ",", "$", "comparison", ")", ";", "}" ]
Filter the query on the serial column Example usage: <code> $query->filterBySerial('fooValue'); // WHERE serial = 'fooValue' $query->filterBySerial('%fooValue%'); // WHERE serial LIKE '%fooValue%' </code> @param string $serial The value to use as filter. Accepts wildcards (* and % trigger a LIKE) @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL @return LicenseQuery The current query, for fluid interface
[ "Filter", "the", "query", "on", "the", "serial", "column" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseLicenseQuery.php#L398-L410
19,334
nyeholt/silverstripe-external-content
thirdparty/Zend/Feed/Element.php
Zend_Feed_Element.setDOM
public function setDOM(DOMElement $element) { $this->_element = $this->_element->ownerDocument->importNode($element, true); }
php
public function setDOM(DOMElement $element) { $this->_element = $this->_element->ownerDocument->importNode($element, true); }
[ "public", "function", "setDOM", "(", "DOMElement", "$", "element", ")", "{", "$", "this", "->", "_element", "=", "$", "this", "->", "_element", "->", "ownerDocument", "->", "importNode", "(", "$", "element", ",", "true", ")", ";", "}" ]
Update the object from a DOM element Take a DOMElement object, which may be originally from a call to getDOM() or may be custom created, and use it as the DOM tree for this Zend_Feed_Element. @param DOMElement $element @return void
[ "Update", "the", "object", "from", "a", "DOM", "element" ]
1c6da8c56ef717225ff904e1522aff94ed051601
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Element.php#L87-L90
19,335
nyeholt/silverstripe-external-content
thirdparty/Zend/Feed/Element.php
Zend_Feed_Element.ensureAppended
protected function ensureAppended() { if (!$this->_appended) { $this->_parentElement->getDOM()->appendChild($this->_element); $this->_appended = true; $this->_parentElement->ensureAppended(); } }
php
protected function ensureAppended() { if (!$this->_appended) { $this->_parentElement->getDOM()->appendChild($this->_element); $this->_appended = true; $this->_parentElement->ensureAppended(); } }
[ "protected", "function", "ensureAppended", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_appended", ")", "{", "$", "this", "->", "_parentElement", "->", "getDOM", "(", ")", "->", "appendChild", "(", "$", "this", "->", "_element", ")", ";", "$", "this", "->", "_appended", "=", "true", ";", "$", "this", "->", "_parentElement", "->", "ensureAppended", "(", ")", ";", "}", "}" ]
Appends this element to its parent if necessary. @return void
[ "Appends", "this", "element", "to", "its", "parent", "if", "necessary", "." ]
1c6da8c56ef717225ff904e1522aff94ed051601
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Element.php#L111-L118
19,336
nyeholt/silverstripe-external-content
thirdparty/Zend/Feed/Element.php
Zend_Feed_Element.__isset
public function __isset($var) { // Look for access of the form {ns:var}. We don't use // _children() here because we can break out of the loop // immediately once we find something. if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); foreach ($this->_element->childNodes as $child) { if ($child->localName == $elt && $child->prefix == $ns) { return true; } } } else { foreach ($this->_element->childNodes as $child) { if ($child->localName == $var) { return true; } } } }
php
public function __isset($var) { // Look for access of the form {ns:var}. We don't use // _children() here because we can break out of the loop // immediately once we find something. if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); foreach ($this->_element->childNodes as $child) { if ($child->localName == $elt && $child->prefix == $ns) { return true; } } } else { foreach ($this->_element->childNodes as $child) { if ($child->localName == $var) { return true; } } } }
[ "public", "function", "__isset", "(", "$", "var", ")", "{", "// Look for access of the form {ns:var}. We don't use", "// _children() here because we can break out of the loop", "// immediately once we find something.", "if", "(", "strpos", "(", "$", "var", ",", "':'", ")", "!==", "false", ")", "{", "list", "(", "$", "ns", ",", "$", "elt", ")", "=", "explode", "(", "':'", ",", "$", "var", ",", "2", ")", ";", "foreach", "(", "$", "this", "->", "_element", "->", "childNodes", "as", "$", "child", ")", "{", "if", "(", "$", "child", "->", "localName", "==", "$", "elt", "&&", "$", "child", "->", "prefix", "==", "$", "ns", ")", "{", "return", "true", ";", "}", "}", "}", "else", "{", "foreach", "(", "$", "this", "->", "_element", "->", "childNodes", "as", "$", "child", ")", "{", "if", "(", "$", "child", "->", "localName", "==", "$", "var", ")", "{", "return", "true", ";", "}", "}", "}", "}" ]
Map isset calls onto the underlying entry representation. @param string $var @return boolean
[ "Map", "isset", "calls", "onto", "the", "underlying", "entry", "representation", "." ]
1c6da8c56ef717225ff904e1522aff94ed051601
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Element.php#L231-L250
19,337
CakeCMS/Core
src/View/Widget/MaterializeCss/TextareaWidget.php
TextareaWidget.render
public function render(array $data, ContextInterface $context) { $data = array_merge(['class' => null], $data); $data['class'] .= ' materialize-textarea'; $data['class'] = Str::trim($data['class']); return parent::render($data, $context); }
php
public function render(array $data, ContextInterface $context) { $data = array_merge(['class' => null], $data); $data['class'] .= ' materialize-textarea'; $data['class'] = Str::trim($data['class']); return parent::render($data, $context); }
[ "public", "function", "render", "(", "array", "$", "data", ",", "ContextInterface", "$", "context", ")", "{", "$", "data", "=", "array_merge", "(", "[", "'class'", "=>", "null", "]", ",", "$", "data", ")", ";", "$", "data", "[", "'class'", "]", ".=", "' materialize-textarea'", ";", "$", "data", "[", "'class'", "]", "=", "Str", "::", "trim", "(", "$", "data", "[", "'class'", "]", ")", ";", "return", "parent", "::", "render", "(", "$", "data", ",", "$", "context", ")", ";", "}" ]
Render a text area form widget. Data supports the following keys: - `name` - Set the input name. - `val` - A string of the option to mark as selected. - `escape` - Set to false to disable HTML escaping. All other keys will be converted into HTML attributes. @param array $data The data to build a textarea with. @param \Cake\View\Form\ContextInterface $context The current form context. @return string HTML elements.
[ "Render", "a", "text", "area", "form", "widget", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Widget/MaterializeCss/TextareaWidget.php#L45-L53
19,338
CPSB/Validation-helper
src/Form.php
Form.input
public function input($name, $default = null) { $value = e($this->value($name, $default)); $name = e($name); return "name=\"$name\" value=\"$value\""; }
php
public function input($name, $default = null) { $value = e($this->value($name, $default)); $name = e($name); return "name=\"$name\" value=\"$value\""; }
[ "public", "function", "input", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "$", "value", "=", "e", "(", "$", "this", "->", "value", "(", "$", "name", ",", "$", "default", ")", ")", ";", "$", "name", "=", "e", "(", "$", "name", ")", ";", "return", "\"name=\\\"$name\\\" value=\\\"$value\\\"\"", ";", "}" ]
Get the attributes for an input field. @param string $name @param mixed|null $default @return string
[ "Get", "the", "attributes", "for", "an", "input", "field", "." ]
adb91cb42b7e3c1f88be059a8b4f86de5aba64cc
https://github.com/CPSB/Validation-helper/blob/adb91cb42b7e3c1f88be059a8b4f86de5aba64cc/src/Form.php#L64-L69
19,339
CPSB/Validation-helper
src/Form.php
Form.checkbox
public function checkbox($name, $inputValue = 1, $checkByDefault = false) { $value = $this->value($name); // Define the state for the checkbox, when $value is null then we // use the $checkByDefault value directly, otherwise the checkbox will // be checked only if the $value is equal to the $inputValue. if (is_null($value)) { $checked = $checkByDefault; } else { $checked = $value == $inputValue; } $name = e($name); $inputValue = e($inputValue); $checked = $checked ? ' checked' : ''; return "name=\"$name\" value=\"$inputValue\"$checked"; }
php
public function checkbox($name, $inputValue = 1, $checkByDefault = false) { $value = $this->value($name); // Define the state for the checkbox, when $value is null then we // use the $checkByDefault value directly, otherwise the checkbox will // be checked only if the $value is equal to the $inputValue. if (is_null($value)) { $checked = $checkByDefault; } else { $checked = $value == $inputValue; } $name = e($name); $inputValue = e($inputValue); $checked = $checked ? ' checked' : ''; return "name=\"$name\" value=\"$inputValue\"$checked"; }
[ "public", "function", "checkbox", "(", "$", "name", ",", "$", "inputValue", "=", "1", ",", "$", "checkByDefault", "=", "false", ")", "{", "$", "value", "=", "$", "this", "->", "value", "(", "$", "name", ")", ";", "// Define the state for the checkbox, when $value is null then we", "// use the $checkByDefault value directly, otherwise the checkbox will", "// be checked only if the $value is equal to the $inputValue.", "if", "(", "is_null", "(", "$", "value", ")", ")", "{", "$", "checked", "=", "$", "checkByDefault", ";", "}", "else", "{", "$", "checked", "=", "$", "value", "==", "$", "inputValue", ";", "}", "$", "name", "=", "e", "(", "$", "name", ")", ";", "$", "inputValue", "=", "e", "(", "$", "inputValue", ")", ";", "$", "checked", "=", "$", "checked", "?", "' checked'", ":", "''", ";", "return", "\"name=\\\"$name\\\" value=\\\"$inputValue\\\"$checked\"", ";", "}" ]
Get the attributes for a checkbox. @param string $name @param mixed $inputValue @param bool $checkByDefault @return string
[ "Get", "the", "attributes", "for", "a", "checkbox", "." ]
adb91cb42b7e3c1f88be059a8b4f86de5aba64cc
https://github.com/CPSB/Validation-helper/blob/adb91cb42b7e3c1f88be059a8b4f86de5aba64cc/src/Form.php#L79-L95
19,340
CPSB/Validation-helper
src/Form.php
Form.radio
public function radio($name, $inputValue = 1, $checkByDefault = false) { return $this->checkbox($name, $inputValue, $checkByDefault); }
php
public function radio($name, $inputValue = 1, $checkByDefault = false) { return $this->checkbox($name, $inputValue, $checkByDefault); }
[ "public", "function", "radio", "(", "$", "name", ",", "$", "inputValue", "=", "1", ",", "$", "checkByDefault", "=", "false", ")", "{", "return", "$", "this", "->", "checkbox", "(", "$", "name", ",", "$", "inputValue", ",", "$", "checkByDefault", ")", ";", "}" ]
Get the attributes for a radio. @param string $name @param mixed $inputValue @param bool $checkByDefault @return string
[ "Get", "the", "attributes", "for", "a", "radio", "." ]
adb91cb42b7e3c1f88be059a8b4f86de5aba64cc
https://github.com/CPSB/Validation-helper/blob/adb91cb42b7e3c1f88be059a8b4f86de5aba64cc/src/Form.php#L105-L108
19,341
CPSB/Validation-helper
src/Form.php
Form.options
public function options($options, $name, $default = null, $placeholder = null) { $tags = []; // Prepend the placeholder to the options list if needed. if ($placeholder) { $tags[] = '<option value="" selected disabled>'.e($placeholder).'</option>'; } $value = $this->value($name, $default); // Cast $default and $value to an array in order to support selects with // multiple options selected. if (! is_array($value)) { $value = [$value]; } foreach ($options as $key => $text) { $selected = in_array($key, $value) ? ' selected' : ''; $key = e($key); $text = e($text); $tags[] = "<option value=\"$key\"$selected>$text</option>"; } return implode($tags); }
php
public function options($options, $name, $default = null, $placeholder = null) { $tags = []; // Prepend the placeholder to the options list if needed. if ($placeholder) { $tags[] = '<option value="" selected disabled>'.e($placeholder).'</option>'; } $value = $this->value($name, $default); // Cast $default and $value to an array in order to support selects with // multiple options selected. if (! is_array($value)) { $value = [$value]; } foreach ($options as $key => $text) { $selected = in_array($key, $value) ? ' selected' : ''; $key = e($key); $text = e($text); $tags[] = "<option value=\"$key\"$selected>$text</option>"; } return implode($tags); }
[ "public", "function", "options", "(", "$", "options", ",", "$", "name", ",", "$", "default", "=", "null", ",", "$", "placeholder", "=", "null", ")", "{", "$", "tags", "=", "[", "]", ";", "// Prepend the placeholder to the options list if needed.", "if", "(", "$", "placeholder", ")", "{", "$", "tags", "[", "]", "=", "'<option value=\"\" selected disabled>'", ".", "e", "(", "$", "placeholder", ")", ".", "'</option>'", ";", "}", "$", "value", "=", "$", "this", "->", "value", "(", "$", "name", ",", "$", "default", ")", ";", "// Cast $default and $value to an array in order to support selects with", "// multiple options selected.", "if", "(", "!", "is_array", "(", "$", "value", ")", ")", "{", "$", "value", "=", "[", "$", "value", "]", ";", "}", "foreach", "(", "$", "options", "as", "$", "key", "=>", "$", "text", ")", "{", "$", "selected", "=", "in_array", "(", "$", "key", ",", "$", "value", ")", "?", "' selected'", ":", "''", ";", "$", "key", "=", "e", "(", "$", "key", ")", ";", "$", "text", "=", "e", "(", "$", "text", ")", ";", "$", "tags", "[", "]", "=", "\"<option value=\\\"$key\\\"$selected>$text</option>\"", ";", "}", "return", "implode", "(", "$", "tags", ")", ";", "}" ]
Get the options for a select. @param array $options @param string $name @param mixed|null $default @param string|null $placeholder @return string
[ "Get", "the", "options", "for", "a", "select", "." ]
adb91cb42b7e3c1f88be059a8b4f86de5aba64cc
https://github.com/CPSB/Validation-helper/blob/adb91cb42b7e3c1f88be059a8b4f86de5aba64cc/src/Form.php#L119-L140
19,342
CPSB/Validation-helper
src/Form.php
Form.error
public function error($name, $template = null) { $errors = $this->session->get('errors'); // Default template is bootstrap friendly. if (is_null($template)) { $template = config('form-helpers.error_template'); } if ($errors && $errors->has($name)) { return str_replace(':message', e($errors->first($name)), $template); } }
php
public function error($name, $template = null) { $errors = $this->session->get('errors'); // Default template is bootstrap friendly. if (is_null($template)) { $template = config('form-helpers.error_template'); } if ($errors && $errors->has($name)) { return str_replace(':message', e($errors->first($name)), $template); } }
[ "public", "function", "error", "(", "$", "name", ",", "$", "template", "=", "null", ")", "{", "$", "errors", "=", "$", "this", "->", "session", "->", "get", "(", "'errors'", ")", ";", "// Default template is bootstrap friendly.", "if", "(", "is_null", "(", "$", "template", ")", ")", "{", "$", "template", "=", "config", "(", "'form-helpers.error_template'", ")", ";", "}", "if", "(", "$", "errors", "&&", "$", "errors", "->", "has", "(", "$", "name", ")", ")", "{", "return", "str_replace", "(", "':message'", ",", "e", "(", "$", "errors", "->", "first", "(", "$", "name", ")", ")", ",", "$", "template", ")", ";", "}", "}" ]
Get the error message if exists. @param string $name @param string|null $template @return string|null
[ "Get", "the", "error", "message", "if", "exists", "." ]
adb91cb42b7e3c1f88be059a8b4f86de5aba64cc
https://github.com/CPSB/Validation-helper/blob/adb91cb42b7e3c1f88be059a8b4f86de5aba64cc/src/Form.php#L149-L159
19,343
CPSB/Validation-helper
src/Form.php
Form.value
public function value($name, $default = null) { if (! is_null($value = $this->valueFromOld($name))) { return $value; } if (! is_null($value = $this->valueFromModel($name))) { return $value; } return $default; }
php
public function value($name, $default = null) { if (! is_null($value = $this->valueFromOld($name))) { return $value; } if (! is_null($value = $this->valueFromModel($name))) { return $value; } return $default; }
[ "public", "function", "value", "(", "$", "name", ",", "$", "default", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "value", "=", "$", "this", "->", "valueFromOld", "(", "$", "name", ")", ")", ")", "{", "return", "$", "value", ";", "}", "if", "(", "!", "is_null", "(", "$", "value", "=", "$", "this", "->", "valueFromModel", "(", "$", "name", ")", ")", ")", "{", "return", "$", "value", ";", "}", "return", "$", "default", ";", "}" ]
Get the value to use in an input field. @param string $name @param mixed|null $default @return mixed|null
[ "Get", "the", "value", "to", "use", "in", "an", "input", "field", "." ]
adb91cb42b7e3c1f88be059a8b4f86de5aba64cc
https://github.com/CPSB/Validation-helper/blob/adb91cb42b7e3c1f88be059a8b4f86de5aba64cc/src/Form.php#L168-L178
19,344
jfusion/org.jfusion.framework
src/Framework.php
Framework.hasFeature
public static function hasFeature($jname, $feature) { $return = false; $admin = Factory::getAdmin($jname); $user = Factory::getUser($jname); switch ($feature) { //Admin Features case 'wizard': $return = $admin->methodDefined('setupFromPath'); break; //User Features case 'useractivity': $return = $user->methodDefined('activateUser'); break; case 'duallogin': $return = $user->methodDefined('createSession'); break; case 'duallogout': $return = $user->methodDefined('destroySession'); break; case 'updatepassword': $return = $user->methodDefined('updatePassword'); break; case 'updateusername': $return = $user->methodDefined('updateUsername'); break; case 'updateemail': $return = $user->methodDefined('updateEmail'); break; case 'updateusergroup': $return = $user->methodDefined('updateUsergroup'); break; case 'updateuserlanguage': $return = $user->methodDefined('updateUserLanguage'); break; case 'syncsessions': $return = $user->methodDefined('syncSessions'); break; case 'blockuser': $return = $user->methodDefined('blockUser'); break; case 'activateuser': $return = $user->methodDefined('activateUser'); break; case 'deleteuser': $return = $user->methodDefined('deleteUser'); break; } return $return; }
php
public static function hasFeature($jname, $feature) { $return = false; $admin = Factory::getAdmin($jname); $user = Factory::getUser($jname); switch ($feature) { //Admin Features case 'wizard': $return = $admin->methodDefined('setupFromPath'); break; //User Features case 'useractivity': $return = $user->methodDefined('activateUser'); break; case 'duallogin': $return = $user->methodDefined('createSession'); break; case 'duallogout': $return = $user->methodDefined('destroySession'); break; case 'updatepassword': $return = $user->methodDefined('updatePassword'); break; case 'updateusername': $return = $user->methodDefined('updateUsername'); break; case 'updateemail': $return = $user->methodDefined('updateEmail'); break; case 'updateusergroup': $return = $user->methodDefined('updateUsergroup'); break; case 'updateuserlanguage': $return = $user->methodDefined('updateUserLanguage'); break; case 'syncsessions': $return = $user->methodDefined('syncSessions'); break; case 'blockuser': $return = $user->methodDefined('blockUser'); break; case 'activateuser': $return = $user->methodDefined('activateUser'); break; case 'deleteuser': $return = $user->methodDefined('deleteUser'); break; } return $return; }
[ "public", "static", "function", "hasFeature", "(", "$", "jname", ",", "$", "feature", ")", "{", "$", "return", "=", "false", ";", "$", "admin", "=", "Factory", "::", "getAdmin", "(", "$", "jname", ")", ";", "$", "user", "=", "Factory", "::", "getUser", "(", "$", "jname", ")", ";", "switch", "(", "$", "feature", ")", "{", "//Admin Features", "case", "'wizard'", ":", "$", "return", "=", "$", "admin", "->", "methodDefined", "(", "'setupFromPath'", ")", ";", "break", ";", "//User Features", "case", "'useractivity'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'activateUser'", ")", ";", "break", ";", "case", "'duallogin'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'createSession'", ")", ";", "break", ";", "case", "'duallogout'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'destroySession'", ")", ";", "break", ";", "case", "'updatepassword'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'updatePassword'", ")", ";", "break", ";", "case", "'updateusername'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'updateUsername'", ")", ";", "break", ";", "case", "'updateemail'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'updateEmail'", ")", ";", "break", ";", "case", "'updateusergroup'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'updateUsergroup'", ")", ";", "break", ";", "case", "'updateuserlanguage'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'updateUserLanguage'", ")", ";", "break", ";", "case", "'syncsessions'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'syncSessions'", ")", ";", "break", ";", "case", "'blockuser'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'blockUser'", ")", ";", "break", ";", "case", "'activateuser'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'activateUser'", ")", ";", "break", ";", "case", "'deleteuser'", ":", "$", "return", "=", "$", "user", "->", "methodDefined", "(", "'deleteUser'", ")", ";", "break", ";", "}", "return", "$", "return", ";", "}" ]
Check if feature exists @static @param string $jname @param string $feature feature @return bool
[ "Check", "if", "feature", "exists" ]
65771963f23ccabcf1f867eb17c9452299cfe683
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Framework.php#L75-L123
19,345
jfusion/org.jfusion.framework
src/Framework.php
Framework.getXml
public static function getXml($data, $isFile = true) { // Disable libxml errors and allow to fetch error information as needed libxml_use_internal_errors(true); if ($isFile) { // Try to load the XML file $xml = simplexml_load_file($data); } else { // Try to load the XML string $xml = simplexml_load_string($data); } if ($xml === false) { $message = null; if ($isFile) { $message = Text::_('FILE') . ': ' . $data; } foreach (libxml_get_errors() as $error) { if ($message) { $message .= ' '; } $message .= ' '. Text::_('MESSAGE') . ': ' . $error->message; } throw new RuntimeException(Text::_('ERROR_XML_LOAD') . ' : ' . $message); } return $xml; }
php
public static function getXml($data, $isFile = true) { // Disable libxml errors and allow to fetch error information as needed libxml_use_internal_errors(true); if ($isFile) { // Try to load the XML file $xml = simplexml_load_file($data); } else { // Try to load the XML string $xml = simplexml_load_string($data); } if ($xml === false) { $message = null; if ($isFile) { $message = Text::_('FILE') . ': ' . $data; } foreach (libxml_get_errors() as $error) { if ($message) { $message .= ' '; } $message .= ' '. Text::_('MESSAGE') . ': ' . $error->message; } throw new RuntimeException(Text::_('ERROR_XML_LOAD') . ' : ' . $message); } return $xml; }
[ "public", "static", "function", "getXml", "(", "$", "data", ",", "$", "isFile", "=", "true", ")", "{", "// Disable libxml errors and allow to fetch error information as needed", "libxml_use_internal_errors", "(", "true", ")", ";", "if", "(", "$", "isFile", ")", "{", "// Try to load the XML file", "$", "xml", "=", "simplexml_load_file", "(", "$", "data", ")", ";", "}", "else", "{", "// Try to load the XML string", "$", "xml", "=", "simplexml_load_string", "(", "$", "data", ")", ";", "}", "if", "(", "$", "xml", "===", "false", ")", "{", "$", "message", "=", "null", ";", "if", "(", "$", "isFile", ")", "{", "$", "message", "=", "Text", "::", "_", "(", "'FILE'", ")", ".", "': '", ".", "$", "data", ";", "}", "foreach", "(", "libxml_get_errors", "(", ")", "as", "$", "error", ")", "{", "if", "(", "$", "message", ")", "{", "$", "message", ".=", "' '", ";", "}", "$", "message", ".=", "' '", ".", "Text", "::", "_", "(", "'MESSAGE'", ")", ".", "': '", ".", "$", "error", "->", "message", ";", "}", "throw", "new", "RuntimeException", "(", "Text", "::", "_", "(", "'ERROR_XML_LOAD'", ")", ".", "' : '", ".", "$", "message", ")", ";", "}", "return", "$", "xml", ";", "}" ]
Checks to see if a JFusion plugin is properly configured @param string $data file path or file content @param boolean $isFile load from file @throws \Symfony\Component\Yaml\Exception\RuntimeException @return SimpleXMLElement returns true if plugin is correctly configured
[ "Checks", "to", "see", "if", "a", "JFusion", "plugin", "is", "properly", "configured" ]
65771963f23ccabcf1f867eb17c9452299cfe683
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Framework.php#L134-L161
19,346
jfusion/org.jfusion.framework
src/Framework.php
Framework.raise
public static function raise($type, $message, $jname = '') { if (is_array($message)) { foreach ($message as $msgtype => $msg) { //if still an array implode for nicer display if (is_numeric($msgtype)) { $msgtype = $jname; } static::raise($type, $msg, $msgtype); } } else { $app = Application::getInstance(); if ($message instanceof Exception) { $message = $message->getMessage(); } if (!empty($jname)) { $message = $jname . ': ' . $message; } $app->enqueueMessage($message, strtolower($type)); } }
php
public static function raise($type, $message, $jname = '') { if (is_array($message)) { foreach ($message as $msgtype => $msg) { //if still an array implode for nicer display if (is_numeric($msgtype)) { $msgtype = $jname; } static::raise($type, $msg, $msgtype); } } else { $app = Application::getInstance(); if ($message instanceof Exception) { $message = $message->getMessage(); } if (!empty($jname)) { $message = $jname . ': ' . $message; } $app->enqueueMessage($message, strtolower($type)); } }
[ "public", "static", "function", "raise", "(", "$", "type", ",", "$", "message", ",", "$", "jname", "=", "''", ")", "{", "if", "(", "is_array", "(", "$", "message", ")", ")", "{", "foreach", "(", "$", "message", "as", "$", "msgtype", "=>", "$", "msg", ")", "{", "//if still an array implode for nicer display", "if", "(", "is_numeric", "(", "$", "msgtype", ")", ")", "{", "$", "msgtype", "=", "$", "jname", ";", "}", "static", "::", "raise", "(", "$", "type", ",", "$", "msg", ",", "$", "msgtype", ")", ";", "}", "}", "else", "{", "$", "app", "=", "Application", "::", "getInstance", "(", ")", ";", "if", "(", "$", "message", "instanceof", "Exception", ")", "{", "$", "message", "=", "$", "message", "->", "getMessage", "(", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "jname", ")", ")", "{", "$", "message", "=", "$", "jname", ".", "': '", ".", "$", "message", ";", "}", "$", "app", "->", "enqueueMessage", "(", "$", "message", ",", "strtolower", "(", "$", "type", ")", ")", ";", "}", "}" ]
Raise warning function that can handle arrays @param $type @param array|string|Exception $message message itself @param string $jname @return string nothing
[ "Raise", "warning", "function", "that", "can", "handle", "arrays" ]
65771963f23ccabcf1f867eb17c9452299cfe683
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Framework.php#L172-L191
19,347
ClanCats/Core
src/bundles/Auth/CCAuth.php
CCAuth.validate
public static function validate( $identifier, $password, $name = null ) { return Handler::create( $name )->validate( $identifier, $password ); }
php
public static function validate( $identifier, $password, $name = null ) { return Handler::create( $name )->validate( $identifier, $password ); }
[ "public", "static", "function", "validate", "(", "$", "identifier", ",", "$", "password", ",", "$", "name", "=", "null", ")", "{", "return", "Handler", "::", "create", "(", "$", "name", ")", "->", "validate", "(", "$", "identifier", ",", "$", "password", ")", ";", "}" ]
Validate user credentials @param mixed $identifier @param string $password @param string $name The auth instance @return bool
[ "Validate", "user", "credentials" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Auth/CCAuth.php#L44-L47
19,348
ClanCats/Core
src/bundles/Auth/CCAuth.php
CCAuth.sign_in
public static function sign_in( \Auth\User $user, $keep_loggedin = true, $name = null ) { return Handler::create( $name )->sign_in( $user, $keep_loggedin ); }
php
public static function sign_in( \Auth\User $user, $keep_loggedin = true, $name = null ) { return Handler::create( $name )->sign_in( $user, $keep_loggedin ); }
[ "public", "static", "function", "sign_in", "(", "\\", "Auth", "\\", "User", "$", "user", ",", "$", "keep_loggedin", "=", "true", ",", "$", "name", "=", "null", ")", "{", "return", "Handler", "::", "create", "(", "$", "name", ")", "->", "sign_in", "(", "$", "user", ",", "$", "keep_loggedin", ")", ";", "}" ]
Sign in a user @param Auth\User $user @param string $keep_loggedin @param string $name The auth instance @return bool
[ "Sign", "in", "a", "user" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Auth/CCAuth.php#L57-L60
19,349
slashworks/control-bundle
src/Slashworks/BackendBundle/Model/om/BaseSystemSettingsPeer.php
BaseSystemSettingsPeer.doUpdate
public static function doUpdate($values, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(SystemSettingsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $selectCriteria = new Criteria(SystemSettingsPeer::DATABASE_NAME); if ($values instanceof Criteria) { $criteria = clone $values; // rename for clarity $comparison = $criteria->getComparison(SystemSettingsPeer::ID); $value = $criteria->remove(SystemSettingsPeer::ID); if ($value) { $selectCriteria->add(SystemSettingsPeer::ID, $value, $comparison); } else { $selectCriteria->setPrimaryTableName(SystemSettingsPeer::TABLE_NAME); } } else { // $values is SystemSettings object $criteria = $values->buildCriteria(); // gets full criteria $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) } // set the correct dbName $criteria->setDbName(SystemSettingsPeer::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); }
php
public static function doUpdate($values, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(SystemSettingsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $selectCriteria = new Criteria(SystemSettingsPeer::DATABASE_NAME); if ($values instanceof Criteria) { $criteria = clone $values; // rename for clarity $comparison = $criteria->getComparison(SystemSettingsPeer::ID); $value = $criteria->remove(SystemSettingsPeer::ID); if ($value) { $selectCriteria->add(SystemSettingsPeer::ID, $value, $comparison); } else { $selectCriteria->setPrimaryTableName(SystemSettingsPeer::TABLE_NAME); } } else { // $values is SystemSettings object $criteria = $values->buildCriteria(); // gets full criteria $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) } // set the correct dbName $criteria->setDbName(SystemSettingsPeer::DATABASE_NAME); return BasePeer::doUpdate($selectCriteria, $criteria, $con); }
[ "public", "static", "function", "doUpdate", "(", "$", "values", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "if", "(", "$", "con", "===", "null", ")", "{", "$", "con", "=", "Propel", "::", "getConnection", "(", "SystemSettingsPeer", "::", "DATABASE_NAME", ",", "Propel", "::", "CONNECTION_WRITE", ")", ";", "}", "$", "selectCriteria", "=", "new", "Criteria", "(", "SystemSettingsPeer", "::", "DATABASE_NAME", ")", ";", "if", "(", "$", "values", "instanceof", "Criteria", ")", "{", "$", "criteria", "=", "clone", "$", "values", ";", "// rename for clarity", "$", "comparison", "=", "$", "criteria", "->", "getComparison", "(", "SystemSettingsPeer", "::", "ID", ")", ";", "$", "value", "=", "$", "criteria", "->", "remove", "(", "SystemSettingsPeer", "::", "ID", ")", ";", "if", "(", "$", "value", ")", "{", "$", "selectCriteria", "->", "add", "(", "SystemSettingsPeer", "::", "ID", ",", "$", "value", ",", "$", "comparison", ")", ";", "}", "else", "{", "$", "selectCriteria", "->", "setPrimaryTableName", "(", "SystemSettingsPeer", "::", "TABLE_NAME", ")", ";", "}", "}", "else", "{", "// $values is SystemSettings object", "$", "criteria", "=", "$", "values", "->", "buildCriteria", "(", ")", ";", "// gets full criteria", "$", "selectCriteria", "=", "$", "values", "->", "buildPkeyCriteria", "(", ")", ";", "// gets criteria w/ primary key(s)", "}", "// set the correct dbName", "$", "criteria", "->", "setDbName", "(", "SystemSettingsPeer", "::", "DATABASE_NAME", ")", ";", "return", "BasePeer", "::", "doUpdate", "(", "$", "selectCriteria", ",", "$", "criteria", ",", "$", "con", ")", ";", "}" ]
Performs an UPDATE on the database, given a SystemSettings or Criteria object. @param mixed $values Criteria or SystemSettings object containing data that is used to create the UPDATE statement. @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). @return int The number of affected rows (if supported by underlying database driver). @throws PropelException Any exceptions caught during processing will be rethrown wrapped into a PropelException.
[ "Performs", "an", "UPDATE", "on", "the", "database", "given", "a", "SystemSettings", "or", "Criteria", "object", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseSystemSettingsPeer.php#L555-L583
19,350
neos/doctools
Classes/Domain/Service/EelHelperClassParser.php
EelHelperClassParser.parseTitle
protected function parseTitle() { if (($registeredName = array_search($this->className, $this->defaultContextSettings)) !== false) { return $registeredName; } elseif (preg_match('/\\\\([^\\\\]*)Helper$/', $this->className, $matches)) { return $matches[1]; } return $this->className; }
php
protected function parseTitle() { if (($registeredName = array_search($this->className, $this->defaultContextSettings)) !== false) { return $registeredName; } elseif (preg_match('/\\\\([^\\\\]*)Helper$/', $this->className, $matches)) { return $matches[1]; } return $this->className; }
[ "protected", "function", "parseTitle", "(", ")", "{", "if", "(", "(", "$", "registeredName", "=", "array_search", "(", "$", "this", "->", "className", ",", "$", "this", "->", "defaultContextSettings", ")", ")", "!==", "false", ")", "{", "return", "$", "registeredName", ";", "}", "elseif", "(", "preg_match", "(", "'/\\\\\\\\([^\\\\\\\\]*)Helper$/'", ",", "$", "this", "->", "className", ",", "$", "matches", ")", ")", "{", "return", "$", "matches", "[", "1", "]", ";", "}", "return", "$", "this", "->", "className", ";", "}" ]
Get the title from the Eel helper class name @return string
[ "Get", "the", "title", "from", "the", "Eel", "helper", "class", "name" ]
726981245a8d59319ee594a582f80a30256df98b
https://github.com/neos/doctools/blob/726981245a8d59319ee594a582f80a30256df98b/Classes/Domain/Service/EelHelperClassParser.php#L34-L43
19,351
neos/doctools
Classes/Domain/Service/EelHelperClassParser.php
EelHelperClassParser.parseDescription
protected function parseDescription() { $description = $this->classReflection->getDescription() . chr(10) . chr(10); $description .= 'Implemented in: ``' . $this->className . '``' . chr(10) . chr(10); $helperName = $this->parseTitle(); $helperInstance = new $this->className(); $methods = $this->getHelperMethods(); foreach ($methods as $methodReflection) { if (!$helperInstance instanceof ProtectedContextAwareInterface || $helperInstance->allowsCallOfMethod($methodReflection->getName())) { $methodDescription = $this->getMethodDescription($helperName, $methodReflection); $description .= trim($methodDescription) . chr(10) . chr(10); } } return $description; }
php
protected function parseDescription() { $description = $this->classReflection->getDescription() . chr(10) . chr(10); $description .= 'Implemented in: ``' . $this->className . '``' . chr(10) . chr(10); $helperName = $this->parseTitle(); $helperInstance = new $this->className(); $methods = $this->getHelperMethods(); foreach ($methods as $methodReflection) { if (!$helperInstance instanceof ProtectedContextAwareInterface || $helperInstance->allowsCallOfMethod($methodReflection->getName())) { $methodDescription = $this->getMethodDescription($helperName, $methodReflection); $description .= trim($methodDescription) . chr(10) . chr(10); } } return $description; }
[ "protected", "function", "parseDescription", "(", ")", "{", "$", "description", "=", "$", "this", "->", "classReflection", "->", "getDescription", "(", ")", ".", "chr", "(", "10", ")", ".", "chr", "(", "10", ")", ";", "$", "description", ".=", "'Implemented in: ``'", ".", "$", "this", "->", "className", ".", "'``'", ".", "chr", "(", "10", ")", ".", "chr", "(", "10", ")", ";", "$", "helperName", "=", "$", "this", "->", "parseTitle", "(", ")", ";", "$", "helperInstance", "=", "new", "$", "this", "->", "className", "(", ")", ";", "$", "methods", "=", "$", "this", "->", "getHelperMethods", "(", ")", ";", "foreach", "(", "$", "methods", "as", "$", "methodReflection", ")", "{", "if", "(", "!", "$", "helperInstance", "instanceof", "ProtectedContextAwareInterface", "||", "$", "helperInstance", "->", "allowsCallOfMethod", "(", "$", "methodReflection", "->", "getName", "(", ")", ")", ")", "{", "$", "methodDescription", "=", "$", "this", "->", "getMethodDescription", "(", "$", "helperName", ",", "$", "methodReflection", ")", ";", "$", "description", ".=", "trim", "(", "$", "methodDescription", ")", ".", "chr", "(", "10", ")", ".", "chr", "(", "10", ")", ";", "}", "}", "return", "$", "description", ";", "}" ]
Iterate over all methods in the helper class @return string
[ "Iterate", "over", "all", "methods", "in", "the", "helper", "class" ]
726981245a8d59319ee594a582f80a30256df98b
https://github.com/neos/doctools/blob/726981245a8d59319ee594a582f80a30256df98b/Classes/Domain/Service/EelHelperClassParser.php#L50-L68
19,352
xinix-technology/norm
src/Norm/Connection/OCIConnection.php
OCIConnection.prepareInit
protected function prepareInit() { $stid = oci_parse($this->raw, "ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'"); oci_execute($stid); oci_free_statement($stid); $stid = oci_parse($this->raw, "ALTER SESSION SET NLS_SORT = BINARY_CI"); oci_execute($stid); oci_free_statement($stid); $stid = oci_parse($this->raw, "ALTER SESSION SET NLS_COMP = LINGUISTIC"); oci_execute($stid); oci_free_statement($stid); }
php
protected function prepareInit() { $stid = oci_parse($this->raw, "ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'"); oci_execute($stid); oci_free_statement($stid); $stid = oci_parse($this->raw, "ALTER SESSION SET NLS_SORT = BINARY_CI"); oci_execute($stid); oci_free_statement($stid); $stid = oci_parse($this->raw, "ALTER SESSION SET NLS_COMP = LINGUISTIC"); oci_execute($stid); oci_free_statement($stid); }
[ "protected", "function", "prepareInit", "(", ")", "{", "$", "stid", "=", "oci_parse", "(", "$", "this", "->", "raw", ",", "\"ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'\"", ")", ";", "oci_execute", "(", "$", "stid", ")", ";", "oci_free_statement", "(", "$", "stid", ")", ";", "$", "stid", "=", "oci_parse", "(", "$", "this", "->", "raw", ",", "\"ALTER SESSION SET NLS_SORT = BINARY_CI\"", ")", ";", "oci_execute", "(", "$", "stid", ")", ";", "oci_free_statement", "(", "$", "stid", ")", ";", "$", "stid", "=", "oci_parse", "(", "$", "this", "->", "raw", ",", "\"ALTER SESSION SET NLS_COMP = LINGUISTIC\"", ")", ";", "oci_execute", "(", "$", "stid", ")", ";", "oci_free_statement", "(", "$", "stid", ")", ";", "}" ]
Preparing initialization of connection @return void
[ "Preparing", "initialization", "of", "connection" ]
c357f7d3a75d05324dd84b8f6a968a094c53d603
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Connection/OCIConnection.php#L72-L85
19,353
xinix-technology/norm
src/Norm/Connection/OCIConnection.php
OCIConnection.persist
public function persist($collection, array $document) { if ($collection instanceof Collection) { $collectionName = $collection->getName(); } else { $collectionName = $collection; $collection = static::factory($collection); } $data = $this->marshall($document); $result = false; if (!isset($document['$id'])) { $id = $this->insert($collectionName, $data); if ($id) { $data['$id'] = $id; $result = $data; } } else { $data['id'] = $document['$id']; unset($data['$id']); $result = $this->update($collectionName, $data); if ($result) { $result = $data; } } return $this->unmarshall($result); }
php
public function persist($collection, array $document) { if ($collection instanceof Collection) { $collectionName = $collection->getName(); } else { $collectionName = $collection; $collection = static::factory($collection); } $data = $this->marshall($document); $result = false; if (!isset($document['$id'])) { $id = $this->insert($collectionName, $data); if ($id) { $data['$id'] = $id; $result = $data; } } else { $data['id'] = $document['$id']; unset($data['$id']); $result = $this->update($collectionName, $data); if ($result) { $result = $data; } } return $this->unmarshall($result); }
[ "public", "function", "persist", "(", "$", "collection", ",", "array", "$", "document", ")", "{", "if", "(", "$", "collection", "instanceof", "Collection", ")", "{", "$", "collectionName", "=", "$", "collection", "->", "getName", "(", ")", ";", "}", "else", "{", "$", "collectionName", "=", "$", "collection", ";", "$", "collection", "=", "static", "::", "factory", "(", "$", "collection", ")", ";", "}", "$", "data", "=", "$", "this", "->", "marshall", "(", "$", "document", ")", ";", "$", "result", "=", "false", ";", "if", "(", "!", "isset", "(", "$", "document", "[", "'$id'", "]", ")", ")", "{", "$", "id", "=", "$", "this", "->", "insert", "(", "$", "collectionName", ",", "$", "data", ")", ";", "if", "(", "$", "id", ")", "{", "$", "data", "[", "'$id'", "]", "=", "$", "id", ";", "$", "result", "=", "$", "data", ";", "}", "}", "else", "{", "$", "data", "[", "'id'", "]", "=", "$", "document", "[", "'$id'", "]", ";", "unset", "(", "$", "data", "[", "'$id'", "]", ")", ";", "$", "result", "=", "$", "this", "->", "update", "(", "$", "collectionName", ",", "$", "data", ")", ";", "if", "(", "$", "result", ")", "{", "$", "result", "=", "$", "data", ";", "}", "}", "return", "$", "this", "->", "unmarshall", "(", "$", "result", ")", ";", "}" ]
Sync data to database. If it's new data, we insert it as new document, otherwise, if the document exists, we just update it. @param Collection $collection @param Model $model @return bool
[ "Sync", "data", "to", "database", ".", "If", "it", "s", "new", "data", "we", "insert", "it", "as", "new", "document", "otherwise", "if", "the", "document", "exists", "we", "just", "update", "it", "." ]
c357f7d3a75d05324dd84b8f6a968a094c53d603
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Connection/OCIConnection.php#L104-L136
19,354
xinix-technology/norm
src/Norm/Connection/OCIConnection.php
OCIConnection.insert
public function insert($collectionName, $data) { $id = 0; $sql = $this->dialect->grammarInsert($collectionName, $data); $stid = oci_parse($this->raw, $sql); //Fixme : problem from other oracle dialect on method insert oci_bind_by_name($stid, ":id", $id,-1,SQLT_INT); foreach ($data as $key => $value) { oci_bind_by_name($stid, ":".$key, $data[$key]); } oci_execute($stid); oci_free_statement($stid); return $id; }
php
public function insert($collectionName, $data) { $id = 0; $sql = $this->dialect->grammarInsert($collectionName, $data); $stid = oci_parse($this->raw, $sql); //Fixme : problem from other oracle dialect on method insert oci_bind_by_name($stid, ":id", $id,-1,SQLT_INT); foreach ($data as $key => $value) { oci_bind_by_name($stid, ":".$key, $data[$key]); } oci_execute($stid); oci_free_statement($stid); return $id; }
[ "public", "function", "insert", "(", "$", "collectionName", ",", "$", "data", ")", "{", "$", "id", "=", "0", ";", "$", "sql", "=", "$", "this", "->", "dialect", "->", "grammarInsert", "(", "$", "collectionName", ",", "$", "data", ")", ";", "$", "stid", "=", "oci_parse", "(", "$", "this", "->", "raw", ",", "$", "sql", ")", ";", "//Fixme : problem from other oracle dialect on method insert", "oci_bind_by_name", "(", "$", "stid", ",", "\":id\"", ",", "$", "id", ",", "-", "1", ",", "SQLT_INT", ")", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "oci_bind_by_name", "(", "$", "stid", ",", "\":\"", ".", "$", "key", ",", "$", "data", "[", "$", "key", "]", ")", ";", "}", "oci_execute", "(", "$", "stid", ")", ";", "oci_free_statement", "(", "$", "stid", ")", ";", "return", "$", "id", ";", "}" ]
Perform insert new document to database. @param string $collectionName @param mixed $data @return bool
[ "Perform", "insert", "new", "document", "to", "database", "." ]
c357f7d3a75d05324dd84b8f6a968a094c53d603
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Connection/OCIConnection.php#L174-L193
19,355
xinix-technology/norm
src/Norm/Connection/OCIConnection.php
OCIConnection.update
public function update($collectionName, $data) { $sql = $this->dialect->grammarUpdate($collectionName, $data); $stid = oci_parse($this->raw, $sql); oci_bind_by_name($stid, ":id", $data['id']); foreach ($data as $key => $value) { oci_bind_by_name($stid, ":".$key, $data[$key]); } $result = oci_execute($stid); oci_free_statement($stid); return $result; }
php
public function update($collectionName, $data) { $sql = $this->dialect->grammarUpdate($collectionName, $data); $stid = oci_parse($this->raw, $sql); oci_bind_by_name($stid, ":id", $data['id']); foreach ($data as $key => $value) { oci_bind_by_name($stid, ":".$key, $data[$key]); } $result = oci_execute($stid); oci_free_statement($stid); return $result; }
[ "public", "function", "update", "(", "$", "collectionName", ",", "$", "data", ")", "{", "$", "sql", "=", "$", "this", "->", "dialect", "->", "grammarUpdate", "(", "$", "collectionName", ",", "$", "data", ")", ";", "$", "stid", "=", "oci_parse", "(", "$", "this", "->", "raw", ",", "$", "sql", ")", ";", "oci_bind_by_name", "(", "$", "stid", ",", "\":id\"", ",", "$", "data", "[", "'id'", "]", ")", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "oci_bind_by_name", "(", "$", "stid", ",", "\":\"", ".", "$", "key", ",", "$", "data", "[", "$", "key", "]", ")", ";", "}", "$", "result", "=", "oci_execute", "(", "$", "stid", ")", ";", "oci_free_statement", "(", "$", "stid", ")", ";", "return", "$", "result", ";", "}" ]
Perform update to a document. @param string $collectionName @param mixed $data @return bool
[ "Perform", "update", "to", "a", "document", "." ]
c357f7d3a75d05324dd84b8f6a968a094c53d603
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Connection/OCIConnection.php#L203-L220
19,356
inpsyde/inpsyde-filter
src/AbstractFilter.php
AbstractFilter.set_options
protected function set_options( array $options = [ ] ) { foreach ( $options as $key => $value ) { if ( ! array_key_exists( $key, $this->options ) ) { throw new \InvalidArgumentException( sprintf( 'The option "%1$s" does not have a matching option[%1$s] array key', $key ), 1.0 ); continue; } $this->options[ $key ] = $value; } }
php
protected function set_options( array $options = [ ] ) { foreach ( $options as $key => $value ) { if ( ! array_key_exists( $key, $this->options ) ) { throw new \InvalidArgumentException( sprintf( 'The option "%1$s" does not have a matching option[%1$s] array key', $key ), 1.0 ); continue; } $this->options[ $key ] = $value; } }
[ "protected", "function", "set_options", "(", "array", "$", "options", "=", "[", "]", ")", "{", "foreach", "(", "$", "options", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "options", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'The option \"%1$s\" does not have a matching option[%1$s] array key'", ",", "$", "key", ")", ",", "1.0", ")", ";", "continue", ";", "}", "$", "this", "->", "options", "[", "$", "key", "]", "=", "$", "value", ";", "}", "}" ]
Setting the given options from constructor. @param array $options @throws \InvalidArgumentException if the given option is not available to overwrite.
[ "Setting", "the", "given", "options", "from", "constructor", "." ]
777a6208ea4dfbeed89e6d0712a35dc25eab498b
https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/AbstractFilter.php#L34-L47
19,357
slashworks/control-bundle
src/Slashworks/AppBundle/Controller/AppController.php
AppController.check4Client
public function check4Client($iCustomerId) { if ($this->get('security.context')->isGranted('ROLE_ADMIN')) { return true; } else { $oUser = $this->getUser(); if (empty($oUser)) { return false; } $oResult = UserCustomerRelationQuery::create()->findOneByArray(array("UserId" => $oUser->getId(), "CustomerId" => $iCustomerId)); return (!empty($oResult)); } }
php
public function check4Client($iCustomerId) { if ($this->get('security.context')->isGranted('ROLE_ADMIN')) { return true; } else { $oUser = $this->getUser(); if (empty($oUser)) { return false; } $oResult = UserCustomerRelationQuery::create()->findOneByArray(array("UserId" => $oUser->getId(), "CustomerId" => $iCustomerId)); return (!empty($oResult)); } }
[ "public", "function", "check4Client", "(", "$", "iCustomerId", ")", "{", "if", "(", "$", "this", "->", "get", "(", "'security.context'", ")", "->", "isGranted", "(", "'ROLE_ADMIN'", ")", ")", "{", "return", "true", ";", "}", "else", "{", "$", "oUser", "=", "$", "this", "->", "getUser", "(", ")", ";", "if", "(", "empty", "(", "$", "oUser", ")", ")", "{", "return", "false", ";", "}", "$", "oResult", "=", "UserCustomerRelationQuery", "::", "create", "(", ")", "->", "findOneByArray", "(", "array", "(", "\"UserId\"", "=>", "$", "oUser", "->", "getId", "(", ")", ",", "\"CustomerId\"", "=>", "$", "iCustomerId", ")", ")", ";", "return", "(", "!", "empty", "(", "$", "oResult", ")", ")", ";", "}", "}" ]
Check if user has access to customer @param int $iCustomerId @return bool
[ "Check", "if", "user", "has", "access", "to", "customer" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/AppController.php#L59-L75
19,358
webtown-php/KunstmaanExtensionBundle
src/Translation/Extraction/File/KunstmaanExtractor.php
KunstmaanExtractor.visitFile
public function visitFile(\SplFileInfo $file, MessageCatalogue $catalogue) { if ($file->getExtension() != 'yml') { return; } $path = strtr($file->getRealPath(), DIRECTORY_SEPARATOR, '/'); if (strpos($path, 'Resources/config/pageparts') === false) { return; } $parser = $this->getYmlParser(); $pagePartConfigs = $parser->parse(file_get_contents($file)); if (array_key_exists('types', $pagePartConfigs) && is_array($pagePartConfigs['types'])) { foreach ($pagePartConfigs['types'] as $type) { if (is_array($type) && array_key_exists('name', $type)) { $message = new Message($type['name']); $message->addSource(new FileSource((string)$file)); $catalogue->add($message); } } } }
php
public function visitFile(\SplFileInfo $file, MessageCatalogue $catalogue) { if ($file->getExtension() != 'yml') { return; } $path = strtr($file->getRealPath(), DIRECTORY_SEPARATOR, '/'); if (strpos($path, 'Resources/config/pageparts') === false) { return; } $parser = $this->getYmlParser(); $pagePartConfigs = $parser->parse(file_get_contents($file)); if (array_key_exists('types', $pagePartConfigs) && is_array($pagePartConfigs['types'])) { foreach ($pagePartConfigs['types'] as $type) { if (is_array($type) && array_key_exists('name', $type)) { $message = new Message($type['name']); $message->addSource(new FileSource((string)$file)); $catalogue->add($message); } } } }
[ "public", "function", "visitFile", "(", "\\", "SplFileInfo", "$", "file", ",", "MessageCatalogue", "$", "catalogue", ")", "{", "if", "(", "$", "file", "->", "getExtension", "(", ")", "!=", "'yml'", ")", "{", "return", ";", "}", "$", "path", "=", "strtr", "(", "$", "file", "->", "getRealPath", "(", ")", ",", "DIRECTORY_SEPARATOR", ",", "'/'", ")", ";", "if", "(", "strpos", "(", "$", "path", ",", "'Resources/config/pageparts'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "parser", "=", "$", "this", "->", "getYmlParser", "(", ")", ";", "$", "pagePartConfigs", "=", "$", "parser", "->", "parse", "(", "file_get_contents", "(", "$", "file", ")", ")", ";", "if", "(", "array_key_exists", "(", "'types'", ",", "$", "pagePartConfigs", ")", "&&", "is_array", "(", "$", "pagePartConfigs", "[", "'types'", "]", ")", ")", "{", "foreach", "(", "$", "pagePartConfigs", "[", "'types'", "]", "as", "$", "type", ")", "{", "if", "(", "is_array", "(", "$", "type", ")", "&&", "array_key_exists", "(", "'name'", ",", "$", "type", ")", ")", "{", "$", "message", "=", "new", "Message", "(", "$", "type", "[", "'name'", "]", ")", ";", "$", "message", "->", "addSource", "(", "new", "FileSource", "(", "(", "string", ")", "$", "file", ")", ")", ";", "$", "catalogue", "->", "add", "(", "$", "message", ")", ";", "}", "}", "}", "}" ]
Collect the pagepart names! @param \SplFileInfo $file @param MessageCatalogue $catalogue
[ "Collect", "the", "pagepart", "names!" ]
86c656c131295fe1f3f7694fd4da1e5e454076b9
https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Translation/Extraction/File/KunstmaanExtractor.php#L229-L249
19,359
steeffeen/FancyManiaLinks
FML/XmlRpc/UIProperties.php
UIProperties.setChatOffset
public function setChatOffset($offsetX, $offsetY) { $offset = array((float)$offsetX, (float)$offsetY); $this->setProperty($this->chatProperties, "offset", implode(" ", $offset)); return $this; }
php
public function setChatOffset($offsetX, $offsetY) { $offset = array((float)$offsetX, (float)$offsetY); $this->setProperty($this->chatProperties, "offset", implode(" ", $offset)); return $this; }
[ "public", "function", "setChatOffset", "(", "$", "offsetX", ",", "$", "offsetY", ")", "{", "$", "offset", "=", "array", "(", "(", "float", ")", "$", "offsetX", ",", "(", "float", ")", "$", "offsetY", ")", ";", "$", "this", "->", "setProperty", "(", "$", "this", "->", "chatProperties", ",", "\"offset\"", ",", "implode", "(", "\" \"", ",", "$", "offset", ")", ")", ";", "return", "$", "this", ";", "}" ]
Set the chat offset @api @param float $offsetX X offset @param float $offsetY Y offset @return static
[ "Set", "the", "chat", "offset" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/UIProperties.php#L104-L109
19,360
steeffeen/FancyManiaLinks
FML/XmlRpc/UIProperties.php
UIProperties.setMapInfoPosition
public function setMapInfoPosition($positionX, $positionY, $positionZ = null) { $this->setPositionProperty($this->mapInfoProperties, $positionX, $positionY, $positionZ); return $this; }
php
public function setMapInfoPosition($positionX, $positionY, $positionZ = null) { $this->setPositionProperty($this->mapInfoProperties, $positionX, $positionY, $positionZ); return $this; }
[ "public", "function", "setMapInfoPosition", "(", "$", "positionX", ",", "$", "positionY", ",", "$", "positionZ", "=", "null", ")", "{", "$", "this", "->", "setPositionProperty", "(", "$", "this", "->", "mapInfoProperties", ",", "$", "positionX", ",", "$", "positionY", ",", "$", "positionZ", ")", ";", "return", "$", "this", ";", "}" ]
Set the map info position @api @param float $positionX X position @param float $positionY Y position @param float $positionZ (optional) Z position (Z-index) @return static
[ "Set", "the", "map", "info", "position" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/UIProperties.php#L203-L207
19,361
steeffeen/FancyManiaLinks
FML/XmlRpc/UIProperties.php
UIProperties.setCountdownPosition
public function setCountdownPosition($positionX, $positionY, $positionZ = null) { $this->setPositionProperty($this->countdownProperties, $positionX, $positionY, $positionZ); return $this; }
php
public function setCountdownPosition($positionX, $positionY, $positionZ = null) { $this->setPositionProperty($this->countdownProperties, $positionX, $positionY, $positionZ); return $this; }
[ "public", "function", "setCountdownPosition", "(", "$", "positionX", ",", "$", "positionY", ",", "$", "positionZ", "=", "null", ")", "{", "$", "this", "->", "setPositionProperty", "(", "$", "this", "->", "countdownProperties", ",", "$", "positionX", ",", "$", "positionY", ",", "$", "positionZ", ")", ";", "return", "$", "this", ";", "}" ]
Set the countdown position @api @param float $positionX X position @param float $positionY Y position @param float $positionZ (optional) Z position (Z-index) @return static
[ "Set", "the", "countdown", "position" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/UIProperties.php#L253-L257
19,362
steeffeen/FancyManiaLinks
FML/XmlRpc/UIProperties.php
UIProperties.renderStandalone
public function renderStandalone() { $domDocument = new \DOMDocument("1.0", "utf-8"); $domDocument->xmlStandalone = true; $domElement = $domDocument->createElement("ui_properties"); $domDocument->appendChild($domElement); $allProperties = $this->getProperties(); foreach ($allProperties as $property => $propertySettings) { if (!$propertySettings) { continue; } $propertyDomElement = $domDocument->createElement($property); $domElement->appendChild($propertyDomElement); foreach ($propertySettings as $settingName => $settingValue) { $settingValueString = (is_string($settingValue) ? $settingValue : var_export($settingValue, true)); $propertyDomElement->setAttribute($settingName, $settingValueString); } } return $domDocument; }
php
public function renderStandalone() { $domDocument = new \DOMDocument("1.0", "utf-8"); $domDocument->xmlStandalone = true; $domElement = $domDocument->createElement("ui_properties"); $domDocument->appendChild($domElement); $allProperties = $this->getProperties(); foreach ($allProperties as $property => $propertySettings) { if (!$propertySettings) { continue; } $propertyDomElement = $domDocument->createElement($property); $domElement->appendChild($propertyDomElement); foreach ($propertySettings as $settingName => $settingValue) { $settingValueString = (is_string($settingValue) ? $settingValue : var_export($settingValue, true)); $propertyDomElement->setAttribute($settingName, $settingValueString); } } return $domDocument; }
[ "public", "function", "renderStandalone", "(", ")", "{", "$", "domDocument", "=", "new", "\\", "DOMDocument", "(", "\"1.0\"", ",", "\"utf-8\"", ")", ";", "$", "domDocument", "->", "xmlStandalone", "=", "true", ";", "$", "domElement", "=", "$", "domDocument", "->", "createElement", "(", "\"ui_properties\"", ")", ";", "$", "domDocument", "->", "appendChild", "(", "$", "domElement", ")", ";", "$", "allProperties", "=", "$", "this", "->", "getProperties", "(", ")", ";", "foreach", "(", "$", "allProperties", "as", "$", "property", "=>", "$", "propertySettings", ")", "{", "if", "(", "!", "$", "propertySettings", ")", "{", "continue", ";", "}", "$", "propertyDomElement", "=", "$", "domDocument", "->", "createElement", "(", "$", "property", ")", ";", "$", "domElement", "->", "appendChild", "(", "$", "propertyDomElement", ")", ";", "foreach", "(", "$", "propertySettings", "as", "$", "settingName", "=>", "$", "settingValue", ")", "{", "$", "settingValueString", "=", "(", "is_string", "(", "$", "settingValue", ")", "?", "$", "settingValue", ":", "var_export", "(", "$", "settingValue", ",", "true", ")", ")", ";", "$", "propertyDomElement", "->", "setAttribute", "(", "$", "settingName", ",", "$", "settingValueString", ")", ";", "}", "}", "return", "$", "domDocument", ";", "}" ]
Render the UI Properties standalone @return \DOMDocument
[ "Render", "the", "UI", "Properties", "standalone" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/UIProperties.php#L336-L360
19,363
steeffeen/FancyManiaLinks
FML/XmlRpc/UIProperties.php
UIProperties.getProperties
protected function getProperties() { return array( "chat" => $this->chatProperties, "chat_avatar" => $this->chatAvatarProperties, "map_info" => $this->mapInfoProperties, "countdown" => $this->countdownProperties, "go" => $this->goProperties, "endmap_ladder_recap" => $this->endMapLadderRecapProperties, "scorestable" => $this->scoresTableProperties ); }
php
protected function getProperties() { return array( "chat" => $this->chatProperties, "chat_avatar" => $this->chatAvatarProperties, "map_info" => $this->mapInfoProperties, "countdown" => $this->countdownProperties, "go" => $this->goProperties, "endmap_ladder_recap" => $this->endMapLadderRecapProperties, "scorestable" => $this->scoresTableProperties ); }
[ "protected", "function", "getProperties", "(", ")", "{", "return", "array", "(", "\"chat\"", "=>", "$", "this", "->", "chatProperties", ",", "\"chat_avatar\"", "=>", "$", "this", "->", "chatAvatarProperties", ",", "\"map_info\"", "=>", "$", "this", "->", "mapInfoProperties", ",", "\"countdown\"", "=>", "$", "this", "->", "countdownProperties", ",", "\"go\"", "=>", "$", "this", "->", "goProperties", ",", "\"endmap_ladder_recap\"", "=>", "$", "this", "->", "endMapLadderRecapProperties", ",", "\"scorestable\"", "=>", "$", "this", "->", "scoresTableProperties", ")", ";", "}" ]
Get associative array of all properties @return array
[ "Get", "associative", "array", "of", "all", "properties" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/UIProperties.php#L378-L389
19,364
steeffeen/FancyManiaLinks
FML/XmlRpc/UIProperties.php
UIProperties.setPositionProperty
protected function setPositionProperty(array &$properties, $positionX, $positionY, $positionZ = null) { $position = array((float)$positionX, (float)$positionY); if ($positionZ) { array_push($position, (float)$positionZ); } $this->setProperty($properties, "pos", implode(" ", $position)); return $this; }
php
protected function setPositionProperty(array &$properties, $positionX, $positionY, $positionZ = null) { $position = array((float)$positionX, (float)$positionY); if ($positionZ) { array_push($position, (float)$positionZ); } $this->setProperty($properties, "pos", implode(" ", $position)); return $this; }
[ "protected", "function", "setPositionProperty", "(", "array", "&", "$", "properties", ",", "$", "positionX", ",", "$", "positionY", ",", "$", "positionZ", "=", "null", ")", "{", "$", "position", "=", "array", "(", "(", "float", ")", "$", "positionX", ",", "(", "float", ")", "$", "positionY", ")", ";", "if", "(", "$", "positionZ", ")", "{", "array_push", "(", "$", "position", ",", "(", "float", ")", "$", "positionZ", ")", ";", "}", "$", "this", "->", "setProperty", "(", "$", "properties", ",", "\"pos\"", ",", "implode", "(", "\" \"", ",", "$", "position", ")", ")", ";", "return", "$", "this", ";", "}" ]
Set the Position property value @param array $properties Properties array @param float $positionX X position @param float $positionY Y position @param float $positionZ (optional) Z position (Z-index) @return static
[ "Set", "the", "Position", "property", "value" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/XmlRpc/UIProperties.php#L461-L469
19,365
php-rise/rise
src/Router/Scope.php
Scope.createScope
public function createScope($closure) { $newScope = (new static($this->request, $this->result, $this->urlGenerator)); $newScope->setupParent( $this->prefix, $this->prefixMatched, $this->requestPathOffset, $this->params ); $newScope->use($this->middlewares); // Must add middlewares before adding namespace, as the middlewares are already prefixed with namespace. $newScope->namespace($this->namespace); $closure($newScope); }
php
public function createScope($closure) { $newScope = (new static($this->request, $this->result, $this->urlGenerator)); $newScope->setupParent( $this->prefix, $this->prefixMatched, $this->requestPathOffset, $this->params ); $newScope->use($this->middlewares); // Must add middlewares before adding namespace, as the middlewares are already prefixed with namespace. $newScope->namespace($this->namespace); $closure($newScope); }
[ "public", "function", "createScope", "(", "$", "closure", ")", "{", "$", "newScope", "=", "(", "new", "static", "(", "$", "this", "->", "request", ",", "$", "this", "->", "result", ",", "$", "this", "->", "urlGenerator", ")", ")", ";", "$", "newScope", "->", "setupParent", "(", "$", "this", "->", "prefix", ",", "$", "this", "->", "prefixMatched", ",", "$", "this", "->", "requestPathOffset", ",", "$", "this", "->", "params", ")", ";", "$", "newScope", "->", "use", "(", "$", "this", "->", "middlewares", ")", ";", "// Must add middlewares before adding namespace, as the middlewares are already prefixed with namespace.", "$", "newScope", "->", "namespace", "(", "$", "this", "->", "namespace", ")", ";", "$", "closure", "(", "$", "newScope", ")", ";", "}" ]
Create a child scope. @param callable $closure
[ "Create", "a", "child", "scope", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Router/Scope.php#L88-L99
19,366
php-rise/rise
src/Router/Scope.php
Scope.prefix
public function prefix($prefix) { // Reset values before matching. $this->prefix = $this->parentPrefix; $this->requestPathOffset = $this->parentRequestPathOffset; if ($this->parentPrefixMatched) { $this->prefixMatched = $this->parentPrefixMatched; } if (!$this->result->hasHandler() && $this->prefixMatched) { $this->prefixMatched = $this->matchPartial($prefix); } $this->prefix .= $prefix; return $this; }
php
public function prefix($prefix) { // Reset values before matching. $this->prefix = $this->parentPrefix; $this->requestPathOffset = $this->parentRequestPathOffset; if ($this->parentPrefixMatched) { $this->prefixMatched = $this->parentPrefixMatched; } if (!$this->result->hasHandler() && $this->prefixMatched) { $this->prefixMatched = $this->matchPartial($prefix); } $this->prefix .= $prefix; return $this; }
[ "public", "function", "prefix", "(", "$", "prefix", ")", "{", "// Reset values before matching.", "$", "this", "->", "prefix", "=", "$", "this", "->", "parentPrefix", ";", "$", "this", "->", "requestPathOffset", "=", "$", "this", "->", "parentRequestPathOffset", ";", "if", "(", "$", "this", "->", "parentPrefixMatched", ")", "{", "$", "this", "->", "prefixMatched", "=", "$", "this", "->", "parentPrefixMatched", ";", "}", "if", "(", "!", "$", "this", "->", "result", "->", "hasHandler", "(", ")", "&&", "$", "this", "->", "prefixMatched", ")", "{", "$", "this", "->", "prefixMatched", "=", "$", "this", "->", "matchPartial", "(", "$", "prefix", ")", ";", "}", "$", "this", "->", "prefix", ".=", "$", "prefix", ";", "return", "$", "this", ";", "}" ]
Set a common path prefix for all routes. @param string $prefix @return self
[ "Set", "a", "common", "path", "prefix", "for", "all", "routes", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Router/Scope.php#L107-L122
19,367
php-rise/rise
src/Router/Scope.php
Scope.use
public function use($middlewares) { $middlewares = (array)$middlewares; if ($this->namespace) { foreach ($middlewares as &$middleware) { $middleware = $this->namespace . $middleware; } } $this->middlewares = array_merge($this->middlewares, (array)$middlewares); return $this; }
php
public function use($middlewares) { $middlewares = (array)$middlewares; if ($this->namespace) { foreach ($middlewares as &$middleware) { $middleware = $this->namespace . $middleware; } } $this->middlewares = array_merge($this->middlewares, (array)$middlewares); return $this; }
[ "public", "function", "use", "(", "$", "middlewares", ")", "{", "$", "middlewares", "=", "(", "array", ")", "$", "middlewares", ";", "if", "(", "$", "this", "->", "namespace", ")", "{", "foreach", "(", "$", "middlewares", "as", "&", "$", "middleware", ")", "{", "$", "middleware", "=", "$", "this", "->", "namespace", ".", "$", "middleware", ";", "}", "}", "$", "this", "->", "middlewares", "=", "array_merge", "(", "$", "this", "->", "middlewares", ",", "(", "array", ")", "$", "middlewares", ")", ";", "return", "$", "this", ";", "}" ]
Add middlewares. @param string[]|string $middlewares @return self
[ "Add", "middlewares", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Router/Scope.php#L145-L157
19,368
php-rise/rise
src/Router/Scope.php
Scope.on
public function on($method, $path, $handler, $name = '') { if (!$this->result->hasHandler() && $this->prefixMatched && $this->request->isMethod($method) ) { if ($this->matchPartial($path, true)) { $handlers = (array)$handler; if ($this->namespace) { foreach ($handlers as &$handler) { $handler = $this->namespace . $handler; } } if ($this->middlewares) { $handlers = array_merge($this->middlewares, $handlers); } $this->result->setHandler($handlers); $this->result->setStatus(200); $this->result->setParams($this->params); } } if ($name) { $this->urlGenerator->add($name, $this->prefix . $path); } return $this; }
php
public function on($method, $path, $handler, $name = '') { if (!$this->result->hasHandler() && $this->prefixMatched && $this->request->isMethod($method) ) { if ($this->matchPartial($path, true)) { $handlers = (array)$handler; if ($this->namespace) { foreach ($handlers as &$handler) { $handler = $this->namespace . $handler; } } if ($this->middlewares) { $handlers = array_merge($this->middlewares, $handlers); } $this->result->setHandler($handlers); $this->result->setStatus(200); $this->result->setParams($this->params); } } if ($name) { $this->urlGenerator->add($name, $this->prefix . $path); } return $this; }
[ "public", "function", "on", "(", "$", "method", ",", "$", "path", ",", "$", "handler", ",", "$", "name", "=", "''", ")", "{", "if", "(", "!", "$", "this", "->", "result", "->", "hasHandler", "(", ")", "&&", "$", "this", "->", "prefixMatched", "&&", "$", "this", "->", "request", "->", "isMethod", "(", "$", "method", ")", ")", "{", "if", "(", "$", "this", "->", "matchPartial", "(", "$", "path", ",", "true", ")", ")", "{", "$", "handlers", "=", "(", "array", ")", "$", "handler", ";", "if", "(", "$", "this", "->", "namespace", ")", "{", "foreach", "(", "$", "handlers", "as", "&", "$", "handler", ")", "{", "$", "handler", "=", "$", "this", "->", "namespace", ".", "$", "handler", ";", "}", "}", "if", "(", "$", "this", "->", "middlewares", ")", "{", "$", "handlers", "=", "array_merge", "(", "$", "this", "->", "middlewares", ",", "$", "handlers", ")", ";", "}", "$", "this", "->", "result", "->", "setHandler", "(", "$", "handlers", ")", ";", "$", "this", "->", "result", "->", "setStatus", "(", "200", ")", ";", "$", "this", "->", "result", "->", "setParams", "(", "$", "this", "->", "params", ")", ";", "}", "}", "if", "(", "$", "name", ")", "{", "$", "this", "->", "urlGenerator", "->", "add", "(", "$", "name", ",", "$", "this", "->", "prefix", ".", "$", "path", ")", ";", "}", "return", "$", "this", ";", "}" ]
Add a route. @param string $method @param string $path @param string|string[] $handler @param string $name Route name. @return self
[ "Add", "a", "route", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Router/Scope.php#L168-L197
19,369
php-rise/rise
src/Router/Scope.php
Scope.setupParent
public function setupParent($prefix, $prefixMatched, $requestPathOffset, $params) { $this->prefix = $prefix; $this->parentPrefix = $prefix; $this->prefixMatched = $prefixMatched; $this->parentPrefixMatched = $prefixMatched; $this->requestPathOffset = $requestPathOffset; $this->parentRequestPathOffset = $requestPathOffset; $this->params = $params; }
php
public function setupParent($prefix, $prefixMatched, $requestPathOffset, $params) { $this->prefix = $prefix; $this->parentPrefix = $prefix; $this->prefixMatched = $prefixMatched; $this->parentPrefixMatched = $prefixMatched; $this->requestPathOffset = $requestPathOffset; $this->parentRequestPathOffset = $requestPathOffset; $this->params = $params; }
[ "public", "function", "setupParent", "(", "$", "prefix", ",", "$", "prefixMatched", ",", "$", "requestPathOffset", ",", "$", "params", ")", "{", "$", "this", "->", "prefix", "=", "$", "prefix", ";", "$", "this", "->", "parentPrefix", "=", "$", "prefix", ";", "$", "this", "->", "prefixMatched", "=", "$", "prefixMatched", ";", "$", "this", "->", "parentPrefixMatched", "=", "$", "prefixMatched", ";", "$", "this", "->", "requestPathOffset", "=", "$", "requestPathOffset", ";", "$", "this", "->", "parentRequestPathOffset", "=", "$", "requestPathOffset", ";", "$", "this", "->", "params", "=", "$", "params", ";", "}" ]
Inherit data from parent scope. @param string $prefix @param bool $prefixMatched @param int $requestPathOffset @param array $params
[ "Inherit", "data", "from", "parent", "scope", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Router/Scope.php#L245-L253
19,370
php-rise/rise
src/Router/Scope.php
Scope.matchPartial
protected function matchPartial($routePathPartial, $toEnd = false) { $result = false; $numOfRouteMatches = preg_match_all( self::ROUTE_PARAM_PATTERN, $routePathPartial, $routeMatches, PREG_OFFSET_CAPTURE ); if ($numOfRouteMatches === 0) { // plain string if ($toEnd) { $requestPathPartial = substr($this->request->getPath(), $this->requestPathOffset); } else { $requestPathPartial = substr($this->request->getPath(), $this->requestPathOffset, strlen($routePathPartial)); } if ($routePathPartial === $requestPathPartial) { $result = true; if (!$toEnd) { // Move offset if it is not matching to the end, i.e. not the last match. $this->requestPathOffset += strlen($routePathPartial); } } } else if ($numOfRouteMatches > 0) { // has params // Build regex $pos = 0; $pattern = '#^'; for ($i = 0; $i < $numOfRouteMatches; $i++) { $pattern .= substr($routePathPartial, $pos, $routeMatches[1][$i][1] - $pos); $pattern .= '(?P<' . $routeMatches[2][$i][0] . '>[^/]+)'; $pos = $routeMatches[1][$i][1] + strlen($routeMatches[1][$i][0]); } $pattern .= substr($routePathPartial, $pos); if ($toEnd) { $pattern .= '$'; } $pattern .= '#'; $requestPathPartial = substr($this->request->getPath(), $this->requestPathOffset); $numOfPathMatches = preg_match($pattern, $requestPathPartial, $pathMatches); if ($numOfPathMatches === 1) { $result = true; // Setup params foreach ($routeMatches[2] as $m) { $paramName = $m[0]; $this->params[$paramName] = $pathMatches[$paramName]; } if (!$toEnd) { // Move offset if it is not matching to the end, i.e. not the last match. $this->requestPathOffset += strlen($pathMatches[0]); } } } return $result; }
php
protected function matchPartial($routePathPartial, $toEnd = false) { $result = false; $numOfRouteMatches = preg_match_all( self::ROUTE_PARAM_PATTERN, $routePathPartial, $routeMatches, PREG_OFFSET_CAPTURE ); if ($numOfRouteMatches === 0) { // plain string if ($toEnd) { $requestPathPartial = substr($this->request->getPath(), $this->requestPathOffset); } else { $requestPathPartial = substr($this->request->getPath(), $this->requestPathOffset, strlen($routePathPartial)); } if ($routePathPartial === $requestPathPartial) { $result = true; if (!$toEnd) { // Move offset if it is not matching to the end, i.e. not the last match. $this->requestPathOffset += strlen($routePathPartial); } } } else if ($numOfRouteMatches > 0) { // has params // Build regex $pos = 0; $pattern = '#^'; for ($i = 0; $i < $numOfRouteMatches; $i++) { $pattern .= substr($routePathPartial, $pos, $routeMatches[1][$i][1] - $pos); $pattern .= '(?P<' . $routeMatches[2][$i][0] . '>[^/]+)'; $pos = $routeMatches[1][$i][1] + strlen($routeMatches[1][$i][0]); } $pattern .= substr($routePathPartial, $pos); if ($toEnd) { $pattern .= '$'; } $pattern .= '#'; $requestPathPartial = substr($this->request->getPath(), $this->requestPathOffset); $numOfPathMatches = preg_match($pattern, $requestPathPartial, $pathMatches); if ($numOfPathMatches === 1) { $result = true; // Setup params foreach ($routeMatches[2] as $m) { $paramName = $m[0]; $this->params[$paramName] = $pathMatches[$paramName]; } if (!$toEnd) { // Move offset if it is not matching to the end, i.e. not the last match. $this->requestPathOffset += strlen($pathMatches[0]); } } } return $result; }
[ "protected", "function", "matchPartial", "(", "$", "routePathPartial", ",", "$", "toEnd", "=", "false", ")", "{", "$", "result", "=", "false", ";", "$", "numOfRouteMatches", "=", "preg_match_all", "(", "self", "::", "ROUTE_PARAM_PATTERN", ",", "$", "routePathPartial", ",", "$", "routeMatches", ",", "PREG_OFFSET_CAPTURE", ")", ";", "if", "(", "$", "numOfRouteMatches", "===", "0", ")", "{", "// plain string", "if", "(", "$", "toEnd", ")", "{", "$", "requestPathPartial", "=", "substr", "(", "$", "this", "->", "request", "->", "getPath", "(", ")", ",", "$", "this", "->", "requestPathOffset", ")", ";", "}", "else", "{", "$", "requestPathPartial", "=", "substr", "(", "$", "this", "->", "request", "->", "getPath", "(", ")", ",", "$", "this", "->", "requestPathOffset", ",", "strlen", "(", "$", "routePathPartial", ")", ")", ";", "}", "if", "(", "$", "routePathPartial", "===", "$", "requestPathPartial", ")", "{", "$", "result", "=", "true", ";", "if", "(", "!", "$", "toEnd", ")", "{", "// Move offset if it is not matching to the end, i.e. not the last match.", "$", "this", "->", "requestPathOffset", "+=", "strlen", "(", "$", "routePathPartial", ")", ";", "}", "}", "}", "else", "if", "(", "$", "numOfRouteMatches", ">", "0", ")", "{", "// has params", "// Build regex", "$", "pos", "=", "0", ";", "$", "pattern", "=", "'#^'", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "numOfRouteMatches", ";", "$", "i", "++", ")", "{", "$", "pattern", ".=", "substr", "(", "$", "routePathPartial", ",", "$", "pos", ",", "$", "routeMatches", "[", "1", "]", "[", "$", "i", "]", "[", "1", "]", "-", "$", "pos", ")", ";", "$", "pattern", ".=", "'(?P<'", ".", "$", "routeMatches", "[", "2", "]", "[", "$", "i", "]", "[", "0", "]", ".", "'>[^/]+)'", ";", "$", "pos", "=", "$", "routeMatches", "[", "1", "]", "[", "$", "i", "]", "[", "1", "]", "+", "strlen", "(", "$", "routeMatches", "[", "1", "]", "[", "$", "i", "]", "[", "0", "]", ")", ";", "}", "$", "pattern", ".=", "substr", "(", "$", "routePathPartial", ",", "$", "pos", ")", ";", "if", "(", "$", "toEnd", ")", "{", "$", "pattern", ".=", "'$'", ";", "}", "$", "pattern", ".=", "'#'", ";", "$", "requestPathPartial", "=", "substr", "(", "$", "this", "->", "request", "->", "getPath", "(", ")", ",", "$", "this", "->", "requestPathOffset", ")", ";", "$", "numOfPathMatches", "=", "preg_match", "(", "$", "pattern", ",", "$", "requestPathPartial", ",", "$", "pathMatches", ")", ";", "if", "(", "$", "numOfPathMatches", "===", "1", ")", "{", "$", "result", "=", "true", ";", "// Setup params", "foreach", "(", "$", "routeMatches", "[", "2", "]", "as", "$", "m", ")", "{", "$", "paramName", "=", "$", "m", "[", "0", "]", ";", "$", "this", "->", "params", "[", "$", "paramName", "]", "=", "$", "pathMatches", "[", "$", "paramName", "]", ";", "}", "if", "(", "!", "$", "toEnd", ")", "{", "// Move offset if it is not matching to the end, i.e. not the last match.", "$", "this", "->", "requestPathOffset", "+=", "strlen", "(", "$", "pathMatches", "[", "0", "]", ")", ";", "}", "}", "}", "return", "$", "result", ";", "}" ]
Match path partial with request path. This will move the request path offset. @param string $routePathPartial, @param bool $toEnd @return bool
[ "Match", "path", "partial", "with", "request", "path", ".", "This", "will", "move", "the", "request", "path", "offset", "." ]
cd14ef9956f1b6875b7bcd642545dcef6a9152b7
https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Router/Scope.php#L262-L323
19,371
Lansoweb/LosReCaptcha
src/Service/ReCaptcha.php
ReCaptcha.getHtml
public function getHtml($name = null) { $host = self::API_SERVER; $langOption = ''; if (isset($this->options['lang']) && ! empty($this->options['lang'])) { $langOption = "?hl={$this->options['lang']}"; } $return = <<<HTML <script type="text/javascript" src="{$host}{$langOption}" async defer></script> HTML; return $return; }
php
public function getHtml($name = null) { $host = self::API_SERVER; $langOption = ''; if (isset($this->options['lang']) && ! empty($this->options['lang'])) { $langOption = "?hl={$this->options['lang']}"; } $return = <<<HTML <script type="text/javascript" src="{$host}{$langOption}" async defer></script> HTML; return $return; }
[ "public", "function", "getHtml", "(", "$", "name", "=", "null", ")", "{", "$", "host", "=", "self", "::", "API_SERVER", ";", "$", "langOption", "=", "''", ";", "if", "(", "isset", "(", "$", "this", "->", "options", "[", "'lang'", "]", ")", "&&", "!", "empty", "(", "$", "this", "->", "options", "[", "'lang'", "]", ")", ")", "{", "$", "langOption", "=", "\"?hl={$this->options['lang']}\"", ";", "}", "$", "return", "=", " <<<HTML\n<script type=\"text/javascript\" src=\"{$host}{$langOption}\" async defer></script>\nHTML", ";", "return", "$", "return", ";", "}" ]
Get the HTML code for the captcha This method uses the public key to fetch a recaptcha form. @param null|string $name Base name for recaptcha form elements @return string @throws \LosReCaptcha\Service\Exception
[ "Get", "the", "HTML", "code", "for", "the", "captcha" ]
8df866995501db087c3850f97fd2b6547632e6ed
https://github.com/Lansoweb/LosReCaptcha/blob/8df866995501db087c3850f97fd2b6547632e6ed/src/Service/ReCaptcha.php#L138-L153
19,372
Lansoweb/LosReCaptcha
src/Service/ReCaptcha.php
ReCaptcha.query
protected function query($responseField) { $params = new Parameters($this->secretKey, $responseField, $this->ip); return $this->request->send($params); }
php
protected function query($responseField) { $params = new Parameters($this->secretKey, $responseField, $this->ip); return $this->request->send($params); }
[ "protected", "function", "query", "(", "$", "responseField", ")", "{", "$", "params", "=", "new", "Parameters", "(", "$", "this", "->", "secretKey", ",", "$", "responseField", ",", "$", "this", "->", "ip", ")", ";", "return", "$", "this", "->", "request", "->", "send", "(", "$", "params", ")", ";", "}" ]
Gets a solution to the verify server @param string $responseField @return \LosReCaptcha\Service\Response @throws \LosReCaptcha\\Service\Exception
[ "Gets", "a", "solution", "to", "the", "verify", "server" ]
8df866995501db087c3850f97fd2b6547632e6ed
https://github.com/Lansoweb/LosReCaptcha/blob/8df866995501db087c3850f97fd2b6547632e6ed/src/Service/ReCaptcha.php#L184-L189
19,373
yuncms/framework
src/user/controllers/SettingsController.php
SettingsController.actionProfile
public function actionProfile() { $model = UserProfile::findOne(['user_id' => Yii::$app->user->identity->getId()]); if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Your profile has been updated')); return $this->refresh(); } return $this->render('profile', [ 'model' => $model, ]); }
php
public function actionProfile() { $model = UserProfile::findOne(['user_id' => Yii::$app->user->identity->getId()]); if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Your profile has been updated')); return $this->refresh(); } return $this->render('profile', [ 'model' => $model, ]); }
[ "public", "function", "actionProfile", "(", ")", "{", "$", "model", "=", "UserProfile", "::", "findOne", "(", "[", "'user_id'", "=>", "Yii", "::", "$", "app", "->", "user", "->", "identity", "->", "getId", "(", ")", "]", ")", ";", "if", "(", "Yii", "::", "$", "app", "->", "request", "->", "isAjax", "&&", "$", "model", "->", "load", "(", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ")", ")", "{", "Yii", "::", "$", "app", "->", "response", "->", "format", "=", "Response", "::", "FORMAT_JSON", ";", "return", "ActiveForm", "::", "validate", "(", "$", "model", ")", ";", "}", "if", "(", "$", "model", "->", "load", "(", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ")", "&&", "$", "model", "->", "save", "(", ")", ")", "{", "Yii", "::", "$", "app", "->", "getSession", "(", ")", "->", "setFlash", "(", "'success'", ",", "Yii", "::", "t", "(", "'yuncms'", ",", "'Your profile has been updated'", ")", ")", ";", "return", "$", "this", "->", "refresh", "(", ")", ";", "}", "return", "$", "this", "->", "render", "(", "'profile'", ",", "[", "'model'", "=>", "$", "model", ",", "]", ")", ";", "}" ]
Shows profile settings form. @return array|string|Response
[ "Shows", "profile", "settings", "form", "." ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/controllers/SettingsController.php#L64-L78
19,374
yuncms/framework
src/user/controllers/SettingsController.php
SettingsController.actionAvatar
public function actionAvatar() { $model = new AvatarForm(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Your avatar has been updated')); } return $this->render('avatar', [ 'model' => $model, ]); }
php
public function actionAvatar() { $model = new AvatarForm(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Your avatar has been updated')); } return $this->render('avatar', [ 'model' => $model, ]); }
[ "public", "function", "actionAvatar", "(", ")", "{", "$", "model", "=", "new", "AvatarForm", "(", ")", ";", "if", "(", "$", "model", "->", "load", "(", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ")", "&&", "$", "model", "->", "save", "(", ")", ")", "{", "Yii", "::", "$", "app", "->", "getSession", "(", ")", "->", "setFlash", "(", "'success'", ",", "Yii", "::", "t", "(", "'yuncms'", ",", "'Your avatar has been updated'", ")", ")", ";", "}", "return", "$", "this", "->", "render", "(", "'avatar'", ",", "[", "'model'", "=>", "$", "model", ",", "]", ")", ";", "}" ]
Show portrait setting form @return \yii\web\Response|string @throws \League\Flysystem\FileExistsException @throws \League\Flysystem\FileNotFoundException @throws \yii\base\ErrorException @throws \yii\base\Exception @throws \yii\base\InvalidConfigException
[ "Show", "portrait", "setting", "form" ]
af42e28ea4ae15ab8eead3f6d119f93863b94154
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/controllers/SettingsController.php#L89-L98
19,375
struzik-vladislav/php-error-handler
src/Processor/IntoExceptionProcessor.php
IntoExceptionProcessor.getAssociatedClass
private function getAssociatedClass($errno) { $associations = [ E_WARNING => Exception\WarningException::class, E_NOTICE => Exception\NoticeException::class, E_USER_ERROR => Exception\UserErrorException::class, E_USER_WARNING => Exception\UserWarningException::class, E_USER_NOTICE => Exception\UserNoticeException::class, E_STRICT => Exception\StrictException::class, E_RECOVERABLE_ERROR => Exception\RecoverableErrorException::class, E_DEPRECATED => Exception\DeprecatedException::class, E_USER_DEPRECATED => Exception\UserDeprecatedException::class, ]; if (isset($associations[$errno])) { return $associations[$errno]; } return Exception\ErrorException::class; }
php
private function getAssociatedClass($errno) { $associations = [ E_WARNING => Exception\WarningException::class, E_NOTICE => Exception\NoticeException::class, E_USER_ERROR => Exception\UserErrorException::class, E_USER_WARNING => Exception\UserWarningException::class, E_USER_NOTICE => Exception\UserNoticeException::class, E_STRICT => Exception\StrictException::class, E_RECOVERABLE_ERROR => Exception\RecoverableErrorException::class, E_DEPRECATED => Exception\DeprecatedException::class, E_USER_DEPRECATED => Exception\UserDeprecatedException::class, ]; if (isset($associations[$errno])) { return $associations[$errno]; } return Exception\ErrorException::class; }
[ "private", "function", "getAssociatedClass", "(", "$", "errno", ")", "{", "$", "associations", "=", "[", "E_WARNING", "=>", "Exception", "\\", "WarningException", "::", "class", ",", "E_NOTICE", "=>", "Exception", "\\", "NoticeException", "::", "class", ",", "E_USER_ERROR", "=>", "Exception", "\\", "UserErrorException", "::", "class", ",", "E_USER_WARNING", "=>", "Exception", "\\", "UserWarningException", "::", "class", ",", "E_USER_NOTICE", "=>", "Exception", "\\", "UserNoticeException", "::", "class", ",", "E_STRICT", "=>", "Exception", "\\", "StrictException", "::", "class", ",", "E_RECOVERABLE_ERROR", "=>", "Exception", "\\", "RecoverableErrorException", "::", "class", ",", "E_DEPRECATED", "=>", "Exception", "\\", "DeprecatedException", "::", "class", ",", "E_USER_DEPRECATED", "=>", "Exception", "\\", "UserDeprecatedException", "::", "class", ",", "]", ";", "if", "(", "isset", "(", "$", "associations", "[", "$", "errno", "]", ")", ")", "{", "return", "$", "associations", "[", "$", "errno", "]", ";", "}", "return", "Exception", "\\", "ErrorException", "::", "class", ";", "}" ]
Getting the exception class name associated with error code. @param int $errno level of the error raised @return string
[ "Getting", "the", "exception", "class", "name", "associated", "with", "error", "code", "." ]
87fa9f56edca7011f78e00659bb094b4fe713ebe
https://github.com/struzik-vladislav/php-error-handler/blob/87fa9f56edca7011f78e00659bb094b4fe713ebe/src/Processor/IntoExceptionProcessor.php#L64-L83
19,376
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCountry.php
BaseCountry.initCustomers
public function initCustomers($overrideExisting = true) { if (null !== $this->collCustomers && !$overrideExisting) { return; } $this->collCustomers = new PropelObjectCollection(); $this->collCustomers->setModel('Customer'); }
php
public function initCustomers($overrideExisting = true) { if (null !== $this->collCustomers && !$overrideExisting) { return; } $this->collCustomers = new PropelObjectCollection(); $this->collCustomers->setModel('Customer'); }
[ "public", "function", "initCustomers", "(", "$", "overrideExisting", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "collCustomers", "&&", "!", "$", "overrideExisting", ")", "{", "return", ";", "}", "$", "this", "->", "collCustomers", "=", "new", "PropelObjectCollection", "(", ")", ";", "$", "this", "->", "collCustomers", "->", "setModel", "(", "'Customer'", ")", ";", "}" ]
Initializes the collCustomers collection. By default this just sets the collCustomers collection to an empty array (like clearcollCustomers()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting the initial array to the values stored in database. @param boolean $overrideExisting If set to true, the method call initializes the collection even if it is not empty @return void
[ "Initializes", "the", "collCustomers", "collection", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCountry.php#L1041-L1048
19,377
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCountry.php
BaseCountry.getCustomers
public function getCustomers($criteria = null, PropelPDO $con = null) { $partial = $this->collCustomersPartial && !$this->isNew(); if (null === $this->collCustomers || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomers) { // return empty collection $this->initCustomers(); } else { $collCustomers = CustomerQuery::create(null, $criteria) ->filterByCountry($this) ->find($con); if (null !== $criteria) { if (false !== $this->collCustomersPartial && count($collCustomers)) { $this->initCustomers(false); foreach ($collCustomers as $obj) { if (false == $this->collCustomers->contains($obj)) { $this->collCustomers->append($obj); } } $this->collCustomersPartial = true; } $collCustomers->getInternalIterator()->rewind(); return $collCustomers; } if ($partial && $this->collCustomers) { foreach ($this->collCustomers as $obj) { if ($obj->isNew()) { $collCustomers[] = $obj; } } } $this->collCustomers = $collCustomers; $this->collCustomersPartial = false; } } return $this->collCustomers; }
php
public function getCustomers($criteria = null, PropelPDO $con = null) { $partial = $this->collCustomersPartial && !$this->isNew(); if (null === $this->collCustomers || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomers) { // return empty collection $this->initCustomers(); } else { $collCustomers = CustomerQuery::create(null, $criteria) ->filterByCountry($this) ->find($con); if (null !== $criteria) { if (false !== $this->collCustomersPartial && count($collCustomers)) { $this->initCustomers(false); foreach ($collCustomers as $obj) { if (false == $this->collCustomers->contains($obj)) { $this->collCustomers->append($obj); } } $this->collCustomersPartial = true; } $collCustomers->getInternalIterator()->rewind(); return $collCustomers; } if ($partial && $this->collCustomers) { foreach ($this->collCustomers as $obj) { if ($obj->isNew()) { $collCustomers[] = $obj; } } } $this->collCustomers = $collCustomers; $this->collCustomersPartial = false; } } return $this->collCustomers; }
[ "public", "function", "getCustomers", "(", "$", "criteria", "=", "null", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collCustomersPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collCustomers", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collCustomers", ")", "{", "// return empty collection", "$", "this", "->", "initCustomers", "(", ")", ";", "}", "else", "{", "$", "collCustomers", "=", "CustomerQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", "->", "filterByCountry", "(", "$", "this", ")", "->", "find", "(", "$", "con", ")", ";", "if", "(", "null", "!==", "$", "criteria", ")", "{", "if", "(", "false", "!==", "$", "this", "->", "collCustomersPartial", "&&", "count", "(", "$", "collCustomers", ")", ")", "{", "$", "this", "->", "initCustomers", "(", "false", ")", ";", "foreach", "(", "$", "collCustomers", "as", "$", "obj", ")", "{", "if", "(", "false", "==", "$", "this", "->", "collCustomers", "->", "contains", "(", "$", "obj", ")", ")", "{", "$", "this", "->", "collCustomers", "->", "append", "(", "$", "obj", ")", ";", "}", "}", "$", "this", "->", "collCustomersPartial", "=", "true", ";", "}", "$", "collCustomers", "->", "getInternalIterator", "(", ")", "->", "rewind", "(", ")", ";", "return", "$", "collCustomers", ";", "}", "if", "(", "$", "partial", "&&", "$", "this", "->", "collCustomers", ")", "{", "foreach", "(", "$", "this", "->", "collCustomers", "as", "$", "obj", ")", "{", "if", "(", "$", "obj", "->", "isNew", "(", ")", ")", "{", "$", "collCustomers", "[", "]", "=", "$", "obj", ";", "}", "}", "}", "$", "this", "->", "collCustomers", "=", "$", "collCustomers", ";", "$", "this", "->", "collCustomersPartial", "=", "false", ";", "}", "}", "return", "$", "this", "->", "collCustomers", ";", "}" ]
Gets an array of Customer objects which contain a foreign key that references this object. If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the cached collection is returned. If this Country is new, it will return an empty collection or the current collection; the criteria is ignored on a new object. @param Criteria $criteria optional Criteria object to narrow the query @param PropelPDO $con optional connection object @return PropelObjectCollection|Customer[] List of Customer objects @throws PropelException
[ "Gets", "an", "array", "of", "Customer", "objects", "which", "contain", "a", "foreign", "key", "that", "references", "this", "object", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCountry.php#L1064-L1107
19,378
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCountry.php
BaseCountry.countCustomers
public function countCustomers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collCustomersPartial && !$this->isNew(); if (null === $this->collCustomers || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomers) { return 0; } if ($partial && !$criteria) { return count($this->getCustomers()); } $query = CustomerQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCountry($this) ->count($con); } return count($this->collCustomers); }
php
public function countCustomers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collCustomersPartial && !$this->isNew(); if (null === $this->collCustomers || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomers) { return 0; } if ($partial && !$criteria) { return count($this->getCustomers()); } $query = CustomerQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCountry($this) ->count($con); } return count($this->collCustomers); }
[ "public", "function", "countCustomers", "(", "Criteria", "$", "criteria", "=", "null", ",", "$", "distinct", "=", "false", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collCustomersPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collCustomers", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collCustomers", ")", "{", "return", "0", ";", "}", "if", "(", "$", "partial", "&&", "!", "$", "criteria", ")", "{", "return", "count", "(", "$", "this", "->", "getCustomers", "(", ")", ")", ";", "}", "$", "query", "=", "CustomerQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", ";", "if", "(", "$", "distinct", ")", "{", "$", "query", "->", "distinct", "(", ")", ";", "}", "return", "$", "query", "->", "filterByCountry", "(", "$", "this", ")", "->", "count", "(", "$", "con", ")", ";", "}", "return", "count", "(", "$", "this", "->", "collCustomers", ")", ";", "}" ]
Returns the number of related Customer objects. @param Criteria $criteria @param boolean $distinct @param PropelPDO $con @return int Count of related Customer objects. @throws PropelException
[ "Returns", "the", "number", "of", "related", "Customer", "objects", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCountry.php#L1150-L1172
19,379
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCountry.php
BaseCountry.addCustomer
public function addCustomer(Customer $l) { if ($this->collCustomers === null) { $this->initCustomers(); $this->collCustomersPartial = true; } if (!in_array($l, $this->collCustomers->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddCustomer($l); if ($this->customersScheduledForDeletion and $this->customersScheduledForDeletion->contains($l)) { $this->customersScheduledForDeletion->remove($this->customersScheduledForDeletion->search($l)); } } return $this; }
php
public function addCustomer(Customer $l) { if ($this->collCustomers === null) { $this->initCustomers(); $this->collCustomersPartial = true; } if (!in_array($l, $this->collCustomers->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddCustomer($l); if ($this->customersScheduledForDeletion and $this->customersScheduledForDeletion->contains($l)) { $this->customersScheduledForDeletion->remove($this->customersScheduledForDeletion->search($l)); } } return $this; }
[ "public", "function", "addCustomer", "(", "Customer", "$", "l", ")", "{", "if", "(", "$", "this", "->", "collCustomers", "===", "null", ")", "{", "$", "this", "->", "initCustomers", "(", ")", ";", "$", "this", "->", "collCustomersPartial", "=", "true", ";", "}", "if", "(", "!", "in_array", "(", "$", "l", ",", "$", "this", "->", "collCustomers", "->", "getArrayCopy", "(", ")", ",", "true", ")", ")", "{", "// only add it if the **same** object is not already associated", "$", "this", "->", "doAddCustomer", "(", "$", "l", ")", ";", "if", "(", "$", "this", "->", "customersScheduledForDeletion", "and", "$", "this", "->", "customersScheduledForDeletion", "->", "contains", "(", "$", "l", ")", ")", "{", "$", "this", "->", "customersScheduledForDeletion", "->", "remove", "(", "$", "this", "->", "customersScheduledForDeletion", "->", "search", "(", "$", "l", ")", ")", ";", "}", "}", "return", "$", "this", ";", "}" ]
Method called to associate a Customer object to this object through the Customer foreign key attribute. @param Customer $l Customer @return Country The current object (for fluent API support)
[ "Method", "called", "to", "associate", "a", "Customer", "object", "to", "this", "object", "through", "the", "Customer", "foreign", "key", "attribute", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCountry.php#L1181-L1197
19,380
CakeCMS/Core
src/Controller/Component/MoveComponent.php
MoveComponent.down
public function down(Table $table, $id, $step = 1) { return $this->_move($table, $id, $step, self::TYPE_DOWN); }
php
public function down(Table $table, $id, $step = 1) { return $this->_move($table, $id, $step, self::TYPE_DOWN); }
[ "public", "function", "down", "(", "Table", "$", "table", ",", "$", "id", ",", "$", "step", "=", "1", ")", "{", "return", "$", "this", "->", "_move", "(", "$", "table", ",", "$", "id", ",", "$", "step", ",", "self", "::", "TYPE_DOWN", ")", ";", "}" ]
Move down record in tree. @param Table $table @param int $id @param int $step @return \Cake\Http\Response|null
[ "Move", "down", "record", "in", "tree", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/Component/MoveComponent.php#L53-L56
19,381
CakeCMS/Core
src/Controller/Component/MoveComponent.php
MoveComponent.up
public function up(Table $table, $id, $step = 1) { return $this->_move($table, $id, $step); }
php
public function up(Table $table, $id, $step = 1) { return $this->_move($table, $id, $step); }
[ "public", "function", "up", "(", "Table", "$", "table", ",", "$", "id", ",", "$", "step", "=", "1", ")", "{", "return", "$", "this", "->", "_move", "(", "$", "table", ",", "$", "id", ",", "$", "step", ")", ";", "}" ]
Move up record in tree. @param Table $table @param int $id @param int $step @return \Cake\Http\Response|null @SuppressWarnings(PHPMD.ShortMethodName)
[ "Move", "up", "record", "in", "tree", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/Component/MoveComponent.php#L92-L95
19,382
CakeCMS/Core
src/Controller/Component/MoveComponent.php
MoveComponent._move
protected function _move(Table $table, $id, $step = 1, $type = self::TYPE_UP) { $behaviors = $table->behaviors(); if (!Arr::in('Tree', $behaviors->loaded())) { $behaviors->load('Tree'); } $entity = $table->get($id); /** @var TreeBehavior $treeBehavior */ $treeBehavior = $behaviors->get('Tree'); $treeBehavior->setConfig('scope', $entity->get('id')); if ($table->{$type}($entity, $step)) { $this->Flash->success($this->_configRead('messages.success')); } else { $this->Flash->error($this->_configRead('messages.error')); } return $this->_redirect(); }
php
protected function _move(Table $table, $id, $step = 1, $type = self::TYPE_UP) { $behaviors = $table->behaviors(); if (!Arr::in('Tree', $behaviors->loaded())) { $behaviors->load('Tree'); } $entity = $table->get($id); /** @var TreeBehavior $treeBehavior */ $treeBehavior = $behaviors->get('Tree'); $treeBehavior->setConfig('scope', $entity->get('id')); if ($table->{$type}($entity, $step)) { $this->Flash->success($this->_configRead('messages.success')); } else { $this->Flash->error($this->_configRead('messages.error')); } return $this->_redirect(); }
[ "protected", "function", "_move", "(", "Table", "$", "table", ",", "$", "id", ",", "$", "step", "=", "1", ",", "$", "type", "=", "self", "::", "TYPE_UP", ")", "{", "$", "behaviors", "=", "$", "table", "->", "behaviors", "(", ")", ";", "if", "(", "!", "Arr", "::", "in", "(", "'Tree'", ",", "$", "behaviors", "->", "loaded", "(", ")", ")", ")", "{", "$", "behaviors", "->", "load", "(", "'Tree'", ")", ";", "}", "$", "entity", "=", "$", "table", "->", "get", "(", "$", "id", ")", ";", "/** @var TreeBehavior $treeBehavior */", "$", "treeBehavior", "=", "$", "behaviors", "->", "get", "(", "'Tree'", ")", ";", "$", "treeBehavior", "->", "setConfig", "(", "'scope'", ",", "$", "entity", "->", "get", "(", "'id'", ")", ")", ";", "if", "(", "$", "table", "->", "{", "$", "type", "}", "(", "$", "entity", ",", "$", "step", ")", ")", "{", "$", "this", "->", "Flash", "->", "success", "(", "$", "this", "->", "_configRead", "(", "'messages.success'", ")", ")", ";", "}", "else", "{", "$", "this", "->", "Flash", "->", "error", "(", "$", "this", "->", "_configRead", "(", "'messages.error'", ")", ")", ";", "}", "return", "$", "this", "->", "_redirect", "(", ")", ";", "}" ]
Move object in tree table. @param Table $table @param string $type @param int $id @param int $step @return \Cake\Http\Response|null
[ "Move", "object", "in", "tree", "table", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/Component/MoveComponent.php#L106-L126
19,383
CakeCMS/Core
src/Controller/Component/MoveComponent.php
MoveComponent._redirect
protected function _redirect() { $request = $this->_controller->request; return $this->_controller->redirect([ 'prefix' => $request->getParam('prefix'), 'plugin' => $request->getParam('plugin'), 'controller' => $request->getParam('controller'), 'action' => $this->getConfig('action') ]); }
php
protected function _redirect() { $request = $this->_controller->request; return $this->_controller->redirect([ 'prefix' => $request->getParam('prefix'), 'plugin' => $request->getParam('plugin'), 'controller' => $request->getParam('controller'), 'action' => $this->getConfig('action') ]); }
[ "protected", "function", "_redirect", "(", ")", "{", "$", "request", "=", "$", "this", "->", "_controller", "->", "request", ";", "return", "$", "this", "->", "_controller", "->", "redirect", "(", "[", "'prefix'", "=>", "$", "request", "->", "getParam", "(", "'prefix'", ")", ",", "'plugin'", "=>", "$", "request", "->", "getParam", "(", "'plugin'", ")", ",", "'controller'", "=>", "$", "request", "->", "getParam", "(", "'controller'", ")", ",", "'action'", "=>", "$", "this", "->", "getConfig", "(", "'action'", ")", "]", ")", ";", "}" ]
Process redirect. @return \Cake\Http\Response|null
[ "Process", "redirect", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/Component/MoveComponent.php#L133-L142
19,384
nguyenanhung/nusoap
src-fix/nusoap.php
nusoap_base.&
function &getDebugAsXMLComment() { // it would be nice to use a memory stream here to use // memory more efficiently while (strpos($this->debug_str, '--')) { $this->debug_str = str_replace('--', '- -', $this->debug_str); } $ret = "<!--\n" . $this->debug_str . "\n-->"; return $ret; }
php
function &getDebugAsXMLComment() { // it would be nice to use a memory stream here to use // memory more efficiently while (strpos($this->debug_str, '--')) { $this->debug_str = str_replace('--', '- -', $this->debug_str); } $ret = "<!--\n" . $this->debug_str . "\n-->"; return $ret; }
[ "function", "&", "getDebugAsXMLComment", "(", ")", "{", "// it would be nice to use a memory stream here to use", "// memory more efficiently", "while", "(", "strpos", "(", "$", "this", "->", "debug_str", ",", "'--'", ")", ")", "{", "$", "this", "->", "debug_str", "=", "str_replace", "(", "'--'", ",", "'- -'", ",", "$", "this", "->", "debug_str", ")", ";", "}", "$", "ret", "=", "\"<!--\\n\"", ".", "$", "this", "->", "debug_str", ".", "\"\\n-->\"", ";", "return", "$", "ret", ";", "}" ]
gets the current debug data for this instance as an XML comment this may change the contents of the debug data @return debug data as an XML comment @access public
[ "gets", "the", "current", "debug", "data", "for", "this", "instance", "as", "an", "XML", "comment", "this", "may", "change", "the", "contents", "of", "the", "debug", "data" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L346-L356
19,385
nguyenanhung/nusoap
src-fix/nusoap.php
nusoap_xmlschema.serializeTypeDef
function serializeTypeDef($type) { //print "in sTD() for type $type<br>"; if ($typeDef = $this->getTypeDef($type)) { $str .= '<' . $type; if (is_array($typeDef['attrs'])) { foreach ($typeDef['attrs'] as $attName => $data) { $str .= " $attName=\"{type = " . $data['type'] . "}\""; } } $str .= " xmlns=\"" . $this->schema['targetNamespace'] . "\""; if (count($typeDef['elements']) > 0) { $str .= ">"; foreach ($typeDef['elements'] as $element => $eData) { $str .= $this->serializeTypeDef($element); } $str .= "</$type>"; } elseif ($typeDef['typeClass'] == 'element') { $str .= "></$type>"; } else { $str .= "/>"; } return $str; } return FALSE; }
php
function serializeTypeDef($type) { //print "in sTD() for type $type<br>"; if ($typeDef = $this->getTypeDef($type)) { $str .= '<' . $type; if (is_array($typeDef['attrs'])) { foreach ($typeDef['attrs'] as $attName => $data) { $str .= " $attName=\"{type = " . $data['type'] . "}\""; } } $str .= " xmlns=\"" . $this->schema['targetNamespace'] . "\""; if (count($typeDef['elements']) > 0) { $str .= ">"; foreach ($typeDef['elements'] as $element => $eData) { $str .= $this->serializeTypeDef($element); } $str .= "</$type>"; } elseif ($typeDef['typeClass'] == 'element') { $str .= "></$type>"; } else { $str .= "/>"; } return $str; } return FALSE; }
[ "function", "serializeTypeDef", "(", "$", "type", ")", "{", "//print \"in sTD() for type $type<br>\";", "if", "(", "$", "typeDef", "=", "$", "this", "->", "getTypeDef", "(", "$", "type", ")", ")", "{", "$", "str", ".=", "'<'", ".", "$", "type", ";", "if", "(", "is_array", "(", "$", "typeDef", "[", "'attrs'", "]", ")", ")", "{", "foreach", "(", "$", "typeDef", "[", "'attrs'", "]", "as", "$", "attName", "=>", "$", "data", ")", "{", "$", "str", ".=", "\" $attName=\\\"{type = \"", ".", "$", "data", "[", "'type'", "]", ".", "\"}\\\"\"", ";", "}", "}", "$", "str", ".=", "\" xmlns=\\\"\"", ".", "$", "this", "->", "schema", "[", "'targetNamespace'", "]", ".", "\"\\\"\"", ";", "if", "(", "count", "(", "$", "typeDef", "[", "'elements'", "]", ")", ">", "0", ")", "{", "$", "str", ".=", "\">\"", ";", "foreach", "(", "$", "typeDef", "[", "'elements'", "]", "as", "$", "element", "=>", "$", "eData", ")", "{", "$", "str", ".=", "$", "this", "->", "serializeTypeDef", "(", "$", "element", ")", ";", "}", "$", "str", ".=", "\"</$type>\"", ";", "}", "elseif", "(", "$", "typeDef", "[", "'typeClass'", "]", "==", "'element'", ")", "{", "$", "str", ".=", "\"></$type>\"", ";", "}", "else", "{", "$", "str", ".=", "\"/>\"", ";", "}", "return", "$", "str", ";", "}", "return", "FALSE", ";", "}" ]
returns a sample serialization of a given type, or false if no type by the given name @param string $type name of type @return mixed @access public @deprecated
[ "returns", "a", "sample", "serialization", "of", "a", "given", "type", "or", "false", "if", "no", "type", "by", "the", "given", "name" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L1995-L2022
19,386
nguyenanhung/nusoap
src-fix/nusoap.php
nusoap_xmlschema.typeToForm
function typeToForm($name, $type) { // get typedef if ($typeDef = $this->getTypeDef($type)) { // if struct if ($typeDef['phpType'] == 'struct') { $buffer .= '<table>'; foreach ($typeDef['elements'] as $child => $childDef) { $buffer .= " <tr><td align='right'>$childDef[name] (type: " . $this->getLocalPart($childDef['type']) . "):</td> <td><input type='text' name='parameters[" . $name . "][$childDef[name]]'></td></tr>"; } $buffer .= '</table>'; // if array } elseif ($typeDef['phpType'] == 'array') { $buffer .= '<table>'; for ($i = 0; $i < 3; $i++) { $buffer .= " <tr><td align='right'>array item (type: $typeDef[arrayType]):</td> <td><input type='text' name='parameters[" . $name . "][]'></td></tr>"; } $buffer .= '</table>'; // if scalar } else { $buffer .= "<input type='text' name='parameters[$name]'>"; } } else { $buffer .= "<input type='text' name='parameters[$name]'>"; } return $buffer; }
php
function typeToForm($name, $type) { // get typedef if ($typeDef = $this->getTypeDef($type)) { // if struct if ($typeDef['phpType'] == 'struct') { $buffer .= '<table>'; foreach ($typeDef['elements'] as $child => $childDef) { $buffer .= " <tr><td align='right'>$childDef[name] (type: " . $this->getLocalPart($childDef['type']) . "):</td> <td><input type='text' name='parameters[" . $name . "][$childDef[name]]'></td></tr>"; } $buffer .= '</table>'; // if array } elseif ($typeDef['phpType'] == 'array') { $buffer .= '<table>'; for ($i = 0; $i < 3; $i++) { $buffer .= " <tr><td align='right'>array item (type: $typeDef[arrayType]):</td> <td><input type='text' name='parameters[" . $name . "][]'></td></tr>"; } $buffer .= '</table>'; // if scalar } else { $buffer .= "<input type='text' name='parameters[$name]'>"; } } else { $buffer .= "<input type='text' name='parameters[$name]'>"; } return $buffer; }
[ "function", "typeToForm", "(", "$", "name", ",", "$", "type", ")", "{", "// get typedef", "if", "(", "$", "typeDef", "=", "$", "this", "->", "getTypeDef", "(", "$", "type", ")", ")", "{", "// if struct", "if", "(", "$", "typeDef", "[", "'phpType'", "]", "==", "'struct'", ")", "{", "$", "buffer", ".=", "'<table>'", ";", "foreach", "(", "$", "typeDef", "[", "'elements'", "]", "as", "$", "child", "=>", "$", "childDef", ")", "{", "$", "buffer", ".=", "\"\n\t\t\t\t\t<tr><td align='right'>$childDef[name] (type: \"", ".", "$", "this", "->", "getLocalPart", "(", "$", "childDef", "[", "'type'", "]", ")", ".", "\"):</td>\n\t\t\t\t\t<td><input type='text' name='parameters[\"", ".", "$", "name", ".", "\"][$childDef[name]]'></td></tr>\"", ";", "}", "$", "buffer", ".=", "'</table>'", ";", "// if array", "}", "elseif", "(", "$", "typeDef", "[", "'phpType'", "]", "==", "'array'", ")", "{", "$", "buffer", ".=", "'<table>'", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "3", ";", "$", "i", "++", ")", "{", "$", "buffer", ".=", "\"\n\t\t\t\t\t<tr><td align='right'>array item (type: $typeDef[arrayType]):</td>\n\t\t\t\t\t<td><input type='text' name='parameters[\"", ".", "$", "name", ".", "\"][]'></td></tr>\"", ";", "}", "$", "buffer", ".=", "'</table>'", ";", "// if scalar", "}", "else", "{", "$", "buffer", ".=", "\"<input type='text' name='parameters[$name]'>\"", ";", "}", "}", "else", "{", "$", "buffer", ".=", "\"<input type='text' name='parameters[$name]'>\"", ";", "}", "return", "$", "buffer", ";", "}" ]
returns HTML form elements that allow a user to enter values for creating an instance of the given type. @param string $name name for type instance @param string $type name of type @return string @access public @deprecated
[ "returns", "HTML", "form", "elements", "that", "allow", "a", "user", "to", "enter", "values", "for", "creating", "an", "instance", "of", "the", "given", "type", "." ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L2035-L2066
19,387
nguyenanhung/nusoap
src-fix/nusoap.php
nusoap_xmlschema.addComplexType
function addComplexType( $name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = [], $attrs = [], $arrayType = '' ) { $this->complexTypes[$name] = [ 'name' => $name, 'typeClass' => $typeClass, 'phpType' => $phpType, 'compositor' => $compositor, 'restrictionBase' => $restrictionBase, 'elements' => $elements, 'attrs' => $attrs, 'arrayType' => $arrayType ]; $this->xdebug("addComplexType $name:"); $this->appendDebug($this->varDump($this->complexTypes[$name])); }
php
function addComplexType( $name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = [], $attrs = [], $arrayType = '' ) { $this->complexTypes[$name] = [ 'name' => $name, 'typeClass' => $typeClass, 'phpType' => $phpType, 'compositor' => $compositor, 'restrictionBase' => $restrictionBase, 'elements' => $elements, 'attrs' => $attrs, 'arrayType' => $arrayType ]; $this->xdebug("addComplexType $name:"); $this->appendDebug($this->varDump($this->complexTypes[$name])); }
[ "function", "addComplexType", "(", "$", "name", ",", "$", "typeClass", "=", "'complexType'", ",", "$", "phpType", "=", "'array'", ",", "$", "compositor", "=", "''", ",", "$", "restrictionBase", "=", "''", ",", "$", "elements", "=", "[", "]", ",", "$", "attrs", "=", "[", "]", ",", "$", "arrayType", "=", "''", ")", "{", "$", "this", "->", "complexTypes", "[", "$", "name", "]", "=", "[", "'name'", "=>", "$", "name", ",", "'typeClass'", "=>", "$", "typeClass", ",", "'phpType'", "=>", "$", "phpType", ",", "'compositor'", "=>", "$", "compositor", ",", "'restrictionBase'", "=>", "$", "restrictionBase", ",", "'elements'", "=>", "$", "elements", ",", "'attrs'", "=>", "$", "attrs", ",", "'arrayType'", "=>", "$", "arrayType", "]", ";", "$", "this", "->", "xdebug", "(", "\"addComplexType $name:\"", ")", ";", "$", "this", "->", "appendDebug", "(", "$", "this", "->", "varDump", "(", "$", "this", "->", "complexTypes", "[", "$", "name", "]", ")", ")", ";", "}" ]
adds a complex type to the schema example: array addType( 'ArrayOfstring', 'complexType', 'array', '', 'SOAP-ENC:Array', array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), 'xsd:string' ); example: PHP associative array ( SOAP Struct ) addType( 'SOAPStruct', 'complexType', 'struct', 'all', array('myVar'=> array('name'=>'myVar','type'=>'string') ); @param name @param typeClass (complexType|simpleType|attribute) @param phpType : currently supported are array and struct (php assoc array) @param compositor (all|sequence|choice) @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) @param elements = array ( name = array(name=>'',type=>'') ) @param attrs = array( array( 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" ) ) @param arrayType : namespace:name (http://www.w3.org/2001/XMLSchema:string) @access public @see getTypeDef
[ "adds", "a", "complex", "type", "to", "the", "schema" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L2110-L2127
19,388
nguyenanhung/nusoap
src-fix/nusoap.php
soap_transport_http.setURL
function setURL($url) { $this->url = $url; $u = parse_url($url); foreach ($u as $k => $v) { $this->debug("parsed URL $k = $v"); $this->$k = $v; } // add any GET params to path if (isset($u['query']) && $u['query'] != '') { $this->path .= '?' . $u['query']; } // set default port if (!isset($u['port'])) { if ($u['scheme'] == 'https') { $this->port = 443; } else { $this->port = 80; } } $this->uri = $this->path; $this->digest_uri = $this->uri; // build headers if (!isset($u['port'])) { $this->setHeader('Host', $this->host); } else { $this->setHeader('Host', $this->host . ':' . $this->port); } if (isset($u['user']) && $u['user'] != '') { $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); } }
php
function setURL($url) { $this->url = $url; $u = parse_url($url); foreach ($u as $k => $v) { $this->debug("parsed URL $k = $v"); $this->$k = $v; } // add any GET params to path if (isset($u['query']) && $u['query'] != '') { $this->path .= '?' . $u['query']; } // set default port if (!isset($u['port'])) { if ($u['scheme'] == 'https') { $this->port = 443; } else { $this->port = 80; } } $this->uri = $this->path; $this->digest_uri = $this->uri; // build headers if (!isset($u['port'])) { $this->setHeader('Host', $this->host); } else { $this->setHeader('Host', $this->host . ':' . $this->port); } if (isset($u['user']) && $u['user'] != '') { $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); } }
[ "function", "setURL", "(", "$", "url", ")", "{", "$", "this", "->", "url", "=", "$", "url", ";", "$", "u", "=", "parse_url", "(", "$", "url", ")", ";", "foreach", "(", "$", "u", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "this", "->", "debug", "(", "\"parsed URL $k = $v\"", ")", ";", "$", "this", "->", "$", "k", "=", "$", "v", ";", "}", "// add any GET params to path", "if", "(", "isset", "(", "$", "u", "[", "'query'", "]", ")", "&&", "$", "u", "[", "'query'", "]", "!=", "''", ")", "{", "$", "this", "->", "path", ".=", "'?'", ".", "$", "u", "[", "'query'", "]", ";", "}", "// set default port", "if", "(", "!", "isset", "(", "$", "u", "[", "'port'", "]", ")", ")", "{", "if", "(", "$", "u", "[", "'scheme'", "]", "==", "'https'", ")", "{", "$", "this", "->", "port", "=", "443", ";", "}", "else", "{", "$", "this", "->", "port", "=", "80", ";", "}", "}", "$", "this", "->", "uri", "=", "$", "this", "->", "path", ";", "$", "this", "->", "digest_uri", "=", "$", "this", "->", "uri", ";", "// build headers", "if", "(", "!", "isset", "(", "$", "u", "[", "'port'", "]", ")", ")", "{", "$", "this", "->", "setHeader", "(", "'Host'", ",", "$", "this", "->", "host", ")", ";", "}", "else", "{", "$", "this", "->", "setHeader", "(", "'Host'", ",", "$", "this", "->", "host", ".", "':'", ".", "$", "this", "->", "port", ")", ";", "}", "if", "(", "isset", "(", "$", "u", "[", "'user'", "]", ")", "&&", "$", "u", "[", "'user'", "]", "!=", "''", ")", "{", "$", "this", "->", "setCredentials", "(", "urldecode", "(", "$", "u", "[", "'user'", "]", ")", ",", "isset", "(", "$", "u", "[", "'pass'", "]", ")", "?", "urldecode", "(", "$", "u", "[", "'pass'", "]", ")", ":", "''", ")", ";", "}", "}" ]
sets the URL to which to connect @param string $url The URL to which to connect @access private
[ "sets", "the", "URL", "to", "which", "to", "connect" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L2409-L2446
19,389
nguyenanhung/nusoap
src-fix/nusoap.php
soap_transport_http.setEncoding
function setEncoding($enc = 'gzip, deflate') { if (function_exists('gzdeflate')) { $this->protocol_version = '1.1'; $this->setHeader('Accept-Encoding', $enc); if (!isset($this->outgoing_headers['Connection'])) { $this->setHeader('Connection', 'close'); $this->persistentConnection = FALSE; } // deprecated as of PHP 5.3.0 //set_magic_quotes_runtime(0); $this->encoding = $enc; } }
php
function setEncoding($enc = 'gzip, deflate') { if (function_exists('gzdeflate')) { $this->protocol_version = '1.1'; $this->setHeader('Accept-Encoding', $enc); if (!isset($this->outgoing_headers['Connection'])) { $this->setHeader('Connection', 'close'); $this->persistentConnection = FALSE; } // deprecated as of PHP 5.3.0 //set_magic_quotes_runtime(0); $this->encoding = $enc; } }
[ "function", "setEncoding", "(", "$", "enc", "=", "'gzip, deflate'", ")", "{", "if", "(", "function_exists", "(", "'gzdeflate'", ")", ")", "{", "$", "this", "->", "protocol_version", "=", "'1.1'", ";", "$", "this", "->", "setHeader", "(", "'Accept-Encoding'", ",", "$", "enc", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "outgoing_headers", "[", "'Connection'", "]", ")", ")", "{", "$", "this", "->", "setHeader", "(", "'Connection'", ",", "'close'", ")", ";", "$", "this", "->", "persistentConnection", "=", "FALSE", ";", "}", "// deprecated as of PHP 5.3.0", "//set_magic_quotes_runtime(0);", "$", "this", "->", "encoding", "=", "$", "enc", ";", "}", "}" ]
use http encoding @param string $enc encoding style. supported values: gzip, deflate, or both @access public
[ "use", "http", "encoding" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L2873-L2886
19,390
nguyenanhung/nusoap
src-fix/nusoap.php
nusoap_server.register
function register( $name, $in = [], $out = [], $namespace = FALSE, $soapaction = FALSE, $style = FALSE, $use = FALSE, $documentation = '', $encodingStyle = '' ) { global $HTTP_SERVER_VARS; if ($this->externalWSDLURL) { die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'); } if (!$name) { die('You must specify a name when you register an operation'); } if (!is_array($in)) { die('You must provide an array for operation inputs'); } if (!is_array($out)) { die('You must provide an array for operation outputs'); } if (FALSE == $namespace) { } if (FALSE == $soapaction) { if (isset($_SERVER)) { $SERVER_NAME = $_SERVER['SERVER_NAME']; $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); } elseif (isset($HTTP_SERVER_VARS)) { $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; } else { $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); } if ($HTTPS == '1' || $HTTPS == 'on') { $SCHEME = 'https'; } else { $SCHEME = 'http'; } $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name"; } if (FALSE == $style) { $style = "rpc"; } if (FALSE == $use) { $use = "encoded"; } if ($use == 'encoded' && $encodingStyle == '') { $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; } $this->operations[$name] = [ 'name' => $name, 'in' => $in, 'out' => $out, 'namespace' => $namespace, 'soapaction' => $soapaction, 'style' => $style]; if ($this->wsdl) { $this->wsdl->addOperation($name, $in, $out, $namespace, $soapaction, $style, $use, $documentation, $encodingStyle); } return TRUE; }
php
function register( $name, $in = [], $out = [], $namespace = FALSE, $soapaction = FALSE, $style = FALSE, $use = FALSE, $documentation = '', $encodingStyle = '' ) { global $HTTP_SERVER_VARS; if ($this->externalWSDLURL) { die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'); } if (!$name) { die('You must specify a name when you register an operation'); } if (!is_array($in)) { die('You must provide an array for operation inputs'); } if (!is_array($out)) { die('You must provide an array for operation outputs'); } if (FALSE == $namespace) { } if (FALSE == $soapaction) { if (isset($_SERVER)) { $SERVER_NAME = $_SERVER['SERVER_NAME']; $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); } elseif (isset($HTTP_SERVER_VARS)) { $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; } else { $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); } if ($HTTPS == '1' || $HTTPS == 'on') { $SCHEME = 'https'; } else { $SCHEME = 'http'; } $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name"; } if (FALSE == $style) { $style = "rpc"; } if (FALSE == $use) { $use = "encoded"; } if ($use == 'encoded' && $encodingStyle == '') { $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; } $this->operations[$name] = [ 'name' => $name, 'in' => $in, 'out' => $out, 'namespace' => $namespace, 'soapaction' => $soapaction, 'style' => $style]; if ($this->wsdl) { $this->wsdl->addOperation($name, $in, $out, $namespace, $soapaction, $style, $use, $documentation, $encodingStyle); } return TRUE; }
[ "function", "register", "(", "$", "name", ",", "$", "in", "=", "[", "]", ",", "$", "out", "=", "[", "]", ",", "$", "namespace", "=", "FALSE", ",", "$", "soapaction", "=", "FALSE", ",", "$", "style", "=", "FALSE", ",", "$", "use", "=", "FALSE", ",", "$", "documentation", "=", "''", ",", "$", "encodingStyle", "=", "''", ")", "{", "global", "$", "HTTP_SERVER_VARS", ";", "if", "(", "$", "this", "->", "externalWSDLURL", ")", "{", "die", "(", "'You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'", ")", ";", "}", "if", "(", "!", "$", "name", ")", "{", "die", "(", "'You must specify a name when you register an operation'", ")", ";", "}", "if", "(", "!", "is_array", "(", "$", "in", ")", ")", "{", "die", "(", "'You must provide an array for operation inputs'", ")", ";", "}", "if", "(", "!", "is_array", "(", "$", "out", ")", ")", "{", "die", "(", "'You must provide an array for operation outputs'", ")", ";", "}", "if", "(", "FALSE", "==", "$", "namespace", ")", "{", "}", "if", "(", "FALSE", "==", "$", "soapaction", ")", "{", "if", "(", "isset", "(", "$", "_SERVER", ")", ")", "{", "$", "SERVER_NAME", "=", "$", "_SERVER", "[", "'SERVER_NAME'", "]", ";", "$", "SCRIPT_NAME", "=", "isset", "(", "$", "_SERVER", "[", "'PHP_SELF'", "]", ")", "?", "$", "_SERVER", "[", "'PHP_SELF'", "]", ":", "$", "_SERVER", "[", "'SCRIPT_NAME'", "]", ";", "$", "HTTPS", "=", "isset", "(", "$", "_SERVER", "[", "'HTTPS'", "]", ")", "?", "$", "_SERVER", "[", "'HTTPS'", "]", ":", "(", "isset", "(", "$", "HTTP_SERVER_VARS", "[", "'HTTPS'", "]", ")", "?", "$", "HTTP_SERVER_VARS", "[", "'HTTPS'", "]", ":", "'off'", ")", ";", "}", "elseif", "(", "isset", "(", "$", "HTTP_SERVER_VARS", ")", ")", "{", "$", "SERVER_NAME", "=", "$", "HTTP_SERVER_VARS", "[", "'SERVER_NAME'", "]", ";", "$", "SCRIPT_NAME", "=", "isset", "(", "$", "HTTP_SERVER_VARS", "[", "'PHP_SELF'", "]", ")", "?", "$", "HTTP_SERVER_VARS", "[", "'PHP_SELF'", "]", ":", "$", "HTTP_SERVER_VARS", "[", "'SCRIPT_NAME'", "]", ";", "$", "HTTPS", "=", "isset", "(", "$", "HTTP_SERVER_VARS", "[", "'HTTPS'", "]", ")", "?", "$", "HTTP_SERVER_VARS", "[", "'HTTPS'", "]", ":", "'off'", ";", "}", "else", "{", "$", "this", "->", "setError", "(", "\"Neither _SERVER nor HTTP_SERVER_VARS is available\"", ")", ";", "}", "if", "(", "$", "HTTPS", "==", "'1'", "||", "$", "HTTPS", "==", "'on'", ")", "{", "$", "SCHEME", "=", "'https'", ";", "}", "else", "{", "$", "SCHEME", "=", "'http'", ";", "}", "$", "soapaction", "=", "\"$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name\"", ";", "}", "if", "(", "FALSE", "==", "$", "style", ")", "{", "$", "style", "=", "\"rpc\"", ";", "}", "if", "(", "FALSE", "==", "$", "use", ")", "{", "$", "use", "=", "\"encoded\"", ";", "}", "if", "(", "$", "use", "==", "'encoded'", "&&", "$", "encodingStyle", "==", "''", ")", "{", "$", "encodingStyle", "=", "'http://schemas.xmlsoap.org/soap/encoding/'", ";", "}", "$", "this", "->", "operations", "[", "$", "name", "]", "=", "[", "'name'", "=>", "$", "name", ",", "'in'", "=>", "$", "in", ",", "'out'", "=>", "$", "out", ",", "'namespace'", "=>", "$", "namespace", ",", "'soapaction'", "=>", "$", "soapaction", ",", "'style'", "=>", "$", "style", "]", ";", "if", "(", "$", "this", "->", "wsdl", ")", "{", "$", "this", "->", "wsdl", "->", "addOperation", "(", "$", "name", ",", "$", "in", ",", "$", "out", ",", "$", "namespace", ",", "$", "soapaction", ",", "$", "style", ",", "$", "use", ",", "$", "documentation", ",", "$", "encodingStyle", ")", ";", "}", "return", "TRUE", ";", "}" ]
register a service function with the server @param string $name the name of the PHP function, class.method or class..method @param array $in assoc array of input values: key = param name, value = param type @param array $out assoc array of output values: key = param name, value = param type @param mixed $namespace the element namespace for the method or false @param mixed $soapaction the soapaction for the method or false @param mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically @param mixed $use optional (encoded|literal) or false @param string $documentation optional Description to include in WSDL @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) @access public
[ "register", "a", "service", "function", "with", "the", "server" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L4693-L4754
19,391
nguyenanhung/nusoap
src-fix/nusoap.php
wsdl.getOperations
function getOperations($portName = '', $bindingType = 'soap') { $ops = []; if ($bindingType == 'soap') { $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; } elseif ($bindingType == 'soap12') { $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; } else { $this->debug("getOperations bindingType $bindingType may not be supported"); } $this->debug("getOperations for port '$portName' bindingType $bindingType"); // loop thru ports foreach ($this->ports as $port => $portData) { $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); if ($portName == '' || $port == $portName) { // binding type of port matches parameter if ($portData['bindingType'] == $bindingType) { $this->debug("getOperations found port $port bindingType $bindingType"); //$this->debug("port data: " . $this->varDump($portData)); //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); // merge bindings if (isset($this->bindings[$portData['binding']]['operations'])) { $ops = array_merge($ops, $this->bindings[$portData['binding']]['operations']); } } } } if (count($ops) == 0) { $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); } return $ops; }
php
function getOperations($portName = '', $bindingType = 'soap') { $ops = []; if ($bindingType == 'soap') { $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; } elseif ($bindingType == 'soap12') { $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; } else { $this->debug("getOperations bindingType $bindingType may not be supported"); } $this->debug("getOperations for port '$portName' bindingType $bindingType"); // loop thru ports foreach ($this->ports as $port => $portData) { $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); if ($portName == '' || $port == $portName) { // binding type of port matches parameter if ($portData['bindingType'] == $bindingType) { $this->debug("getOperations found port $port bindingType $bindingType"); //$this->debug("port data: " . $this->varDump($portData)); //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); // merge bindings if (isset($this->bindings[$portData['binding']]['operations'])) { $ops = array_merge($ops, $this->bindings[$portData['binding']]['operations']); } } } } if (count($ops) == 0) { $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); } return $ops; }
[ "function", "getOperations", "(", "$", "portName", "=", "''", ",", "$", "bindingType", "=", "'soap'", ")", "{", "$", "ops", "=", "[", "]", ";", "if", "(", "$", "bindingType", "==", "'soap'", ")", "{", "$", "bindingType", "=", "'http://schemas.xmlsoap.org/wsdl/soap/'", ";", "}", "elseif", "(", "$", "bindingType", "==", "'soap12'", ")", "{", "$", "bindingType", "=", "'http://schemas.xmlsoap.org/wsdl/soap12/'", ";", "}", "else", "{", "$", "this", "->", "debug", "(", "\"getOperations bindingType $bindingType may not be supported\"", ")", ";", "}", "$", "this", "->", "debug", "(", "\"getOperations for port '$portName' bindingType $bindingType\"", ")", ";", "// loop thru ports", "foreach", "(", "$", "this", "->", "ports", "as", "$", "port", "=>", "$", "portData", ")", "{", "$", "this", "->", "debug", "(", "\"getOperations checking port $port bindingType \"", ".", "$", "portData", "[", "'bindingType'", "]", ")", ";", "if", "(", "$", "portName", "==", "''", "||", "$", "port", "==", "$", "portName", ")", "{", "// binding type of port matches parameter", "if", "(", "$", "portData", "[", "'bindingType'", "]", "==", "$", "bindingType", ")", "{", "$", "this", "->", "debug", "(", "\"getOperations found port $port bindingType $bindingType\"", ")", ";", "//$this->debug(\"port data: \" . $this->varDump($portData));", "//$this->debug(\"bindings: \" . $this->varDump($this->bindings[ $portData['binding'] ]));", "// merge bindings", "if", "(", "isset", "(", "$", "this", "->", "bindings", "[", "$", "portData", "[", "'binding'", "]", "]", "[", "'operations'", "]", ")", ")", "{", "$", "ops", "=", "array_merge", "(", "$", "ops", ",", "$", "this", "->", "bindings", "[", "$", "portData", "[", "'binding'", "]", "]", "[", "'operations'", "]", ")", ";", "}", "}", "}", "}", "if", "(", "count", "(", "$", "ops", ")", "==", "0", ")", "{", "$", "this", "->", "debug", "(", "\"getOperations found no operations for port '$portName' bindingType $bindingType\"", ")", ";", "}", "return", "$", "ops", ";", "}" ]
returns an assoc array of operation names => operation data @param string $portName WSDL port name @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported) @return array @access public
[ "returns", "an", "assoc", "array", "of", "operation", "names", "=", ">", "operation", "data" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L5481-L5513
19,392
nguyenanhung/nusoap
src-fix/nusoap.php
nusoap_client.parseResponse
function parseResponse($headers, $data) { $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); $this->appendDebug($this->varDump($headers)); if (!isset($headers['content-type'])) { $this->setError('Response not of type text/xml (no content-type header)'); return FALSE; } if (!strstr($headers['content-type'], 'text/xml')) { $this->setError('Response not of type text/xml: ' . $headers['content-type']); return FALSE; } if (strpos($headers['content-type'], '=')) { $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); $this->debug('Got response encoding: ' . $enc); if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) { $this->xml_encoding = strtoupper($enc); } else { $this->xml_encoding = 'US-ASCII'; } } else { // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 $this->xml_encoding = 'ISO-8859-1'; } $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); $parser = new nusoap_parser($data, $this->xml_encoding, $this->operations, $this->decode_utf8); // add parser debug data to our debug $this->appendDebug($parser->getDebug()); // if parse errors if ($errstr = $parser->getError()) { $this->setError($errstr); // destroy the parser object unset($parser); return FALSE; } else { // get SOAP headers $this->responseHeaders = $parser->getHeaders(); // get SOAP headers $this->responseHeader = $parser->get_soapheader(); // get decoded message $return = $parser->get_soapbody(); // add document for doclit support $this->document = $parser->document; // destroy the parser object unset($parser); // return decode message return $return; } }
php
function parseResponse($headers, $data) { $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); $this->appendDebug($this->varDump($headers)); if (!isset($headers['content-type'])) { $this->setError('Response not of type text/xml (no content-type header)'); return FALSE; } if (!strstr($headers['content-type'], 'text/xml')) { $this->setError('Response not of type text/xml: ' . $headers['content-type']); return FALSE; } if (strpos($headers['content-type'], '=')) { $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); $this->debug('Got response encoding: ' . $enc); if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) { $this->xml_encoding = strtoupper($enc); } else { $this->xml_encoding = 'US-ASCII'; } } else { // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 $this->xml_encoding = 'ISO-8859-1'; } $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); $parser = new nusoap_parser($data, $this->xml_encoding, $this->operations, $this->decode_utf8); // add parser debug data to our debug $this->appendDebug($parser->getDebug()); // if parse errors if ($errstr = $parser->getError()) { $this->setError($errstr); // destroy the parser object unset($parser); return FALSE; } else { // get SOAP headers $this->responseHeaders = $parser->getHeaders(); // get SOAP headers $this->responseHeader = $parser->get_soapheader(); // get decoded message $return = $parser->get_soapbody(); // add document for doclit support $this->document = $parser->document; // destroy the parser object unset($parser); // return decode message return $return; } }
[ "function", "parseResponse", "(", "$", "headers", ",", "$", "data", ")", "{", "$", "this", "->", "debug", "(", "'Entering parseResponse() for data of length '", ".", "strlen", "(", "$", "data", ")", ".", "' headers:'", ")", ";", "$", "this", "->", "appendDebug", "(", "$", "this", "->", "varDump", "(", "$", "headers", ")", ")", ";", "if", "(", "!", "isset", "(", "$", "headers", "[", "'content-type'", "]", ")", ")", "{", "$", "this", "->", "setError", "(", "'Response not of type text/xml (no content-type header)'", ")", ";", "return", "FALSE", ";", "}", "if", "(", "!", "strstr", "(", "$", "headers", "[", "'content-type'", "]", ",", "'text/xml'", ")", ")", "{", "$", "this", "->", "setError", "(", "'Response not of type text/xml: '", ".", "$", "headers", "[", "'content-type'", "]", ")", ";", "return", "FALSE", ";", "}", "if", "(", "strpos", "(", "$", "headers", "[", "'content-type'", "]", ",", "'='", ")", ")", "{", "$", "enc", "=", "str_replace", "(", "'\"'", ",", "''", ",", "substr", "(", "strstr", "(", "$", "headers", "[", "\"content-type\"", "]", ",", "'='", ")", ",", "1", ")", ")", ";", "$", "this", "->", "debug", "(", "'Got response encoding: '", ".", "$", "enc", ")", ";", "if", "(", "preg_match", "(", "'/^(ISO-8859-1|US-ASCII|UTF-8)$/i'", ",", "$", "enc", ")", ")", "{", "$", "this", "->", "xml_encoding", "=", "strtoupper", "(", "$", "enc", ")", ";", "}", "else", "{", "$", "this", "->", "xml_encoding", "=", "'US-ASCII'", ";", "}", "}", "else", "{", "// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1", "$", "this", "->", "xml_encoding", "=", "'ISO-8859-1'", ";", "}", "$", "this", "->", "debug", "(", "'Use encoding: '", ".", "$", "this", "->", "xml_encoding", ".", "' when creating nusoap_parser'", ")", ";", "$", "parser", "=", "new", "nusoap_parser", "(", "$", "data", ",", "$", "this", "->", "xml_encoding", ",", "$", "this", "->", "operations", ",", "$", "this", "->", "decode_utf8", ")", ";", "// add parser debug data to our debug", "$", "this", "->", "appendDebug", "(", "$", "parser", "->", "getDebug", "(", ")", ")", ";", "// if parse errors", "if", "(", "$", "errstr", "=", "$", "parser", "->", "getError", "(", ")", ")", "{", "$", "this", "->", "setError", "(", "$", "errstr", ")", ";", "// destroy the parser object", "unset", "(", "$", "parser", ")", ";", "return", "FALSE", ";", "}", "else", "{", "// get SOAP headers", "$", "this", "->", "responseHeaders", "=", "$", "parser", "->", "getHeaders", "(", ")", ";", "// get SOAP headers", "$", "this", "->", "responseHeader", "=", "$", "parser", "->", "get_soapheader", "(", ")", ";", "// get decoded message", "$", "return", "=", "$", "parser", "->", "get_soapbody", "(", ")", ";", "// add document for doclit support", "$", "this", "->", "document", "=", "$", "parser", "->", "document", ";", "// destroy the parser object", "unset", "(", "$", "parser", ")", ";", "// return decode message", "return", "$", "return", ";", "}", "}" ]
processes SOAP message returned from server @param array $headers The HTTP headers @param string $data unprocessed response data from server @return mixed value of the message, decoded into a PHP type @access private
[ "processes", "SOAP", "message", "returned", "from", "server" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L8072-L8124
19,393
nguyenanhung/nusoap
src-fix/nusoap.php
nusoap_client.getProxy
function getProxy() { $r = rand(); $evalStr = $this->_getProxyClassCode($r); //$this->debug("proxy class: $evalStr"); if ($this->getError()) { $this->debug("Error from _getProxyClassCode, so return null"); return NULL; } // eval the class eval($evalStr); // instantiate proxy object eval("\$proxy = new nusoap_proxy_$r('');"); // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice $proxy->endpointType = 'wsdl'; $proxy->wsdlFile = $this->wsdlFile; $proxy->wsdl = $this->wsdl; $proxy->operations = $this->operations; $proxy->defaultRpcParams = $this->defaultRpcParams; // transfer other state $proxy->soap_defencoding = $this->soap_defencoding; $proxy->username = $this->username; $proxy->password = $this->password; $proxy->authtype = $this->authtype; $proxy->certRequest = $this->certRequest; $proxy->requestHeaders = $this->requestHeaders; $proxy->endpoint = $this->endpoint; $proxy->forceEndpoint = $this->forceEndpoint; $proxy->proxyhost = $this->proxyhost; $proxy->proxyport = $this->proxyport; $proxy->proxyusername = $this->proxyusername; $proxy->proxypassword = $this->proxypassword; $proxy->http_encoding = $this->http_encoding; $proxy->timeout = $this->timeout; $proxy->response_timeout = $this->response_timeout; $proxy->persistentConnection = &$this->persistentConnection; $proxy->decode_utf8 = $this->decode_utf8; $proxy->curl_options = $this->curl_options; $proxy->bindingType = $this->bindingType; $proxy->use_curl = $this->use_curl; return $proxy; }
php
function getProxy() { $r = rand(); $evalStr = $this->_getProxyClassCode($r); //$this->debug("proxy class: $evalStr"); if ($this->getError()) { $this->debug("Error from _getProxyClassCode, so return null"); return NULL; } // eval the class eval($evalStr); // instantiate proxy object eval("\$proxy = new nusoap_proxy_$r('');"); // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice $proxy->endpointType = 'wsdl'; $proxy->wsdlFile = $this->wsdlFile; $proxy->wsdl = $this->wsdl; $proxy->operations = $this->operations; $proxy->defaultRpcParams = $this->defaultRpcParams; // transfer other state $proxy->soap_defencoding = $this->soap_defencoding; $proxy->username = $this->username; $proxy->password = $this->password; $proxy->authtype = $this->authtype; $proxy->certRequest = $this->certRequest; $proxy->requestHeaders = $this->requestHeaders; $proxy->endpoint = $this->endpoint; $proxy->forceEndpoint = $this->forceEndpoint; $proxy->proxyhost = $this->proxyhost; $proxy->proxyport = $this->proxyport; $proxy->proxyusername = $this->proxyusername; $proxy->proxypassword = $this->proxypassword; $proxy->http_encoding = $this->http_encoding; $proxy->timeout = $this->timeout; $proxy->response_timeout = $this->response_timeout; $proxy->persistentConnection = &$this->persistentConnection; $proxy->decode_utf8 = $this->decode_utf8; $proxy->curl_options = $this->curl_options; $proxy->bindingType = $this->bindingType; $proxy->use_curl = $this->use_curl; return $proxy; }
[ "function", "getProxy", "(", ")", "{", "$", "r", "=", "rand", "(", ")", ";", "$", "evalStr", "=", "$", "this", "->", "_getProxyClassCode", "(", "$", "r", ")", ";", "//$this->debug(\"proxy class: $evalStr\");", "if", "(", "$", "this", "->", "getError", "(", ")", ")", "{", "$", "this", "->", "debug", "(", "\"Error from _getProxyClassCode, so return null\"", ")", ";", "return", "NULL", ";", "}", "// eval the class", "eval", "(", "$", "evalStr", ")", ";", "// instantiate proxy object", "eval", "(", "\"\\$proxy = new nusoap_proxy_$r('');\"", ")", ";", "// transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice", "$", "proxy", "->", "endpointType", "=", "'wsdl'", ";", "$", "proxy", "->", "wsdlFile", "=", "$", "this", "->", "wsdlFile", ";", "$", "proxy", "->", "wsdl", "=", "$", "this", "->", "wsdl", ";", "$", "proxy", "->", "operations", "=", "$", "this", "->", "operations", ";", "$", "proxy", "->", "defaultRpcParams", "=", "$", "this", "->", "defaultRpcParams", ";", "// transfer other state", "$", "proxy", "->", "soap_defencoding", "=", "$", "this", "->", "soap_defencoding", ";", "$", "proxy", "->", "username", "=", "$", "this", "->", "username", ";", "$", "proxy", "->", "password", "=", "$", "this", "->", "password", ";", "$", "proxy", "->", "authtype", "=", "$", "this", "->", "authtype", ";", "$", "proxy", "->", "certRequest", "=", "$", "this", "->", "certRequest", ";", "$", "proxy", "->", "requestHeaders", "=", "$", "this", "->", "requestHeaders", ";", "$", "proxy", "->", "endpoint", "=", "$", "this", "->", "endpoint", ";", "$", "proxy", "->", "forceEndpoint", "=", "$", "this", "->", "forceEndpoint", ";", "$", "proxy", "->", "proxyhost", "=", "$", "this", "->", "proxyhost", ";", "$", "proxy", "->", "proxyport", "=", "$", "this", "->", "proxyport", ";", "$", "proxy", "->", "proxyusername", "=", "$", "this", "->", "proxyusername", ";", "$", "proxy", "->", "proxypassword", "=", "$", "this", "->", "proxypassword", ";", "$", "proxy", "->", "http_encoding", "=", "$", "this", "->", "http_encoding", ";", "$", "proxy", "->", "timeout", "=", "$", "this", "->", "timeout", ";", "$", "proxy", "->", "response_timeout", "=", "$", "this", "->", "response_timeout", ";", "$", "proxy", "->", "persistentConnection", "=", "&", "$", "this", "->", "persistentConnection", ";", "$", "proxy", "->", "decode_utf8", "=", "$", "this", "->", "decode_utf8", ";", "$", "proxy", "->", "curl_options", "=", "$", "this", "->", "curl_options", ";", "$", "proxy", "->", "bindingType", "=", "$", "this", "->", "bindingType", ";", "$", "proxy", "->", "use_curl", "=", "$", "this", "->", "use_curl", ";", "return", "$", "proxy", ";", "}" ]
dynamically creates an instance of a proxy class, allowing user to directly call methods from wsdl @return object soap_proxy object @access public
[ "dynamically", "creates", "an", "instance", "of", "a", "proxy", "class", "allowing", "user", "to", "directly", "call", "methods", "from", "wsdl" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L8306-L8349
19,394
nguyenanhung/nusoap
src-fix/nusoap.php
nusoap_client._getProxyClassCode
function _getProxyClassCode($r) { $this->debug("in getProxy endpointType=$this->endpointType"); $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); if ($this->endpointType != 'wsdl') { $evalStr = 'A proxy can only be created for a WSDL client'; $this->setError($evalStr); $evalStr = "echo \"$evalStr\";"; return $evalStr; } if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { $this->loadWSDL(); if ($this->getError()) { return "echo \"" . $this->getError() . "\";"; } } $evalStr = ''; foreach ($this->operations as $operation => $opData) { if ($operation != '') { // create param string and param comment string if (sizeof($opData['input']['parts']) > 0) { $paramStr = ''; $paramArrayStr = ''; $paramCommentStr = ''; foreach ($opData['input']['parts'] as $name => $type) { $paramStr .= "\$$name, "; $paramArrayStr .= "'$name' => \$$name, "; $paramCommentStr .= "$type \$$name, "; } $paramStr = substr($paramStr, 0, strlen($paramStr) - 2); $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr) - 2); $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr) - 2); } else { $paramStr = ''; $paramArrayStr = ''; $paramCommentStr = 'void'; } $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; $evalStr .= "// $paramCommentStr function " . str_replace('.', '__', $operation) . "($paramStr) { \$params = array($paramArrayStr); return \$this->call('$operation', \$params, '" . $opData['namespace'] . "', '" . (isset($opData['soapAction']) ? $opData['soapAction'] : '') . "'); } "; unset($paramStr); unset($paramCommentStr); } } $evalStr = 'class nusoap_proxy_' . $r . ' extends nusoap_client { ' . $evalStr . ' }'; return $evalStr; }
php
function _getProxyClassCode($r) { $this->debug("in getProxy endpointType=$this->endpointType"); $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); if ($this->endpointType != 'wsdl') { $evalStr = 'A proxy can only be created for a WSDL client'; $this->setError($evalStr); $evalStr = "echo \"$evalStr\";"; return $evalStr; } if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { $this->loadWSDL(); if ($this->getError()) { return "echo \"" . $this->getError() . "\";"; } } $evalStr = ''; foreach ($this->operations as $operation => $opData) { if ($operation != '') { // create param string and param comment string if (sizeof($opData['input']['parts']) > 0) { $paramStr = ''; $paramArrayStr = ''; $paramCommentStr = ''; foreach ($opData['input']['parts'] as $name => $type) { $paramStr .= "\$$name, "; $paramArrayStr .= "'$name' => \$$name, "; $paramCommentStr .= "$type \$$name, "; } $paramStr = substr($paramStr, 0, strlen($paramStr) - 2); $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr) - 2); $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr) - 2); } else { $paramStr = ''; $paramArrayStr = ''; $paramCommentStr = 'void'; } $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; $evalStr .= "// $paramCommentStr function " . str_replace('.', '__', $operation) . "($paramStr) { \$params = array($paramArrayStr); return \$this->call('$operation', \$params, '" . $opData['namespace'] . "', '" . (isset($opData['soapAction']) ? $opData['soapAction'] : '') . "'); } "; unset($paramStr); unset($paramCommentStr); } } $evalStr = 'class nusoap_proxy_' . $r . ' extends nusoap_client { ' . $evalStr . ' }'; return $evalStr; }
[ "function", "_getProxyClassCode", "(", "$", "r", ")", "{", "$", "this", "->", "debug", "(", "\"in getProxy endpointType=$this->endpointType\"", ")", ";", "$", "this", "->", "appendDebug", "(", "\"wsdl=\"", ".", "$", "this", "->", "varDump", "(", "$", "this", "->", "wsdl", ")", ")", ";", "if", "(", "$", "this", "->", "endpointType", "!=", "'wsdl'", ")", "{", "$", "evalStr", "=", "'A proxy can only be created for a WSDL client'", ";", "$", "this", "->", "setError", "(", "$", "evalStr", ")", ";", "$", "evalStr", "=", "\"echo \\\"$evalStr\\\";\"", ";", "return", "$", "evalStr", ";", "}", "if", "(", "$", "this", "->", "endpointType", "==", "'wsdl'", "&&", "is_null", "(", "$", "this", "->", "wsdl", ")", ")", "{", "$", "this", "->", "loadWSDL", "(", ")", ";", "if", "(", "$", "this", "->", "getError", "(", ")", ")", "{", "return", "\"echo \\\"\"", ".", "$", "this", "->", "getError", "(", ")", ".", "\"\\\";\"", ";", "}", "}", "$", "evalStr", "=", "''", ";", "foreach", "(", "$", "this", "->", "operations", "as", "$", "operation", "=>", "$", "opData", ")", "{", "if", "(", "$", "operation", "!=", "''", ")", "{", "// create param string and param comment string", "if", "(", "sizeof", "(", "$", "opData", "[", "'input'", "]", "[", "'parts'", "]", ")", ">", "0", ")", "{", "$", "paramStr", "=", "''", ";", "$", "paramArrayStr", "=", "''", ";", "$", "paramCommentStr", "=", "''", ";", "foreach", "(", "$", "opData", "[", "'input'", "]", "[", "'parts'", "]", "as", "$", "name", "=>", "$", "type", ")", "{", "$", "paramStr", ".=", "\"\\$$name, \"", ";", "$", "paramArrayStr", ".=", "\"'$name' => \\$$name, \"", ";", "$", "paramCommentStr", ".=", "\"$type \\$$name, \"", ";", "}", "$", "paramStr", "=", "substr", "(", "$", "paramStr", ",", "0", ",", "strlen", "(", "$", "paramStr", ")", "-", "2", ")", ";", "$", "paramArrayStr", "=", "substr", "(", "$", "paramArrayStr", ",", "0", ",", "strlen", "(", "$", "paramArrayStr", ")", "-", "2", ")", ";", "$", "paramCommentStr", "=", "substr", "(", "$", "paramCommentStr", ",", "0", ",", "strlen", "(", "$", "paramCommentStr", ")", "-", "2", ")", ";", "}", "else", "{", "$", "paramStr", "=", "''", ";", "$", "paramArrayStr", "=", "''", ";", "$", "paramCommentStr", "=", "'void'", ";", "}", "$", "opData", "[", "'namespace'", "]", "=", "!", "isset", "(", "$", "opData", "[", "'namespace'", "]", ")", "?", "'http://testuri.com'", ":", "$", "opData", "[", "'namespace'", "]", ";", "$", "evalStr", ".=", "\"// $paramCommentStr\n\tfunction \"", ".", "str_replace", "(", "'.'", ",", "'__'", ",", "$", "operation", ")", ".", "\"($paramStr) {\n\t\t\\$params = array($paramArrayStr);\n\t\treturn \\$this->call('$operation', \\$params, '\"", ".", "$", "opData", "[", "'namespace'", "]", ".", "\"', '\"", ".", "(", "isset", "(", "$", "opData", "[", "'soapAction'", "]", ")", "?", "$", "opData", "[", "'soapAction'", "]", ":", "''", ")", ".", "\"');\n\t}\n\t\"", ";", "unset", "(", "$", "paramStr", ")", ";", "unset", "(", "$", "paramCommentStr", ")", ";", "}", "}", "$", "evalStr", "=", "'class nusoap_proxy_'", ".", "$", "r", ".", "' extends nusoap_client {\n\t'", ".", "$", "evalStr", ".", "'\n}'", ";", "return", "$", "evalStr", ";", "}" ]
dynamically creates proxy class code @return string PHP/NuSOAP code for the proxy class @access private
[ "dynamically", "creates", "proxy", "class", "code" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src-fix/nusoap.php#L8357-L8411
19,395
webforge-labs/psc-cms
lib/Psc/Form/ComponentsValidator.php
ComponentsValidator.validateSet
public function validateSet() { $this->validatedComponents = array(); // jede Componente nur einmal validieren, wir führen buch $exceptions = array(); foreach ($this->components as $component) { try { $this->validateComponent($component); } catch (ValidatorException $e) { if ($this->exceptionList) { $exceptions[] = $e; } else { throw $e; } } } if ($this->exceptionList && count($exceptions) > 0) { throw new ValidatorExceptionList($exceptions); } $this->postValidation(); return $this; }
php
public function validateSet() { $this->validatedComponents = array(); // jede Componente nur einmal validieren, wir führen buch $exceptions = array(); foreach ($this->components as $component) { try { $this->validateComponent($component); } catch (ValidatorException $e) { if ($this->exceptionList) { $exceptions[] = $e; } else { throw $e; } } } if ($this->exceptionList && count($exceptions) > 0) { throw new ValidatorExceptionList($exceptions); } $this->postValidation(); return $this; }
[ "public", "function", "validateSet", "(", ")", "{", "$", "this", "->", "validatedComponents", "=", "array", "(", ")", ";", "// jede Componente nur einmal validieren, wir führen buch", "$", "exceptions", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "components", "as", "$", "component", ")", "{", "try", "{", "$", "this", "->", "validateComponent", "(", "$", "component", ")", ";", "}", "catch", "(", "ValidatorException", "$", "e", ")", "{", "if", "(", "$", "this", "->", "exceptionList", ")", "{", "$", "exceptions", "[", "]", "=", "$", "e", ";", "}", "else", "{", "throw", "$", "e", ";", "}", "}", "}", "if", "(", "$", "this", "->", "exceptionList", "&&", "count", "(", "$", "exceptions", ")", ">", "0", ")", "{", "throw", "new", "ValidatorExceptionList", "(", "$", "exceptions", ")", ";", "}", "$", "this", "->", "postValidation", "(", ")", ";", "return", "$", "this", ";", "}" ]
Validiert alle Daten anhand der Meta-Daten von den FormDaten optionals müssen hiervor gesetzt werden wenn $this->exceptionList TRUE ist werden die ValidationExceptions gesammelt und dann eine ValidatorExceptionList geworfen wenn FALSE wird direkt die erste ValidatorException geworfen
[ "Validiert", "alle", "Daten", "anhand", "der", "Meta", "-", "Daten", "von", "den", "FormDaten" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Form/ComponentsValidator.php#L67-L89
19,396
PortaText/php-sdk
src/PortaText/Command/Base.php
Base.getContentType
protected function getContentType($method) { // Just to make PHPMD happy. $method = null; $file = $this->getArgument("file"); if (!is_null($file)) { return "text/csv"; } $soundFile = $this->getArgument("sound_file"); if (!is_null($soundFile)) { return "audio/mpeg"; } return 'application/json'; }
php
protected function getContentType($method) { // Just to make PHPMD happy. $method = null; $file = $this->getArgument("file"); if (!is_null($file)) { return "text/csv"; } $soundFile = $this->getArgument("sound_file"); if (!is_null($soundFile)) { return "audio/mpeg"; } return 'application/json'; }
[ "protected", "function", "getContentType", "(", "$", "method", ")", "{", "// Just to make PHPMD happy.", "$", "method", "=", "null", ";", "$", "file", "=", "$", "this", "->", "getArgument", "(", "\"file\"", ")", ";", "if", "(", "!", "is_null", "(", "$", "file", ")", ")", "{", "return", "\"text/csv\"", ";", "}", "$", "soundFile", "=", "$", "this", "->", "getArgument", "(", "\"sound_file\"", ")", ";", "if", "(", "!", "is_null", "(", "$", "soundFile", ")", ")", "{", "return", "\"audio/mpeg\"", ";", "}", "return", "'application/json'", ";", "}" ]
Returns the content type for this endpoint. @param string $method Method for this command. @return string
[ "Returns", "the", "content", "type", "for", "this", "endpoint", "." ]
dbe04ef043db5b251953f9de57aa4d0f1785dfcc
https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Base.php#L115-L128
19,397
PortaText/php-sdk
src/PortaText/Command/Base.php
Base.getAcceptContentType
protected function getAcceptContentType($method) { // Just to make PHPMD happy. $method = null; $acceptFile = $this->getArgument("accept_file"); if (!is_null($acceptFile)) { return "text/csv"; } $acceptAnyFile = $this->getArgument("accept_any_file"); if (!is_null($acceptAnyFile)) { return "*/*"; } $acceptSoundFile = $this->getArgument("accept_sound_file"); if (!is_null($acceptSoundFile)) { return "audio/mpeg"; } return 'application/json'; }
php
protected function getAcceptContentType($method) { // Just to make PHPMD happy. $method = null; $acceptFile = $this->getArgument("accept_file"); if (!is_null($acceptFile)) { return "text/csv"; } $acceptAnyFile = $this->getArgument("accept_any_file"); if (!is_null($acceptAnyFile)) { return "*/*"; } $acceptSoundFile = $this->getArgument("accept_sound_file"); if (!is_null($acceptSoundFile)) { return "audio/mpeg"; } return 'application/json'; }
[ "protected", "function", "getAcceptContentType", "(", "$", "method", ")", "{", "// Just to make PHPMD happy.", "$", "method", "=", "null", ";", "$", "acceptFile", "=", "$", "this", "->", "getArgument", "(", "\"accept_file\"", ")", ";", "if", "(", "!", "is_null", "(", "$", "acceptFile", ")", ")", "{", "return", "\"text/csv\"", ";", "}", "$", "acceptAnyFile", "=", "$", "this", "->", "getArgument", "(", "\"accept_any_file\"", ")", ";", "if", "(", "!", "is_null", "(", "$", "acceptAnyFile", ")", ")", "{", "return", "\"*/*\"", ";", "}", "$", "acceptSoundFile", "=", "$", "this", "->", "getArgument", "(", "\"accept_sound_file\"", ")", ";", "if", "(", "!", "is_null", "(", "$", "acceptSoundFile", ")", ")", "{", "return", "\"audio/mpeg\"", ";", "}", "return", "'application/json'", ";", "}" ]
Returns the accepted content type for this endpoint. @param string $method Method for this command. @return string
[ "Returns", "the", "accepted", "content", "type", "for", "this", "endpoint", "." ]
dbe04ef043db5b251953f9de57aa4d0f1785dfcc
https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Base.php#L137-L154
19,398
PortaText/php-sdk
src/PortaText/Command/Base.php
Base.run
protected function run($method) { $endpoint = $this->getEndpoint($method); $outputFile = $this->getArgument('accept_file'); if (is_null($outputFile)) { $outputFile = $this->getArgument('accept_any_file'); } if (is_null($outputFile)) { $outputFile = $this->getArgument('accept_sound_file'); } $cType = $this->getContentType($method); $aCType = $this->getAcceptContentType($method); $this->delArgument('accept_file'); $this->delArgument('accept_any_file'); $this->delArgument('accept_sound_file'); $body = $this->getBody($method); return $this->client->run( $endpoint, $method, $cType, $aCType, $body, $outputFile ); }
php
protected function run($method) { $endpoint = $this->getEndpoint($method); $outputFile = $this->getArgument('accept_file'); if (is_null($outputFile)) { $outputFile = $this->getArgument('accept_any_file'); } if (is_null($outputFile)) { $outputFile = $this->getArgument('accept_sound_file'); } $cType = $this->getContentType($method); $aCType = $this->getAcceptContentType($method); $this->delArgument('accept_file'); $this->delArgument('accept_any_file'); $this->delArgument('accept_sound_file'); $body = $this->getBody($method); return $this->client->run( $endpoint, $method, $cType, $aCType, $body, $outputFile ); }
[ "protected", "function", "run", "(", "$", "method", ")", "{", "$", "endpoint", "=", "$", "this", "->", "getEndpoint", "(", "$", "method", ")", ";", "$", "outputFile", "=", "$", "this", "->", "getArgument", "(", "'accept_file'", ")", ";", "if", "(", "is_null", "(", "$", "outputFile", ")", ")", "{", "$", "outputFile", "=", "$", "this", "->", "getArgument", "(", "'accept_any_file'", ")", ";", "}", "if", "(", "is_null", "(", "$", "outputFile", ")", ")", "{", "$", "outputFile", "=", "$", "this", "->", "getArgument", "(", "'accept_sound_file'", ")", ";", "}", "$", "cType", "=", "$", "this", "->", "getContentType", "(", "$", "method", ")", ";", "$", "aCType", "=", "$", "this", "->", "getAcceptContentType", "(", "$", "method", ")", ";", "$", "this", "->", "delArgument", "(", "'accept_file'", ")", ";", "$", "this", "->", "delArgument", "(", "'accept_any_file'", ")", ";", "$", "this", "->", "delArgument", "(", "'accept_sound_file'", ")", ";", "$", "body", "=", "$", "this", "->", "getBody", "(", "$", "method", ")", ";", "return", "$", "this", "->", "client", "->", "run", "(", "$", "endpoint", ",", "$", "method", ",", "$", "cType", ",", "$", "aCType", ",", "$", "body", ",", "$", "outputFile", ")", ";", "}" ]
Runs this command with the given method and returns the result. @param string $method HTTP Method to use. @return PortaText\Command\ICommand @throws PortaText\Exception\RequestError
[ "Runs", "this", "command", "with", "the", "given", "method", "and", "returns", "the", "result", "." ]
dbe04ef043db5b251953f9de57aa4d0f1785dfcc
https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Base.php#L219-L243
19,399
onigoetz/imagecache
src/Manager.php
Manager.getOriginalFile
public function getOriginalFile($source_file) { $original_file = $this->options['path_local'] . '/' . $source_file; if (!is_file($original_file)) { throw new Exceptions\NotFoundException('File not found'); } return $original_file; }
php
public function getOriginalFile($source_file) { $original_file = $this->options['path_local'] . '/' . $source_file; if (!is_file($original_file)) { throw new Exceptions\NotFoundException('File not found'); } return $original_file; }
[ "public", "function", "getOriginalFile", "(", "$", "source_file", ")", "{", "$", "original_file", "=", "$", "this", "->", "options", "[", "'path_local'", "]", ".", "'/'", ".", "$", "source_file", ";", "if", "(", "!", "is_file", "(", "$", "original_file", ")", ")", "{", "throw", "new", "Exceptions", "\\", "NotFoundException", "(", "'File not found'", ")", ";", "}", "return", "$", "original_file", ";", "}" ]
The path to the original file @param $source_file @return string @throws Exceptions\NotFoundException
[ "The", "path", "to", "the", "original", "file" ]
8e22c11def1733819183e8296bab3c8a4ffc1d9c
https://github.com/onigoetz/imagecache/blob/8e22c11def1733819183e8296bab3c8a4ffc1d9c/src/Manager.php#L128-L136