repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.validateDate
protected function validateDate($attribute, $value) { if ($value instanceof DateTime) { return true; } if (strtotime($value) === false) { return false; } $date = date_parse($value); return checkdate($date['month'], $date['day'], $date['year']); }
php
protected function validateDate($attribute, $value) { if ($value instanceof DateTime) { return true; } if (strtotime($value) === false) { return false; } $date = date_parse($value); return checkdate($date['month'], $date['day'], $date['year']); }
[ "protected", "function", "validateDate", "(", "$", "attribute", ",", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "DateTime", ")", "{", "return", "true", ";", "}", "if", "(", "strtotime", "(", "$", "value", ")", "===", "false", ")", ...
Validate that an attribute is a valid date. @param string $attribute @param mixed $value @return bool
[ "Validate", "that", "an", "attribute", "is", "a", "valid", "date", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L1262-L1275
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.validateBefore
protected function validateBefore($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'before'); if ($format = $this->getDateFormat($attribute)) { return $this->validateBeforeWithFormat($format, $value, $parameters); } if (!($date = strtotime($parameters[0]))) { return strtotime($value) < strtotime($this->getValue($parameters[0])); } else { return strtotime($value) < $date; } }
php
protected function validateBefore($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'before'); if ($format = $this->getDateFormat($attribute)) { return $this->validateBeforeWithFormat($format, $value, $parameters); } if (!($date = strtotime($parameters[0]))) { return strtotime($value) < strtotime($this->getValue($parameters[0])); } else { return strtotime($value) < $date; } }
[ "protected", "function", "validateBefore", "(", "$", "attribute", ",", "$", "value", ",", "$", "parameters", ")", "{", "$", "this", "->", "requireParameterCount", "(", "1", ",", "$", "parameters", ",", "'before'", ")", ";", "if", "(", "$", "format", "=",...
Validate the date is before a given date. @param string $attribute @param mixed $value @param array $parameters @return bool
[ "Validate", "the", "date", "is", "before", "a", "given", "date", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L1304-L1317
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.validateAfter
protected function validateAfter($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'after'); if ($format = $this->getDateFormat($attribute)) { return $this->validateAfterWithFormat($format, $value, $parameters); } if (!($date = strtotime($parameters[0]))) { return strtotime($value) > strtotime($this->getValue($parameters[0])); } else { return strtotime($value) > $date; } }
php
protected function validateAfter($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'after'); if ($format = $this->getDateFormat($attribute)) { return $this->validateAfterWithFormat($format, $value, $parameters); } if (!($date = strtotime($parameters[0]))) { return strtotime($value) > strtotime($this->getValue($parameters[0])); } else { return strtotime($value) > $date; } }
[ "protected", "function", "validateAfter", "(", "$", "attribute", ",", "$", "value", ",", "$", "parameters", ")", "{", "$", "this", "->", "requireParameterCount", "(", "1", ",", "$", "parameters", ",", "'after'", ")", ";", "if", "(", "$", "format", "=", ...
Validate the date is after a given date. @param string $attribute @param mixed $value @param array $parameters @return bool
[ "Validate", "the", "date", "is", "after", "a", "given", "date", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L1344-L1357
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.getSizeMessage
protected function getSizeMessage($attribute, $rule) { $lowerRule = snake_case($rule); // There are three different types of size validations. The attribute may be // either a number, file, or string so we will check a few things to know // which type of value it is and return the correct line for that type. $type = $this->getAttributeType($attribute); $key = "validation.{$lowerRule}.{$type}"; return $this->translator->trans($key); }
php
protected function getSizeMessage($attribute, $rule) { $lowerRule = snake_case($rule); // There are three different types of size validations. The attribute may be // either a number, file, or string so we will check a few things to know // which type of value it is and return the correct line for that type. $type = $this->getAttributeType($attribute); $key = "validation.{$lowerRule}.{$type}"; return $this->translator->trans($key); }
[ "protected", "function", "getSizeMessage", "(", "$", "attribute", ",", "$", "rule", ")", "{", "$", "lowerRule", "=", "snake_case", "(", "$", "rule", ")", ";", "// There are three different types of size validations. The attribute may be", "// either a number, file, or strin...
Get the proper error message for an attribute and size rule. @param string $attribute @param string $rule @return string
[ "Get", "the", "proper", "error", "message", "for", "an", "attribute", "and", "size", "rule", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L1535-L1547
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.doReplacements
protected function doReplacements($message, $attribute, $rule, $parameters) { $value = $this->getAttribute($attribute); $message = str_replace( [':ATTRIBUTE', ':Attribute', ':attribute'], [strtoupper($value), ucfirst($value), $value], $message ); if (isset($this->replacers[snake_case($rule)])) { $message = $this->callReplacer($message, $attribute, snake_case($rule), $parameters); } elseif (method_exists($this, $replacer = "replace{$rule}")) { $message = $this->$replacer($message, $attribute, $rule, $parameters); } return $message; }
php
protected function doReplacements($message, $attribute, $rule, $parameters) { $value = $this->getAttribute($attribute); $message = str_replace( [':ATTRIBUTE', ':Attribute', ':attribute'], [strtoupper($value), ucfirst($value), $value], $message ); if (isset($this->replacers[snake_case($rule)])) { $message = $this->callReplacer($message, $attribute, snake_case($rule), $parameters); } elseif (method_exists($this, $replacer = "replace{$rule}")) { $message = $this->$replacer($message, $attribute, $rule, $parameters); } return $message; }
[ "protected", "function", "doReplacements", "(", "$", "message", ",", "$", "attribute", ",", "$", "rule", ",", "$", "parameters", ")", "{", "$", "value", "=", "$", "this", "->", "getAttribute", "(", "$", "attribute", ")", ";", "$", "message", "=", "str_...
Replace all error message place-holders with actual values. @param string $message @param string $attribute @param string $rule @param array $parameters @return string
[ "Replace", "all", "error", "message", "place", "-", "holders", "with", "actual", "values", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L1582-L1599
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.getAttributeList
protected function getAttributeList(array $values) { $attributes = []; // For each attribute in the list we will simply get its displayable form as // this is convenient when replacing lists of parameters like some of the // replacement functions do when formatting out the validation message. foreach ($values as $key => $value) { $attributes[$key] = $this->getAttribute($value); } return $attributes; }
php
protected function getAttributeList(array $values) { $attributes = []; // For each attribute in the list we will simply get its displayable form as // this is convenient when replacing lists of parameters like some of the // replacement functions do when formatting out the validation message. foreach ($values as $key => $value) { $attributes[$key] = $this->getAttribute($value); } return $attributes; }
[ "protected", "function", "getAttributeList", "(", "array", "$", "values", ")", "{", "$", "attributes", "=", "[", "]", ";", "// For each attribute in the list we will simply get its displayable form as", "// this is convenient when replacing lists of parameters like some of the", "/...
Transform an array of attributes to their displayable form. @param array $values @return array
[ "Transform", "an", "array", "of", "attributes", "to", "their", "displayable", "form", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L1608-L1620
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.parseStringRule
protected function parseStringRule($rules) { $parameters = []; // The format for specifying validation rules and parameters follows an // easy {rule}:{parameters} formatting convention. For instance the // rule "Max:3" states that the value may only be three letters. if (strpos($rules, ':') !== false) { list($rules, $parameter) = explode(':', $rules, 2); $parameters = $this->parseParameters($rules, $parameter); } return [studly_case(trim($rules)), $parameters]; }
php
protected function parseStringRule($rules) { $parameters = []; // The format for specifying validation rules and parameters follows an // easy {rule}:{parameters} formatting convention. For instance the // rule "Max:3" states that the value may only be three letters. if (strpos($rules, ':') !== false) { list($rules, $parameter) = explode(':', $rules, 2); $parameters = $this->parseParameters($rules, $parameter); } return [studly_case(trim($rules)), $parameters]; }
[ "protected", "function", "parseStringRule", "(", "$", "rules", ")", "{", "$", "parameters", "=", "[", "]", ";", "// The format for specifying validation rules and parameters follows an", "// easy {rule}:{parameters} formatting convention. For instance the", "// rule \"Max:3\" states ...
Parse a string based rule. @param string $rules @return array
[ "Parse", "a", "string", "based", "rule", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L2050-L2064
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.addImplicitExtensions
public function addImplicitExtensions(array $extensions) { $this->addExtensions($extensions); foreach ($extensions as $rule => $extension) { $this->implicitRules[] = studly_case($rule); } }
php
public function addImplicitExtensions(array $extensions) { $this->addExtensions($extensions); foreach ($extensions as $rule => $extension) { $this->implicitRules[] = studly_case($rule); } }
[ "public", "function", "addImplicitExtensions", "(", "array", "$", "extensions", ")", "{", "$", "this", "->", "addExtensions", "(", "$", "extensions", ")", ";", "foreach", "(", "$", "extensions", "as", "$", "rule", "=>", "$", "extension", ")", "{", "$", "...
Register an array of custom implicit validator extensions. @param array $extensions
[ "Register", "an", "array", "of", "custom", "implicit", "validator", "extensions", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L2114-L2121
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.addImplicitExtension
public function addImplicitExtension($rule, $extension) { $this->addExtension($rule, $extension); $this->implicitRules[] = studly_case($rule); }
php
public function addImplicitExtension($rule, $extension) { $this->addExtension($rule, $extension); $this->implicitRules[] = studly_case($rule); }
[ "public", "function", "addImplicitExtension", "(", "$", "rule", ",", "$", "extension", ")", "{", "$", "this", "->", "addExtension", "(", "$", "rule", ",", "$", "extension", ")", ";", "$", "this", "->", "implicitRules", "[", "]", "=", "studly_case", "(", ...
Register a custom implicit validator extension. @param string $rule @param \Closure|string $extension
[ "Register", "a", "custom", "implicit", "validator", "extension", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L2140-L2145
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.callExtension
protected function callExtension($rule, $parameters) { $callback = $this->extensions[$rule]; if ($callback instanceof Closure) { return call_user_func_array($callback, $parameters); } elseif (is_string($callback)) { return $this->callClassBasedExtension($callback, $parameters); } }
php
protected function callExtension($rule, $parameters) { $callback = $this->extensions[$rule]; if ($callback instanceof Closure) { return call_user_func_array($callback, $parameters); } elseif (is_string($callback)) { return $this->callClassBasedExtension($callback, $parameters); } }
[ "protected", "function", "callExtension", "(", "$", "rule", ",", "$", "parameters", ")", "{", "$", "callback", "=", "$", "this", "->", "extensions", "[", "$", "rule", "]", ";", "if", "(", "$", "callback", "instanceof", "Closure", ")", "{", "return", "c...
Call a custom validator extension. @param string $rule @param array $parameters @return bool
[ "Call", "a", "custom", "validator", "extension", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L2460-L2469
txj123/zilf
src/Zilf/Validation/Validator.php
Validator.callClassBasedExtension
protected function callClassBasedExtension($callback, $parameters) { list($class, $method) = explode('@', $callback); return call_user_func_array([$class, $method], $parameters); }
php
protected function callClassBasedExtension($callback, $parameters) { list($class, $method) = explode('@', $callback); return call_user_func_array([$class, $method], $parameters); }
[ "protected", "function", "callClassBasedExtension", "(", "$", "callback", ",", "$", "parameters", ")", "{", "list", "(", "$", "class", ",", "$", "method", ")", "=", "explode", "(", "'@'", ",", "$", "callback", ")", ";", "return", "call_user_func_array", "(...
Call a class based validator extension. @param string $callback @param array $parameters @return bool
[ "Call", "a", "class", "based", "validator", "extension", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Validation/Validator.php#L2479-L2484
txj123/zilf
src/Zilf/Routing/Domain.php
Domain.check
public function check($url, $completeMatch = false) { // 检测别名路由 $result = $this->checkRouteAlias($url); if (false !== $result) { return $result; } // 检测URL绑定 $result = $this->checkUrlBind($url); if (!empty($this->option['append'])) { $request->setRouteVars($this->option['append']); unset($this->option['append']); } if (false !== $result) { return $result; } return parent::check($url, $completeMatch); }
php
public function check($url, $completeMatch = false) { // 检测别名路由 $result = $this->checkRouteAlias($url); if (false !== $result) { return $result; } // 检测URL绑定 $result = $this->checkUrlBind($url); if (!empty($this->option['append'])) { $request->setRouteVars($this->option['append']); unset($this->option['append']); } if (false !== $result) { return $result; } return parent::check($url, $completeMatch); }
[ "public", "function", "check", "(", "$", "url", ",", "$", "completeMatch", "=", "false", ")", "{", "// 检测别名路由", "$", "result", "=", "$", "this", "->", "checkRouteAlias", "(", "$", "url", ")", ";", "if", "(", "false", "!==", "$", "result", ")", "{", ...
检测域名路由 @access public @param string $url 访问地址 @param bool $completeMatch 路由是否完全匹配 @return Dispatch|false
[ "检测域名路由" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/Domain.php#L48-L70
txj123/zilf
src/Zilf/Routing/Domain.php
Domain.checkRouteAlias
private function checkRouteAlias($url) { $alias = strpos($url, '|') ? strstr($url, '|', true) : $url; $item = $this->router->getAlias($alias); return $item ? $item->check($url) : false; }
php
private function checkRouteAlias($url) { $alias = strpos($url, '|') ? strstr($url, '|', true) : $url; $item = $this->router->getAlias($alias); return $item ? $item->check($url) : false; }
[ "private", "function", "checkRouteAlias", "(", "$", "url", ")", "{", "$", "alias", "=", "strpos", "(", "$", "url", ",", "'|'", ")", "?", "strstr", "(", "$", "url", ",", "'|'", ",", "true", ")", ":", "$", "url", ";", "$", "item", "=", "$", "this...
检测路由别名 @access private @param Request $request @param string $url URL地址 @return Dispatch|false
[ "检测路由别名" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/Domain.php#L91-L98
txj123/zilf
src/Zilf/Routing/Domain.php
Domain.checkUrlBind
private function checkUrlBind($url) { $bind = $this->router->getBind($this->domain); if (!empty($bind)) { $this->parseBindAppendParam($bind); // 记录绑定信息 Container::get('app')->log('[ BIND ] ' . var_export($bind, true)); // 如果有URL绑定 则进行绑定检测 $type = substr($bind, 0, 1); $bind = substr($bind, 1); $bindTo = [ '\\' => 'bindToClass', '@' => 'bindToController', ':' => 'bindToNamespace', ]; if (isset($bindTo[$type])) { return $this->{$bindTo[$type]}($url, $bind); } } return false; }
php
private function checkUrlBind($url) { $bind = $this->router->getBind($this->domain); if (!empty($bind)) { $this->parseBindAppendParam($bind); // 记录绑定信息 Container::get('app')->log('[ BIND ] ' . var_export($bind, true)); // 如果有URL绑定 则进行绑定检测 $type = substr($bind, 0, 1); $bind = substr($bind, 1); $bindTo = [ '\\' => 'bindToClass', '@' => 'bindToController', ':' => 'bindToNamespace', ]; if (isset($bindTo[$type])) { return $this->{$bindTo[$type]}($url, $bind); } } return false; }
[ "private", "function", "checkUrlBind", "(", "$", "url", ")", "{", "$", "bind", "=", "$", "this", "->", "router", "->", "getBind", "(", "$", "this", "->", "domain", ")", ";", "if", "(", "!", "empty", "(", "$", "bind", ")", ")", "{", "$", "this", ...
检测URL绑定 @access private @param string $url URL地址 @return Dispatch|false
[ "检测URL绑定" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/Domain.php#L106-L132
txj123/zilf
src/Zilf/Routing/Domain.php
Domain.bindToClass
protected function bindToClass($url, $class) { $array = explode('|', $url, 2); $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); $param = []; if (!empty($array[1])) { $this->parseUrlParams($array[1], $param); } return new CallbackDispatch($this, [$class, $action], $param); }
php
protected function bindToClass($url, $class) { $array = explode('|', $url, 2); $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); $param = []; if (!empty($array[1])) { $this->parseUrlParams($array[1], $param); } return new CallbackDispatch($this, [$class, $action], $param); }
[ "protected", "function", "bindToClass", "(", "$", "url", ",", "$", "class", ")", "{", "$", "array", "=", "explode", "(", "'|'", ",", "$", "url", ",", "2", ")", ";", "$", "action", "=", "!", "empty", "(", "$", "array", "[", "0", "]", ")", "?", ...
绑定到类 @access protected @param string $url URL地址 @param string $class 类名(带命名空间) @return CallbackDispatch
[ "绑定到类" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/Domain.php#L150-L161
txj123/zilf
src/Zilf/Routing/Domain.php
Domain.bindToNamespace
protected function bindToNamespace($request, $url, $namespace) { $array = explode('|', $url, 3); $class = !empty($array[0]) ? $array[0] : $this->router->config('default_controller'); $method = !empty($array[1]) ? $array[1] : $this->router->config('default_action'); $param = []; if (!empty($array[2])) { $this->parseUrlParams($request, $array[2], $param); } return new CallbackDispatch($request, $this, [$namespace . '\\' . Loader::parseName($class, 1), $method], $param); }
php
protected function bindToNamespace($request, $url, $namespace) { $array = explode('|', $url, 3); $class = !empty($array[0]) ? $array[0] : $this->router->config('default_controller'); $method = !empty($array[1]) ? $array[1] : $this->router->config('default_action'); $param = []; if (!empty($array[2])) { $this->parseUrlParams($request, $array[2], $param); } return new CallbackDispatch($request, $this, [$namespace . '\\' . Loader::parseName($class, 1), $method], $param); }
[ "protected", "function", "bindToNamespace", "(", "$", "request", ",", "$", "url", ",", "$", "namespace", ")", "{", "$", "array", "=", "explode", "(", "'|'", ",", "$", "url", ",", "3", ")", ";", "$", "class", "=", "!", "empty", "(", "$", "array", ...
绑定到命名空间 @access protected @param Request $request @param string $url URL地址 @param string $namespace 命名空间 @return CallbackDispatch
[ "绑定到命名空间" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/Domain.php#L171-L183
txj123/zilf
src/Zilf/Routing/Domain.php
Domain.bindToController
protected function bindToController($request, $url, $controller) { $array = explode('|', $url, 2); $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); $param = []; if (!empty($array[1])) { $this->parseUrlParams($request, $array[1], $param); } return new ControllerDispatch($request, $this, $controller . '/' . $action, $param); }
php
protected function bindToController($request, $url, $controller) { $array = explode('|', $url, 2); $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); $param = []; if (!empty($array[1])) { $this->parseUrlParams($request, $array[1], $param); } return new ControllerDispatch($request, $this, $controller . '/' . $action, $param); }
[ "protected", "function", "bindToController", "(", "$", "request", ",", "$", "url", ",", "$", "controller", ")", "{", "$", "array", "=", "explode", "(", "'|'", ",", "$", "url", ",", "2", ")", ";", "$", "action", "=", "!", "empty", "(", "$", "array",...
绑定到控制器类 @access protected @param Request $request @param string $url URL地址 @param string $controller 控制器名 (支持带模块名 index/user ) @return ControllerDispatch
[ "绑定到控制器类" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/Domain.php#L193-L204
txj123/zilf
src/Zilf/Routing/Domain.php
Domain.bindToModule
protected function bindToModule($request, $url, $controller) { $array = explode('|', $url, 2); $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); $param = []; if (!empty($array[1])) { $this->parseUrlParams($request, $array[1], $param); } return new ModuleDispatch($request, $this, $controller . '/' . $action, $param); }
php
protected function bindToModule($request, $url, $controller) { $array = explode('|', $url, 2); $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); $param = []; if (!empty($array[1])) { $this->parseUrlParams($request, $array[1], $param); } return new ModuleDispatch($request, $this, $controller . '/' . $action, $param); }
[ "protected", "function", "bindToModule", "(", "$", "request", ",", "$", "url", ",", "$", "controller", ")", "{", "$", "array", "=", "explode", "(", "'|'", ",", "$", "url", ",", "2", ")", ";", "$", "action", "=", "!", "empty", "(", "$", "array", "...
绑定到模块/控制器 @access protected @param Request $request @param string $url URL地址 @param string $controller 控制器类名(带命名空间) @return ModuleDispatch
[ "绑定到模块", "/", "控制器" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/Domain.php#L214-L225
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.setFullName
protected function setFullName() { if (false !== strpos($this->name, ':')) { $this->name = preg_replace(['/\[\:(\w+)\]/', '/\:(\w+)/'], ['<\1?>', '<\1>'], $this->name); } if ($this->parent && $this->parent->getFullName()) { $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : ''); } else { $this->fullName = $this->name; } }
php
protected function setFullName() { if (false !== strpos($this->name, ':')) { $this->name = preg_replace(['/\[\:(\w+)\]/', '/\:(\w+)/'], ['<\1?>', '<\1>'], $this->name); } if ($this->parent && $this->parent->getFullName()) { $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : ''); } else { $this->fullName = $this->name; } }
[ "protected", "function", "setFullName", "(", ")", "{", "if", "(", "false", "!==", "strpos", "(", "$", "this", "->", "name", ",", "':'", ")", ")", "{", "$", "this", "->", "name", "=", "preg_replace", "(", "[", "'/\\[\\:(\\w+)\\]/'", ",", "'/\\:(\\w+)/'", ...
设置分组的路由规则 @access public @return void
[ "设置分组的路由规则" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L88-L99
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.check
public function check($url, $completeMatch = false) { if ($dispatch = $this->checkCrossDomain()) { // 跨域OPTIONS请求 return $dispatch; } // 检查分组有效性 if (!$this->checkOption($this->option) || !$this->checkUrl($url)) { return false; } // 检查前置行为 if (isset($this->option['before'])) { if (false === $this->checkBefore($this->option['before'])) { return false; } unset($this->option['before']); } // 解析分组路由 if ($this instanceof Resource) { $this->buildResourceRule(); } elseif ($this->rule) { if ($this->rule instanceof Response) { return new ResponseDispatch($this, $this->rule); } $this->parseGroupRule($this->rule); } // 获取当前路由规则 $method = strtolower(Request::getMethod()); $rules = $this->getMethodRules($method); if (count($rules) == 0) { return false; } if ($this->parent) { // 合并分组参数 $this->mergeGroupOptions(); // 合并分组变量规则 $this->pattern = array_merge($this->parent->getPattern(), $this->pattern); } if (isset($this->option['complete_match'])) { $completeMatch = $this->option['complete_match']; } if (!empty($this->option['merge_rule_regex'])) { // 合并路由正则规则进行路由匹配检查 $result = $this->checkMergeRuleRegex($rules, $url, $completeMatch); if (false !== $result) { return $result; } } // 检查分组路由 foreach ($rules as $key => $item) { $result = $item->check($url, $completeMatch); if (false !== $result) { return $result; } } if ($this->auto) { // 自动解析URL地址 $result = new UrlDispatch($this, $this->auto . '/' . $url, ['auto_search' => false]); } elseif ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) { // 未匹配所有路由的路由规则处理 $result = $this->miss->parseRule('', $this->miss->getRoute(), $url, $this->miss->mergeGroupOptions()); } else { $result = false; } return $result; }
php
public function check($url, $completeMatch = false) { if ($dispatch = $this->checkCrossDomain()) { // 跨域OPTIONS请求 return $dispatch; } // 检查分组有效性 if (!$this->checkOption($this->option) || !$this->checkUrl($url)) { return false; } // 检查前置行为 if (isset($this->option['before'])) { if (false === $this->checkBefore($this->option['before'])) { return false; } unset($this->option['before']); } // 解析分组路由 if ($this instanceof Resource) { $this->buildResourceRule(); } elseif ($this->rule) { if ($this->rule instanceof Response) { return new ResponseDispatch($this, $this->rule); } $this->parseGroupRule($this->rule); } // 获取当前路由规则 $method = strtolower(Request::getMethod()); $rules = $this->getMethodRules($method); if (count($rules) == 0) { return false; } if ($this->parent) { // 合并分组参数 $this->mergeGroupOptions(); // 合并分组变量规则 $this->pattern = array_merge($this->parent->getPattern(), $this->pattern); } if (isset($this->option['complete_match'])) { $completeMatch = $this->option['complete_match']; } if (!empty($this->option['merge_rule_regex'])) { // 合并路由正则规则进行路由匹配检查 $result = $this->checkMergeRuleRegex($rules, $url, $completeMatch); if (false !== $result) { return $result; } } // 检查分组路由 foreach ($rules as $key => $item) { $result = $item->check($url, $completeMatch); if (false !== $result) { return $result; } } if ($this->auto) { // 自动解析URL地址 $result = new UrlDispatch($this, $this->auto . '/' . $url, ['auto_search' => false]); } elseif ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) { // 未匹配所有路由的路由规则处理 $result = $this->miss->parseRule('', $this->miss->getRoute(), $url, $this->miss->mergeGroupOptions()); } else { $result = false; } return $result; }
[ "public", "function", "check", "(", "$", "url", ",", "$", "completeMatch", "=", "false", ")", "{", "if", "(", "$", "dispatch", "=", "$", "this", "->", "checkCrossDomain", "(", ")", ")", "{", "// 跨域OPTIONS请求", "return", "$", "dispatch", ";", "}", "// 检查...
检测分组路由 @access public @param string $url 访问地址 @param bool $completeMatch 路由是否完全匹配 @return Dispatch|false
[ "检测分组路由" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L118-L197
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.checkUrl
protected function checkUrl($url) { if ($this->fullName) { $pos = strpos($this->fullName, '<'); if (false !== $pos) { $str = substr($this->fullName, 0, $pos); } else { $str = $this->fullName; } if ($str && 0 !== stripos(str_replace('|', '/', $url), $str)) { return false; } } return true; }
php
protected function checkUrl($url) { if ($this->fullName) { $pos = strpos($this->fullName, '<'); if (false !== $pos) { $str = substr($this->fullName, 0, $pos); } else { $str = $this->fullName; } if ($str && 0 !== stripos(str_replace('|', '/', $url), $str)) { return false; } } return true; }
[ "protected", "function", "checkUrl", "(", "$", "url", ")", "{", "if", "(", "$", "this", "->", "fullName", ")", "{", "$", "pos", "=", "strpos", "(", "$", "this", "->", "fullName", ",", "'<'", ")", ";", "if", "(", "false", "!==", "$", "pos", ")", ...
分组URL匹配检查 @access protected @param string $url @return bool
[ "分组URL匹配检查" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L216-L233
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.lazy
public function lazy($lazy = true) { if (!$lazy) { $this->parseGroupRule($this->rule); $this->rule = null; } return $this; }
php
public function lazy($lazy = true) { if (!$lazy) { $this->parseGroupRule($this->rule); $this->rule = null; } return $this; }
[ "public", "function", "lazy", "(", "$", "lazy", "=", "true", ")", "{", "if", "(", "!", "$", "lazy", ")", "{", "$", "this", "->", "parseGroupRule", "(", "$", "this", "->", "rule", ")", ";", "$", "this", "->", "rule", "=", "null", ";", "}", "retu...
延迟解析分组的路由规则 @access public @param bool $lazy 路由是否延迟解析 @return $this
[ "延迟解析分组的路由规则" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L241-L249
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.parseGroupRule
public function parseGroupRule($rule) { $origin = $this->router->getGroup(); $this->router->setGroup($this); if ($rule instanceof \Closure) { Container::getInstance()->invokeFunction($rule); } elseif (is_array($rule)) { $this->addRules($rule); } elseif (is_string($rule) && $rule) { $this->router->bind($rule, $this->domain); } $this->router->setGroup($origin); }
php
public function parseGroupRule($rule) { $origin = $this->router->getGroup(); $this->router->setGroup($this); if ($rule instanceof \Closure) { Container::getInstance()->invokeFunction($rule); } elseif (is_array($rule)) { $this->addRules($rule); } elseif (is_string($rule) && $rule) { $this->router->bind($rule, $this->domain); } $this->router->setGroup($origin); }
[ "public", "function", "parseGroupRule", "(", "$", "rule", ")", "{", "$", "origin", "=", "$", "this", "->", "router", "->", "getGroup", "(", ")", ";", "$", "this", "->", "router", "->", "setGroup", "(", "$", "this", ")", ";", "if", "(", "$", "rule",...
解析分组和域名的路由规则及绑定 @access public @param mixed $rule 路由规则 @return void
[ "解析分组和域名的路由规则及绑定" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L257-L271
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.checkMergeRuleRegex
protected function checkMergeRuleRegex($request, &$rules, $url, $completeMatch) { $depr = $this->router->config('app.pathinfo_depr'); $url = $depr . str_replace('|', $depr, $url); foreach ($rules as $key => $item) { if ($item instanceof RuleItem) { $rule = $depr . str_replace('/', $depr, $item->getRule()); if ($depr == $rule && $depr != $url) { unset($rules[$key]); continue; } $complete = null !== $item->getOption('complete_match') ? $item->getOption('complete_match') : $completeMatch; if (false === strpos($rule, '<')) { if (0 === strcasecmp($rule, $url) || (!$complete && 0 === strncasecmp($rule, $url, strlen($rule)))) { return $item->checkRule( $url, []); } unset($rules[$key]); continue; } $slash = preg_quote('/-' . $depr, '/'); if ($matchRule = preg_split('/[' . $slash . ']<\w+\??>/', $rule, 2)) { if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { unset($rules[$key]); continue; } } if (preg_match_all('/[' . $slash . ']?<?\w+\??>?/', $rule, $matches)) { unset($rules[$key]); $pattern = array_merge($this->getPattern(), $item->getPattern()); $option = array_merge($this->getOption(), $item->getOption()); $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_' . $key); $items[$key] = $item; } } } if (empty($regex)) { return false; } try { $result = preg_match('/^(?:' . implode('|', $regex) . ')/u', $url, $match); } catch (\Exception $e) { throw new Exception('route pattern error'); } if ($result) { $var = []; foreach ($match as $key => $val) { if (is_string($key) && '' !== $val) { list($name, $pos) = explode('_THINK_', $key); $var[$name] = $val; } } if (!isset($pos)) { foreach ($regex as $key => $item) { if (0 === strpos(str_replace(['\/', '\-', '\\' . $depr], ['/', '-', $depr], $item), $match[0])) { $pos = $key; break; } } } $rule = $items[$pos]->getRule(); $array = $this->router->getRule($rule); foreach ($array as $item) { if (in_array($item->getMethod(), ['*', strtolower($request->method())])) { $result = $item->checkRule($request, $url, $var); if (false !== $result) { return $result; } } } } return false; }
php
protected function checkMergeRuleRegex($request, &$rules, $url, $completeMatch) { $depr = $this->router->config('app.pathinfo_depr'); $url = $depr . str_replace('|', $depr, $url); foreach ($rules as $key => $item) { if ($item instanceof RuleItem) { $rule = $depr . str_replace('/', $depr, $item->getRule()); if ($depr == $rule && $depr != $url) { unset($rules[$key]); continue; } $complete = null !== $item->getOption('complete_match') ? $item->getOption('complete_match') : $completeMatch; if (false === strpos($rule, '<')) { if (0 === strcasecmp($rule, $url) || (!$complete && 0 === strncasecmp($rule, $url, strlen($rule)))) { return $item->checkRule( $url, []); } unset($rules[$key]); continue; } $slash = preg_quote('/-' . $depr, '/'); if ($matchRule = preg_split('/[' . $slash . ']<\w+\??>/', $rule, 2)) { if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { unset($rules[$key]); continue; } } if (preg_match_all('/[' . $slash . ']?<?\w+\??>?/', $rule, $matches)) { unset($rules[$key]); $pattern = array_merge($this->getPattern(), $item->getPattern()); $option = array_merge($this->getOption(), $item->getOption()); $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_' . $key); $items[$key] = $item; } } } if (empty($regex)) { return false; } try { $result = preg_match('/^(?:' . implode('|', $regex) . ')/u', $url, $match); } catch (\Exception $e) { throw new Exception('route pattern error'); } if ($result) { $var = []; foreach ($match as $key => $val) { if (is_string($key) && '' !== $val) { list($name, $pos) = explode('_THINK_', $key); $var[$name] = $val; } } if (!isset($pos)) { foreach ($regex as $key => $item) { if (0 === strpos(str_replace(['\/', '\-', '\\' . $depr], ['/', '-', $depr], $item), $match[0])) { $pos = $key; break; } } } $rule = $items[$pos]->getRule(); $array = $this->router->getRule($rule); foreach ($array as $item) { if (in_array($item->getMethod(), ['*', strtolower($request->method())])) { $result = $item->checkRule($request, $url, $var); if (false !== $result) { return $result; } } } } return false; }
[ "protected", "function", "checkMergeRuleRegex", "(", "$", "request", ",", "&", "$", "rules", ",", "$", "url", ",", "$", "completeMatch", ")", "{", "$", "depr", "=", "$", "this", "->", "router", "->", "config", "(", "'app.pathinfo_depr'", ")", ";", "$", ...
检测分组路由 @access public @param Request $request 请求对象 @param array $rules 路由规则 @param string $url 访问地址 @param bool $completeMatch 路由是否完全匹配 @return Dispatch|false
[ "检测分组路由" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L282-L370
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.addMissRule
public function addMissRule($route, $method = '*', $option = []) { // 创建路由规则实例 $ruleItem = new RuleItem($this->router, $this, null, '', $route, strtolower($method), $option); $this->miss = $ruleItem; return $ruleItem; }
php
public function addMissRule($route, $method = '*', $option = []) { // 创建路由规则实例 $ruleItem = new RuleItem($this->router, $this, null, '', $route, strtolower($method), $option); $this->miss = $ruleItem; return $ruleItem; }
[ "public", "function", "addMissRule", "(", "$", "route", ",", "$", "method", "=", "'*'", ",", "$", "option", "=", "[", "]", ")", "{", "// 创建路由规则实例", "$", "ruleItem", "=", "new", "RuleItem", "(", "$", "this", "->", "router", ",", "$", "this", ",", "n...
注册MISS路由 @access public @param string $route 路由地址 @param string $method 请求类型 @param array $option 路由参数 @return RuleItem
[ "注册MISS路由" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L411-L419
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.addRule
public function addRule($rule, $route, $method = '*', $option = [], $pattern = []) { // 读取路由标识 if (is_array($rule)) { $name = $rule[0]; $rule = $rule[1]; } elseif (is_string($route)) { $name = $route; } else { $name = null; } $method = strtolower($method); if ('/' === $rule || '' === $rule) { // 首页自动完整匹配 $rule .= '$'; } // 创建路由规则实例 $ruleItem = new RuleItem($this->router, $this, $name, $rule, $route, $method, $option, $pattern); if (!empty($option['cross_domain'])) { $this->router->setCrossDomainRule($ruleItem, $method); } $this->addRuleItem($ruleItem, $method); return $ruleItem; }
php
public function addRule($rule, $route, $method = '*', $option = [], $pattern = []) { // 读取路由标识 if (is_array($rule)) { $name = $rule[0]; $rule = $rule[1]; } elseif (is_string($route)) { $name = $route; } else { $name = null; } $method = strtolower($method); if ('/' === $rule || '' === $rule) { // 首页自动完整匹配 $rule .= '$'; } // 创建路由规则实例 $ruleItem = new RuleItem($this->router, $this, $name, $rule, $route, $method, $option, $pattern); if (!empty($option['cross_domain'])) { $this->router->setCrossDomainRule($ruleItem, $method); } $this->addRuleItem($ruleItem, $method); return $ruleItem; }
[ "public", "function", "addRule", "(", "$", "rule", ",", "$", "route", ",", "$", "method", "=", "'*'", ",", "$", "option", "=", "[", "]", ",", "$", "pattern", "=", "[", "]", ")", "{", "// 读取路由标识", "if", "(", "is_array", "(", "$", "rule", ")", ")...
添加分组下的路由规则或者子分组 @access public @param string $rule 路由规则 @param string $route 路由地址 @param string $method 请求类型 @param array $option 路由参数 @param array $pattern 变量规则 @return $this
[ "添加分组下的路由规则或者子分组" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L431-L460
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.addRules
public function addRules($rules, $method = '*', $option = [], $pattern = []) { foreach ($rules as $key => $val) { if (is_numeric($key)) { $key = array_shift($val); } if (is_array($val)) { $route = array_shift($val); $option = $val ? array_shift($val) : []; $pattern = $val ? array_shift($val) : []; } else { $route = $val; } $this->addRule($key, $route, $method, $option, $pattern); } }
php
public function addRules($rules, $method = '*', $option = [], $pattern = []) { foreach ($rules as $key => $val) { if (is_numeric($key)) { $key = array_shift($val); } if (is_array($val)) { $route = array_shift($val); $option = $val ? array_shift($val) : []; $pattern = $val ? array_shift($val) : []; } else { $route = $val; } $this->addRule($key, $route, $method, $option, $pattern); } }
[ "public", "function", "addRules", "(", "$", "rules", ",", "$", "method", "=", "'*'", ",", "$", "option", "=", "[", "]", ",", "$", "pattern", "=", "[", "]", ")", "{", "foreach", "(", "$", "rules", "as", "$", "key", "=>", "$", "val", ")", "{", ...
批量注册路由规则 @access public @param array $rules 路由规则 @param string $method 请求类型 @param array $option 路由参数 @param array $pattern 变量规则 @return void
[ "批量注册路由规则" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L471-L488
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.prefix
public function prefix($prefix) { if ($this->parent && $this->parent->getOption('prefix')) { $prefix = $this->parent->getOption('prefix') . $prefix; } return $this->option('prefix', $prefix); }
php
public function prefix($prefix) { if ($this->parent && $this->parent->getOption('prefix')) { $prefix = $this->parent->getOption('prefix') . $prefix; } return $this->option('prefix', $prefix); }
[ "public", "function", "prefix", "(", "$", "prefix", ")", "{", "if", "(", "$", "this", "->", "parent", "&&", "$", "this", "->", "parent", "->", "getOption", "(", "'prefix'", ")", ")", "{", "$", "prefix", "=", "$", "this", "->", "parent", "->", "getO...
设置分组的路由前缀 @access public @param string $prefix @return $this
[ "设置分组的路由前缀" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L508-L515
txj123/zilf
src/Zilf/Routing/RuleGroup.php
RuleGroup.getRules
public function getRules($method = '') { if ('' === $method) { return $this->rules; } return isset($this->rules[strtolower($method)]) ? $this->rules[strtolower($method)] : []; }
php
public function getRules($method = '') { if ('' === $method) { return $this->rules; } return isset($this->rules[strtolower($method)]) ? $this->rules[strtolower($method)] : []; }
[ "public", "function", "getRules", "(", "$", "method", "=", "''", ")", "{", "if", "(", "''", "===", "$", "method", ")", "{", "return", "$", "this", "->", "rules", ";", "}", "return", "isset", "(", "$", "this", "->", "rules", "[", "strtolower", "(", ...
获取分组的路由规则 @access public @param string $method @return array
[ "获取分组的路由规则" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Routing/RuleGroup.php#L577-L584
txj123/zilf
src/Zilf/Redis/Connectors/PredisConnector.php
PredisConnector.connect
public function connect(array $config, array $options) { return new PredisConnection( new Client( $config, array_merge( ['timeout' => 10.0], $options, Arr::pull($config, 'options', []) ) ) ); }
php
public function connect(array $config, array $options) { return new PredisConnection( new Client( $config, array_merge( ['timeout' => 10.0], $options, Arr::pull($config, 'options', []) ) ) ); }
[ "public", "function", "connect", "(", "array", "$", "config", ",", "array", "$", "options", ")", "{", "return", "new", "PredisConnection", "(", "new", "Client", "(", "$", "config", ",", "array_merge", "(", "[", "'timeout'", "=>", "10.0", "]", ",", "$", ...
Create a new clustered Predis connection. @param array $config @param array $options @return \Zilf\Redis\Connections\PredisConnection
[ "Create", "a", "new", "clustered", "Predis", "connection", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Redis/Connectors/PredisConnector.php#L19-L28
txj123/zilf
src/Zilf/Db/sqlite/QueryBuilder.php
QueryBuilder.upsert
public function upsert($table, $insertColumns, $updateColumns, &$params) { /** * @var Constraint[] $constraints */ list($uniqueNames, $insertNames, $updateNames) = $this->prepareUpsertColumns($table, $insertColumns, $updateColumns, $constraints); if (empty($uniqueNames)) { return $this->insert($table, $insertColumns, $params); } list(, $placeholders, $values, $params) = $this->prepareInsertValues($table, $insertColumns, $params); $insertSql = 'INSERT OR IGNORE INTO ' . $this->db->quoteTableName($table) . (!empty($insertNames) ? ' (' . implode(', ', $insertNames) . ')' : '') . (!empty($placeholders) ? ' VALUES (' . implode(', ', $placeholders) . ')' : $values); if ($updateColumns === false) { return $insertSql; } $updateCondition = ['or']; $quotedTableName = $this->db->quoteTableName($table); foreach ($constraints as $constraint) { $constraintCondition = ['and']; foreach ($constraint->columnNames as $name) { $quotedName = $this->db->quoteColumnName($name); $constraintCondition[] = "$quotedTableName.$quotedName=(SELECT $quotedName FROM `EXCLUDED`)"; } $updateCondition[] = $constraintCondition; } if ($updateColumns === true) { $updateColumns = []; foreach ($updateNames as $name) { $quotedName = $this->db->quoteColumnName($name); if (strrpos($quotedName, '.') === false) { $quotedName = "(SELECT $quotedName FROM `EXCLUDED`)"; } $updateColumns[$name] = new Expression($quotedName); } } $updateSql = 'WITH "EXCLUDED" (' . implode(', ', $insertNames) . ') AS (' . (!empty($placeholders) ? 'VALUES (' . implode(', ', $placeholders) . ')' : ltrim($values, ' ')) . ') ' . $this->update($table, $updateColumns, $updateCondition, $params); return "$updateSql; $insertSql;"; }
php
public function upsert($table, $insertColumns, $updateColumns, &$params) { /** * @var Constraint[] $constraints */ list($uniqueNames, $insertNames, $updateNames) = $this->prepareUpsertColumns($table, $insertColumns, $updateColumns, $constraints); if (empty($uniqueNames)) { return $this->insert($table, $insertColumns, $params); } list(, $placeholders, $values, $params) = $this->prepareInsertValues($table, $insertColumns, $params); $insertSql = 'INSERT OR IGNORE INTO ' . $this->db->quoteTableName($table) . (!empty($insertNames) ? ' (' . implode(', ', $insertNames) . ')' : '') . (!empty($placeholders) ? ' VALUES (' . implode(', ', $placeholders) . ')' : $values); if ($updateColumns === false) { return $insertSql; } $updateCondition = ['or']; $quotedTableName = $this->db->quoteTableName($table); foreach ($constraints as $constraint) { $constraintCondition = ['and']; foreach ($constraint->columnNames as $name) { $quotedName = $this->db->quoteColumnName($name); $constraintCondition[] = "$quotedTableName.$quotedName=(SELECT $quotedName FROM `EXCLUDED`)"; } $updateCondition[] = $constraintCondition; } if ($updateColumns === true) { $updateColumns = []; foreach ($updateNames as $name) { $quotedName = $this->db->quoteColumnName($name); if (strrpos($quotedName, '.') === false) { $quotedName = "(SELECT $quotedName FROM `EXCLUDED`)"; } $updateColumns[$name] = new Expression($quotedName); } } $updateSql = 'WITH "EXCLUDED" (' . implode(', ', $insertNames) . ') AS (' . (!empty($placeholders) ? 'VALUES (' . implode(', ', $placeholders) . ')' : ltrim($values, ' ')) . ') ' . $this->update($table, $updateColumns, $updateCondition, $params); return "$updateSql; $insertSql;"; }
[ "public", "function", "upsert", "(", "$", "table", ",", "$", "insertColumns", ",", "$", "updateColumns", ",", "&", "$", "params", ")", "{", "/**\n * @var Constraint[] $constraints \n*/", "list", "(", "$", "uniqueNames", ",", "$", "insertNames", ",", "$", "upda...
{@inheritdoc} @see https://stackoverflow.com/questions/15277373/sqlite-upsert-update-or-insert/15277374#15277374
[ "{", "@inheritdoc", "}" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Db/sqlite/QueryBuilder.php#L73-L115
txj123/zilf
src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php
Zend_Json_Decoder.decode
public static function decode($source = null, $objectDecodeType = Zend_Json::TYPE_ARRAY) { if (null === $source) { throw new Zend_Json_Exception('Must specify JSON encoded source for decoding'); } elseif (!is_string($source)) { throw new Zend_Json_Exception('Can only decode JSON encoded strings'); } $decoder = new self($source, $objectDecodeType); return $decoder->_decodeValue(); }
php
public static function decode($source = null, $objectDecodeType = Zend_Json::TYPE_ARRAY) { if (null === $source) { throw new Zend_Json_Exception('Must specify JSON encoded source for decoding'); } elseif (!is_string($source)) { throw new Zend_Json_Exception('Can only decode JSON encoded strings'); } $decoder = new self($source, $objectDecodeType); return $decoder->_decodeValue(); }
[ "public", "static", "function", "decode", "(", "$", "source", "=", "null", ",", "$", "objectDecodeType", "=", "Zend_Json", "::", "TYPE_ARRAY", ")", "{", "if", "(", "null", "===", "$", "source", ")", "{", "throw", "new", "Zend_Json_Exception", "(", "'Must s...
Decode a JSON source string Decodes a JSON encoded string. The value returned will be one of the following: - integer - float - boolean - null - StdClass - array - array of one or more of the above types By default, decoded objects will be returned as associative arrays; to return a StdClass object instead, pass {@link Zend_Json::TYPE_OBJECT} to the $objectDecodeType parameter. Throws a Zend_Json_Exception if the source string is null. @static @access public @param string $source String to be decoded @param int $objectDecodeType How objects should be decoded; should be either or {@link Zend_Json::TYPE_ARRAY} or {@link Zend_Json::TYPE_OBJECT}; defaults to TYPE_ARRAY @return mixed @throws Zend_Json_Exception
[ "Decode", "a", "JSON", "source", "string" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php#L149-L160
txj123/zilf
src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php
Zend_Json_Decoder._decodeValue
protected function _decodeValue() { switch ($this->_token) { case self::DATUM: $result = $this->_tokenValue; $this->_getNextToken(); return($result); break; case self::LBRACE: return($this->_decodeObject()); break; case self::LBRACKET: return($this->_decodeArray()); break; default: return null; break; } }
php
protected function _decodeValue() { switch ($this->_token) { case self::DATUM: $result = $this->_tokenValue; $this->_getNextToken(); return($result); break; case self::LBRACE: return($this->_decodeObject()); break; case self::LBRACKET: return($this->_decodeArray()); break; default: return null; break; } }
[ "protected", "function", "_decodeValue", "(", ")", "{", "switch", "(", "$", "this", "->", "_token", ")", "{", "case", "self", "::", "DATUM", ":", "$", "result", "=", "$", "this", "->", "_tokenValue", ";", "$", "this", "->", "_getNextToken", "(", ")", ...
Recursive driving rountine for supported toplevel tops @return mixed
[ "Recursive", "driving", "rountine", "for", "supported", "toplevel", "tops" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php#L168-L186
txj123/zilf
src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php
Zend_Json_Decoder._decodeObject
protected function _decodeObject() { $members = array(); $tok = $this->_getNextToken(); while ($tok && $tok != self::RBRACE) { if ($tok != self::DATUM || ! is_string($this->_tokenValue)) { throw new Zend_Json_Exception('Missing key in object encoding: ' . $this->_source); } $key = $this->_tokenValue; $tok = $this->_getNextToken(); if ($tok != self::COLON) { throw new Zend_Json_Exception('Missing ":" in object encoding: ' . $this->_source); } $tok = $this->_getNextToken(); $members[$key] = $this->_decodeValue(); $tok = $this->_token; if ($tok == self::RBRACE) { break; } if ($tok != self::COMMA) { throw new Zend_Json_Exception('Missing "," in object encoding: ' . $this->_source); } $tok = $this->_getNextToken(); } switch ($this->_decodeType) { case Zend_Json::TYPE_OBJECT: // Create new StdClass and populate with $members $result = new StdClass(); foreach ($members as $key => $value) { $result->$key = $value; } break; case Zend_Json::TYPE_ARRAY: default: $result = $members; break; } $this->_getNextToken(); return $result; }
php
protected function _decodeObject() { $members = array(); $tok = $this->_getNextToken(); while ($tok && $tok != self::RBRACE) { if ($tok != self::DATUM || ! is_string($this->_tokenValue)) { throw new Zend_Json_Exception('Missing key in object encoding: ' . $this->_source); } $key = $this->_tokenValue; $tok = $this->_getNextToken(); if ($tok != self::COLON) { throw new Zend_Json_Exception('Missing ":" in object encoding: ' . $this->_source); } $tok = $this->_getNextToken(); $members[$key] = $this->_decodeValue(); $tok = $this->_token; if ($tok == self::RBRACE) { break; } if ($tok != self::COMMA) { throw new Zend_Json_Exception('Missing "," in object encoding: ' . $this->_source); } $tok = $this->_getNextToken(); } switch ($this->_decodeType) { case Zend_Json::TYPE_OBJECT: // Create new StdClass and populate with $members $result = new StdClass(); foreach ($members as $key => $value) { $result->$key = $value; } break; case Zend_Json::TYPE_ARRAY: default: $result = $members; break; } $this->_getNextToken(); return $result; }
[ "protected", "function", "_decodeObject", "(", ")", "{", "$", "members", "=", "array", "(", ")", ";", "$", "tok", "=", "$", "this", "->", "_getNextToken", "(", ")", ";", "while", "(", "$", "tok", "&&", "$", "tok", "!=", "self", "::", "RBRACE", ")",...
Decodes an object of the form: { "attribute: value, "attribute2" : value,...} If Zend_Json_Encoder was used to encode the original object then a special attribute called __className which specifies a class name that should wrap the data contained within the encoded source. Decodes to either an array or StdClass object, based on the value of {@link $_decodeType}. If invalid $_decodeType present, returns as an array. @return array|StdClass
[ "Decodes", "an", "object", "of", "the", "form", ":", "{", "attribute", ":", "value", "attribute2", ":", "value", "...", "}" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php#L202-L250
txj123/zilf
src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php
Zend_Json_Decoder._decodeArray
protected function _decodeArray() { $result = array(); $starttok = $tok = $this->_getNextToken(); // Move past the '[' $index = 0; while ($tok && $tok != self::RBRACKET) { $result[$index++] = $this->_decodeValue(); $tok = $this->_token; if ($tok == self::RBRACKET || !$tok) { break; } if ($tok != self::COMMA) { throw new Zend_Json_Exception('Missing "," in array encoding: ' . $this->_source); } $tok = $this->_getNextToken(); } $this->_getNextToken(); return($result); }
php
protected function _decodeArray() { $result = array(); $starttok = $tok = $this->_getNextToken(); // Move past the '[' $index = 0; while ($tok && $tok != self::RBRACKET) { $result[$index++] = $this->_decodeValue(); $tok = $this->_token; if ($tok == self::RBRACKET || !$tok) { break; } if ($tok != self::COMMA) { throw new Zend_Json_Exception('Missing "," in array encoding: ' . $this->_source); } $tok = $this->_getNextToken(); } $this->_getNextToken(); return($result); }
[ "protected", "function", "_decodeArray", "(", ")", "{", "$", "result", "=", "array", "(", ")", ";", "$", "starttok", "=", "$", "tok", "=", "$", "this", "->", "_getNextToken", "(", ")", ";", "// Move past the '['", "$", "index", "=", "0", ";", "while", ...
Decodes a JSON array format: [element, element2,...,elementN] @return array
[ "Decodes", "a", "JSON", "array", "format", ":", "[", "element", "element2", "...", "elementN", "]" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php#L258-L282
txj123/zilf
src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php
Zend_Json_Decoder._eatWhitespace
protected function _eatWhitespace() { if (preg_match( '/([\t\b\f\n\r ])*/s', $this->_source, $matches, PREG_OFFSET_CAPTURE, $this->_offset ) && $matches[0][1] == $this->_offset ) { $this->_offset += strlen($matches[0][0]); } }
php
protected function _eatWhitespace() { if (preg_match( '/([\t\b\f\n\r ])*/s', $this->_source, $matches, PREG_OFFSET_CAPTURE, $this->_offset ) && $matches[0][1] == $this->_offset ) { $this->_offset += strlen($matches[0][0]); } }
[ "protected", "function", "_eatWhitespace", "(", ")", "{", "if", "(", "preg_match", "(", "'/([\\t\\b\\f\\n\\r ])*/s'", ",", "$", "this", "->", "_source", ",", "$", "matches", ",", "PREG_OFFSET_CAPTURE", ",", "$", "this", "->", "_offset", ")", "&&", "$", "matc...
Removes whitepsace characters from the source input
[ "Removes", "whitepsace", "characters", "from", "the", "source", "input" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php#L288-L301
txj123/zilf
src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php
Zend_Json_Decoder._getNextToken
protected function _getNextToken() { $this->_token = self::EOF; $this->_tokenValue = null; $this->_eatWhitespace(); if ($this->_offset >= $this->_sourceLength) { return(self::EOF); } $str = $this->_source; $str_length = $this->_sourceLength; $i = $this->_offset; $start = $i; switch ($str{$i}) { case '{': $this->_token = self::LBRACE; break; case '}': $this->_token = self::RBRACE; break; case '[': $this->_token = self::LBRACKET; break; case ']': $this->_token = self::RBRACKET; break; case ',': $this->_token = self::COMMA; break; case ':': $this->_token = self::COLON; break; case '"': $result = ''; do { $i++; if ($i >= $str_length) { break; } $chr = $str{$i}; if ($chr == '\\') { $i++; if ($i >= $str_length) { break; } $chr = $str{$i}; switch ($chr) { case '"' : $result .= '"'; break; case '\\': $result .= '\\'; break; case '/' : $result .= '/'; break; case 'b' : $result .= chr(8); break; case 'f' : $result .= chr(12); break; case 'n' : $result .= chr(10); break; case 'r' : $result .= chr(13); break; case 't' : $result .= chr(9); break; case '\'' : $result .= '\''; break; default: throw new Zend_Json_Exception( "Illegal escape " . "sequence '" . $chr . "'" ); } } elseif ($chr == '"') { break; } else { $result .= $chr; } } while ($i < $str_length); $this->_token = self::DATUM; //$this->_tokenValue = substr($str, $start + 1, $i - $start - 1); $this->_tokenValue = $result; break; case 't': if (($i+ 3) < $str_length && substr($str, $start, 4) == "true") { $this->_token = self::DATUM; } $this->_tokenValue = true; $i += 3; break; case 'f': if (($i+ 4) < $str_length && substr($str, $start, 5) == "false") { $this->_token = self::DATUM; } $this->_tokenValue = false; $i += 4; break; case 'n': if (($i+ 3) < $str_length && substr($str, $start, 4) == "null") { $this->_token = self::DATUM; } $this->_tokenValue = null; $i += 3; break; } if ($this->_token != self::EOF) { $this->_offset = $i + 1; // Consume the last token character return($this->_token); } $chr = $str{$i}; if ($chr == '-' || $chr == '.' || ($chr >= '0' && $chr <= '9')) { if (preg_match( '/-?([0-9])*(\.[0-9]*)?((e|E)((-|\+)?)[0-9]+)?/s', $str, $matches, PREG_OFFSET_CAPTURE, $start ) && $matches[0][1] == $start ) { $datum = $matches[0][0]; if (is_numeric($datum)) { if (preg_match('/^0\d+$/', $datum)) { throw new Zend_Json_Exception("Octal notation not supported by JSON (value: $datum)"); } else { $val = intval($datum); $fVal = floatval($datum); $this->_tokenValue = ($val == $fVal ? $val : $fVal); } } else { throw new Zend_Json_Exception("Illegal number format: $datum"); } $this->_token = self::DATUM; $this->_offset = $start + strlen($datum); } } else { throw new Zend_Json_Exception('Illegal Token'); } return($this->_token); }
php
protected function _getNextToken() { $this->_token = self::EOF; $this->_tokenValue = null; $this->_eatWhitespace(); if ($this->_offset >= $this->_sourceLength) { return(self::EOF); } $str = $this->_source; $str_length = $this->_sourceLength; $i = $this->_offset; $start = $i; switch ($str{$i}) { case '{': $this->_token = self::LBRACE; break; case '}': $this->_token = self::RBRACE; break; case '[': $this->_token = self::LBRACKET; break; case ']': $this->_token = self::RBRACKET; break; case ',': $this->_token = self::COMMA; break; case ':': $this->_token = self::COLON; break; case '"': $result = ''; do { $i++; if ($i >= $str_length) { break; } $chr = $str{$i}; if ($chr == '\\') { $i++; if ($i >= $str_length) { break; } $chr = $str{$i}; switch ($chr) { case '"' : $result .= '"'; break; case '\\': $result .= '\\'; break; case '/' : $result .= '/'; break; case 'b' : $result .= chr(8); break; case 'f' : $result .= chr(12); break; case 'n' : $result .= chr(10); break; case 'r' : $result .= chr(13); break; case 't' : $result .= chr(9); break; case '\'' : $result .= '\''; break; default: throw new Zend_Json_Exception( "Illegal escape " . "sequence '" . $chr . "'" ); } } elseif ($chr == '"') { break; } else { $result .= $chr; } } while ($i < $str_length); $this->_token = self::DATUM; //$this->_tokenValue = substr($str, $start + 1, $i - $start - 1); $this->_tokenValue = $result; break; case 't': if (($i+ 3) < $str_length && substr($str, $start, 4) == "true") { $this->_token = self::DATUM; } $this->_tokenValue = true; $i += 3; break; case 'f': if (($i+ 4) < $str_length && substr($str, $start, 5) == "false") { $this->_token = self::DATUM; } $this->_tokenValue = false; $i += 4; break; case 'n': if (($i+ 3) < $str_length && substr($str, $start, 4) == "null") { $this->_token = self::DATUM; } $this->_tokenValue = null; $i += 3; break; } if ($this->_token != self::EOF) { $this->_offset = $i + 1; // Consume the last token character return($this->_token); } $chr = $str{$i}; if ($chr == '-' || $chr == '.' || ($chr >= '0' && $chr <= '9')) { if (preg_match( '/-?([0-9])*(\.[0-9]*)?((e|E)((-|\+)?)[0-9]+)?/s', $str, $matches, PREG_OFFSET_CAPTURE, $start ) && $matches[0][1] == $start ) { $datum = $matches[0][0]; if (is_numeric($datum)) { if (preg_match('/^0\d+$/', $datum)) { throw new Zend_Json_Exception("Octal notation not supported by JSON (value: $datum)"); } else { $val = intval($datum); $fVal = floatval($datum); $this->_tokenValue = ($val == $fVal ? $val : $fVal); } } else { throw new Zend_Json_Exception("Illegal number format: $datum"); } $this->_token = self::DATUM; $this->_offset = $start + strlen($datum); } } else { throw new Zend_Json_Exception('Illegal Token'); } return($this->_token); }
[ "protected", "function", "_getNextToken", "(", ")", "{", "$", "this", "->", "_token", "=", "self", "::", "EOF", ";", "$", "this", "->", "_tokenValue", "=", "null", ";", "$", "this", "->", "_eatWhitespace", "(", ")", ";", "if", "(", "$", "this", "->",...
Retrieves the next token from the source stream @return int Token constant value specified in class definition
[ "Retrieves", "the", "next", "token", "from", "the", "source", "stream" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Json/Decoder.php#L309-L461
dave-redfern/laravel-doctrine-tenancy
src/Services/TenantTypeResolver.php
TenantTypeResolver.hasType
public function hasType(TenantParticipantContract $tenant, $type) { if ( null === $class = $this->getMapping($type) ) { throw new \InvalidArgumentException( sprintf('Type "%s" is not mapped to the TenantParticipant class', $type) ); } if ( $tenant instanceof $class ) { return true; } return false; }
php
public function hasType(TenantParticipantContract $tenant, $type) { if ( null === $class = $this->getMapping($type) ) { throw new \InvalidArgumentException( sprintf('Type "%s" is not mapped to the TenantParticipant class', $type) ); } if ( $tenant instanceof $class ) { return true; } return false; }
[ "public", "function", "hasType", "(", "TenantParticipantContract", "$", "tenant", ",", "$", "type", ")", "{", "if", "(", "null", "===", "$", "class", "=", "$", "this", "->", "getMapping", "(", "$", "type", ")", ")", "{", "throw", "new", "\\", "InvalidA...
@param TenantParticipantContract $tenant @param string $type @return boolean
[ "@param", "TenantParticipantContract", "$tenant", "@param", "string", "$type" ]
train
https://github.com/dave-redfern/laravel-doctrine-tenancy/blob/3307fc57ad64d5a4dd5dfb235e19b301661255f9/src/Services/TenantTypeResolver.php#L60-L73
dave-redfern/laravel-doctrine-tenancy
src/Services/TenantTypeResolver.php
TenantTypeResolver.removeMapping
public function removeMapping($type) { $this->mappings->forget($type); $mappings = $this->getMappingsForClass($type); foreach ( $mappings as $key ) { $this->mappings->forget($key); } return $this; }
php
public function removeMapping($type) { $this->mappings->forget($type); $mappings = $this->getMappingsForClass($type); foreach ( $mappings as $key ) { $this->mappings->forget($key); } return $this; }
[ "public", "function", "removeMapping", "(", "$", "type", ")", "{", "$", "this", "->", "mappings", "->", "forget", "(", "$", "type", ")", ";", "$", "mappings", "=", "$", "this", "->", "getMappingsForClass", "(", "$", "type", ")", ";", "foreach", "(", ...
@param string $type @return $this
[ "@param", "string", "$type" ]
train
https://github.com/dave-redfern/laravel-doctrine-tenancy/blob/3307fc57ad64d5a4dd5dfb235e19b301661255f9/src/Services/TenantTypeResolver.php#L152-L162
dave-redfern/laravel-doctrine-tenancy
src/Http/Middleware/TenantSiteResolver.php
TenantSiteResolver.handle
public function handle($request, \Closure $next) { $config = app('config'); $view = app('view'); $domain = str_replace($config->get('tenancy.multi_site.ignorable_domain_components', []), '', $request->getHost()); $tenant = $this->repository->findOneByDomain($domain); if (!$tenant instanceof TenantParticipant) { throw new \RuntimeException( sprintf('Unable to resolve host "%s" to valid TenantParticipant.', $domain) ); } $finder = $view->getFinder(); if ($finder instanceof TenantViewFinder) { $paths = $this->appendPathsInFinder($finder, $tenant); } else { $paths = $this->registerPathsInFinder($view, $finder, $tenant); } // update app config $config->set('app.url', $request->getHost()); $config->set('view.paths', array_merge($config->get('view.paths', []), $paths)); // bind resolved tenant data to container app('auth.tenant')->updateTenancy(new NullUser(), $tenant->getTenantOwner(), $tenant); return $next($request); }
php
public function handle($request, \Closure $next) { $config = app('config'); $view = app('view'); $domain = str_replace($config->get('tenancy.multi_site.ignorable_domain_components', []), '', $request->getHost()); $tenant = $this->repository->findOneByDomain($domain); if (!$tenant instanceof TenantParticipant) { throw new \RuntimeException( sprintf('Unable to resolve host "%s" to valid TenantParticipant.', $domain) ); } $finder = $view->getFinder(); if ($finder instanceof TenantViewFinder) { $paths = $this->appendPathsInFinder($finder, $tenant); } else { $paths = $this->registerPathsInFinder($view, $finder, $tenant); } // update app config $config->set('app.url', $request->getHost()); $config->set('view.paths', array_merge($config->get('view.paths', []), $paths)); // bind resolved tenant data to container app('auth.tenant')->updateTenancy(new NullUser(), $tenant->getTenantOwner(), $tenant); return $next($request); }
[ "public", "function", "handle", "(", "$", "request", ",", "\\", "Closure", "$", "next", ")", "{", "$", "config", "=", "app", "(", "'config'", ")", ";", "$", "view", "=", "app", "(", "'view'", ")", ";", "$", "domain", "=", "str_replace", "(", "$", ...
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @return mixed
[ "Handle", "an", "incoming", "request", "." ]
train
https://github.com/dave-redfern/laravel-doctrine-tenancy/blob/3307fc57ad64d5a4dd5dfb235e19b301661255f9/src/Http/Middleware/TenantSiteResolver.php#L63-L91
dave-redfern/laravel-doctrine-tenancy
src/Http/Middleware/TenantSiteResolver.php
TenantSiteResolver.appendPathsInFinder
protected function appendPathsInFinder(TenantViewFinder $finder, TenantParticipant $tenant) { $finder->prependLocation($this->createViewPath($tenant->getTenantOwner()->getDomain())); $finder->prependLocation($this->createViewPath($tenant->getDomain())); return $finder->getPaths(); }
php
protected function appendPathsInFinder(TenantViewFinder $finder, TenantParticipant $tenant) { $finder->prependLocation($this->createViewPath($tenant->getTenantOwner()->getDomain())); $finder->prependLocation($this->createViewPath($tenant->getDomain())); return $finder->getPaths(); }
[ "protected", "function", "appendPathsInFinder", "(", "TenantViewFinder", "$", "finder", ",", "TenantParticipant", "$", "tenant", ")", "{", "$", "finder", "->", "prependLocation", "(", "$", "this", "->", "createViewPath", "(", "$", "tenant", "->", "getTenantOwner",...
Prepends the view paths to the FileViewFinder, provided it has been replaced @param TenantViewFinder $finder @param TenantParticipant $tenant @return array
[ "Prepends", "the", "view", "paths", "to", "the", "FileViewFinder", "provided", "it", "has", "been", "replaced" ]
train
https://github.com/dave-redfern/laravel-doctrine-tenancy/blob/3307fc57ad64d5a4dd5dfb235e19b301661255f9/src/Http/Middleware/TenantSiteResolver.php#L101-L107
dave-redfern/laravel-doctrine-tenancy
src/Http/Middleware/TenantSiteResolver.php
TenantSiteResolver.registerPathsInFinder
protected function registerPathsInFinder(Factory $view, FileViewFinder $finder, TenantParticipant $tenant) { $paths = []; $this->addPathToViewPaths($paths, $tenant->getDomain()); $this->addPathToViewPaths($paths, $tenant->getTenantOwner()->getDomain()); $paths = array_merge($paths, $finder->getPaths()); $finder = $this->createViewFinder($finder, $paths); // replace ViewFinder in ViewManager with new instance with ordered paths $view->setFinder($finder); return $paths; }
php
protected function registerPathsInFinder(Factory $view, FileViewFinder $finder, TenantParticipant $tenant) { $paths = []; $this->addPathToViewPaths($paths, $tenant->getDomain()); $this->addPathToViewPaths($paths, $tenant->getTenantOwner()->getDomain()); $paths = array_merge($paths, $finder->getPaths()); $finder = $this->createViewFinder($finder, $paths); // replace ViewFinder in ViewManager with new instance with ordered paths $view->setFinder($finder); return $paths; }
[ "protected", "function", "registerPathsInFinder", "(", "Factory", "$", "view", ",", "FileViewFinder", "$", "finder", ",", "TenantParticipant", "$", "tenant", ")", "{", "$", "paths", "=", "[", "]", ";", "$", "this", "->", "addPathToViewPaths", "(", "$", "path...
Registers the view paths by creating a new array and injecting a new FileViewFinder @param Factory $view @param FileViewFinder $finder @param TenantParticipant $tenant @return array
[ "Registers", "the", "view", "paths", "by", "creating", "a", "new", "array", "and", "injecting", "a", "new", "FileViewFinder" ]
train
https://github.com/dave-redfern/laravel-doctrine-tenancy/blob/3307fc57ad64d5a4dd5dfb235e19b301661255f9/src/Http/Middleware/TenantSiteResolver.php#L118-L131
dave-redfern/laravel-doctrine-tenancy
src/Http/Middleware/TenantSiteResolver.php
TenantSiteResolver.createViewFinder
protected function createViewFinder(FileViewFinder $finder, array $paths = []) { $new = new FileViewFinder(app('files'), $paths, $finder->getExtensions()); foreach ($finder->getHints() as $namespace => $hints) { $new->addNamespace($namespace, $hints); } return $new; }
php
protected function createViewFinder(FileViewFinder $finder, array $paths = []) { $new = new FileViewFinder(app('files'), $paths, $finder->getExtensions()); foreach ($finder->getHints() as $namespace => $hints) { $new->addNamespace($namespace, $hints); } return $new; }
[ "protected", "function", "createViewFinder", "(", "FileViewFinder", "$", "finder", ",", "array", "$", "paths", "=", "[", "]", ")", "{", "$", "new", "=", "new", "FileViewFinder", "(", "app", "(", "'files'", ")", ",", "$", "paths", ",", "$", "finder", "-...
Creates a new FileViewFinder, copying the current contents @param FileViewFinder $finder @param array $paths @return FileViewFinder
[ "Creates", "a", "new", "FileViewFinder", "copying", "the", "current", "contents" ]
train
https://github.com/dave-redfern/laravel-doctrine-tenancy/blob/3307fc57ad64d5a4dd5dfb235e19b301661255f9/src/Http/Middleware/TenantSiteResolver.php#L141-L150
dave-redfern/laravel-doctrine-tenancy
src/Http/Middleware/TenantSiteResolver.php
TenantSiteResolver.addPathToViewPaths
protected function addPathToViewPaths(array &$paths, $host) { $path = $this->createViewPath($host); if ($path && !in_array($path, $paths)) { $paths[] = $path; } return $path; }
php
protected function addPathToViewPaths(array &$paths, $host) { $path = $this->createViewPath($host); if ($path && !in_array($path, $paths)) { $paths[] = $path; } return $path; }
[ "protected", "function", "addPathToViewPaths", "(", "array", "&", "$", "paths", ",", "$", "host", ")", "{", "$", "path", "=", "$", "this", "->", "createViewPath", "(", "$", "host", ")", ";", "if", "(", "$", "path", "&&", "!", "in_array", "(", "$", ...
@param array $paths @param string $host @return string
[ "@param", "array", "$paths", "@param", "string", "$host" ]
train
https://github.com/dave-redfern/laravel-doctrine-tenancy/blob/3307fc57ad64d5a4dd5dfb235e19b301661255f9/src/Http/Middleware/TenantSiteResolver.php#L158-L167
bitExpert/adrenaline
src/bitExpert/Adrenaline/Adrenaline.php
Adrenaline.setErrorHandler
public function setErrorHandler(callable $errorHandler) { $this->raiseThrowables(); $errorHandler = $this->normalizeErrorHandler($errorHandler); $this->errorHandler = $errorHandler; }
php
public function setErrorHandler(callable $errorHandler) { $this->raiseThrowables(); $errorHandler = $this->normalizeErrorHandler($errorHandler); $this->errorHandler = $errorHandler; }
[ "public", "function", "setErrorHandler", "(", "callable", "$", "errorHandler", ")", "{", "$", "this", "->", "raiseThrowables", "(", ")", ";", "$", "errorHandler", "=", "$", "this", "->", "normalizeErrorHandler", "(", "$", "errorHandler", ")", ";", "$", "this...
Sets an errorHandler which will be executed when an exception is thrown during execution of {@link \bitExpert\Adrenaline\Adrenaline} @param callable $errorHandler
[ "Sets", "an", "errorHandler", "which", "will", "be", "executed", "when", "an", "exception", "is", "thrown", "during", "execution", "of", "{", "@link", "\\", "bitExpert", "\\", "Adrenaline", "\\", "Adrenaline", "}" ]
train
https://github.com/bitExpert/adrenaline/blob/2cb9b79147dee04221261d765d66416f0b796b0f/src/bitExpert/Adrenaline/Adrenaline.php#L149-L154
bitExpert/adrenaline
src/bitExpert/Adrenaline/Adrenaline.php
Adrenaline.normalizeErrorHandler
protected function normalizeErrorHandler(callable $errorHandler) { if ($errorHandler instanceof ErrorHandler) { return $errorHandler; } $legacyResponseGenerator = function ( $e, ServerRequestInterface $request, ResponseInterface $response ) use ($errorHandler) { return $errorHandler($request, $response, $e); }; $errorHandler = new ErrorHandler(new Response(), $legacyResponseGenerator); return $errorHandler; }
php
protected function normalizeErrorHandler(callable $errorHandler) { if ($errorHandler instanceof ErrorHandler) { return $errorHandler; } $legacyResponseGenerator = function ( $e, ServerRequestInterface $request, ResponseInterface $response ) use ($errorHandler) { return $errorHandler($request, $response, $e); }; $errorHandler = new ErrorHandler(new Response(), $legacyResponseGenerator); return $errorHandler; }
[ "protected", "function", "normalizeErrorHandler", "(", "callable", "$", "errorHandler", ")", "{", "if", "(", "$", "errorHandler", "instanceof", "ErrorHandler", ")", "{", "return", "$", "errorHandler", ";", "}", "$", "legacyResponseGenerator", "=", "function", "(",...
Checks if given $errorHandler is an instance {@link Zend\Stratigility\Middleware\ErrorHandler} If it is a "legacy" error handler, it will be converted due to backwards compatibility @param callable $errorHandler @return callable|ErrorHandler
[ "Checks", "if", "given", "$errorHandler", "is", "an", "instance", "{", "@link", "Zend", "\\", "Stratigility", "\\", "Middleware", "\\", "ErrorHandler", "}", "If", "it", "is", "a", "legacy", "error", "handler", "it", "will", "be", "converted", "due", "to", ...
train
https://github.com/bitExpert/adrenaline/blob/2cb9b79147dee04221261d765d66416f0b796b0f/src/bitExpert/Adrenaline/Adrenaline.php#L163-L179
bitExpert/adrenaline
src/bitExpert/Adrenaline/Adrenaline.php
Adrenaline.createRoute
protected function createRoute(array $methods, string $name, string $path, $target, array $matchers = []) : Route { $builder = RouteBuilder::route($this->defaultRouteClass); $builder->from($path)->to($target); foreach ($methods as $method) { $builder->accepting($method); } $builder->named($name); foreach ($matchers as $param => $paramMatchers) { foreach ($paramMatchers as $matcher) { $builder->ifMatches($param, $matcher); } } return $builder->build(); }
php
protected function createRoute(array $methods, string $name, string $path, $target, array $matchers = []) : Route { $builder = RouteBuilder::route($this->defaultRouteClass); $builder->from($path)->to($target); foreach ($methods as $method) { $builder->accepting($method); } $builder->named($name); foreach ($matchers as $param => $paramMatchers) { foreach ($paramMatchers as $matcher) { $builder->ifMatches($param, $matcher); } } return $builder->build(); }
[ "protected", "function", "createRoute", "(", "array", "$", "methods", ",", "string", "$", "name", ",", "string", "$", "path", ",", "$", "target", ",", "array", "$", "matchers", "=", "[", "]", ")", ":", "Route", "{", "$", "builder", "=", "RouteBuilder",...
Creates a route using given params @param array $methods @param string $name @param string $path @param mixed $target @param array $matchers @return Route
[ "Creates", "a", "route", "using", "given", "params" ]
train
https://github.com/bitExpert/adrenaline/blob/2cb9b79147dee04221261d765d66416f0b796b0f/src/bitExpert/Adrenaline/Adrenaline.php#L237-L256
bitExpert/adrenaline
src/bitExpert/Adrenaline/Adrenaline.php
Adrenaline.get
public function get(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute(['GET'], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
php
public function get(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute(['GET'], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
[ "public", "function", "get", "(", "string", "$", "name", ",", "string", "$", "path", ",", "$", "target", ",", "array", "$", "matchers", "=", "[", "]", ")", ":", "self", "{", "$", "route", "=", "$", "this", "->", "createRoute", "(", "[", "'GET'", ...
Adds a GET route @param string $name @param string $path @param mixed $target @param callable[][] $matchers @return Adrenaline
[ "Adds", "a", "GET", "route" ]
train
https://github.com/bitExpert/adrenaline/blob/2cb9b79147dee04221261d765d66416f0b796b0f/src/bitExpert/Adrenaline/Adrenaline.php#L267-L272
bitExpert/adrenaline
src/bitExpert/Adrenaline/Adrenaline.php
Adrenaline.put
public function put(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute([RequestMethodInterface::METHOD_PUT], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
php
public function put(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute([RequestMethodInterface::METHOD_PUT], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
[ "public", "function", "put", "(", "string", "$", "name", ",", "string", "$", "path", ",", "$", "target", ",", "array", "$", "matchers", "=", "[", "]", ")", ":", "self", "{", "$", "route", "=", "$", "this", "->", "createRoute", "(", "[", "RequestMet...
Adds a PUT route @param string $name @param string $path @param mixed $target @param callable[][] $matchers @return Adrenaline
[ "Adds", "a", "PUT", "route" ]
train
https://github.com/bitExpert/adrenaline/blob/2cb9b79147dee04221261d765d66416f0b796b0f/src/bitExpert/Adrenaline/Adrenaline.php#L299-L304
bitExpert/adrenaline
src/bitExpert/Adrenaline/Adrenaline.php
Adrenaline.delete
public function delete(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute([RequestMethodInterface::METHOD_DELETE], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
php
public function delete(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute([RequestMethodInterface::METHOD_DELETE], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
[ "public", "function", "delete", "(", "string", "$", "name", ",", "string", "$", "path", ",", "$", "target", ",", "array", "$", "matchers", "=", "[", "]", ")", ":", "self", "{", "$", "route", "=", "$", "this", "->", "createRoute", "(", "[", "Request...
Adds a DELETE route @param string $name @param string $path @param mixed $target @param callable[][] $matchers @return Adrenaline
[ "Adds", "a", "DELETE", "route" ]
train
https://github.com/bitExpert/adrenaline/blob/2cb9b79147dee04221261d765d66416f0b796b0f/src/bitExpert/Adrenaline/Adrenaline.php#L315-L320
bitExpert/adrenaline
src/bitExpert/Adrenaline/Adrenaline.php
Adrenaline.options
public function options(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute([RequestMethodInterface::METHOD_OPTIONS], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
php
public function options(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute([RequestMethodInterface::METHOD_OPTIONS], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
[ "public", "function", "options", "(", "string", "$", "name", ",", "string", "$", "path", ",", "$", "target", ",", "array", "$", "matchers", "=", "[", "]", ")", ":", "self", "{", "$", "route", "=", "$", "this", "->", "createRoute", "(", "[", "Reques...
Adds an OPTIONS route @param string $name @param string $path @param mixed $target @param callable[][] $matchers @return Adrenaline
[ "Adds", "an", "OPTIONS", "route" ]
train
https://github.com/bitExpert/adrenaline/blob/2cb9b79147dee04221261d765d66416f0b796b0f/src/bitExpert/Adrenaline/Adrenaline.php#L331-L336
bitExpert/adrenaline
src/bitExpert/Adrenaline/Adrenaline.php
Adrenaline.patch
public function patch(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute([RequestMethodInterface::METHOD_PATCH], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
php
public function patch(string $name, string $path, $target, array $matchers = []) : self { $route = $this->createRoute([RequestMethodInterface::METHOD_PATCH], $name, $path, $target, $matchers); $this->addRoute($route); return $this; }
[ "public", "function", "patch", "(", "string", "$", "name", ",", "string", "$", "path", ",", "$", "target", ",", "array", "$", "matchers", "=", "[", "]", ")", ":", "self", "{", "$", "route", "=", "$", "this", "->", "createRoute", "(", "[", "RequestM...
Adds a PATCH route @param string $name @param string $path @param mixed $target @param callable[][] $matchers @return Adrenaline
[ "Adds", "a", "PATCH", "route" ]
train
https://github.com/bitExpert/adrenaline/blob/2cb9b79147dee04221261d765d66416f0b796b0f/src/bitExpert/Adrenaline/Adrenaline.php#L347-L352
railken/search-query
src/QueryParser.php
QueryParser.parse
public function parse($query) { $node = new Nodes\RootNode(); $node->setValue($query); $l = new Nodes\UndefinedLogicNode(); $node->addChild($l); $t = new Nodes\TextNode(); $t->setValue($query); $l->addChild($t); // $this->addResolver(new Resolvers\TextResolver()); foreach ($this->resolvers as $token) { $token->resolve($node); } // From Root to Logic $node = $node->getChildByIndex(0); if ($node === null) { throw new Exceptions\QuerySyntaxException($query); } $node->setParent(null); // If logic has only one child, skip to first key node if (count($node->getChildren()) === 1) { $node = $node->getChildByIndex(0); $node->setParent(null); } if ($node instanceof Nodes\UndefinedLogicNode) { throw new Exceptions\QuerySyntaxException($query); } return $node; }
php
public function parse($query) { $node = new Nodes\RootNode(); $node->setValue($query); $l = new Nodes\UndefinedLogicNode(); $node->addChild($l); $t = new Nodes\TextNode(); $t->setValue($query); $l->addChild($t); // $this->addResolver(new Resolvers\TextResolver()); foreach ($this->resolvers as $token) { $token->resolve($node); } // From Root to Logic $node = $node->getChildByIndex(0); if ($node === null) { throw new Exceptions\QuerySyntaxException($query); } $node->setParent(null); // If logic has only one child, skip to first key node if (count($node->getChildren()) === 1) { $node = $node->getChildByIndex(0); $node->setParent(null); } if ($node instanceof Nodes\UndefinedLogicNode) { throw new Exceptions\QuerySyntaxException($query); } return $node; }
[ "public", "function", "parse", "(", "$", "query", ")", "{", "$", "node", "=", "new", "Nodes", "\\", "RootNode", "(", ")", ";", "$", "node", "->", "setValue", "(", "$", "query", ")", ";", "$", "l", "=", "new", "Nodes", "\\", "UndefinedLogicNode", "(...
Convert the string query into an object (e.g.). @param string $query (e.g.) title eq 'something' @return \Railken\SQ\Contracts\NodeContract
[ "Convert", "the", "string", "query", "into", "an", "object", "(", "e", ".", "g", ".", ")", "." ]
train
https://github.com/railken/search-query/blob/06e1bfb3eb59347afec9ca764d6f8c3b691d6889/src/QueryParser.php#L52-L90
txj123/zilf
src/Zilf/Db/QueryBuilder.php
QueryBuilder.prepareInsertValues
protected function prepareInsertValues($table, $columns, $params = []) { $schema = $this->db->getSchema(); $tableSchema = $schema->getTableSchema($table); $columnSchemas = $tableSchema !== null ? $tableSchema->columns : []; $names = []; $placeholders = []; $values = ' DEFAULT VALUES'; if ($columns instanceof Query) { list($names, $values, $params) = $this->prepareInsertSelectSubQuery($columns, $schema, $params); } else { foreach ($columns as $name => $value) { $names[] = $schema->quoteColumnName($name); $value = isset($columnSchemas[$name]) ? $columnSchemas[$name]->dbTypecast($value) : $value; if ($value instanceof ExpressionInterface) { $placeholders[] = $this->buildExpression($value, $params); } elseif ($value instanceof \Zilf\Db\Query) { list($sql, $params) = $this->build($value, $params); $placeholders[] = "($sql)"; } else { $placeholders[] = $this->bindParam($value, $params); } } } return [$names, $placeholders, $values, $params]; }
php
protected function prepareInsertValues($table, $columns, $params = []) { $schema = $this->db->getSchema(); $tableSchema = $schema->getTableSchema($table); $columnSchemas = $tableSchema !== null ? $tableSchema->columns : []; $names = []; $placeholders = []; $values = ' DEFAULT VALUES'; if ($columns instanceof Query) { list($names, $values, $params) = $this->prepareInsertSelectSubQuery($columns, $schema, $params); } else { foreach ($columns as $name => $value) { $names[] = $schema->quoteColumnName($name); $value = isset($columnSchemas[$name]) ? $columnSchemas[$name]->dbTypecast($value) : $value; if ($value instanceof ExpressionInterface) { $placeholders[] = $this->buildExpression($value, $params); } elseif ($value instanceof \Zilf\Db\Query) { list($sql, $params) = $this->build($value, $params); $placeholders[] = "($sql)"; } else { $placeholders[] = $this->bindParam($value, $params); } } } return [$names, $placeholders, $values, $params]; }
[ "protected", "function", "prepareInsertValues", "(", "$", "table", ",", "$", "columns", ",", "$", "params", "=", "[", "]", ")", "{", "$", "schema", "=", "$", "this", "->", "db", "->", "getSchema", "(", ")", ";", "$", "tableSchema", "=", "$", "schema"...
Prepares a `VALUES` part for an `INSERT` SQL statement. @param string $table the table that new rows will be inserted into. @param array|Query $columns the column data (name => value) to be inserted into the table or instance of [[Zilf\Db\Query|Query]] to perform INSERT INTO ... SELECT SQL statement. @param array $params the binding parameters that will be generated by this method. They should be bound to the DB command later. @return array array of column names, placeholders, values and params. @since 2.0.14
[ "Prepares", "a", "VALUES", "part", "for", "an", "INSERT", "SQL", "statement", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Db/QueryBuilder.php#L364-L390
txj123/zilf
src/Zilf/Db/QueryBuilder.php
QueryBuilder.createConditionFromArray
public function createConditionFromArray($condition) { if (isset($condition[0])) { // operator format: operator, operand 1, operand 2, ... $operator = strtoupper(array_shift($condition)); if (isset($this->conditionClasses[$operator])) { $className = $this->conditionClasses[$operator]; } else { $className = 'Zilf\Db\conditions\SimpleCondition'; } /** * @var ConditionInterface $className */ return $className::fromArrayDefinition($operator, $condition); } // hash format: 'column1' => 'value1', 'column2' => 'value2', ... return new HashCondition($condition); }
php
public function createConditionFromArray($condition) { if (isset($condition[0])) { // operator format: operator, operand 1, operand 2, ... $operator = strtoupper(array_shift($condition)); if (isset($this->conditionClasses[$operator])) { $className = $this->conditionClasses[$operator]; } else { $className = 'Zilf\Db\conditions\SimpleCondition'; } /** * @var ConditionInterface $className */ return $className::fromArrayDefinition($operator, $condition); } // hash format: 'column1' => 'value1', 'column2' => 'value2', ... return new HashCondition($condition); }
[ "public", "function", "createConditionFromArray", "(", "$", "condition", ")", "{", "if", "(", "isset", "(", "$", "condition", "[", "0", "]", ")", ")", "{", "// operator format: operator, operand 1, operand 2, ...", "$", "operator", "=", "strtoupper", "(", "array_s...
Transforms $condition defined in array format (as described in [[Query::where()]] to instance of [[Zilf\Db\condition\ConditionInterface|ConditionInterface]] according to [[conditionClasses]] map. @param string|array $condition @see conditionClasses @return ConditionInterface @since 2.0.14
[ "Transforms", "$condition", "defined", "in", "array", "format", "(", "as", "described", "in", "[[", "Query", "::", "where", "()", "]]", "to", "instance", "of", "[[", "Zilf", "\\", "Db", "\\", "condition", "\\", "ConditionInterface|ConditionInterface", "]]", "a...
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Db/QueryBuilder.php#L1606-L1623
txj123/zilf
src/Zilf/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php
MimeTypeExtensionGuesser.guess
public function guess($mimeType) { return isset($this->defaultExtensions[$mimeType]) ? $this->defaultExtensions[$mimeType] : null; }
php
public function guess($mimeType) { return isset($this->defaultExtensions[$mimeType]) ? $this->defaultExtensions[$mimeType] : null; }
[ "public", "function", "guess", "(", "$", "mimeType", ")", "{", "return", "isset", "(", "$", "this", "->", "defaultExtensions", "[", "$", "mimeType", "]", ")", "?", "$", "this", "->", "defaultExtensions", "[", "$", "mimeType", "]", ":", "null", ";", "}"...
{@inheritdoc}
[ "{" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php#L804-L807
appzcoder/phpcloc
src/Analyzers/ClocAnalyzer.php
ClocAnalyzer.processLines
protected function processLines(SplFileObject $file) { $extension = $file->getExtension(); $totalLines = 0; $totalBlankLines = 0; $totalComments = 0; $isMultilines = false; while ($file->valid()) { $currentLine = $file->fgets(); $trimLine = trim($currentLine); // Ignoring the last new line if ($file->eof() && empty($trimLine)) { break; } $totalLines ++; if (empty($trimLine)) { $totalBlankLines ++; } // Detecting comments if (strpos($trimLine, '//') === 0 || strpos($trimLine, '#') === 0) { $totalComments ++; } // Detecting multilines comments if (strpos($trimLine, '/*') === 0) { $isMultilines = true; } if ($isMultilines) { $totalComments ++; } if (strpos($trimLine, '*/') === 0) { $isMultilines = false; } } if (!isset($this->extensions[$extension])) { return; } $this->setStats($extension, [ 'language' => $this->extensions[$extension], 'files' => 1, 'blank' => $totalBlankLines, 'comment' => $totalComments, 'code' => $totalLines - ($totalBlankLines + $totalComments), ]); }
php
protected function processLines(SplFileObject $file) { $extension = $file->getExtension(); $totalLines = 0; $totalBlankLines = 0; $totalComments = 0; $isMultilines = false; while ($file->valid()) { $currentLine = $file->fgets(); $trimLine = trim($currentLine); // Ignoring the last new line if ($file->eof() && empty($trimLine)) { break; } $totalLines ++; if (empty($trimLine)) { $totalBlankLines ++; } // Detecting comments if (strpos($trimLine, '//') === 0 || strpos($trimLine, '#') === 0) { $totalComments ++; } // Detecting multilines comments if (strpos($trimLine, '/*') === 0) { $isMultilines = true; } if ($isMultilines) { $totalComments ++; } if (strpos($trimLine, '*/') === 0) { $isMultilines = false; } } if (!isset($this->extensions[$extension])) { return; } $this->setStats($extension, [ 'language' => $this->extensions[$extension], 'files' => 1, 'blank' => $totalBlankLines, 'comment' => $totalComments, 'code' => $totalLines - ($totalBlankLines + $totalComments), ]); }
[ "protected", "function", "processLines", "(", "SplFileObject", "$", "file", ")", "{", "$", "extension", "=", "$", "file", "->", "getExtension", "(", ")", ";", "$", "totalLines", "=", "0", ";", "$", "totalBlankLines", "=", "0", ";", "$", "totalComments", ...
Process the lines from a file. @param SplFileObject $file @return void
[ "Process", "the", "lines", "from", "a", "file", "." ]
train
https://github.com/appzcoder/phpcloc/blob/0fa4b45e490238e7210009e4a1278e7a1c98d0c2/src/Analyzers/ClocAnalyzer.php#L257-L308
appzcoder/phpcloc
src/Analyzers/ClocAnalyzer.php
ClocAnalyzer.setStats
protected function setStats($extension, $stat) { if (isset($this->stats[$extension])) { $this->stats[$extension]['files'] += $stat['files']; $this->stats[$extension]['blank'] += $stat['blank']; $this->stats[$extension]['comment'] += $stat['comment']; $this->stats[$extension]['code'] += $stat['code']; } else { $this->stats[$extension] = $stat; } }
php
protected function setStats($extension, $stat) { if (isset($this->stats[$extension])) { $this->stats[$extension]['files'] += $stat['files']; $this->stats[$extension]['blank'] += $stat['blank']; $this->stats[$extension]['comment'] += $stat['comment']; $this->stats[$extension]['code'] += $stat['code']; } else { $this->stats[$extension] = $stat; } }
[ "protected", "function", "setStats", "(", "$", "extension", ",", "$", "stat", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "stats", "[", "$", "extension", "]", ")", ")", "{", "$", "this", "->", "stats", "[", "$", "extension", "]", "[", "...
Set or increment the stat. @param string $extension @param array $stat @return void
[ "Set", "or", "increment", "the", "stat", "." ]
train
https://github.com/appzcoder/phpcloc/blob/0fa4b45e490238e7210009e4a1278e7a1c98d0c2/src/Analyzers/ClocAnalyzer.php#L318-L328
Lansoweb/LosLog
src/ExceptionLogger.php
ExceptionLogger.registerHandlers
public static function registerHandlers($logFile = 'exception.log', $logDir = 'data/logs') { $logger = AbstractLogger::generateFileLogger($logFile, $logDir); Logger::registerExceptionHandler($logger->getLogger()); }
php
public static function registerHandlers($logFile = 'exception.log', $logDir = 'data/logs') { $logger = AbstractLogger::generateFileLogger($logFile, $logDir); Logger::registerExceptionHandler($logger->getLogger()); }
[ "public", "static", "function", "registerHandlers", "(", "$", "logFile", "=", "'exception.log'", ",", "$", "logDir", "=", "'data/logs'", ")", "{", "$", "logger", "=", "AbstractLogger", "::", "generateFileLogger", "(", "$", "logFile", ",", "$", "logDir", ")", ...
Registers the handlers for errors and exceptions. @param string $logFile @param string $logDir @throws Exception\InvalidArgumentException
[ "Registers", "the", "handlers", "for", "errors", "and", "exceptions", "." ]
train
https://github.com/Lansoweb/LosLog/blob/1d7d24db66a8f77da2b7e33bb10d6665133c9199/src/ExceptionLogger.php#L39-L44
krafthaus/bauhaus
src/KraftHaus/Bauhaus/Util/Value.php
Value.encode
public static function encode($strategy, $value) { switch ($strategy) { case 'explode': return implode(',', $value); case 'json': return json_encode($value); case 'serialize': return serialize($value); } return $value; }
php
public static function encode($strategy, $value) { switch ($strategy) { case 'explode': return implode(',', $value); case 'json': return json_encode($value); case 'serialize': return serialize($value); } return $value; }
[ "public", "static", "function", "encode", "(", "$", "strategy", ",", "$", "value", ")", "{", "switch", "(", "$", "strategy", ")", "{", "case", "'explode'", ":", "return", "implode", "(", "','", ",", "$", "value", ")", ";", "case", "'json'", ":", "ret...
Encode a value based on the strategy @param string $strategy @param string $value @access public @return string
[ "Encode", "a", "value", "based", "on", "the", "strategy" ]
train
https://github.com/krafthaus/bauhaus/blob/02b6c5f4f7e5b5748d5300ab037feaff2a84ca80/src/KraftHaus/Bauhaus/Util/Value.php#L30-L42
krafthaus/bauhaus
src/KraftHaus/Bauhaus/Util/Value.php
Value.decode
public static function decode($strategy, $value) { switch ($strategy) { case 'explode': return explode(',', $value); case 'json': return json_decode($value); case 'serialize': return unserialize($value); } return $value; }
php
public static function decode($strategy, $value) { switch ($strategy) { case 'explode': return explode(',', $value); case 'json': return json_decode($value); case 'serialize': return unserialize($value); } return $value; }
[ "public", "static", "function", "decode", "(", "$", "strategy", ",", "$", "value", ")", "{", "switch", "(", "$", "strategy", ")", "{", "case", "'explode'", ":", "return", "explode", "(", "','", ",", "$", "value", ")", ";", "case", "'json'", ":", "ret...
Decode a value based on the strategy. @param string $strategy @param string $value @access public @return array|mixed
[ "Decode", "a", "value", "based", "on", "the", "strategy", "." ]
train
https://github.com/krafthaus/bauhaus/blob/02b6c5f4f7e5b5748d5300ab037feaff2a84ca80/src/KraftHaus/Bauhaus/Util/Value.php#L53-L65
kiwiz/esquery
src/Engine.php
Engine.execute
public function execute() { $sch = new Scheduler($this->settings, $this->query_list, $this->conn_provider, $this->list_provider); return $sch->execute(); }
php
public function execute() { $sch = new Scheduler($this->settings, $this->query_list, $this->conn_provider, $this->list_provider); return $sch->execute(); }
[ "public", "function", "execute", "(", ")", "{", "$", "sch", "=", "new", "Scheduler", "(", "$", "this", "->", "settings", ",", "$", "this", "->", "query_list", ",", "$", "this", "->", "conn_provider", ",", "$", "this", "->", "list_provider", ")", ";", ...
Execute the query. @return Results.
[ "Execute", "the", "query", "." ]
train
https://github.com/kiwiz/esquery/blob/ad05f8d18cb9f1227a82f8d0b9d270882865b31d/src/Engine.php#L40-L43
txj123/zilf
src/Zilf/HttpFoundation/Session/Flash/AutoExpireFlashBag.php
AutoExpireFlashBag.initialize
public function initialize(array &$flashes) { $this->flashes = &$flashes; // The logic: messages from the last request will be stored in new, so we move them to previous // This request we will show what is in 'display'. What is placed into 'new' this time round will // be moved to display next time round. $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array(); $this->flashes['new'] = array(); }
php
public function initialize(array &$flashes) { $this->flashes = &$flashes; // The logic: messages from the last request will be stored in new, so we move them to previous // This request we will show what is in 'display'. What is placed into 'new' this time round will // be moved to display next time round. $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array(); $this->flashes['new'] = array(); }
[ "public", "function", "initialize", "(", "array", "&", "$", "flashes", ")", "{", "$", "this", "->", "flashes", "=", "&", "$", "flashes", ";", "// The logic: messages from the last request will be stored in new, so we move them to previous", "// This request we will show what ...
{@inheritdoc}
[ "{" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/HttpFoundation/Session/Flash/AutoExpireFlashBag.php#L63-L72
txj123/zilf
src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Validate/Barcode.php
Zend_Validate_Barcode.setType
public function setType($barcodeType) { switch (strtolower($barcodeType)) { case 'upc': case 'upc-a': $className = 'UpcA'; break; case 'ean13': case 'ean-13': $className = 'Ean13'; break; default: include_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("Barcode type '$barcodeType' is not supported'"); break; } include_once 'Zend/Validate/Barcode/' . $className . '.php'; $class = 'Zend_Validate_Barcode_' . $className; $this->_barcodeValidator = new $class; }
php
public function setType($barcodeType) { switch (strtolower($barcodeType)) { case 'upc': case 'upc-a': $className = 'UpcA'; break; case 'ean13': case 'ean-13': $className = 'Ean13'; break; default: include_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("Barcode type '$barcodeType' is not supported'"); break; } include_once 'Zend/Validate/Barcode/' . $className . '.php'; $class = 'Zend_Validate_Barcode_' . $className; $this->_barcodeValidator = new $class; }
[ "public", "function", "setType", "(", "$", "barcodeType", ")", "{", "switch", "(", "strtolower", "(", "$", "barcodeType", ")", ")", "{", "case", "'upc'", ":", "case", "'upc-a'", ":", "$", "className", "=", "'UpcA'", ";", "break", ";", "case", "'ean13'", ...
Sets a new barcode validator @param string $barcodeType - Barcode validator to use @return void @throws Zend_Validate_Exception
[ "Sets", "a", "new", "barcode", "validator" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/DataCrawler/PhpQuery/phpQuery/Zend/Validate/Barcode.php#L64-L85
dave-redfern/laravel-doctrine-tenancy
src/View/FileViewFinder.php
FileViewFinder.prependLocation
public function prependLocation($location) { if ($location && !in_array($location, $this->paths)) { array_unshift($this->paths, $location); } return $this; }
php
public function prependLocation($location) { if ($location && !in_array($location, $this->paths)) { array_unshift($this->paths, $location); } return $this; }
[ "public", "function", "prependLocation", "(", "$", "location", ")", "{", "if", "(", "$", "location", "&&", "!", "in_array", "(", "$", "location", ",", "$", "this", "->", "paths", ")", ")", "{", "array_unshift", "(", "$", "this", "->", "paths", ",", "...
Append a path to the top of the array of paths @param string $location @return $this
[ "Append", "a", "path", "to", "the", "top", "of", "the", "array", "of", "paths" ]
train
https://github.com/dave-redfern/laravel-doctrine-tenancy/blob/3307fc57ad64d5a4dd5dfb235e19b301661255f9/src/View/FileViewFinder.php#L40-L47
Syonix/log-viewer-lib
lib/LogCollection.php
LogCollection.getLog
public function getLog($slug) { foreach ($this->logs as $log) { if ($log->getSlug() == $slug) { return $log; } } }
php
public function getLog($slug) { foreach ($this->logs as $log) { if ($log->getSlug() == $slug) { return $log; } } }
[ "public", "function", "getLog", "(", "$", "slug", ")", "{", "foreach", "(", "$", "this", "->", "logs", "as", "$", "log", ")", "{", "if", "(", "$", "log", "->", "getSlug", "(", ")", "==", "$", "slug", ")", "{", "return", "$", "log", ";", "}", ...
@param $slug @return LogFile|null
[ "@param", "$slug" ]
train
https://github.com/Syonix/log-viewer-lib/blob/5212208bf2f0174eb5d0408d2d3028db4d478a74/lib/LogCollection.php#L68-L75
txj123/zilf
src/Zilf/Support/Collection.php
Collection.dump
public function dump() { (new static(func_get_args())) ->push($this) ->each( function ($item) { (new Dumper)->dump($item); } ); return $this; }
php
public function dump() { (new static(func_get_args())) ->push($this) ->each( function ($item) { (new Dumper)->dump($item); } ); return $this; }
[ "public", "function", "dump", "(", ")", "{", "(", "new", "static", "(", "func_get_args", "(", ")", ")", ")", "->", "push", "(", "$", "this", ")", "->", "each", "(", "function", "(", "$", "item", ")", "{", "(", "new", "Dumper", ")", "->", "dump", ...
Dump the collection. @return $this
[ "Dump", "the", "collection", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Support/Collection.php#L315-L326
appzcoder/phpcloc
src/Commands/DuplicateCommand.php
DuplicateCommand.execute
public function execute(InputInterface $input, OutputInterface $output) { $path = $input->getArgument('path'); $ext = $input->getOption('ext'); $exclude = $input->getOption('exclude'); $stats = (new DuplicateAnalyzer($path, $ext, $exclude))->stats(); if (count($stats) === 0) { $output->writeln('No files found.'); return; } array_push( $stats, new TableSeparator(), [ 'Total', new TableCell( array_reduce($stats, function ($carry, $item) { return $carry + $item['duplicate']; }), ['colspan' => 2] ), ] ); $table = new Table($output); $table ->setHeaders(['File', 'Duplicate', 'In Line(s)']) ->setRows($stats) ; $table->render(); }
php
public function execute(InputInterface $input, OutputInterface $output) { $path = $input->getArgument('path'); $ext = $input->getOption('ext'); $exclude = $input->getOption('exclude'); $stats = (new DuplicateAnalyzer($path, $ext, $exclude))->stats(); if (count($stats) === 0) { $output->writeln('No files found.'); return; } array_push( $stats, new TableSeparator(), [ 'Total', new TableCell( array_reduce($stats, function ($carry, $item) { return $carry + $item['duplicate']; }), ['colspan' => 2] ), ] ); $table = new Table($output); $table ->setHeaders(['File', 'Duplicate', 'In Line(s)']) ->setRows($stats) ; $table->render(); }
[ "public", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "path", "=", "$", "input", "->", "getArgument", "(", "'path'", ")", ";", "$", "ext", "=", "$", "input", "->", "getOption", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/appzcoder/phpcloc/blob/0fa4b45e490238e7210009e4a1278e7a1c98d0c2/src/Commands/DuplicateCommand.php#L50-L82
txj123/zilf
src/Zilf/Queue/Listener.php
Listener.formatCommand
protected function formatCommand($command, $connection, $queue, ListenerOptions $options) { return sprintf( $command, ProcessUtils::escapeArgument($connection), ProcessUtils::escapeArgument($queue), $options->delay, $options->memory, $options->sleep, $options->maxTries ); }
php
protected function formatCommand($command, $connection, $queue, ListenerOptions $options) { return sprintf( $command, ProcessUtils::escapeArgument($connection), ProcessUtils::escapeArgument($queue), $options->delay, $options->memory, $options->sleep, $options->maxTries ); }
[ "protected", "function", "formatCommand", "(", "$", "command", ",", "$", "connection", ",", "$", "queue", ",", "ListenerOptions", "$", "options", ")", "{", "return", "sprintf", "(", "$", "command", ",", "ProcessUtils", "::", "escapeArgument", "(", "$", "conn...
Format the given command with the listener options. @param string $command @param string $connection @param string $queue @param \Illuminate\Queue\ListenerOptions $options @return string
[ "Format", "the", "given", "command", "with", "the", "listener", "options", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Queue/Listener.php#L171-L180
txj123/zilf
src/Zilf/HttpFoundation/Session/Flash/FlashBag.php
FlashBag.get
public function get($type, array $default = array()) { if (!$this->has($type)) { return $default; } $return = $this->flashes[$type]; unset($this->flashes[$type]); return $return; }
php
public function get($type, array $default = array()) { if (!$this->has($type)) { return $default; } $return = $this->flashes[$type]; unset($this->flashes[$type]); return $return; }
[ "public", "function", "get", "(", "$", "type", ",", "array", "$", "default", "=", "array", "(", ")", ")", "{", "if", "(", "!", "$", "this", "->", "has", "(", "$", "type", ")", ")", "{", "return", "$", "default", ";", "}", "$", "return", "=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/HttpFoundation/Session/Flash/FlashBag.php#L95-L106
txj123/zilf
src/Zilf/DataCrawler/PhpQuery/phpQuery/phpQueryEvents.php
phpQueryEvents.trigger
public static function trigger($document, $type, $data = array(), $node = null) { // trigger: function(type, data, elem, donative, extra) { $documentID = phpQuery::getDocumentID($document); $namespace = null; if (strpos($type, '.') !== false) { list($name, $namespace) = explode('.', $type); } else { $name = $type; } if (! $node) { if (self::issetGlobal($documentID, $type)) { $pq = phpQuery::getDocument($documentID); // TODO check add($pq->document) $pq->find('*')->add($pq->document) ->trigger($type, $data); } } else { if (isset($data[0]) && $data[0] instanceof DOMEvent) { $event = $data[0]; $event->relatedTarget = $event->target; $event->target = $node; $data = array_slice($data, 1); } else { $event = new DOMEvent( array( 'type' => $type, 'target' => $node, 'timeStamp' => time(), ) ); } $i = 0; while($node) { // TODO whois phpQuery::debug( "Triggering ".($i?"bubbled ":'')."event '{$type}' on " ."node \n" );//.phpQueryObject::whois($node)."\n"); $event->currentTarget = $node; $eventNode = self::getNode($documentID, $node); if (isset($eventNode->eventHandlers)) { foreach($eventNode->eventHandlers as $eventType => $handlers) { $eventNamespace = null; if (strpos($type, '.') !== false) { list($eventName, $eventNamespace) = explode('.', $eventType); } else { $eventName = $eventType; } if ($name != $eventName) { continue; } if ($namespace && $eventNamespace && $namespace != $eventNamespace) { continue; } foreach($handlers as $handler) { phpQuery::debug("Calling event handler\n"); $event->data = $handler['data'] ? $handler['data'] : null; $params = array_merge(array($event), $data); $return = phpQuery::callbackRun($handler['callback'], $params); if ($return === false) { $event->bubbles = false; } } } } // to bubble or not to bubble... if (! $event->bubbles) { break; } $node = $node->parentNode; $i++; } } }
php
public static function trigger($document, $type, $data = array(), $node = null) { // trigger: function(type, data, elem, donative, extra) { $documentID = phpQuery::getDocumentID($document); $namespace = null; if (strpos($type, '.') !== false) { list($name, $namespace) = explode('.', $type); } else { $name = $type; } if (! $node) { if (self::issetGlobal($documentID, $type)) { $pq = phpQuery::getDocument($documentID); // TODO check add($pq->document) $pq->find('*')->add($pq->document) ->trigger($type, $data); } } else { if (isset($data[0]) && $data[0] instanceof DOMEvent) { $event = $data[0]; $event->relatedTarget = $event->target; $event->target = $node; $data = array_slice($data, 1); } else { $event = new DOMEvent( array( 'type' => $type, 'target' => $node, 'timeStamp' => time(), ) ); } $i = 0; while($node) { // TODO whois phpQuery::debug( "Triggering ".($i?"bubbled ":'')."event '{$type}' on " ."node \n" );//.phpQueryObject::whois($node)."\n"); $event->currentTarget = $node; $eventNode = self::getNode($documentID, $node); if (isset($eventNode->eventHandlers)) { foreach($eventNode->eventHandlers as $eventType => $handlers) { $eventNamespace = null; if (strpos($type, '.') !== false) { list($eventName, $eventNamespace) = explode('.', $eventType); } else { $eventName = $eventType; } if ($name != $eventName) { continue; } if ($namespace && $eventNamespace && $namespace != $eventNamespace) { continue; } foreach($handlers as $handler) { phpQuery::debug("Calling event handler\n"); $event->data = $handler['data'] ? $handler['data'] : null; $params = array_merge(array($event), $data); $return = phpQuery::callbackRun($handler['callback'], $params); if ($return === false) { $event->bubbles = false; } } } } // to bubble or not to bubble... if (! $event->bubbles) { break; } $node = $node->parentNode; $i++; } } }
[ "public", "static", "function", "trigger", "(", "$", "document", ",", "$", "type", ",", "$", "data", "=", "array", "(", ")", ",", "$", "node", "=", "null", ")", "{", "// trigger: function(type, data, elem, donative, extra) {", "$", "documentID", "=", "phpQuery...
Trigger a type of event on every matched element. @param DOMNode|phpQueryObject|string $document @param unknown_type $type @param unknown_type $data @TODO exclusive events (with !) @TODO global events (test) @TODO support more than event in $type (space-separated)
[ "Trigger", "a", "type", "of", "event", "on", "every", "matched", "element", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/DataCrawler/PhpQuery/phpQuery/phpQueryEvents.php#L22-L98
txj123/zilf
src/Zilf/DataCrawler/PhpQuery/phpQuery/phpQueryEvents.php
phpQueryEvents.remove
public static function remove($document, $node, $type = null, $callback = null) { $documentID = phpQuery::getDocumentID($document); $eventNode = self::getNode($documentID, $node); if (is_object($eventNode) && isset($eventNode->eventHandlers[$type])) { if ($callback) { foreach($eventNode->eventHandlers[$type] as $k => $handler) { if ($handler['callback'] == $callback) { unset($eventNode->eventHandlers[$type][$k]); } } } else { unset($eventNode->eventHandlers[$type]); } } }
php
public static function remove($document, $node, $type = null, $callback = null) { $documentID = phpQuery::getDocumentID($document); $eventNode = self::getNode($documentID, $node); if (is_object($eventNode) && isset($eventNode->eventHandlers[$type])) { if ($callback) { foreach($eventNode->eventHandlers[$type] as $k => $handler) { if ($handler['callback'] == $callback) { unset($eventNode->eventHandlers[$type][$k]); } } } else { unset($eventNode->eventHandlers[$type]); } } }
[ "public", "static", "function", "remove", "(", "$", "document", ",", "$", "node", ",", "$", "type", "=", "null", ",", "$", "callback", "=", "null", ")", "{", "$", "documentID", "=", "phpQuery", "::", "getDocumentID", "(", "$", "document", ")", ";", "...
Enter description here... @param DOMNode|phpQueryObject|string $document @param unknown_type $type @param unknown_type $callback @TODO namespace events @TODO support more than event in $type (space-separated)
[ "Enter", "description", "here", "..." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/DataCrawler/PhpQuery/phpQuery/phpQueryEvents.php#L142-L157
crysalead/sql-dialect
src/Statement/Behavior/HasWhere.php
HasWhere.where
public function where($conditions) { if ($conditions = is_array($conditions) && func_num_args() === 1 ? $conditions : func_get_args()) { $this->_parts['where'][] = $conditions; } return $this; }
php
public function where($conditions) { if ($conditions = is_array($conditions) && func_num_args() === 1 ? $conditions : func_get_args()) { $this->_parts['where'][] = $conditions; } return $this; }
[ "public", "function", "where", "(", "$", "conditions", ")", "{", "if", "(", "$", "conditions", "=", "is_array", "(", "$", "conditions", ")", "&&", "func_num_args", "(", ")", "===", "1", "?", "$", "conditions", ":", "func_get_args", "(", ")", ")", "{", ...
Adds some where conditions to the query. @param string|array $conditions The conditions for this query. @return object Returns `$this`.
[ "Adds", "some", "where", "conditions", "to", "the", "query", "." ]
train
https://github.com/crysalead/sql-dialect/blob/867a768086fb3eb539752671a0dd54b949fe9d79/src/Statement/Behavior/HasWhere.php#L12-L18
xutl/qcloud-cmq
src/Requests/BatchDeleteMessageRequest.php
BatchDeleteMessageRequest.setReceiptHandles
public function setReceiptHandles($receiptHandles) { if (is_array($receiptHandles) && !empty($receiptHandles)) { $n = 1; foreach ($receiptHandles as $receiptHandle) { $key = 'receiptHandle.' . $n; $this->setParameter($key, $receiptHandle); $n += 1; } } return $this; }
php
public function setReceiptHandles($receiptHandles) { if (is_array($receiptHandles) && !empty($receiptHandles)) { $n = 1; foreach ($receiptHandles as $receiptHandle) { $key = 'receiptHandle.' . $n; $this->setParameter($key, $receiptHandle); $n += 1; } } return $this; }
[ "public", "function", "setReceiptHandles", "(", "$", "receiptHandles", ")", "{", "if", "(", "is_array", "(", "$", "receiptHandles", ")", "&&", "!", "empty", "(", "$", "receiptHandles", ")", ")", "{", "$", "n", "=", "1", ";", "foreach", "(", "$", "recei...
上次消费消息时返回的消息句柄。为方便用户使用,n 从 0 开始或者从 1 开始都可以,但必须连续,例如删除两条消息,可以是(receiptHandle.0,receiptHandle.1),或者(receiptHandle.1, receiptHandle.2)。 @param array $receiptHandles @return BaseRequest
[ "上次消费消息时返回的消息句柄。为方便用户使用,n", "从", "0", "开始或者从", "1", "开始都可以,但必须连续,例如删除两条消息,可以是", "(", "receiptHandle", ".", "0", "receiptHandle", ".", "1", ")", ",或者", "(", "receiptHandle", ".", "1", "receiptHandle", ".", "2", ")", "。" ]
train
https://github.com/xutl/qcloud-cmq/blob/f48b905c2d4001817126f0c25a0433acda79ea6a/src/Requests/BatchDeleteMessageRequest.php#L43-L54
txj123/zilf
src/Zilf/Cache/MemcachedStore.php
MemcachedStore.add
public function add($key, $value, $minutes) { return $this->memcached->add($this->prefix.$key, $value, $this->toTimestamp($minutes)); }
php
public function add($key, $value, $minutes) { return $this->memcached->add($this->prefix.$key, $value, $this->toTimestamp($minutes)); }
[ "public", "function", "add", "(", "$", "key", ",", "$", "value", ",", "$", "minutes", ")", "{", "return", "$", "this", "->", "memcached", "->", "add", "(", "$", "this", "->", "prefix", ".", "$", "key", ",", "$", "value", ",", "$", "this", "->", ...
Store an item in the cache if the key doesn't exist. @param string $key @param mixed $value @param float|int $minutes @return bool
[ "Store", "an", "item", "in", "the", "cache", "if", "the", "key", "doesn", "t", "exist", "." ]
train
https://github.com/txj123/zilf/blob/8fc979ae338e850e6f40bfb97d4d57869f9e4480/src/Zilf/Cache/MemcachedStore.php#L133-L136
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.authenticate
function authenticate($user, $password) { if (!is_string($user) || !isset(self::$levels[$user])) { throw new InvalidArgumentException('user = ' . print_r($user, true)); } if (self::$levels[$this->user] >= self::$levels[$user]) { return true; } if (!is_string($password)) { throw new InvalidArgumentException('password = ' . print_r($password, true)); } $res = $this->execute(ucfirst(__FUNCTION__), array($user, $password)); if ($res) { $this->user = $user; } return $res; }
php
function authenticate($user, $password) { if (!is_string($user) || !isset(self::$levels[$user])) { throw new InvalidArgumentException('user = ' . print_r($user, true)); } if (self::$levels[$this->user] >= self::$levels[$user]) { return true; } if (!is_string($password)) { throw new InvalidArgumentException('password = ' . print_r($password, true)); } $res = $this->execute(ucfirst(__FUNCTION__), array($user, $password)); if ($res) { $this->user = $user; } return $res; }
[ "function", "authenticate", "(", "$", "user", ",", "$", "password", ")", "{", "if", "(", "!", "is_string", "(", "$", "user", ")", "||", "!", "isset", "(", "self", "::", "$", "levels", "[", "$", "user", "]", ")", ")", "{", "throw", "new", "Invalid...
Allow user authentication by specifying a login and a password, to gain access to the set of functionalities corresponding to this authorization level. @param string $user @param string $password @return bool @throws InvalidArgumentException
[ "Allow", "user", "authentication", "by", "specifying", "a", "login", "and", "a", "password", "to", "gain", "access", "to", "the", "set", "of", "functionalities", "corresponding", "to", "this", "authorization", "level", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L75-L93
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.execute
public function execute($methodName, $params = array(), $multicall = false) { if ($multicall) { $this->xmlrpcClient->addCall($methodName, $params); $this->multicallHandlers[] = $multicall; } else { return $this->xmlrpcClient->query($methodName, $params); } }
php
public function execute($methodName, $params = array(), $multicall = false) { if ($multicall) { $this->xmlrpcClient->addCall($methodName, $params); $this->multicallHandlers[] = $multicall; } else { return $this->xmlrpcClient->query($methodName, $params); } }
[ "public", "function", "execute", "(", "$", "methodName", ",", "$", "params", "=", "array", "(", ")", ",", "$", "multicall", "=", "false", ")", "{", "if", "(", "$", "multicall", ")", "{", "$", "this", "->", "xmlrpcClient", "->", "addCall", "(", "$", ...
Add a call in queue. It will be executed by the next Call from the user to executeMulticall @param string $methodName @param mixed[] $params @param bool|callable $multicall True to queue the request or false to execute it immediately @return mixed
[ "Add", "a", "call", "in", "queue", ".", "It", "will", "be", "executed", "by", "the", "next", "Call", "from", "the", "user", "to", "executeMulticall" ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L102-L110
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.setApiVersion
function setApiVersion($version, $multicall = false) { if (!is_string($version)) { throw new InvalidArgumentException('version = ' . print_r($version, true)); } return $this->execute(ucfirst(__FUNCTION__), array($version), $multicall); }
php
function setApiVersion($version, $multicall = false) { if (!is_string($version)) { throw new InvalidArgumentException('version = ' . print_r($version, true)); } return $this->execute(ucfirst(__FUNCTION__), array($version), $multicall); }
[ "function", "setApiVersion", "(", "$", "version", ",", "$", "multicall", "=", "false", ")", "{", "if", "(", "!", "is_string", "(", "$", "version", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'version = '", ".", "print_r", "(", "$", "...
Define the wanted api. @param string $version @param bool $multicall @return bool @throws InvalidArgumentException
[ "Define", "the", "wanted", "api", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L119-L126
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.setTimeouts
function setTimeouts($read = null, $write = null) { $this->xmlrpcClient->setTimeouts($read, $write); }
php
function setTimeouts($read = null, $write = null) { $this->xmlrpcClient->setTimeouts($read, $write); }
[ "function", "setTimeouts", "(", "$", "read", "=", "null", ",", "$", "write", "=", "null", ")", "{", "$", "this", "->", "xmlrpcClient", "->", "setTimeouts", "(", "$", "read", ",", "$", "write", ")", ";", "}" ]
Change client timeouts @param int $read read timeout (in ms), 0 to leave unchanged @param int $write write timeout (in ms), 0 to leave unchanged
[ "Change", "client", "timeouts" ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L162-L165
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.executeMulticall
function executeMulticall() { $responses = $this->xmlrpcClient->multiquery(); foreach ($responses as $i => &$response) { if (!($response instanceof Xmlrpc\FaultException) && is_callable($this->multicallHandlers[$i])) { $response = call_user_func($this->multicallHandlers[$i], $response); } } $this->multicallHandlers = array(); return $responses; }
php
function executeMulticall() { $responses = $this->xmlrpcClient->multiquery(); foreach ($responses as $i => &$response) { if (!($response instanceof Xmlrpc\FaultException) && is_callable($this->multicallHandlers[$i])) { $response = call_user_func($this->multicallHandlers[$i], $response); } } $this->multicallHandlers = array(); return $responses; }
[ "function", "executeMulticall", "(", ")", "{", "$", "responses", "=", "$", "this", "->", "xmlrpcClient", "->", "multiquery", "(", ")", ";", "foreach", "(", "$", "responses", "as", "$", "i", "=>", "&", "$", "response", ")", "{", "if", "(", "!", "(", ...
Execute the calls in queue and return the result @return mixed[]
[ "Execute", "the", "calls", "in", "queue", "and", "return", "the", "result" ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L188-L198
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.changeAuthPassword
function changeAuthPassword($user, $password, $multicall = false) { if (!is_string($user) || !isset(self::$levels[$user])) { throw new InvalidArgumentException('user = ' . print_r($user, true)); } if (!is_string($password)) { throw new InvalidArgumentException('password = ' . print_r($password, true)); } return $this->execute(ucfirst(__FUNCTION__), array($user, $password), $multicall); }
php
function changeAuthPassword($user, $password, $multicall = false) { if (!is_string($user) || !isset(self::$levels[$user])) { throw new InvalidArgumentException('user = ' . print_r($user, true)); } if (!is_string($password)) { throw new InvalidArgumentException('password = ' . print_r($password, true)); } return $this->execute(ucfirst(__FUNCTION__), array($user, $password), $multicall); }
[ "function", "changeAuthPassword", "(", "$", "user", ",", "$", "password", ",", "$", "multicall", "=", "false", ")", "{", "if", "(", "!", "is_string", "(", "$", "user", ")", "||", "!", "isset", "(", "self", "::", "$", "levels", "[", "$", "user", "]"...
Change the password for the specified login/user. Only available to SuperAdmin. @param string $user @param string $password @param bool $multicall @return bool @throws InvalidArgumentException
[ "Change", "the", "password", "for", "the", "specified", "login", "/", "user", ".", "Only", "available", "to", "SuperAdmin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L209-L219
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.getVersion
function getVersion($multicall = false) { if ($multicall) { return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Version')); } return Structures\Version::fromArray($this->execute(ucfirst(__FUNCTION__))); }
php
function getVersion($multicall = false) { if ($multicall) { return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Version')); } return Structures\Version::fromArray($this->execute(ucfirst(__FUNCTION__))); }
[ "function", "getVersion", "(", "$", "multicall", "=", "false", ")", "{", "if", "(", "$", "multicall", ")", "{", "return", "$", "this", "->", "execute", "(", "ucfirst", "(", "__FUNCTION__", ")", ",", "array", "(", ")", ",", "$", "this", "->", "structH...
Returns a struct with the Name, TitleId, Version, Build and ApiVersion of the application remotely controlled. @param bool $multicall @return Structures\Version
[ "Returns", "a", "struct", "with", "the", "Name", "TitleId", "Version", "Build", "and", "ApiVersion", "of", "the", "application", "remotely", "controlled", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L242-L248
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.getStatus
function getStatus($multicall = false) { if ($multicall) { return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Status')); } return Structures\Status::fromArray($this->execute(ucfirst(__FUNCTION__))); }
php
function getStatus($multicall = false) { if ($multicall) { return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Status')); } return Structures\Status::fromArray($this->execute(ucfirst(__FUNCTION__))); }
[ "function", "getStatus", "(", "$", "multicall", "=", "false", ")", "{", "if", "(", "$", "multicall", ")", "{", "return", "$", "this", "->", "execute", "(", "ucfirst", "(", "__FUNCTION__", ")", ",", "array", "(", ")", ",", "$", "this", "->", "structHa...
Returns the current status of the server. @param bool $multicall @return Structures\Status
[ "Returns", "the", "current", "status", "of", "the", "server", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L265-L271
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.callVoteKick
function callVoteKick($player, $ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false) { $login = $this->getLogin($player); if ($login === false) { throw new InvalidArgumentException('player = ' . print_r($player, true)); } $vote = new Structures\Vote(Structures\VoteRatio::COMMAND_KICK, array($login)); return $this->callVote($vote, $ratio, $timeout, $voters, $multicall); }
php
function callVoteKick($player, $ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false) { $login = $this->getLogin($player); if ($login === false) { throw new InvalidArgumentException('player = ' . print_r($player, true)); } $vote = new Structures\Vote(Structures\VoteRatio::COMMAND_KICK, array($login)); return $this->callVote($vote, $ratio, $timeout, $voters, $multicall); }
[ "function", "callVoteKick", "(", "$", "player", ",", "$", "ratio", "=", "0.5", ",", "$", "timeout", "=", "0", ",", "$", "voters", "=", "1", ",", "$", "multicall", "=", "false", ")", "{", "$", "login", "=", "$", "this", "->", "getLogin", "(", "$",...
Call a vote to kick a player. You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting. Only available to Admin. @param mixed $player A player object or a login @param float $ratio In range [0,1] or -1 for default ratio @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators @param bool $multicall @return bool @throws InvalidArgumentException
[ "Call", "a", "vote", "to", "kick", "a", "player", ".", "You", "can", "additionally", "supply", "specific", "parameters", "for", "this", "vote", ":", "a", "ratio", "a", "time", "out", "and", "who", "is", "voting", ".", "Only", "available", "to", "Admin", ...
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L296-L305
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.getLogin
private function getLogin($player, $allowEmpty = false) { if (is_object($player)) { if (property_exists($player, 'login')) { $player = $player->login; } else { return false; } } if (empty($player)) { return $allowEmpty ? '' : false; } if (is_string($player)) { return $player; } return false; }
php
private function getLogin($player, $allowEmpty = false) { if (is_object($player)) { if (property_exists($player, 'login')) { $player = $player->login; } else { return false; } } if (empty($player)) { return $allowEmpty ? '' : false; } if (is_string($player)) { return $player; } return false; }
[ "private", "function", "getLogin", "(", "$", "player", ",", "$", "allowEmpty", "=", "false", ")", "{", "if", "(", "is_object", "(", "$", "player", ")", ")", "{", "if", "(", "property_exists", "(", "$", "player", ",", "'login'", ")", ")", "{", "$", ...
Returns the login of the given player @param mixed $player @return string|bool
[ "Returns", "the", "login", "of", "the", "given", "player" ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L312-L328
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.callVote
function callVote($vote, $ratio = -1., $timeout = 0, $voters = 1, $multicall = false) { if (!($vote instanceof Structures\Vote && $vote->isValid())) { throw new InvalidArgumentException('vote = ' . print_r($vote, true)); } if (!Structures\VoteRatio::isRatio($ratio)) { throw new InvalidArgumentException('ratio = ' . print_r($ratio, true)); } if (!is_int($timeout)) { throw new InvalidArgumentException('timeout = ' . print_r($timeout, true)); } if (!is_int($voters) || $voters < 0 || $voters > 2) { throw new InvalidArgumentException('voters = ' . print_r($voters, true)); } $xml = Xmlrpc\Request::encode($vote->cmdName, $vote->cmdParam, false); return $this->execute(ucfirst(__FUNCTION__) . 'Ex', array($xml, $ratio, $timeout, $voters), $multicall); }
php
function callVote($vote, $ratio = -1., $timeout = 0, $voters = 1, $multicall = false) { if (!($vote instanceof Structures\Vote && $vote->isValid())) { throw new InvalidArgumentException('vote = ' . print_r($vote, true)); } if (!Structures\VoteRatio::isRatio($ratio)) { throw new InvalidArgumentException('ratio = ' . print_r($ratio, true)); } if (!is_int($timeout)) { throw new InvalidArgumentException('timeout = ' . print_r($timeout, true)); } if (!is_int($voters) || $voters < 0 || $voters > 2) { throw new InvalidArgumentException('voters = ' . print_r($voters, true)); } $xml = Xmlrpc\Request::encode($vote->cmdName, $vote->cmdParam, false); return $this->execute(ucfirst(__FUNCTION__) . 'Ex', array($xml, $ratio, $timeout, $voters), $multicall); }
[ "function", "callVote", "(", "$", "vote", ",", "$", "ratio", "=", "-", "1.", ",", "$", "timeout", "=", "0", ",", "$", "voters", "=", "1", ",", "$", "multicall", "=", "false", ")", "{", "if", "(", "!", "(", "$", "vote", "instanceof", "Structures",...
Call a vote for a command. You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting. Only available to Admin. @param Structures\Vote $vote @param float $ratio In range [0,1] or -1 for default ratio @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators @param bool $multicall @return bool @throws InvalidArgumentException
[ "Call", "a", "vote", "for", "a", "command", ".", "You", "can", "additionally", "supply", "specific", "parameters", "for", "this", "vote", ":", "a", "ratio", "a", "time", "out", "and", "who", "is", "voting", ".", "Only", "available", "to", "Admin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L342-L359
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.callVoteRestartMap
function callVoteRestartMap($ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false) { $vote = new Structures\Vote(Structures\VoteRatio::COMMAND_RESTART_MAP); return $this->callVote($vote, $ratio, $timeout, $voters, $multicall); }
php
function callVoteRestartMap($ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false) { $vote = new Structures\Vote(Structures\VoteRatio::COMMAND_RESTART_MAP); return $this->callVote($vote, $ratio, $timeout, $voters, $multicall); }
[ "function", "callVoteRestartMap", "(", "$", "ratio", "=", "0.5", ",", "$", "timeout", "=", "0", ",", "$", "voters", "=", "1", ",", "$", "multicall", "=", "false", ")", "{", "$", "vote", "=", "new", "Structures", "\\", "Vote", "(", "Structures", "\\",...
Call a vote to restart the current map. You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting. Only available to Admin. @param float $ratio In range [0,1] or -1 for default ratio @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators @param bool $multicall @return bool @throws InvalidArgumentException
[ "Call", "a", "vote", "to", "restart", "the", "current", "map", ".", "You", "can", "additionally", "supply", "specific", "parameters", "for", "this", "vote", ":", "a", "ratio", "a", "time", "out", "and", "who", "is", "voting", ".", "Only", "available", "t...
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L395-L399
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.callVoteNextMap
function callVoteNextMap($ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false) { $vote = new Structures\Vote(Structures\VoteRatio::COMMAND_NEXT_MAP); return $this->callVote($vote, $ratio, $timeout, $voters, $multicall); }
php
function callVoteNextMap($ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false) { $vote = new Structures\Vote(Structures\VoteRatio::COMMAND_NEXT_MAP); return $this->callVote($vote, $ratio, $timeout, $voters, $multicall); }
[ "function", "callVoteNextMap", "(", "$", "ratio", "=", "0.5", ",", "$", "timeout", "=", "0", ",", "$", "voters", "=", "1", ",", "$", "multicall", "=", "false", ")", "{", "$", "vote", "=", "new", "Structures", "\\", "Vote", "(", "Structures", "\\", ...
Call a vote to go to the next map. You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting. Only available to Admin. @param float $ratio In range [0,1] or -1 for default ratio @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators @param bool $multicall @return bool @throws InvalidArgumentException
[ "Call", "a", "vote", "to", "go", "to", "the", "next", "map", ".", "You", "can", "additionally", "supply", "specific", "parameters", "for", "this", "vote", ":", "a", "ratio", "a", "time", "out", "and", "who", "is", "voting", ".", "Only", "available", "t...
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L412-L416
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.getCurrentCallVote
function getCurrentCallVote($multicall = false) { if ($multicall) { return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Vote')); } return Structures\Vote::fromArray($this->execute(ucfirst(__FUNCTION__))); }
php
function getCurrentCallVote($multicall = false) { if ($multicall) { return $this->execute(ucfirst(__FUNCTION__), array(), $this->structHandler('Vote')); } return Structures\Vote::fromArray($this->execute(ucfirst(__FUNCTION__))); }
[ "function", "getCurrentCallVote", "(", "$", "multicall", "=", "false", ")", "{", "if", "(", "$", "multicall", ")", "{", "return", "$", "this", "->", "execute", "(", "ucfirst", "(", "__FUNCTION__", ")", ",", "array", "(", ")", ",", "$", "this", "->", ...
Returns the vote currently in progress. @param $multicall @return Structures\Vote
[ "Returns", "the", "vote", "currently", "in", "progress", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L434-L440
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.setCallVoteTimeOut
function setCallVoteTimeOut($timeout, $multicall = false) { if (!is_int($timeout)) { throw new InvalidArgumentException('timeout = ' . print_r($timeout, true)); } return $this->execute(ucfirst(__FUNCTION__), array($timeout), $multicall); }
php
function setCallVoteTimeOut($timeout, $multicall = false) { if (!is_int($timeout)) { throw new InvalidArgumentException('timeout = ' . print_r($timeout, true)); } return $this->execute(ucfirst(__FUNCTION__), array($timeout), $multicall); }
[ "function", "setCallVoteTimeOut", "(", "$", "timeout", ",", "$", "multicall", "=", "false", ")", "{", "if", "(", "!", "is_int", "(", "$", "timeout", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'timeout = '", ".", "print_r", "(", "$", ...
Set a new timeout for waiting for votes. Only available to Admin. @param int $timeout In milliseconds, 0 to disable votes @param bool $multicall @return bool @throws InvalidArgumentException
[ "Set", "a", "new", "timeout", "for", "waiting", "for", "votes", ".", "Only", "available", "to", "Admin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L450-L457
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.setCallVoteRatio
function setCallVoteRatio($ratio, $multicall = false) { if (!Structures\VoteRatio::isRatio($ratio)) { throw new InvalidArgumentException('ratio = ' . print_r($ratio, true)); } return $this->execute(ucfirst(__FUNCTION__), array($ratio), $multicall); }
php
function setCallVoteRatio($ratio, $multicall = false) { if (!Structures\VoteRatio::isRatio($ratio)) { throw new InvalidArgumentException('ratio = ' . print_r($ratio, true)); } return $this->execute(ucfirst(__FUNCTION__), array($ratio), $multicall); }
[ "function", "setCallVoteRatio", "(", "$", "ratio", ",", "$", "multicall", "=", "false", ")", "{", "if", "(", "!", "Structures", "\\", "VoteRatio", "::", "isRatio", "(", "$", "ratio", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'ratio =...
Set a new default ratio for passing a vote. Only available to Admin. @param float $ratio In range [0,1] or -1 to disable votes @param bool $multicall @return bool @throws InvalidArgumentException
[ "Set", "a", "new", "default", "ratio", "for", "passing", "a", "vote", ".", "Only", "available", "to", "Admin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L477-L484
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.setCallVoteRatios
function setCallVoteRatios($ratios, $replaceAll = true, $multicall = false) { if (!is_array($ratios)) { throw new InvalidArgumentException('ratios = ' . print_r($ratios, true)); } foreach ($ratios as $i => &$ratio) { if (!($ratio instanceof Structures\VoteRatio && $ratio->isValid())) { throw new InvalidArgumentException('ratios[' . $i . '] = ' . print_r($ratios, true)); } $ratio = $ratio->toArray(); } if (!is_bool($replaceAll)) { throw new InvalidArgumentException('replaceAll = ' . print_r($replaceAll, true)); } return $this->execute(ucfirst(__FUNCTION__) . 'Ex', array($replaceAll, $ratios), $multicall); }
php
function setCallVoteRatios($ratios, $replaceAll = true, $multicall = false) { if (!is_array($ratios)) { throw new InvalidArgumentException('ratios = ' . print_r($ratios, true)); } foreach ($ratios as $i => &$ratio) { if (!($ratio instanceof Structures\VoteRatio && $ratio->isValid())) { throw new InvalidArgumentException('ratios[' . $i . '] = ' . print_r($ratios, true)); } $ratio = $ratio->toArray(); } if (!is_bool($replaceAll)) { throw new InvalidArgumentException('replaceAll = ' . print_r($replaceAll, true)); } return $this->execute(ucfirst(__FUNCTION__) . 'Ex', array($replaceAll, $ratios), $multicall); }
[ "function", "setCallVoteRatios", "(", "$", "ratios", ",", "$", "replaceAll", "=", "true", ",", "$", "multicall", "=", "false", ")", "{", "if", "(", "!", "is_array", "(", "$", "ratios", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'rat...
Set the ratios list for passing specific votes, extended version with parameters matching. Only available to Admin. @param Structures\VoteRatio[] $ratios @param bool $replaceAll True to override the whole ratios list or false to modify only specified ratios @param bool $multicall @return bool @throws InvalidArgumentException
[ "Set", "the", "ratios", "list", "for", "passing", "specific", "votes", "extended", "version", "with", "parameters", "matching", ".", "Only", "available", "to", "Admin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L514-L530
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.getCallVoteRatios
function getCallVoteRatios($multicall = false) { if ($multicall) { return $this->execute(ucfirst(__FUNCTION__) . 'Ex', array(), $this->structHandler('VoteRatio', true)); } return Structures\VoteRatio::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__) . 'Ex')); }
php
function getCallVoteRatios($multicall = false) { if ($multicall) { return $this->execute(ucfirst(__FUNCTION__) . 'Ex', array(), $this->structHandler('VoteRatio', true)); } return Structures\VoteRatio::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__) . 'Ex')); }
[ "function", "getCallVoteRatios", "(", "$", "multicall", "=", "false", ")", "{", "if", "(", "$", "multicall", ")", "{", "return", "$", "this", "->", "execute", "(", "ucfirst", "(", "__FUNCTION__", ")", ".", "'Ex'", ",", "array", "(", ")", ",", "$", "t...
Get the current ratios for passing votes, extended version with parameters matching. @param bool $multicall @return Structures\VoteRatio[]
[ "Get", "the", "current", "ratios", "for", "passing", "votes", "extended", "version", "with", "parameters", "matching", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L546-L552
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.chatSendServerMessage
function chatSendServerMessage($message, $recipient = null, $multicall = false) { $logins = $this->getLogins($recipient, true); if ($logins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } if (is_array($message)) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLanguage', array($message, $logins), $multicall); } if (is_string($message)) { if ($logins) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($message, $logins), $multicall); } return $this->execute(ucfirst(__FUNCTION__), array($message), $multicall); } // else throw new InvalidArgumentException('message = ' . print_r($message, true)); }
php
function chatSendServerMessage($message, $recipient = null, $multicall = false) { $logins = $this->getLogins($recipient, true); if ($logins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } if (is_array($message)) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLanguage', array($message, $logins), $multicall); } if (is_string($message)) { if ($logins) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($message, $logins), $multicall); } return $this->execute(ucfirst(__FUNCTION__), array($message), $multicall); } // else throw new InvalidArgumentException('message = ' . print_r($message, true)); }
[ "function", "chatSendServerMessage", "(", "$", "message", ",", "$", "recipient", "=", "null", ",", "$", "multicall", "=", "false", ")", "{", "$", "logins", "=", "$", "this", "->", "getLogins", "(", "$", "recipient", ",", "true", ")", ";", "if", "(", ...
Send a text message, possibly localised to a specific login or to everyone, without the server login. Only available to Admin. @param string|string[][] $message Single string or array of structures {Lang='xx', Text='...'}: if no matching language is found, the last text in the array is used @param mixed $recipient Login, player object or array; null for all @param bool $multicall @return bool @throws InvalidArgumentException
[ "Send", "a", "text", "message", "possibly", "localised", "to", "a", "specific", "login", "or", "to", "everyone", "without", "the", "server", "login", ".", "Only", "available", "to", "Admin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L573-L591
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.getLogins
private function getLogins($players, $allowEmpty = false) { if (is_array($players)) { $logins = array(); foreach ($players as $player) { $login = $this->getLogin($player); if ($login === false) { return false; } $logins[] = $login; } return implode(',', $logins); } return $this->getLogin($players, $allowEmpty); }
php
private function getLogins($players, $allowEmpty = false) { if (is_array($players)) { $logins = array(); foreach ($players as $player) { $login = $this->getLogin($player); if ($login === false) { return false; } $logins[] = $login; } return implode(',', $logins); } return $this->getLogin($players, $allowEmpty); }
[ "private", "function", "getLogins", "(", "$", "players", ",", "$", "allowEmpty", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "players", ")", ")", "{", "$", "logins", "=", "array", "(", ")", ";", "foreach", "(", "$", "players", "as", "$...
Returns logins of given players @param mixed $players @return string|bool
[ "Returns", "logins", "of", "given", "players" ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L598-L613
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.chatEnableManualRouting
function chatEnableManualRouting($enable = true, $excludeServer = false, $multicall = false) { if (!is_bool($enable)) { throw new InvalidArgumentException('enable = ' . print_r($enable, true)); } if (!is_bool($excludeServer)) { throw new InvalidArgumentException('excludeServer = ' . print_r($excludeServer, true)); } return $this->execute(ucfirst(__FUNCTION__), array($enable, $excludeServer), $multicall); }
php
function chatEnableManualRouting($enable = true, $excludeServer = false, $multicall = false) { if (!is_bool($enable)) { throw new InvalidArgumentException('enable = ' . print_r($enable, true)); } if (!is_bool($excludeServer)) { throw new InvalidArgumentException('excludeServer = ' . print_r($excludeServer, true)); } return $this->execute(ucfirst(__FUNCTION__), array($enable, $excludeServer), $multicall); }
[ "function", "chatEnableManualRouting", "(", "$", "enable", "=", "true", ",", "$", "excludeServer", "=", "false", ",", "$", "multicall", "=", "false", ")", "{", "if", "(", "!", "is_bool", "(", "$", "enable", ")", ")", "{", "throw", "new", "InvalidArgument...
The chat messages are no longer dispatched to the players, they only go to the rpc callback and the controller has to manually forward them. Only available to Admin. @param bool $enable @param bool $excludeServer Allows all messages from the server to be automatically forwarded. @param bool $multicall @return bool @throws InvalidArgumentException
[ "The", "chat", "messages", "are", "no", "longer", "dispatched", "to", "the", "players", "they", "only", "go", "to", "the", "rpc", "callback", "and", "the", "controller", "has", "to", "manually", "forward", "them", ".", "Only", "available", "to", "Admin", "...
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L674-L684
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.chatForward
function chatForward($message, $sender, $recipient = null, $multicall = false) { if (!is_string($message)) { throw new InvalidArgumentException('message = ' . print_r($message, true)); } $senderLogin = $this->getLogin($sender); if ($senderLogin === false) { throw new InvalidArgumentException('sender = ' . print_r($sender, true)); } $recipientLogins = $this->getLogins($recipient, true); if ($recipientLogins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($message, $senderLogin, $recipientLogins), $multicall); }
php
function chatForward($message, $sender, $recipient = null, $multicall = false) { if (!is_string($message)) { throw new InvalidArgumentException('message = ' . print_r($message, true)); } $senderLogin = $this->getLogin($sender); if ($senderLogin === false) { throw new InvalidArgumentException('sender = ' . print_r($sender, true)); } $recipientLogins = $this->getLogins($recipient, true); if ($recipientLogins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($message, $senderLogin, $recipientLogins), $multicall); }
[ "function", "chatForward", "(", "$", "message", ",", "$", "sender", ",", "$", "recipient", "=", "null", ",", "$", "multicall", "=", "false", ")", "{", "if", "(", "!", "is_string", "(", "$", "message", ")", ")", "{", "throw", "new", "InvalidArgumentExce...
Send a message to the specified recipient (or everybody if empty) on behalf of sender. Only available if manual routing is enabled. Only available to Admin. @param string $message @param mixed $sender Login or player object @param mixed $recipient Login, player object or array; empty for all @param bool $multicall @return bool @throws InvalidArgumentException
[ "Send", "a", "message", "to", "the", "specified", "recipient", "(", "or", "everybody", "if", "empty", ")", "on", "behalf", "of", "sender", ".", "Only", "available", "if", "manual", "routing", "is", "enabled", ".", "Only", "available", "to", "Admin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L706-L722
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.sendNotice
function sendNotice($recipient, $message, $avatar = null, $variant = 0, $multicall = false) { $logins = $this->getLogins($recipient, true); if ($logins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } if (!is_string($message)) { throw new InvalidArgumentException('message = ' . print_r($message, true)); } $avatarLogin = $this->getLogin($avatar, true); if ($avatarLogin === false) { throw new InvalidArgumentException('avatar = ' . print_r($avatar, true)); } if (!is_int($variant) || $variant < 0 || $variant > 2) { throw new InvalidArgumentException('variant = ' . print_r($variant, true)); } if ($logins) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($logins, $message, $avatarLogin, $variant), $multicall); } return $this->execute(ucfirst(__FUNCTION__), array($message, $avatar, $variant), $multicall); }
php
function sendNotice($recipient, $message, $avatar = null, $variant = 0, $multicall = false) { $logins = $this->getLogins($recipient, true); if ($logins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } if (!is_string($message)) { throw new InvalidArgumentException('message = ' . print_r($message, true)); } $avatarLogin = $this->getLogin($avatar, true); if ($avatarLogin === false) { throw new InvalidArgumentException('avatar = ' . print_r($avatar, true)); } if (!is_int($variant) || $variant < 0 || $variant > 2) { throw new InvalidArgumentException('variant = ' . print_r($variant, true)); } if ($logins) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($logins, $message, $avatarLogin, $variant), $multicall); } return $this->execute(ucfirst(__FUNCTION__), array($message, $avatar, $variant), $multicall); }
[ "function", "sendNotice", "(", "$", "recipient", ",", "$", "message", ",", "$", "avatar", "=", "null", ",", "$", "variant", "=", "0", ",", "$", "multicall", "=", "false", ")", "{", "$", "logins", "=", "$", "this", "->", "getLogins", "(", "$", "reci...
Display a notice on all clients. Only available to Admin. @param mixed $recipient Login, player object or array; empty for all @param string $message @param mixed $avatar Login or player object whose avatar will be displayed; empty for none @param int $variant 0: normal, 1: sad, 2: happy @param bool $multicall @return bool @throws InvalidArgumentException
[ "Display", "a", "notice", "on", "all", "clients", ".", "Only", "available", "to", "Admin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L735-L756
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.sendDisplayManialinkPage
function sendDisplayManialinkPage($recipient, $manialinks, $timeout = 0, $hideOnClick = false, $multicall = false) { $logins = $this->getLogins($recipient, true); if ($logins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } if (!is_string($manialinks)) { throw new InvalidArgumentException('manialinks = ' . print_r($manialinks, true)); } if (!is_int($timeout)) { throw new InvalidArgumentException('timeout = ' . print_r($timeout, true)); } if (!is_bool($hideOnClick)) { throw new InvalidArgumentException('hideOnClick = ' . print_r($hideOnClick, true)); } if ($logins) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($logins, $manialinks, $timeout, $hideOnClick), $multicall); } return $this->execute(ucfirst(__FUNCTION__), array($manialinks, $timeout, $hideOnClick), $multicall); }
php
function sendDisplayManialinkPage($recipient, $manialinks, $timeout = 0, $hideOnClick = false, $multicall = false) { $logins = $this->getLogins($recipient, true); if ($logins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } if (!is_string($manialinks)) { throw new InvalidArgumentException('manialinks = ' . print_r($manialinks, true)); } if (!is_int($timeout)) { throw new InvalidArgumentException('timeout = ' . print_r($timeout, true)); } if (!is_bool($hideOnClick)) { throw new InvalidArgumentException('hideOnClick = ' . print_r($hideOnClick, true)); } if ($logins) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($logins, $manialinks, $timeout, $hideOnClick), $multicall); } return $this->execute(ucfirst(__FUNCTION__), array($manialinks, $timeout, $hideOnClick), $multicall); }
[ "function", "sendDisplayManialinkPage", "(", "$", "recipient", ",", "$", "manialinks", ",", "$", "timeout", "=", "0", ",", "$", "hideOnClick", "=", "false", ",", "$", "multicall", "=", "false", ")", "{", "$", "logins", "=", "$", "this", "->", "getLogins"...
Display a manialink page on all clients. Only available to Admin. @param mixed $recipient Login, player object or array; empty for all @param string $manialinks XML string @param int $timeout Seconds before autohide, 0 for permanent @param bool $hideOnClick Hide as soon as the user clicks on a page option @param bool $multicall @return bool @throws InvalidArgumentException
[ "Display", "a", "manialink", "page", "on", "all", "clients", ".", "Only", "available", "to", "Admin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L769-L789
maniaplanet/dedicated-server-api
libraries/Maniaplanet/DedicatedServer/Connection.php
Connection.sendHideManialinkPage
function sendHideManialinkPage($recipient = null, $multicall = false) { $logins = $this->getLogins($recipient, true); if ($logins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } if ($logins) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($logins), $multicall); } return $this->execute(ucfirst(__FUNCTION__), array(), $multicall); }
php
function sendHideManialinkPage($recipient = null, $multicall = false) { $logins = $this->getLogins($recipient, true); if ($logins === false) { throw new InvalidArgumentException('recipient = ' . print_r($recipient, true)); } if ($logins) { return $this->execute(ucfirst(__FUNCTION__) . 'ToLogin', array($logins), $multicall); } return $this->execute(ucfirst(__FUNCTION__), array(), $multicall); }
[ "function", "sendHideManialinkPage", "(", "$", "recipient", "=", "null", ",", "$", "multicall", "=", "false", ")", "{", "$", "logins", "=", "$", "this", "->", "getLogins", "(", "$", "recipient", ",", "true", ")", ";", "if", "(", "$", "logins", "===", ...
Hide the displayed manialink page. Only available to Admin. @param mixed $recipient Login, player object or array; empty for all @param bool $multicall @return bool
[ "Hide", "the", "displayed", "manialink", "page", ".", "Only", "available", "to", "Admin", "." ]
train
https://github.com/maniaplanet/dedicated-server-api/blob/c42664b21739fd6335cf2ecfe1907a0eca07c1da/libraries/Maniaplanet/DedicatedServer/Connection.php#L798-L809