id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
189,100
php-mvc-project/php-mvc
src/AppBuilder.php
AppBuilder.exceptionFilters
private static function exceptionFilters($actionContext, $exception) { $context = new ExceptionContext($actionContext, $exception); $filters = $actionContext->getFilters(); foreach ($filters as $filter) { $filter->exception($context); } return $context; ...
php
private static function exceptionFilters($actionContext, $exception) { $context = new ExceptionContext($actionContext, $exception); $filters = $actionContext->getFilters(); foreach ($filters as $filter) { $filter->exception($context); } return $context; ...
[ "private", "static", "function", "exceptionFilters", "(", "$", "actionContext", ",", "$", "exception", ")", "{", "$", "context", "=", "new", "ExceptionContext", "(", "$", "actionContext", ",", "$", "exception", ")", ";", "$", "filters", "=", "$", "actionCont...
Calls the exception methods. @param ActionContext $actionContext The context of the action. @param \Exception $exception The exception. @return ExceptionContext
[ "Calls", "the", "exception", "methods", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppBuilder.php#L1358-L1368
189,101
php-mvc-project/php-mvc
src/Model.php
Model.set
public static function set($actionName, $modelType) { if (empty($actionName)) { throw new \Exception('$actionName must not be empty.'); } if (empty($modelType)) { throw new \Exception('$modelType must not be empty.'); } $canUse = false; if ($act...
php
public static function set($actionName, $modelType) { if (empty($actionName)) { throw new \Exception('$actionName must not be empty.'); } if (empty($modelType)) { throw new \Exception('$modelType must not be empty.'); } $canUse = false; if ($act...
[ "public", "static", "function", "set", "(", "$", "actionName", ",", "$", "modelType", ")", "{", "if", "(", "empty", "(", "$", "actionName", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'$actionName must not be empty.'", ")", ";", "}", "if", "(...
Specifies the model type for the action. @param string|string[] $actionName The action name. @param string|object $modelType The type name of model. @return void
[ "Specifies", "the", "model", "type", "for", "the", "action", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Model.php#L62-L98
189,102
php-mvc-project/php-mvc
src/Model.php
Model.required
public static function required($modelType, $propertyName, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } self::makeDataAnnotation($propertyN...
php
public static function required($modelType, $propertyName, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } self::makeDataAnnotation($propertyN...
[ "public", "static", "function", "required", "(", "$", "modelType", ",", "$", "propertyName", ",", "$", "errorMessage", "=", "null", ")", "{", "if", "(", "!", "self", "::", "canAnnotate", "(", "$", "modelType", ")", ")", "{", "return", ";", "}", "if", ...
Marks the specified property with the attribute "requred" and it is expected that the property value must be specified. @param string|object $modelType The name type of model. @param string $propertyName The property name. @param string $errorMessage The error message. @return void
[ "Marks", "the", "specified", "property", "with", "the", "attribute", "requred", "and", "it", "is", "expected", "that", "the", "property", "value", "must", "be", "specified", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Model.php#L110-L122
189,103
php-mvc-project/php-mvc
src/Model.php
Model.compare
public static function compare($modelType, $propertyName, $compareWith, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } if (empty($compareWith...
php
public static function compare($modelType, $propertyName, $compareWith, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } if (empty($compareWith...
[ "public", "static", "function", "compare", "(", "$", "modelType", ",", "$", "propertyName", ",", "$", "compareWith", ",", "$", "errorMessage", "=", "null", ")", "{", "if", "(", "!", "self", "::", "canAnnotate", "(", "$", "modelType", ")", ")", "{", "re...
Sets a property whose value needs to be compared to the value of the specified property. @param string|object $modelType The name type of model. @param string $propertyName The property name. @param string $compareWith The name of the property with which to compare. @param string $errorMessage The error message. @ret...
[ "Sets", "a", "property", "whose", "value", "needs", "to", "be", "compared", "to", "the", "value", "of", "the", "specified", "property", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Model.php#L134-L154
189,104
php-mvc-project/php-mvc
src/Model.php
Model.stringLength
public static function stringLength($modelType, $propertyName, $maxLength, $minLength = null, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } ...
php
public static function stringLength($modelType, $propertyName, $maxLength, $minLength = null, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } ...
[ "public", "static", "function", "stringLength", "(", "$", "modelType", ",", "$", "propertyName", ",", "$", "maxLength", ",", "$", "minLength", "=", "null", ",", "$", "errorMessage", "=", "null", ")", "{", "if", "(", "!", "self", "::", "canAnnotate", "(",...
Specifies the minimum and maximum length of characters that are allowed in a data field. @param string|object $modelType The name type of model. @param string $propertyName The property name to check. @param int $maxLength The maximum length of a string. @param int $minLength The minimum length of a string. @param str...
[ "Specifies", "the", "minimum", "and", "maximum", "length", "of", "characters", "that", "are", "allowed", "in", "a", "data", "field", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Model.php#L167-L179
189,105
php-mvc-project/php-mvc
src/Model.php
Model.range
public static function range($modelType, $propertyName, $min, $max, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } if ((int)$min > (int)$max)...
php
public static function range($modelType, $propertyName, $min, $max, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } if ((int)$min > (int)$max)...
[ "public", "static", "function", "range", "(", "$", "modelType", ",", "$", "propertyName", ",", "$", "min", ",", "$", "max", ",", "$", "errorMessage", "=", "null", ")", "{", "if", "(", "!", "self", "::", "canAnnotate", "(", "$", "modelType", ")", ")",...
Specifies the numeric range constraints for the value of a data field. @param string|object $modelType The name type of model. @param string $propertyName The property name to check. @param int $max The maximum allowed field value. @param int $min The minimum allowed field value. @param string The error message. @ret...
[ "Specifies", "the", "numeric", "range", "constraints", "for", "the", "value", "of", "a", "data", "field", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Model.php#L192-L208
189,106
php-mvc-project/php-mvc
src/Model.php
Model.validation
public static function validation($modelType, $propertyName, $callback, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } if (!is_callable($call...
php
public static function validation($modelType, $propertyName, $callback, $errorMessage = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } if (!is_callable($call...
[ "public", "static", "function", "validation", "(", "$", "modelType", ",", "$", "propertyName", ",", "$", "callback", ",", "$", "errorMessage", "=", "null", ")", "{", "if", "(", "!", "self", "::", "canAnnotate", "(", "$", "modelType", ")", ")", "{", "re...
Specifies a custom validation method that is used to validate the property. @param string|object $modelType The name type of model. @param string $propertyName The property name to check. @param callback $callback Function to valid the value. The function takes a value of the property and must return true, if successf...
[ "Specifies", "a", "custom", "validation", "method", "that", "is", "used", "to", "validate", "the", "property", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Model.php#L222-L238
189,107
php-mvc-project/php-mvc
src/Model.php
Model.display
public static function display($modelType, $propertyName, $name, $text = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } self::makeDataAnnotation($propertyNam...
php
public static function display($modelType, $propertyName, $name, $text = null) { if (!self::canAnnotate($modelType)) { return; } if (empty($propertyName)) { throw new \Exception('$propertyName must not be empty.'); } self::makeDataAnnotation($propertyNam...
[ "public", "static", "function", "display", "(", "$", "modelType", ",", "$", "propertyName", ",", "$", "name", ",", "$", "text", "=", "null", ")", "{", "if", "(", "!", "self", "::", "canAnnotate", "(", "$", "modelType", ")", ")", "{", "return", ";", ...
Sets a values that is used for display in the UI. @param string|object $modelType The name type of model. @param string $propertyName The property name to set. @param string $name The value that is used for display in the UI. @param string $text The value that is used to display a description in the UI. @return void
[ "Sets", "a", "values", "that", "is", "used", "for", "display", "in", "the", "UI", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Model.php#L250-L263
189,108
mmamedov/page-cache
src/Strategy/DefaultStrategy.php
DefaultStrategy.strategy
public function strategy() { //when session support is enabled add that to file name $session_str = SessionHandler::process(); $uri = empty($_SERVER['REQUEST_URI']) ? 'uri' : $_SERVER['REQUEST_URI']; $query = empty($_SERVER['QUERY_STRING']) ? 'query' : $_SERVER['QUERY_STRING']; ...
php
public function strategy() { //when session support is enabled add that to file name $session_str = SessionHandler::process(); $uri = empty($_SERVER['REQUEST_URI']) ? 'uri' : $_SERVER['REQUEST_URI']; $query = empty($_SERVER['QUERY_STRING']) ? 'query' : $_SERVER['QUERY_STRING']; ...
[ "public", "function", "strategy", "(", ")", "{", "//when session support is enabled add that to file name", "$", "session_str", "=", "SessionHandler", "::", "process", "(", ")", ";", "$", "uri", "=", "empty", "(", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ")", ...
Generate cache filename @return string md5
[ "Generate", "cache", "filename" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Strategy/DefaultStrategy.php#L29-L38
189,109
php-mvc-project/php-mvc
src/InternalHelper.php
InternalHelper.setPropertyValue
public static function setPropertyValue($class, $name, $value) { $property = new \ReflectionProperty($class, $name); $property->setAccessible(true); $property->setValue($class, $value); return $property; }
php
public static function setPropertyValue($class, $name, $value) { $property = new \ReflectionProperty($class, $name); $property->setAccessible(true); $property->setValue($class, $value); return $property; }
[ "public", "static", "function", "setPropertyValue", "(", "$", "class", ",", "$", "name", ",", "$", "value", ")", "{", "$", "property", "=", "new", "\\", "ReflectionProperty", "(", "$", "class", ",", "$", "name", ")", ";", "$", "property", "->", "setAcc...
Sets the value to the specified property of class instance. If the property is unavailable, makes it available. @param mixed $class The class instance, that contains the property. @param string $name The name of the property. @param mixed $value The value to set. @return ReflectionProperty
[ "Sets", "the", "value", "to", "the", "specified", "property", "of", "class", "instance", ".", "If", "the", "property", "is", "unavailable", "makes", "it", "available", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/InternalHelper.php#L58-L64
189,110
php-mvc-project/php-mvc
src/InternalHelper.php
InternalHelper.getPropertyValueOfParentClass
public static function getPropertyValueOfParentClass($instance, $name) { $class = new \ReflectionClass($instance); $parent = $class->getParentClass(); $property = $parent->getProperty($name); $property->setAccessible(true); return $property->getValue($instance); }
php
public static function getPropertyValueOfParentClass($instance, $name) { $class = new \ReflectionClass($instance); $parent = $class->getParentClass(); $property = $parent->getProperty($name); $property->setAccessible(true); return $property->getValue($instance); }
[ "public", "static", "function", "getPropertyValueOfParentClass", "(", "$", "instance", ",", "$", "name", ")", "{", "$", "class", "=", "new", "\\", "ReflectionClass", "(", "$", "instance", ")", ";", "$", "parent", "=", "$", "class", "->", "getParentClass", ...
Gets the property value of the base class. If the property is unavailable, makes it available. @param mixed $instance The class instance, that contains the property. @param string $name The name of the property. @return mixed
[ "Gets", "the", "property", "value", "of", "the", "base", "class", ".", "If", "the", "property", "is", "unavailable", "makes", "it", "available", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/InternalHelper.php#L75-L82
189,111
php-mvc-project/php-mvc
src/InternalHelper.php
InternalHelper.getStaticPropertyValue
public static function getStaticPropertyValue($class, $name) { $property = new \ReflectionProperty($class, $name); $property->setAccessible(true); return $property->getValue(null); }
php
public static function getStaticPropertyValue($class, $name) { $property = new \ReflectionProperty($class, $name); $property->setAccessible(true); return $property->getValue(null); }
[ "public", "static", "function", "getStaticPropertyValue", "(", "$", "class", ",", "$", "name", ")", "{", "$", "property", "=", "new", "\\", "ReflectionProperty", "(", "$", "class", ",", "$", "name", ")", ";", "$", "property", "->", "setAccessible", "(", ...
Gets the property value of the static class. If the property is unavailable, makes it available. @param mixed $class The class name, that contains the property. @param string $name The name of the property. @return mixed
[ "Gets", "the", "property", "value", "of", "the", "static", "class", ".", "If", "the", "property", "is", "unavailable", "makes", "it", "available", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/InternalHelper.php#L93-L97
189,112
php-mvc-project/php-mvc
src/InternalHelper.php
InternalHelper.setStaticPropertyValue
public static function setStaticPropertyValue($class, $name, $value) { $property = new \ReflectionProperty($class, $name); $property->setAccessible(true); $property->setValue(null, $value); return $property; }
php
public static function setStaticPropertyValue($class, $name, $value) { $property = new \ReflectionProperty($class, $name); $property->setAccessible(true); $property->setValue(null, $value); return $property; }
[ "public", "static", "function", "setStaticPropertyValue", "(", "$", "class", ",", "$", "name", ",", "$", "value", ")", "{", "$", "property", "=", "new", "\\", "ReflectionProperty", "(", "$", "class", ",", "$", "name", ")", ";", "$", "property", "->", "...
Sets the value to the specified property of static class. If the property is unavailable, makes it available. @param mixed $class The class name, that contains the property. @param string $name The name of the property. @param mixed $value The value to set. @return ReflectionProperty
[ "Sets", "the", "value", "to", "the", "specified", "property", "of", "static", "class", ".", "If", "the", "property", "is", "unavailable", "makes", "it", "available", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/InternalHelper.php#L109-L115
189,113
php-mvc-project/php-mvc
src/InternalHelper.php
InternalHelper.invokeMethod
public static function invokeMethod($class, $name) { $property = new \ReflectionMethod($class, $name); $property->setAccessible(true); return $property->invoke($class); }
php
public static function invokeMethod($class, $name) { $property = new \ReflectionMethod($class, $name); $property->setAccessible(true); return $property->invoke($class); }
[ "public", "static", "function", "invokeMethod", "(", "$", "class", ",", "$", "name", ")", "{", "$", "property", "=", "new", "\\", "ReflectionMethod", "(", "$", "class", ",", "$", "name", ")", ";", "$", "property", "->", "setAccessible", "(", "true", ")...
Calls the specified method. If the method is protected, this restriction is ignored. @param mixed $class The class name, that contains the method. @param string $name The name of the method. @return mixed
[ "Calls", "the", "specified", "method", ".", "If", "the", "method", "is", "protected", "this", "restriction", "is", "ignored", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/InternalHelper.php#L125-L130
189,114
php-mvc-project/php-mvc
src/InternalHelper.php
InternalHelper.getViewContent
public static function getViewContent($path) { if ($path === false) { throw new \Exception('The view file is not specified. Probably the correct path to the file was not found. Make sure that all paths are specified correctly, the files exists and is available.'); } ob_start(); ...
php
public static function getViewContent($path) { if ($path === false) { throw new \Exception('The view file is not specified. Probably the correct path to the file was not found. Make sure that all paths are specified correctly, the files exists and is available.'); } ob_start(); ...
[ "public", "static", "function", "getViewContent", "(", "$", "path", ")", "{", "if", "(", "$", "path", "===", "false", ")", "{", "throw", "new", "\\", "Exception", "(", "'The view file is not specified. Probably the correct path to the file was not found. Make sure that al...
Gets the content of the view. @param string $path File name or path to the view file. @return string
[ "Gets", "the", "content", "of", "the", "view", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/InternalHelper.php#L139-L153
189,115
php-mvc-project/php-mvc
src/InternalHelper.php
InternalHelper.getSingleKeyOrAll
public static function getSingleKeyOrAll($array, $key, $default = null, $nullIfEmpty = false) { if ($key !== null) { if ($nullIfEmpty === true) { return (isset($array[$key])) && !empty($array[$key]) ? $array[$key] : $default; } else { return (i...
php
public static function getSingleKeyOrAll($array, $key, $default = null, $nullIfEmpty = false) { if ($key !== null) { if ($nullIfEmpty === true) { return (isset($array[$key])) && !empty($array[$key]) ? $array[$key] : $default; } else { return (i...
[ "public", "static", "function", "getSingleKeyOrAll", "(", "$", "array", ",", "$", "key", ",", "$", "default", "=", "null", ",", "$", "nullIfEmpty", "=", "false", ")", "{", "if", "(", "$", "key", "!==", "null", ")", "{", "if", "(", "$", "nullIfEmpty",...
Gets single key from array or all keys, if key is null. @param array $array The array to work. @param string|null $key The key to get, or null to get the $array. @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null. @param b...
[ "Gets", "single", "key", "from", "array", "or", "all", "keys", "if", "key", "is", "null", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/InternalHelper.php#L379-L391
189,116
php-mvc-project/php-mvc
src/InternalHelper.php
InternalHelper.setViewContext
private static function setViewContext($parentActionViewContext, $viewContext) { InternalHelper::setStaticPropertyValue('\\PhpMvc\\View', 'viewContext', $viewContext); InternalHelper::setStaticPropertyValue('\\PhpMvc\\Html', 'viewContext', $viewContext); InternalHelper::setStaticPropertyValue('\...
php
private static function setViewContext($parentActionViewContext, $viewContext) { InternalHelper::setStaticPropertyValue('\\PhpMvc\\View', 'viewContext', $viewContext); InternalHelper::setStaticPropertyValue('\\PhpMvc\\Html', 'viewContext', $viewContext); InternalHelper::setStaticPropertyValue('\...
[ "private", "static", "function", "setViewContext", "(", "$", "parentActionViewContext", ",", "$", "viewContext", ")", "{", "InternalHelper", "::", "setStaticPropertyValue", "(", "'\\\\PhpMvc\\\\View'", ",", "'viewContext'", ",", "$", "viewContext", ")", ";", "Internal...
Sets view context to static classes. @param ViewContext $parentActionViewContext The ViewContext instance of the action. @param ViewContext $viewContext The ViewContext instance to set.
[ "Sets", "view", "context", "to", "static", "classes", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/InternalHelper.php#L399-L403
189,117
xfra35/f3-access
lib/access.php
Access.rule
function rule($accept,$route,$subjects='') { if (!is_array($subjects)) $subjects=explode(',',$subjects); list($verbs,$path)=$this->parseRoute($route); foreach($subjects as $subject) foreach($verbs as $verb) $this->rules[$subject?:'*'][$verb][$path]=$accept...
php
function rule($accept,$route,$subjects='') { if (!is_array($subjects)) $subjects=explode(',',$subjects); list($verbs,$path)=$this->parseRoute($route); foreach($subjects as $subject) foreach($verbs as $verb) $this->rules[$subject?:'*'][$verb][$path]=$accept...
[ "function", "rule", "(", "$", "accept", ",", "$", "route", ",", "$", "subjects", "=", "''", ")", "{", "if", "(", "!", "is_array", "(", "$", "subjects", ")", ")", "$", "subjects", "=", "explode", "(", "','", ",", "$", "subjects", ")", ";", "list",...
Define an access rule to a route @param bool $accept @param string $route @param string|array $subjects @return self
[ "Define", "an", "access", "rule", "to", "a", "route" ]
8ce44f68b06f9edd1f19be8f38f11cd7a9002962
https://github.com/xfra35/f3-access/blob/8ce44f68b06f9edd1f19be8f38f11cd7a9002962/lib/access.php#L23-L31
189,118
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.url
public function url() { // TODO: class for url if ($this->url === null) { $this->url = parse_url( 'http' . (isset($serverVariables['HTTPS']) ? 's' : '') . '://' . $serverVariables['HTTP_HOST'] . $serverVariables[...
php
public function url() { // TODO: class for url if ($this->url === null) { $this->url = parse_url( 'http' . (isset($serverVariables['HTTPS']) ? 's' : '') . '://' . $serverVariables['HTTP_HOST'] . $serverVariables[...
[ "public", "function", "url", "(", ")", "{", "// TODO: class for url", "if", "(", "$", "this", "->", "url", "===", "null", ")", "{", "$", "this", "->", "url", "=", "parse_url", "(", "'http'", ".", "(", "isset", "(", "$", "serverVariables", "[", "'HTTPS'...
Returns URL components. Potential keys within this array are: - scheme - e.g. http - host - port - user - pass - path - query - after the question mark ? - fragment - after the hashmark # @return array
[ "Returns", "URL", "components", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L143-L156
189,119
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.documentRoot
public function documentRoot() { if ($this->documentRoot == null) { $this->documentRoot = isset($this->serverVariables['DOCUMENT_ROOT']) ? $this->serverVariables['DOCUMENT_ROOT'] : substr(PHPMVC_ROOT_PATH, 0, -1); } return $this->documentRoot; }
php
public function documentRoot() { if ($this->documentRoot == null) { $this->documentRoot = isset($this->serverVariables['DOCUMENT_ROOT']) ? $this->serverVariables['DOCUMENT_ROOT'] : substr(PHPMVC_ROOT_PATH, 0, -1); } return $this->documentRoot; }
[ "public", "function", "documentRoot", "(", ")", "{", "if", "(", "$", "this", "->", "documentRoot", "==", "null", ")", "{", "$", "this", "->", "documentRoot", "=", "isset", "(", "$", "this", "->", "serverVariables", "[", "'DOCUMENT_ROOT'", "]", ")", "?", ...
Gets the document root directory under which the current script is executing, as defined in the server's configuration file. @return string
[ "Gets", "the", "document", "root", "directory", "under", "which", "the", "current", "script", "is", "executing", "as", "defined", "in", "the", "server", "s", "configuration", "file", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L218-L224
189,120
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.server
public function server($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->serverVariables, $key, $default, $nullIfEmpty); }
php
public function server($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->serverVariables, $key, $default, $nullIfEmpty); }
[ "public", "function", "server", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ",", "$", "nullIfEmpty", "=", "false", ")", "{", "return", "InternalHelper", "::", "getSingleKeyOrAll", "(", "$", "this", "->", "serverVariables", ",", "$", "...
Returns server variables. @param string|null $key The key to get. Default: null - all variables. @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null. @param bool $nullIfEmpty Check the value with the empty() function. If em...
[ "Returns", "server", "variables", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L235-L237
189,121
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.cookies
public function cookies($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->cookies, $key, $default, $nullIfEmpty); }
php
public function cookies($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->cookies, $key, $default, $nullIfEmpty); }
[ "public", "function", "cookies", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ",", "$", "nullIfEmpty", "=", "false", ")", "{", "return", "InternalHelper", "::", "getSingleKeyOrAll", "(", "$", "this", "->", "cookies", ",", "$", "key", ...
Returns cookies. @param string|null $key The cookie name to get. Default: null - all cookies. @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null. @param bool $nullIfEmpty Check the value with the empty() function. If empty...
[ "Returns", "cookies", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L248-L250
189,122
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.get
public function get($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->get, $key, $default, $nullIfEmpty); }
php
public function get($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->get, $key, $default, $nullIfEmpty); }
[ "public", "function", "get", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ",", "$", "nullIfEmpty", "=", "false", ")", "{", "return", "InternalHelper", "::", "getSingleKeyOrAll", "(", "$", "this", "->", "get", ",", "$", "key", ",", ...
Returns GET data. @param string|null $key The key to get. Default: null - all keys. @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null. @param bool $nullIfEmpty Check the value with the empty() function. If empty() returns...
[ "Returns", "GET", "data", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L261-L263
189,123
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.post
public function post($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->post, $key, $default, $nullIfEmpty); }
php
public function post($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->post, $key, $default, $nullIfEmpty); }
[ "public", "function", "post", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ",", "$", "nullIfEmpty", "=", "false", ")", "{", "return", "InternalHelper", "::", "getSingleKeyOrAll", "(", "$", "this", "->", "post", ",", "$", "key", ",", ...
Returns POST data. @param string|null $key The key to get. Default: null - all keys. @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null. @param bool $nullIfEmpty Check the value with the empty() function. If empty() return...
[ "Returns", "POST", "data", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L274-L276
189,124
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.files
public function files($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->files, $key, $default, $nullIfEmpty); }
php
public function files($key = null, $default = null, $nullIfEmpty = false) { return InternalHelper::getSingleKeyOrAll($this->files, $key, $default, $nullIfEmpty); }
[ "public", "function", "files", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ",", "$", "nullIfEmpty", "=", "false", ")", "{", "return", "InternalHelper", "::", "getSingleKeyOrAll", "(", "$", "this", "->", "files", ",", "$", "key", ","...
Returns posted files. @param string|null $key The key to get. Default: null - all keys. @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null. @param bool $nullIfEmpty Check the value with the empty() function. If empty() ret...
[ "Returns", "posted", "files", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L287-L289
189,125
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.userLanguages
public function userLanguages() { if (isset($this->serverVariables['HTTP_ACCEPT_LANGUAGE'])) { preg_match_all( '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $this->serverVariables['HTTP_ACCEPT_LANGUAGE'], $matches ); ...
php
public function userLanguages() { if (isset($this->serverVariables['HTTP_ACCEPT_LANGUAGE'])) { preg_match_all( '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $this->serverVariables['HTTP_ACCEPT_LANGUAGE'], $matches ); ...
[ "public", "function", "userLanguages", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "serverVariables", "[", "'HTTP_ACCEPT_LANGUAGE'", "]", ")", ")", "{", "preg_match_all", "(", "'/([a-z]{1,8}(-[a-z]{1,8})?)\\s*(;\\s*q\\s*=\\s*(1|0\\.[0-9]+))?/i'", ",", "...
Gets a sorted string array of client language preferences. @return array
[ "Gets", "a", "sorted", "string", "array", "of", "client", "language", "preferences", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L341-L365
189,126
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.contentType
public function contentType() { $headers = array('CONTENT_TYPE', 'HTTP_CONTENT_TYPE'); foreach ($headers as $header) { if (!empty($this->serverVariables[$header])) { return $this->serverVariables[$header]; } } return ''; }
php
public function contentType() { $headers = array('CONTENT_TYPE', 'HTTP_CONTENT_TYPE'); foreach ($headers as $header) { if (!empty($this->serverVariables[$header])) { return $this->serverVariables[$header]; } } return ''; }
[ "public", "function", "contentType", "(", ")", "{", "$", "headers", "=", "array", "(", "'CONTENT_TYPE'", ",", "'HTTP_CONTENT_TYPE'", ")", ";", "foreach", "(", "$", "headers", "as", "$", "header", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->...
Returns Content-Type of the request or empty string. @return string
[ "Returns", "Content", "-", "Type", "of", "the", "request", "or", "empty", "string", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L372-L382
189,127
php-mvc-project/php-mvc
src/HttpRequestBase.php
HttpRequestBase.headers
public function headers($key = null, $default = null, $nullIfEmpty = false) { if ($this->headers === null) { $result = array(); foreach ($this->serverVariables as $k => $v) { if (substr($k, 0, 5) == 'HTTP_') { $headerName...
php
public function headers($key = null, $default = null, $nullIfEmpty = false) { if ($this->headers === null) { $result = array(); foreach ($this->serverVariables as $k => $v) { if (substr($k, 0, 5) == 'HTTP_') { $headerName...
[ "public", "function", "headers", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ",", "$", "nullIfEmpty", "=", "false", ")", "{", "if", "(", "$", "this", "->", "headers", "===", "null", ")", "{", "$", "result", "=", "array", "(", ...
Returns HTTP headers of the request. @param string|null $key The key to get. Default: null - all keys. @param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null. @param bool $nullIfEmpty Check the value with the empty() function....
[ "Returns", "HTTP", "headers", "of", "the", "request", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpRequestBase.php#L393-L410
189,128
php-mvc-project/php-mvc
src/ValidateAntiForgeryToken.php
ValidateAntiForgeryToken.set
public static function set($actionName = null, $enable) { $actionName = ($actionName === null ? '.' : $actionName); if ($actionName != '.' && !self::$actionContext->actionNameEquals($actionName)) { return; } self::$enable = $enable; }
php
public static function set($actionName = null, $enable) { $actionName = ($actionName === null ? '.' : $actionName); if ($actionName != '.' && !self::$actionContext->actionNameEquals($actionName)) { return; } self::$enable = $enable; }
[ "public", "static", "function", "set", "(", "$", "actionName", "=", "null", ",", "$", "enable", ")", "{", "$", "actionName", "=", "(", "$", "actionName", "===", "null", "?", "'.'", ":", "$", "actionName", ")", ";", "if", "(", "$", "actionName", "!=",...
Sets verification mode for the specified action. @param string $actionName Action name. @param bool $enable Enable (true) or disable (false) verification. @return void
[ "Sets", "verification", "mode", "for", "the", "specified", "action", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/ValidateAntiForgeryToken.php#L77-L85
189,129
php-mvc-project/php-mvc
src/OutputCache.php
OutputCache.set
public static function set($actionName, $duration, $location, $varyByParam = null, $varyByHeader = null, $varyByCustom = null) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['duration'] = $duration; self::$settings[$actionName]['location'] = $location; if ...
php
public static function set($actionName, $duration, $location, $varyByParam = null, $varyByHeader = null, $varyByCustom = null) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['duration'] = $duration; self::$settings[$actionName]['location'] = $location; if ...
[ "public", "static", "function", "set", "(", "$", "actionName", ",", "$", "duration", ",", "$", "location", ",", "$", "varyByParam", "=", "null", ",", "$", "varyByHeader", "=", "null", ",", "$", "varyByCustom", "=", "null", ")", "{", "if", "(", "!", "...
Sets the cache settings. @param string $actionName Action name. @param int $duration A cache duration value, in seconds. @param int $location A cache location. Please see OutputCacheLocation class. @param string|null $varyByParam A semicolon-separated list of strings that correspond to query-string values for the GET ...
[ "Sets", "the", "cache", "settings", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/OutputCache.php#L70-L87
189,130
php-mvc-project/php-mvc
src/OutputCache.php
OutputCache.setDuration
public static function setDuration($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['duration'] = $value; }
php
public static function setDuration($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['duration'] = $value; }
[ "public", "static", "function", "setDuration", "(", "$", "actionName", ",", "$", "value", ")", "{", "if", "(", "!", "self", "::", "canCache", "(", "$", "actionName", ")", ")", "{", "return", ";", "}", "self", "::", "$", "settings", "[", "$", "actionN...
Sets the cache duration, in seconds. @param string $actionName Action name. @param int $value A cache duration value, in seconds. @return void
[ "Sets", "the", "cache", "duration", "in", "seconds", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/OutputCache.php#L97-L100
189,131
php-mvc-project/php-mvc
src/OutputCache.php
OutputCache.setLocation
public static function setLocation($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['location'] = $value; }
php
public static function setLocation($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['location'] = $value; }
[ "public", "static", "function", "setLocation", "(", "$", "actionName", ",", "$", "value", ")", "{", "if", "(", "!", "self", "::", "canCache", "(", "$", "actionName", ")", ")", "{", "return", ";", "}", "self", "::", "$", "settings", "[", "$", "actionN...
Sets the location. See OutputCacheLocation class for a list of possible values. @param string $actionName Action name. @param int $value A cache location. @return void
[ "Sets", "the", "location", ".", "See", "OutputCacheLocation", "class", "for", "a", "list", "of", "possible", "values", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/OutputCache.php#L110-L113
189,132
php-mvc-project/php-mvc
src/OutputCache.php
OutputCache.setVaryByParam
public static function setVaryByParam($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['varyByParam'] = $value; }
php
public static function setVaryByParam($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['varyByParam'] = $value; }
[ "public", "static", "function", "setVaryByParam", "(", "$", "actionName", ",", "$", "value", ")", "{", "if", "(", "!", "self", "::", "canCache", "(", "$", "actionName", ")", ")", "{", "return", ";", "}", "self", "::", "$", "settings", "[", "$", "acti...
Sets the vary-by-param value. @param string $actionName Action name. @param string $value A semicolon-separated list of strings that correspond to query-string values for the GET method, or to parameter values for the POST method. @return void
[ "Sets", "the", "vary", "-", "by", "-", "param", "value", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/OutputCache.php#L123-L126
189,133
php-mvc-project/php-mvc
src/OutputCache.php
OutputCache.setVaryByHeader
public static function setVaryByHeader($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['varyByHeader'] = $value; }
php
public static function setVaryByHeader($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['varyByHeader'] = $value; }
[ "public", "static", "function", "setVaryByHeader", "(", "$", "actionName", ",", "$", "value", ")", "{", "if", "(", "!", "self", "::", "canCache", "(", "$", "actionName", ")", ")", "{", "return", ";", "}", "self", "::", "$", "settings", "[", "$", "act...
Sets the vary-by-header value. @param string $actionName Action name. @param string $value A semicolon-separated list of HTTP headers that are used to vary the output cache. @return void
[ "Sets", "the", "vary", "-", "by", "-", "header", "value", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/OutputCache.php#L136-L139
189,134
php-mvc-project/php-mvc
src/OutputCache.php
OutputCache.setVaryByCustom
public static function setVaryByCustom($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['varyByCustom'] = function($actionContext) use ($value) { return $value($actionContext); }; }
php
public static function setVaryByCustom($actionName, $value) { if (!self::canCache($actionName)) { return; } self::$settings[$actionName]['varyByCustom'] = function($actionContext) use ($value) { return $value($actionContext); }; }
[ "public", "static", "function", "setVaryByCustom", "(", "$", "actionName", ",", "$", "value", ")", "{", "if", "(", "!", "self", "::", "canCache", "(", "$", "actionName", ")", ")", "{", "return", ";", "}", "self", "::", "$", "settings", "[", "$", "act...
Sets the vary-by-custom. @param string $actionName Action name. @param callback $value A function to check. For example: function($actionContext) { $userAgent = $actionContext->getHttpContext()->getRequest()->server('HTTP_USER_AGENT'); $browser = get_browser($userAgent, true); if ($browser['browser'] == 'Firefox') { ...
[ "Sets", "the", "vary", "-", "by", "-", "custom", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/OutputCache.php#L160-L165
189,135
php-mvc-project/php-mvc
src/View.php
View.injectModel
public static function injectModel(&$model) { $actionResult = self::$viewContext->actionResult; if (!empty($actionResult)) { if ($actionResult instanceof ViewResult && !empty($actionResult->model)) { $model = $actionResult->model; } else { ...
php
public static function injectModel(&$model) { $actionResult = self::$viewContext->actionResult; if (!empty($actionResult)) { if ($actionResult instanceof ViewResult && !empty($actionResult->model)) { $model = $actionResult->model; } else { ...
[ "public", "static", "function", "injectModel", "(", "&", "$", "model", ")", "{", "$", "actionResult", "=", "self", "::", "$", "viewContext", "->", "actionResult", ";", "if", "(", "!", "empty", "(", "$", "actionResult", ")", ")", "{", "if", "(", "$", ...
Injects model to state. @param mixed &$model Model to injection. @return void
[ "Injects", "model", "to", "state", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/View.php#L132-L143
189,136
php-mvc-project/php-mvc
src/View.php
View.getData
public static function getData($key = null) { if (!isset($key)) { return self::$viewContext->viewData; } else { return isset(self::$viewContext->viewData[$key]) ? self::$viewContext->viewData[$key] : null; } }
php
public static function getData($key = null) { if (!isset($key)) { return self::$viewContext->viewData; } else { return isset(self::$viewContext->viewData[$key]) ? self::$viewContext->viewData[$key] : null; } }
[ "public", "static", "function", "getData", "(", "$", "key", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "key", ")", ")", "{", "return", "self", "::", "$", "viewContext", "->", "viewData", ";", "}", "else", "{", "return", "isset", "(",...
Gets the data with the specified key. If the specified key does not exist, function returns null. If no key is specified, returns all data. @param string $key The key to get the data. @return mixed|array|null
[ "Gets", "the", "data", "with", "the", "specified", "key", ".", "If", "the", "specified", "key", "does", "not", "exist", "function", "returns", "null", ".", "If", "no", "key", "is", "specified", "returns", "all", "data", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/View.php#L166-L173
189,137
php-mvc-project/php-mvc
src/RouteCollection.php
RouteCollection.validateRoute
private function validateRoute($route) { if (!$route instanceof Route) { throw new \Exception('A type of Route or a derivative is expected.'); } if ($route->ignore !== true && empty($route->name)) { throw new \Exception('The name of the route is expected. The val...
php
private function validateRoute($route) { if (!$route instanceof Route) { throw new \Exception('A type of Route or a derivative is expected.'); } if ($route->ignore !== true && empty($route->name)) { throw new \Exception('The name of the route is expected. The val...
[ "private", "function", "validateRoute", "(", "$", "route", ")", "{", "if", "(", "!", "$", "route", "instanceof", "Route", ")", "{", "throw", "new", "\\", "Exception", "(", "'A type of Route or a derivative is expected.'", ")", ";", "}", "if", "(", "$", "rout...
Verifies that the data in the route instance is correct. @param Route $route The route to check. @return void
[ "Verifies", "that", "the", "data", "in", "the", "route", "instance", "is", "correct", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/RouteCollection.php#L113-L129
189,138
php-mvc-project/php-mvc
src/RouteCollection.php
RouteCollection.isUniqueRouteName
private function isUniqueRouteName($name) { foreach ($this->routes as $route) { if (mb_strtolower($route->name) == mb_strtolower($name)) { return false; } } return true; }
php
private function isUniqueRouteName($name) { foreach ($this->routes as $route) { if (mb_strtolower($route->name) == mb_strtolower($name)) { return false; } } return true; }
[ "private", "function", "isUniqueRouteName", "(", "$", "name", ")", "{", "foreach", "(", "$", "this", "->", "routes", "as", "$", "route", ")", "{", "if", "(", "mb_strtolower", "(", "$", "route", "->", "name", ")", "==", "mb_strtolower", "(", "$", "name"...
Checks the uniqueness of the route name. @param string $name Name to check. @return bool
[ "Checks", "the", "uniqueness", "of", "the", "route", "name", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/RouteCollection.php#L138-L146
189,139
mmamedov/page-cache
src/Storage/FileSystem/HashDirectory.php
HashDirectory.getDirectoryPathByHash
private function getDirectoryPathByHash($filename) { //get 2 number $val1 = ord($filename[1]); $val2 = ord($filename[3]); //normalize to 99 $val1 %= 99; $val2 %= 99; return $val1 . '/' . $val2 . '/'; }
php
private function getDirectoryPathByHash($filename) { //get 2 number $val1 = ord($filename[1]); $val2 = ord($filename[3]); //normalize to 99 $val1 %= 99; $val2 %= 99; return $val1 . '/' . $val2 . '/'; }
[ "private", "function", "getDirectoryPathByHash", "(", "$", "filename", ")", "{", "//get 2 number", "$", "val1", "=", "ord", "(", "$", "filename", "[", "1", "]", ")", ";", "$", "val2", "=", "ord", "(", "$", "filename", "[", "3", "]", ")", ";", "//norm...
Get a path with 2 directories, based on filename hash @param string $filename @return string directory path
[ "Get", "a", "path", "with", "2", "directories", "based", "on", "filename", "hash" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Storage/FileSystem/HashDirectory.php#L178-L188
189,140
mmamedov/page-cache
src/Storage/FileSystem/HashDirectory.php
HashDirectory.clearDirectory
public function clearDirectory($dir) { if (empty($dir) || !@is_dir($dir)) { return false; } $iterator = new \RecursiveDirectoryIterator($dir); $filter = new \RecursiveCallbackFilterIterator($iterator, function ($current) { /** @var \SplFileInfo $current */ ...
php
public function clearDirectory($dir) { if (empty($dir) || !@is_dir($dir)) { return false; } $iterator = new \RecursiveDirectoryIterator($dir); $filter = new \RecursiveCallbackFilterIterator($iterator, function ($current) { /** @var \SplFileInfo $current */ ...
[ "public", "function", "clearDirectory", "(", "$", "dir", ")", "{", "if", "(", "empty", "(", "$", "dir", ")", "||", "!", "@", "is_dir", "(", "$", "dir", ")", ")", "{", "return", "false", ";", "}", "$", "iterator", "=", "new", "\\", "RecursiveDirecto...
Removes all files and directories inside a directory. Used for deleting all cache content. @param string $dir @return bool
[ "Removes", "all", "files", "and", "directories", "inside", "a", "directory", ".", "Used", "for", "deleting", "all", "cache", "content", "." ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Storage/FileSystem/HashDirectory.php#L198-L219
189,141
mmamedov/page-cache
src/PageCache.php
PageCache.init
public function init() { if ($this->config()->isDryRunMode()) { $this->log('Dry run mode is on. Live content is displayed, no cached output.'); } $this->log(__METHOD__ . ' uri:' . $_SERVER['REQUEST_URI'] . '; script:' . $_SERVER['SCRIPT_NAME'] . '; query:' . $_SERVER...
php
public function init() { if ($this->config()->isDryRunMode()) { $this->log('Dry run mode is on. Live content is displayed, no cached output.'); } $this->log(__METHOD__ . ' uri:' . $_SERVER['REQUEST_URI'] . '; script:' . $_SERVER['SCRIPT_NAME'] . '; query:' . $_SERVER...
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "config", "(", ")", "->", "isDryRunMode", "(", ")", ")", "{", "$", "this", "->", "log", "(", "'Dry run mode is on. Live content is displayed, no cached output.'", ")", ";", "}", "$", ...
Initialize cache. If you need to set configuration options, do so before calling this method.
[ "Initialize", "cache", ".", "If", "you", "need", "to", "set", "configuration", "options", "do", "so", "before", "calling", "this", "method", "." ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/PageCache.php#L126-L149
189,142
mmamedov/page-cache
src/PageCache.php
PageCache.getDefaultCacheAdapter
private function getDefaultCacheAdapter() { return new FileSystemCacheAdapter( $this->config->getCachePath(), $this->config->getFileLock(), $this->config->getMinCacheFileSize() ); }
php
private function getDefaultCacheAdapter() { return new FileSystemCacheAdapter( $this->config->getCachePath(), $this->config->getFileLock(), $this->config->getMinCacheFileSize() ); }
[ "private", "function", "getDefaultCacheAdapter", "(", ")", "{", "return", "new", "FileSystemCacheAdapter", "(", "$", "this", "->", "config", "->", "getCachePath", "(", ")", ",", "$", "this", "->", "config", "->", "getFileLock", "(", ")", ",", "$", "this", ...
Get Default Cache Adapter @return FileSystemCacheAdapter @throws PageCacheException
[ "Get", "Default", "Cache", "Adapter" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/PageCache.php#L177-L184
189,143
mmamedov/page-cache
src/PageCache.php
PageCache.getCurrentKey
public function getCurrentKey() { if (!$this->currentKey) { $this->currentKey = $this->getStrategy()->strategy(); } return $this->currentKey; }
php
public function getCurrentKey() { if (!$this->currentKey) { $this->currentKey = $this->getStrategy()->strategy(); } return $this->currentKey; }
[ "public", "function", "getCurrentKey", "(", ")", "{", "if", "(", "!", "$", "this", "->", "currentKey", ")", "{", "$", "this", "->", "currentKey", "=", "$", "this", "->", "getStrategy", "(", ")", "->", "strategy", "(", ")", ";", "}", "return", "$", ...
Get current key @return string
[ "Get", "current", "key" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/PageCache.php#L191-L198
189,144
mmamedov/page-cache
src/PageCache.php
PageCache.displayItem
private function displayItem(CacheItemInterface $item) { $isDryRun = $this->config()->isDryRunMode(); $itemContent = $item->getContent(); if (empty($itemContent)) { $this->log(__METHOD__ . ' Empty cache item found, skipping cache.', print_r($item, true)); return; ...
php
private function displayItem(CacheItemInterface $item) { $isDryRun = $this->config()->isDryRunMode(); $itemContent = $item->getContent(); if (empty($itemContent)) { $this->log(__METHOD__ . ' Empty cache item found, skipping cache.', print_r($item, true)); return; ...
[ "private", "function", "displayItem", "(", "CacheItemInterface", "$", "item", ")", "{", "$", "isDryRun", "=", "$", "this", "->", "config", "(", ")", "->", "isDryRunMode", "(", ")", ";", "$", "itemContent", "=", "$", "item", "->", "getContent", "(", ")", ...
Display cache item, send headers if necessary. @param \PageCache\Storage\CacheItemInterface $item
[ "Display", "cache", "item", "send", "headers", "if", "necessary", "." ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/PageCache.php#L205-L265
189,145
mmamedov/page-cache
src/PageCache.php
PageCache.storePageContent
private function storePageContent($content) { $key = $this->getCurrentKey(); $item = new CacheItem($key); // When enabled we store original header values with the item $isHeadersForwardingEnabled = $this->config->isSendHeaders() && $this->config->isForwardHeaders(); $this->...
php
private function storePageContent($content) { $key = $this->getCurrentKey(); $item = new CacheItem($key); // When enabled we store original header values with the item $isHeadersForwardingEnabled = $this->config->isSendHeaders() && $this->config->isForwardHeaders(); $this->...
[ "private", "function", "storePageContent", "(", "$", "content", ")", "{", "$", "key", "=", "$", "this", "->", "getCurrentKey", "(", ")", ";", "$", "item", "=", "new", "CacheItem", "(", "$", "key", ")", ";", "// When enabled we store original header values with...
Write page to cache, and display it. When write is unsuccessful, string content is returned. @param string $content String from ob_start @return string Page content @throws \Psr\SimpleCache\InvalidArgumentException
[ "Write", "page", "to", "cache", "and", "display", "it", ".", "When", "write", "is", "unsuccessful", "string", "content", "is", "returned", "." ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/PageCache.php#L276-L336
189,146
mmamedov/page-cache
src/PageCache.php
PageCache.getPageCache
public function getPageCache() { $key = $this->getCurrentKey(); $item = $this->getItemStorage()->get($key); return $item ? $item->getContent() : false; }
php
public function getPageCache() { $key = $this->getCurrentKey(); $item = $this->getItemStorage()->get($key); return $item ? $item->getContent() : false; }
[ "public", "function", "getPageCache", "(", ")", "{", "$", "key", "=", "$", "this", "->", "getCurrentKey", "(", ")", ";", "$", "item", "=", "$", "this", "->", "getItemStorage", "(", ")", "->", "get", "(", "$", "key", ")", ";", "return", "$", "item",...
Return current page cache as a string or false on error, if this page was cached before. @return string|false @throws \Psr\SimpleCache\InvalidArgumentException
[ "Return", "current", "page", "cache", "as", "a", "string", "or", "false", "on", "error", "if", "this", "page", "was", "cached", "before", "." ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/PageCache.php#L387-L393
189,147
mmamedov/page-cache
src/PageCache.php
PageCache.isCached
public function isCached(CacheItemInterface $item = null) { if (!$item) { $key = $this->getCurrentKey(); $item = $this->getItemStorage()->get($key); } return $item ? true : false; }
php
public function isCached(CacheItemInterface $item = null) { if (!$item) { $key = $this->getCurrentKey(); $item = $this->getItemStorage()->get($key); } return $item ? true : false; }
[ "public", "function", "isCached", "(", "CacheItemInterface", "$", "item", "=", "null", ")", "{", "if", "(", "!", "$", "item", ")", "{", "$", "key", "=", "$", "this", "->", "getCurrentKey", "(", ")", ";", "$", "item", "=", "$", "this", "->", "getIte...
Checks if current page is in cache. @param \PageCache\Storage\CacheItemInterface|null $item @return bool Returns true if page has a valid cache file saved, false if not @throws \Psr\SimpleCache\InvalidArgumentException
[ "Checks", "if", "current", "page", "is", "in", "cache", "." ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/PageCache.php#L403-L411
189,148
mmamedov/page-cache
src/PageCache.php
PageCache.log
private function log($msg, $exception = null) { if (!$this->config->isEnableLog()) { return false; } if (empty($this->logger) && !empty($this->config->getLogFilePath())) { $this->logger = new DefaultLogger($this->config->getLogFilePath()); } if ($exc...
php
private function log($msg, $exception = null) { if (!$this->config->isEnableLog()) { return false; } if (empty($this->logger) && !empty($this->config->getLogFilePath())) { $this->logger = new DefaultLogger($this->config->getLogFilePath()); } if ($exc...
[ "private", "function", "log", "(", "$", "msg", ",", "$", "exception", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "config", "->", "isEnableLog", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "empty", "(", "$", "this", ...
Log message using PSR Logger, or error_log. Works only when logging was enabled and log file path was define. Attempts to create default logger if no logger exists. @param string $msg Message @param null|\Exception $exception @return bool true when logged, false when didn't log
[ "Log", "message", "using", "PSR", "Logger", "or", "error_log", ".", "Works", "only", "when", "logging", "was", "enabled", "and", "log", "file", "path", "was", "define", ".", "Attempts", "to", "create", "default", "logger", "if", "no", "logger", "exists", "...
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/PageCache.php#L478-L495
189,149
mmamedov/page-cache
src/HttpHeaders.php
HttpHeaders.setHeader
private function setHeader($name, $value = null, $httpResponseCode = null) { header($name . ($value ? ': ' . $value : ''), true, $httpResponseCode); }
php
private function setHeader($name, $value = null, $httpResponseCode = null) { header($name . ($value ? ': ' . $value : ''), true, $httpResponseCode); }
[ "private", "function", "setHeader", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "httpResponseCode", "=", "null", ")", "{", "header", "(", "$", "name", ".", "(", "$", "value", "?", "': '", ".", "$", "value", ":", "''", ")", ",", "t...
Sends HTTP Header @param string $name Header name @param string|null $value Header value @param int $httpResponseCode HTTP response code
[ "Sends", "HTTP", "Header" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/HttpHeaders.php#L144-L147
189,150
mmamedov/page-cache
src/HttpHeaders.php
HttpHeaders.getIfModifiedSinceTimestamp
private function getIfModifiedSinceTimestamp() { if (!empty($_SERVER[self::HTTP_IF_MODIFIED_SINCE])) { $modifiedSinceString = $_SERVER[self::HTTP_IF_MODIFIED_SINCE]; } elseif (!empty($_ENV[self::HTTP_IF_MODIFIED_SINCE])) { $modifiedSinceString = $_ENV[self::HTTP_IF_MODIFIED_S...
php
private function getIfModifiedSinceTimestamp() { if (!empty($_SERVER[self::HTTP_IF_MODIFIED_SINCE])) { $modifiedSinceString = $_SERVER[self::HTTP_IF_MODIFIED_SINCE]; } elseif (!empty($_ENV[self::HTTP_IF_MODIFIED_SINCE])) { $modifiedSinceString = $_ENV[self::HTTP_IF_MODIFIED_S...
[ "private", "function", "getIfModifiedSinceTimestamp", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "_SERVER", "[", "self", "::", "HTTP_IF_MODIFIED_SINCE", "]", ")", ")", "{", "$", "modifiedSinceString", "=", "$", "_SERVER", "[", "self", "::", "HTTP_IF_M...
Get timestamp value from If-Modified-Since request header @return false|int Timestamp or false when header not found
[ "Get", "timestamp", "value", "from", "If", "-", "Modified", "-", "Since", "request", "header" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/HttpHeaders.php#L194-L214
189,151
mmamedov/page-cache
src/HttpHeaders.php
HttpHeaders.getResponseHeaders
private function getResponseHeaders() { if (!$this->responseHeaders) { foreach ($this->getSentHeaders() as $item) { list($key, $value) = explode(':', $item, 2); $this->responseHeaders[$key] = trim($value); } } return $this->responseHe...
php
private function getResponseHeaders() { if (!$this->responseHeaders) { foreach ($this->getSentHeaders() as $item) { list($key, $value) = explode(':', $item, 2); $this->responseHeaders[$key] = trim($value); } } return $this->responseHe...
[ "private", "function", "getResponseHeaders", "(", ")", "{", "if", "(", "!", "$", "this", "->", "responseHeaders", ")", "{", "foreach", "(", "$", "this", "->", "getSentHeaders", "(", ")", "as", "$", "item", ")", "{", "list", "(", "$", "key", ",", "$",...
Get headers and populate local responseHeaders variable @return array
[ "Get", "headers", "and", "populate", "local", "responseHeaders", "variable" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/HttpHeaders.php#L265-L276
189,152
php-mvc-project/php-mvc
src/HttpResponseBase.php
HttpResponseBase.setFlushHandler
public function setFlushHandler($value) { if ($value !== null && !is_callable($value)) { throw new \Exception('A function is expected, or null.'); } $this->flushHandler = $value; }
php
public function setFlushHandler($value) { if ($value !== null && !is_callable($value)) { throw new \Exception('A function is expected, or null.'); } $this->flushHandler = $value; }
[ "public", "function", "setFlushHandler", "(", "$", "value", ")", "{", "if", "(", "$", "value", "!==", "null", "&&", "!", "is_callable", "(", "$", "value", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'A function is expected, or null.'", ")", ";"...
Sets the event handler when calling the "flush" method. @param callback|null $value The function to set. @return void
[ "Sets", "the", "event", "handler", "when", "calling", "the", "flush", "method", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpResponseBase.php#L119-L125
189,153
php-mvc-project/php-mvc
src/HttpResponseBase.php
HttpResponseBase.setPreSendHandler
public function setPreSendHandler($value) { if ($value !== null && !is_callable($value)) { throw new \Exception('A function is expected, or null.'); } $this->preSendHandler = $value; }
php
public function setPreSendHandler($value) { if ($value !== null && !is_callable($value)) { throw new \Exception('A function is expected, or null.'); } $this->preSendHandler = $value; }
[ "public", "function", "setPreSendHandler", "(", "$", "value", ")", "{", "if", "(", "$", "value", "!==", "null", "&&", "!", "is_callable", "(", "$", "value", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'A function is expected, or null.'", ")", "...
Sets the event handler when calling the "preSend" method. @param callback|null $value The function to set. @return void
[ "Sets", "the", "event", "handler", "when", "calling", "the", "preSend", "method", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpResponseBase.php#L134-L140
189,154
php-mvc-project/php-mvc
src/HttpResponseBase.php
HttpResponseBase.setEndHandler
public function setEndHandler($value) { if ($value !== null && !is_callable($value)) { throw new \Exception('A function is expected, or null.'); } $this->endHandler = $value; }
php
public function setEndHandler($value) { if ($value !== null && !is_callable($value)) { throw new \Exception('A function is expected, or null.'); } $this->endHandler = $value; }
[ "public", "function", "setEndHandler", "(", "$", "value", ")", "{", "if", "(", "$", "value", "!==", "null", "&&", "!", "is_callable", "(", "$", "value", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'A function is expected, or null.'", ")", ";", ...
Sets the event handler when calling the "end" method. @param callback|null $value The function to set. @return void
[ "Sets", "the", "event", "handler", "when", "calling", "the", "end", "method", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpResponseBase.php#L149-L155
189,155
php-mvc-project/php-mvc
src/HttpResponseBase.php
HttpResponseBase.addHeader
public function addHeader($name, $value = null) { if ($this->canSetHeaders()) { if ($value === null) { $value = trim(substr($name, strpos($name, ':') + 1)); $name = trim(substr($name, 0, strpos($name, ':'))); } $this->headers[$name] = $value; ...
php
public function addHeader($name, $value = null) { if ($this->canSetHeaders()) { if ($value === null) { $value = trim(substr($name, strpos($name, ':') + 1)); $name = trim(substr($name, 0, strpos($name, ':'))); } $this->headers[$name] = $value; ...
[ "public", "function", "addHeader", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "if", "(", "$", "this", "->", "canSetHeaders", "(", ")", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "$", "value", "=", "trim", "(", ...
Adds an HTTP header to the current response. @param string @name The name of the HTTP header to add value to. @param string @value The string to add to the header. @return void
[ "Adds", "an", "HTTP", "header", "to", "the", "current", "response", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpResponseBase.php#L209-L218
189,156
php-mvc-project/php-mvc
src/HttpResponseBase.php
HttpResponseBase.addCookie
public function addCookie($name, $value = '', $expire = 0, $path = '', $domain = '', $secure = false, $httponly = false) { if ($this->canSetHeaders()) { $this->cookies[] = func_get_args(); } }
php
public function addCookie($name, $value = '', $expire = 0, $path = '', $domain = '', $secure = false, $httponly = false) { if ($this->canSetHeaders()) { $this->cookies[] = func_get_args(); } }
[ "public", "function", "addCookie", "(", "$", "name", ",", "$", "value", "=", "''", ",", "$", "expire", "=", "0", ",", "$", "path", "=", "''", ",", "$", "domain", "=", "''", ",", "$", "secure", "=", "false", ",", "$", "httponly", "=", "false", "...
Adds cookie to send to the client. @param string $name The name of the cookie. @param string $value The value of the cookie. @param int $expire The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words, you'll most likely set this with the time() function plus the...
[ "Adds", "cookie", "to", "send", "to", "the", "client", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpResponseBase.php#L267-L271
189,157
php-mvc-project/php-mvc
src/HttpResponseBase.php
HttpResponseBase.write
public function write($value, $glue = "\n") { if (is_array($value)) { $this->output .= implode(chr(10), $value); } else { $this->output .= $value; } }
php
public function write($value, $glue = "\n") { if (is_array($value)) { $this->output .= implode(chr(10), $value); } else { $this->output .= $value; } }
[ "public", "function", "write", "(", "$", "value", ",", "$", "glue", "=", "\"\\n\"", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "this", "->", "output", ".=", "implode", "(", "chr", "(", "10", ")", ",", "$", "value", ...
Writes the specified string to the HTTP response output stream. @param string|array $value The string to write to the HTTP output stream. @param string $glue The string for gluing together the elements of an array, if $value is an array. Default: "\n". @return void
[ "Writes", "the", "specified", "string", "to", "the", "HTTP", "response", "output", "stream", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpResponseBase.php#L301-L308
189,158
php-mvc-project/php-mvc
src/HttpResponseBase.php
HttpResponseBase.writeFile
public function writeFile($path) { if (is_array($path)) { $this->files = array_merge($this->files, $path); } elseif (!empty($path)) { $this->files[] = $path; } }
php
public function writeFile($path) { if (is_array($path)) { $this->files = array_merge($this->files, $path); } elseif (!empty($path)) { $this->files[] = $path; } }
[ "public", "function", "writeFile", "(", "$", "path", ")", "{", "if", "(", "is_array", "(", "$", "path", ")", ")", "{", "$", "this", "->", "files", "=", "array_merge", "(", "$", "this", "->", "files", ",", "$", "path", ")", ";", "}", "elseif", "("...
Writes the contents of the specified file to the HTTP response output stream. @param string|array $path The path of the file to write to the HTTP output. @return void
[ "Writes", "the", "contents", "of", "the", "specified", "file", "to", "the", "HTTP", "response", "output", "stream", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpResponseBase.php#L317-L324
189,159
php-mvc-project/php-mvc
src/HttpResponseBase.php
HttpResponseBase.clear
public function clear() { $this->header = array(); $this->cookies = array(); $this->files = array(); $this->statusCode = null; $this->statusDescription = null; $this->output = ''; if (ob_get_length() > 0) { ob_clean(); } }
php
public function clear() { $this->header = array(); $this->cookies = array(); $this->files = array(); $this->statusCode = null; $this->statusDescription = null; $this->output = ''; if (ob_get_length() > 0) { ob_clean(); } }
[ "public", "function", "clear", "(", ")", "{", "$", "this", "->", "header", "=", "array", "(", ")", ";", "$", "this", "->", "cookies", "=", "array", "(", ")", ";", "$", "this", "->", "files", "=", "array", "(", ")", ";", "$", "this", "->", "stat...
Clears all headers and content output from the current response. @return void
[ "Clears", "all", "headers", "and", "content", "output", "from", "the", "current", "response", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpResponseBase.php#L331-L342
189,160
php-mvc-project/php-mvc
src/HttpResponseBase.php
HttpResponseBase.flush
public function flush() { $this->outputStarted = true; $files = $this->files; $output = $this->output; $this->files = array(); $this->output = ''; if ($this->flushHandler !== null) { call_user_func($this->flushHandler, array( 'files' => ...
php
public function flush() { $this->outputStarted = true; $files = $this->files; $output = $this->output; $this->files = array(); $this->output = ''; if ($this->flushHandler !== null) { call_user_func($this->flushHandler, array( 'files' => ...
[ "public", "function", "flush", "(", ")", "{", "$", "this", "->", "outputStarted", "=", "true", ";", "$", "files", "=", "$", "this", "->", "files", ";", "$", "output", "=", "$", "this", "->", "output", ";", "$", "this", "->", "files", "=", "array", ...
Sends all currently buffered output to the client. @return void
[ "Sends", "all", "currently", "buffered", "output", "to", "the", "client", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpResponseBase.php#L349-L365
189,161
php-mvc-project/php-mvc
src/HttpContextBase.php
HttpContextBase.getRoute
public function getRoute() { if ($this->route === null && $this->isIgnoredRoute() === false) { $this->route = $this->routes->matchRoute($this); } return $this->route; }
php
public function getRoute() { if ($this->route === null && $this->isIgnoredRoute() === false) { $this->route = $this->routes->matchRoute($this); } return $this->route; }
[ "public", "function", "getRoute", "(", ")", "{", "if", "(", "$", "this", "->", "route", "===", "null", "&&", "$", "this", "->", "isIgnoredRoute", "(", ")", "===", "false", ")", "{", "$", "this", "->", "route", "=", "$", "this", "->", "routes", "->"...
Returns a route that is comparable to the current request context. @return Route|null
[ "Returns", "a", "route", "that", "is", "comparable", "to", "the", "current", "request", "context", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpContextBase.php#L157-L163
189,162
php-mvc-project/php-mvc
src/HttpContextBase.php
HttpContextBase.isIgnoredRoute
public function isIgnoredRoute() { if ($this->ignoreRoute === null) { $this->ignoreRoute = ($this->route = $this->routes->matchIgnore($this)) !== null; } return $this->ignoreRoute; }
php
public function isIgnoredRoute() { if ($this->ignoreRoute === null) { $this->ignoreRoute = ($this->route = $this->routes->matchIgnore($this)) !== null; } return $this->ignoreRoute; }
[ "public", "function", "isIgnoredRoute", "(", ")", "{", "if", "(", "$", "this", "->", "ignoreRoute", "===", "null", ")", "{", "$", "this", "->", "ignoreRoute", "=", "(", "$", "this", "->", "route", "=", "$", "this", "->", "routes", "->", "matchIgnore", ...
Returns TRUE if the current route is to be ignored. @return bool
[ "Returns", "TRUE", "if", "the", "current", "route", "is", "to", "be", "ignored", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/HttpContextBase.php#L170-L176
189,163
php-mvc-project/php-mvc
src/Html.php
Html.displayName
public static function displayName($propertyName) { $propertyName = (is_array($propertyName) ? implode('_', $propertyName) : $propertyName); if (($dataAnnotation = self::$viewContext->getModelDataAnnotation($propertyName)) !== null) { return htmlspecialchars($dataAnnotation->displayName); ...
php
public static function displayName($propertyName) { $propertyName = (is_array($propertyName) ? implode('_', $propertyName) : $propertyName); if (($dataAnnotation = self::$viewContext->getModelDataAnnotation($propertyName)) !== null) { return htmlspecialchars($dataAnnotation->displayName); ...
[ "public", "static", "function", "displayName", "(", "$", "propertyName", ")", "{", "$", "propertyName", "=", "(", "is_array", "(", "$", "propertyName", ")", "?", "implode", "(", "'_'", ",", "$", "propertyName", ")", ":", "$", "propertyName", ")", ";", "i...
Gets display name for the specified field. @param string|array $propertyName The name of the property to display the name. It can be a string or an array. If an array is specified, the property chain in the model will be searched. For example: array('A', 'B') is $model->A->B. @return string
[ "Gets", "display", "name", "for", "the", "specified", "field", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Html.php#L79-L88
189,164
php-mvc-project/php-mvc
src/Html.php
Html.validationMessage
public static function validationMessage($propertyName, $validationMessage = null, $tag = 'span', $htmlAttributes = array()) { $propertyName = (is_array($propertyName) ? implode('_', $propertyName) : $propertyName); $htmlAttributes = ($htmlAttributes === null ? array() : $htmlAttributes); $tag =...
php
public static function validationMessage($propertyName, $validationMessage = null, $tag = 'span', $htmlAttributes = array()) { $propertyName = (is_array($propertyName) ? implode('_', $propertyName) : $propertyName); $htmlAttributes = ($htmlAttributes === null ? array() : $htmlAttributes); $tag =...
[ "public", "static", "function", "validationMessage", "(", "$", "propertyName", ",", "$", "validationMessage", "=", "null", ",", "$", "tag", "=", "'span'", ",", "$", "htmlAttributes", "=", "array", "(", ")", ")", "{", "$", "propertyName", "=", "(", "is_arra...
Gets a validation message if an error exists for the specified field. @param string|array $propertyName The name of the property that is being validated. It can be a string or an array. If an array is specified, the property chain in the model will be searched. For example: array('A', 'B') is $model->A->B. @param stri...
[ "Gets", "a", "validation", "message", "if", "an", "error", "exists", "for", "the", "specified", "field", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Html.php#L172-L197
189,165
php-mvc-project/php-mvc
src/Html.php
Html.view
public static function view($path, $model = null) { if (($viewPath = PathUtility::getViewFilePath($path)) !== false) { $viewResult = new ViewResult($viewPath, $model); $viewContext = InternalHelper::makeViewContext( $viewPath, self::$viewContext, ...
php
public static function view($path, $model = null) { if (($viewPath = PathUtility::getViewFilePath($path)) !== false) { $viewResult = new ViewResult($viewPath, $model); $viewContext = InternalHelper::makeViewContext( $viewPath, self::$viewContext, ...
[ "public", "static", "function", "view", "(", "$", "path", ",", "$", "model", "=", "null", ")", "{", "if", "(", "(", "$", "viewPath", "=", "PathUtility", "::", "getViewFilePath", "(", "$", "path", ")", ")", "!==", "false", ")", "{", "$", "viewResult",...
Returns the specified view as an HTML-encoded string. @param string $path The name or file path of the view. @param string $model The model. @return string
[ "Returns", "the", "specified", "view", "as", "an", "HTML", "-", "encoded", "string", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Html.php#L228-L247
189,166
php-mvc-project/php-mvc
src/Html.php
Html.action
public static function action($actionName, $controllerName = null, $routeValues = null, $fragment = null, $schema = null, $host = null) { return UrlHelper::action(self::$viewContext, $actionName, $controllerName, $routeValues, $fragment, $schema, $host); }
php
public static function action($actionName, $controllerName = null, $routeValues = null, $fragment = null, $schema = null, $host = null) { return UrlHelper::action(self::$viewContext, $actionName, $controllerName, $routeValues, $fragment, $schema, $host); }
[ "public", "static", "function", "action", "(", "$", "actionName", ",", "$", "controllerName", "=", "null", ",", "$", "routeValues", "=", "null", ",", "$", "fragment", "=", "null", ",", "$", "schema", "=", "null", ",", "$", "host", "=", "null", ")", "...
Returns the path to action. @param string $actionName The name of the action. @param string $controllerName The name of the controller. Default: current controller. @param array $routeValues An array that contains the parameters for a route. @param string $fragment The URL fragment name (the anchor name). @param strin...
[ "Returns", "the", "path", "to", "action", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Html.php#L261-L263
189,167
php-mvc-project/php-mvc
src/Html.php
Html.buildAttributes
private static function buildAttributes($htmlAttributes, $ignore = array()) { if (empty($htmlAttributes)) { return ''; } if ($ignore === null) { $ignore = array(); } $filtered = array_filter($htmlAttributes, function($key) use ($ignore) { ...
php
private static function buildAttributes($htmlAttributes, $ignore = array()) { if (empty($htmlAttributes)) { return ''; } if ($ignore === null) { $ignore = array(); } $filtered = array_filter($htmlAttributes, function($key) use ($ignore) { ...
[ "private", "static", "function", "buildAttributes", "(", "$", "htmlAttributes", ",", "$", "ignore", "=", "array", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "htmlAttributes", ")", ")", "{", "return", "''", ";", "}", "if", "(", "$", "ignore", "...
Generates HTML-attributes string. @param array $htmlAttributes Associative array of attributes. @param array $ignore List of attributes to ignore. @return string
[ "Generates", "HTML", "-", "attributes", "string", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Html.php#L822-L842
189,168
php-mvc-project/php-mvc
src/Html.php
Html.encodeHtmlAttributeString
private static function encodeHtmlAttributeString($value) { if ($value === null) { return ''; } $result = $value; $result = str_replace('&', '&amp;', $result); $result = str_replace('<', '&lt;', $result); $result = str_replace('"', '&quot;', $result); ...
php
private static function encodeHtmlAttributeString($value) { if ($value === null) { return ''; } $result = $value; $result = str_replace('&', '&amp;', $result); $result = str_replace('<', '&lt;', $result); $result = str_replace('"', '&quot;', $result); ...
[ "private", "static", "function", "encodeHtmlAttributeString", "(", "$", "value", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "return", "''", ";", "}", "$", "result", "=", "$", "value", ";", "$", "result", "=", "str_replace", "(", "'&'",...
Escapes special characters in the specified value for its use as the value of an HTML-attribute. @param string $value String to encode. @return string
[ "Escapes", "special", "characters", "in", "the", "specified", "value", "for", "its", "use", "as", "the", "value", "of", "an", "HTML", "-", "attribute", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Html.php#L851-L864
189,169
mmamedov/page-cache
src/Storage/FileSystem/FileSystemCacheAdapter.php
FileSystemCacheAdapter.getKeyPath
private function getKeyPath($key) { $this->validateKey($key); $file = sha1($key); $this->hashDirectory->processFile($file); return $this->hashDirectory->getFileStoragePath(); }
php
private function getKeyPath($key) { $this->validateKey($key); $file = sha1($key); $this->hashDirectory->processFile($file); return $this->hashDirectory->getFileStoragePath(); }
[ "private", "function", "getKeyPath", "(", "$", "key", ")", "{", "$", "this", "->", "validateKey", "(", "$", "key", ")", ";", "$", "file", "=", "sha1", "(", "$", "key", ")", ";", "$", "this", "->", "hashDirectory", "->", "processFile", "(", "$", "fi...
Make full cache file path for provided key @param string $key @return string @throws \Psr\SimpleCache\InvalidArgumentException @throws \PageCache\PageCacheException
[ "Make", "full", "cache", "file", "path", "for", "provided", "key" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Storage/FileSystem/FileSystemCacheAdapter.php#L349-L355
189,170
mmamedov/page-cache
src/Storage/FileSystem/FileSystemCacheAdapter.php
FileSystemCacheAdapter.normalizeTtl
private function normalizeTtl($ttl) { if ($ttl === null) { return self::DEFAULT_TTL; // Default TTL is one hour } if (\is_int($ttl)) { return $ttl; } if ($ttl instanceof DateInterval) { $currentDateTime = new \DateTimeImmutable(); ...
php
private function normalizeTtl($ttl) { if ($ttl === null) { return self::DEFAULT_TTL; // Default TTL is one hour } if (\is_int($ttl)) { return $ttl; } if ($ttl instanceof DateInterval) { $currentDateTime = new \DateTimeImmutable(); ...
[ "private", "function", "normalizeTtl", "(", "$", "ttl", ")", "{", "if", "(", "$", "ttl", "===", "null", ")", "{", "return", "self", "::", "DEFAULT_TTL", ";", "// Default TTL is one hour", "}", "if", "(", "\\", "is_int", "(", "$", "ttl", ")", ")", "{", ...
Convert TTL to seconds @param int|DateInterval|null $ttl @return int @throws \PageCache\Storage\InvalidArgumentException
[ "Convert", "TTL", "to", "seconds" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Storage/FileSystem/FileSystemCacheAdapter.php#L398-L416
189,171
php-mvc-project/php-mvc
src/PathUtility.php
PathUtility.mapPath
public static function mapPath($virtualPath = null) { if (empty($virtualPath)) { return PHPMVC_ROOT_PATH; } if ($virtualPath[0] == '~' || $virtualPath[0] == '/') { $result = PHPMVC_ROOT_PATH; $result .= trim(substr($virtualPath, 1, strlen($virtualPath) - 1), ...
php
public static function mapPath($virtualPath = null) { if (empty($virtualPath)) { return PHPMVC_ROOT_PATH; } if ($virtualPath[0] == '~' || $virtualPath[0] == '/') { $result = PHPMVC_ROOT_PATH; $result .= trim(substr($virtualPath, 1, strlen($virtualPath) - 1), ...
[ "public", "static", "function", "mapPath", "(", "$", "virtualPath", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "virtualPath", ")", ")", "{", "return", "PHPMVC_ROOT_PATH", ";", "}", "if", "(", "$", "virtualPath", "[", "0", "]", "==", "'~'", ...
Converts a virtual path to an physical path. @param string $virtualPath The virtual path to convert to physical path. @return string
[ "Converts", "a", "virtual", "path", "to", "an", "physical", "path", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/PathUtility.php#L40-L57
189,172
php-mvc-project/php-mvc
src/PathUtility.php
PathUtility.isRelativePath
public static function isRelativePath($path) { if ($path[0] == '~' || $path[0] == '.') { return true; } if ($path[0] == '/' && !is_file($path) && !is_dir($path)) { return true; } return false; }
php
public static function isRelativePath($path) { if ($path[0] == '~' || $path[0] == '.') { return true; } if ($path[0] == '/' && !is_file($path) && !is_dir($path)) { return true; } return false; }
[ "public", "static", "function", "isRelativePath", "(", "$", "path", ")", "{", "if", "(", "$", "path", "[", "0", "]", "==", "'~'", "||", "$", "path", "[", "0", "]", "==", "'.'", ")", "{", "return", "true", ";", "}", "if", "(", "$", "path", "[", ...
Checks whether the specified path is relative or not. @param bool $path Path to check. @return bool
[ "Checks", "whether", "the", "specified", "path", "is", "relative", "or", "not", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/PathUtility.php#L66-L76
189,173
php-mvc-project/php-mvc
src/PathUtility.php
PathUtility.getFilePath
public static function getFilePath($path) { if (empty($path)) { return false; } if (is_file($path)) { return $path; } if (is_file($result = self::mapPath($path))) { return $result; } if (($result = self::appendPhpExtension($p...
php
public static function getFilePath($path) { if (empty($path)) { return false; } if (is_file($path)) { return $path; } if (is_file($result = self::mapPath($path))) { return $result; } if (($result = self::appendPhpExtension($p...
[ "public", "static", "function", "getFilePath", "(", "$", "path", ")", "{", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "return", "false", ";", "}", "if", "(", "is_file", "(", "$", "path", ")", ")", "{", "return", "$", "path", ";", "}", ...
Returns the physical path to an existing file. If no path is found, returns FALSE. @param string $path Relative or physical path. If no file is found on the specified path, an attempt will be made to add the extension .php to the specified path. @return string|bool
[ "Returns", "the", "physical", "path", "to", "an", "existing", "file", ".", "If", "no", "path", "is", "found", "returns", "FALSE", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/PathUtility.php#L117-L135
189,174
php-mvc-project/php-mvc
src/PathUtility.php
PathUtility.getViewFilePath
public static function getViewFilePath($path) { if (empty($path)) { return false; } if ((strpos($path, '/') !== false || strpos($path, '\\') !== false) && is_file($result = $path)) { return $result; } if (self::isRelativePath($path) && is_file($result = ...
php
public static function getViewFilePath($path) { if (empty($path)) { return false; } if ((strpos($path, '/') !== false || strpos($path, '\\') !== false) && is_file($result = $path)) { return $result; } if (self::isRelativePath($path) && is_file($result = ...
[ "public", "static", "function", "getViewFilePath", "(", "$", "path", ")", "{", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "return", "false", ";", "}", "if", "(", "(", "strpos", "(", "$", "path", ",", "'/'", ")", "!==", "false", "||", "s...
Searches for a file with a specified name and returns the correct path. If the file is not found, returns FALSE. @param string $path The file name or file path. @return string|bool
[ "Searches", "for", "a", "file", "with", "a", "specified", "name", "and", "returns", "the", "correct", "path", ".", "If", "the", "file", "is", "not", "found", "returns", "FALSE", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/PathUtility.php#L145-L171
189,175
php-mvc-project/php-mvc
src/Controller.php
Controller.view
protected function view($viewOrModel = null, $model = null, $layout = null) { return new ViewResult($viewOrModel, $model, $layout); }
php
protected function view($viewOrModel = null, $model = null, $layout = null) { return new ViewResult($viewOrModel, $model, $layout); }
[ "protected", "function", "view", "(", "$", "viewOrModel", "=", "null", ",", "$", "model", "=", "null", ",", "$", "layout", "=", "null", ")", "{", "return", "new", "ViewResult", "(", "$", "viewOrModel", ",", "$", "model", ",", "$", "layout", ")", ";",...
Creates a ViewResult object that renders a view to the response. @param string|object|null $viewOrModel View name or model. @param object|null $model Model. @param string|null $layout Layout file name or path. @return ViewResult
[ "Creates", "a", "ViewResult", "object", "that", "renders", "a", "view", "to", "the", "response", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Controller.php#L133-L135
189,176
php-mvc-project/php-mvc
src/Controller.php
Controller.file
protected function file($path, $contentType = null, $downloadName = null) { return new FileResult($path, $contentType, $downloadName); }
php
protected function file($path, $contentType = null, $downloadName = null) { return new FileResult($path, $contentType, $downloadName); }
[ "protected", "function", "file", "(", "$", "path", ",", "$", "contentType", "=", "null", ",", "$", "downloadName", "=", "null", ")", "{", "return", "new", "FileResult", "(", "$", "path", ",", "$", "contentType", ",", "$", "downloadName", ")", ";", "}" ...
Creates a FileResult object by using the file contents and file type. @param string $path The file path to output. @param string $contentType The content type. @param string|bool $downloadName the content-disposition header so that a file-download dialog box is displayed in the browser with the specified file name. @...
[ "Creates", "a", "FileResult", "object", "by", "using", "the", "file", "contents", "and", "file", "type", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/Controller.php#L163-L165
189,177
php-mvc-project/php-mvc
src/AppContext.php
AppContext.setConfig
public function setConfig($configOrKey, $config = null) { if ($config !== null) { $this->config[$configOrKey] = $config; } else { $this->config = ($configOrKey !== null ? $configOrKey : array()); } }
php
public function setConfig($configOrKey, $config = null) { if ($config !== null) { $this->config[$configOrKey] = $config; } else { $this->config = ($configOrKey !== null ? $configOrKey : array()); } }
[ "public", "function", "setConfig", "(", "$", "configOrKey", ",", "$", "config", "=", "null", ")", "{", "if", "(", "$", "config", "!==", "null", ")", "{", "$", "this", "->", "config", "[", "$", "configOrKey", "]", "=", "$", "config", ";", "}", "else...
Sets config. @param string|array $configOrKey The config or key to set. @param array $config The config to set. @return void
[ "Sets", "config", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppContext.php#L117-L124
189,178
php-mvc-project/php-mvc
src/AppContext.php
AppContext.add
public function add($eventName, $eventHandler, $key = null) { if (!is_callable($eventHandler)) { throw new \Exception('Function is expected.'); } if ($key !== null) { $this->{$eventName}[$key] = $eventHandler; } else { $this->{$eventName}[] = ...
php
public function add($eventName, $eventHandler, $key = null) { if (!is_callable($eventHandler)) { throw new \Exception('Function is expected.'); } if ($key !== null) { $this->{$eventName}[$key] = $eventHandler; } else { $this->{$eventName}[] = ...
[ "public", "function", "add", "(", "$", "eventName", ",", "$", "eventHandler", ",", "$", "key", "=", "null", ")", "{", "if", "(", "!", "is_callable", "(", "$", "eventHandler", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Function is expected.'...
Adds a handler. @param string $eventName The event name. @param callback $eventHandler The function of the handler. @param string $key The unique name of the handler. @return void
[ "Adds", "a", "handler", "." ]
2523373c1cd3d77da73126a7ed60311b6e251d3a
https://github.com/php-mvc-project/php-mvc/blob/2523373c1cd3d77da73126a7ed60311b6e251d3a/src/AppContext.php#L268-L279
189,179
mmamedov/page-cache
src/Config.php
Config.setConfigValues
private function setConfigValues() { if (isset($this->config['min_cache_file_size']) && is_numeric($this->config['min_cache_file_size'])) { $this->setMinCacheFileSize($this->config['min_cache_file_size']); } //Enable Log if (isset($this->config['enable_log']) && $this->i...
php
private function setConfigValues() { if (isset($this->config['min_cache_file_size']) && is_numeric($this->config['min_cache_file_size'])) { $this->setMinCacheFileSize($this->config['min_cache_file_size']); } //Enable Log if (isset($this->config['enable_log']) && $this->i...
[ "private", "function", "setConfigValues", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "config", "[", "'min_cache_file_size'", "]", ")", "&&", "is_numeric", "(", "$", "this", "->", "config", "[", "'min_cache_file_size'", "]", ")", ")", "{", ...
Reads config array and assigns config values @throws PageCacheException
[ "Reads", "config", "array", "and", "assigns", "config", "values" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Config.php#L119-L174
189,180
mmamedov/page-cache
src/Config.php
Config.setLogFilePath
public function setLogFilePath($logFilePath) { if (!$this->isParentDirectoryExists($logFilePath)) { throw new PageCacheException('Log file directory does not exist for the path provided ' . $logFilePath); } $this->logFilePath = $logFilePath; return $this;...
php
public function setLogFilePath($logFilePath) { if (!$this->isParentDirectoryExists($logFilePath)) { throw new PageCacheException('Log file directory does not exist for the path provided ' . $logFilePath); } $this->logFilePath = $logFilePath; return $this;...
[ "public", "function", "setLogFilePath", "(", "$", "logFilePath", ")", "{", "if", "(", "!", "$", "this", "->", "isParentDirectoryExists", "(", "$", "logFilePath", ")", ")", "{", "throw", "new", "PageCacheException", "(", "'Log file directory does not exist for the pa...
Set path for internal log file @param string $logFilePath @return Config for chaining @throws PageCacheException
[ "Set", "path", "for", "internal", "log", "file" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Config.php#L249-L258
189,181
mmamedov/page-cache
src/Config.php
Config.setCachePath
public function setCachePath($cachePath) { if (empty($cachePath) || !is_writable($cachePath)) { throw new PageCacheException(__METHOD__.' - Cache path not writable: '.$cachePath); } if (substr($cachePath, -1) !== '/') { throw new PageCacheException(__METHOD__.' - / tr...
php
public function setCachePath($cachePath) { if (empty($cachePath) || !is_writable($cachePath)) { throw new PageCacheException(__METHOD__.' - Cache path not writable: '.$cachePath); } if (substr($cachePath, -1) !== '/') { throw new PageCacheException(__METHOD__.' - / tr...
[ "public", "function", "setCachePath", "(", "$", "cachePath", ")", "{", "if", "(", "empty", "(", "$", "cachePath", ")", "||", "!", "is_writable", "(", "$", "cachePath", ")", ")", "{", "throw", "new", "PageCacheException", "(", "__METHOD__", ".", "' - Cache ...
Set cache path directory @param string $cachePath Full path of cache files @return Config for chaining @throws PageCacheException
[ "Set", "cache", "path", "directory" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Config.php#L301-L311
189,182
mmamedov/page-cache
src/Config.php
Config.setUseSession
public function setUseSession($useSession) { $this->useSession = (bool)$useSession; if ($useSession) { SessionHandler::enable(); } else { SessionHandler::disable(); } return $this; }
php
public function setUseSession($useSession) { $this->useSession = (bool)$useSession; if ($useSession) { SessionHandler::enable(); } else { SessionHandler::disable(); } return $this; }
[ "public", "function", "setUseSession", "(", "$", "useSession", ")", "{", "$", "this", "->", "useSession", "=", "(", "bool", ")", "$", "useSession", ";", "if", "(", "$", "useSession", ")", "{", "SessionHandler", "::", "enable", "(", ")", ";", "}", "else...
Enable or disable Session handeling in cache files @param bool $useSession @return Config for chaining
[ "Enable", "or", "disable", "Session", "handeling", "in", "cache", "files" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Config.php#L327-L336
189,183
mmamedov/page-cache
src/Strategy/MobileStrategy.php
MobileStrategy.currentMobile
private function currentMobile() { if (!$this->MobileDetect || !($this->MobileDetect instanceof \Mobile_Detect)) { return false; } //for phones only, not tablets //create your own Strategy if needed, and change this functionality return $this->MobileDetect->isMob...
php
private function currentMobile() { if (!$this->MobileDetect || !($this->MobileDetect instanceof \Mobile_Detect)) { return false; } //for phones only, not tablets //create your own Strategy if needed, and change this functionality return $this->MobileDetect->isMob...
[ "private", "function", "currentMobile", "(", ")", "{", "if", "(", "!", "$", "this", "->", "MobileDetect", "||", "!", "(", "$", "this", "->", "MobileDetect", "instanceof", "\\", "Mobile_Detect", ")", ")", "{", "return", "false", ";", "}", "//for phones only...
Whether current page was accessed from a mobile phone @return bool true for phones, else false
[ "Whether", "current", "page", "was", "accessed", "from", "a", "mobile", "phone" ]
8b41cea121c3687b2e485bd9ab17ed4ede222754
https://github.com/mmamedov/page-cache/blob/8b41cea121c3687b2e485bd9ab17ed4ede222754/src/Strategy/MobileStrategy.php#L70-L79
189,184
thephpleague/omnipay-securepay
src/Message/SecureXMLResponse.php
SecureXMLResponse.isSuccessful
public function isSuccessful() { // As per appendix F, 000 means the message was processed correctly if ((string) $this->data->Status->statusCode !== '000' || ($this->hasTransaction() && (string) $this->data->Payment->TxnList->Txn->approved !== 'Yes')) { retur...
php
public function isSuccessful() { // As per appendix F, 000 means the message was processed correctly if ((string) $this->data->Status->statusCode !== '000' || ($this->hasTransaction() && (string) $this->data->Payment->TxnList->Txn->approved !== 'Yes')) { retur...
[ "public", "function", "isSuccessful", "(", ")", "{", "// As per appendix F, 000 means the message was processed correctly", "if", "(", "(", "string", ")", "$", "this", "->", "data", "->", "Status", "->", "statusCode", "!==", "'000'", "||", "(", "$", "this", "->", ...
Determine if the transaction is successful or not. @note Rather than using HTTP status codes, the SecureXML API returns a status code as part of the response if there is an internal API issue. @return bool
[ "Determine", "if", "the", "transaction", "is", "successful", "or", "not", "." ]
f1dc0d1e41b41baccc42cb1202f650be8121878f
https://github.com/thephpleague/omnipay-securepay/blob/f1dc0d1e41b41baccc42cb1202f650be8121878f/src/Message/SecureXMLResponse.php#L17-L27
189,185
thephpleague/omnipay-securepay
src/Message/SecureXMLAbstractRequest.php
SecureXMLAbstractRequest.getMessageId
public function getMessageId() { $messageId = $this->getParameter('messageId'); if (empty($messageId)) { $this->setMessageId(substr(md5(microtime()), 0, 30)); } return $this->getParameter('messageId'); }
php
public function getMessageId() { $messageId = $this->getParameter('messageId'); if (empty($messageId)) { $this->setMessageId(substr(md5(microtime()), 0, 30)); } return $this->getParameter('messageId'); }
[ "public", "function", "getMessageId", "(", ")", "{", "$", "messageId", "=", "$", "this", "->", "getParameter", "(", "'messageId'", ")", ";", "if", "(", "empty", "(", "$", "messageId", ")", ")", "{", "$", "this", "->", "setMessageId", "(", "substr", "("...
Get the messageID for the request. @return string User-supplied messageID or generated one based on timestamp.
[ "Get", "the", "messageID", "for", "the", "request", "." ]
f1dc0d1e41b41baccc42cb1202f650be8121878f
https://github.com/thephpleague/omnipay-securepay/blob/f1dc0d1e41b41baccc42cb1202f650be8121878f/src/Message/SecureXMLAbstractRequest.php#L47-L56
189,186
thephpleague/omnipay-securepay
src/Message/SecureXMLAbstractRequest.php
SecureXMLAbstractRequest.getBaseXML
protected function getBaseXML() { foreach ($this->requiredFields as $field) { $this->validate($field); } $xml = new \SimpleXMLElement('<SecurePayMessage/>'); $messageInfo = $xml->addChild('MessageInfo'); $messageInfo->messageID = $this->getMessageId(); $...
php
protected function getBaseXML() { foreach ($this->requiredFields as $field) { $this->validate($field); } $xml = new \SimpleXMLElement('<SecurePayMessage/>'); $messageInfo = $xml->addChild('MessageInfo'); $messageInfo->messageID = $this->getMessageId(); $...
[ "protected", "function", "getBaseXML", "(", ")", "{", "foreach", "(", "$", "this", "->", "requiredFields", "as", "$", "field", ")", "{", "$", "this", "->", "validate", "(", "$", "field", ")", ";", "}", "$", "xml", "=", "new", "\\", "SimpleXMLElement", ...
XML Template of a SecurePayMessage. As per section 5.1 of the documentation, these elements are common to all requests. @return \SimpleXMLElement SecurePayMessage template.
[ "XML", "Template", "of", "a", "SecurePayMessage", "." ]
f1dc0d1e41b41baccc42cb1202f650be8121878f
https://github.com/thephpleague/omnipay-securepay/blob/f1dc0d1e41b41baccc42cb1202f650be8121878f/src/Message/SecureXMLAbstractRequest.php#L75-L96
189,187
thephpleague/omnipay-securepay
src/Message/SecureXMLAbstractRequest.php
SecureXMLAbstractRequest.getBasePaymentXML
protected function getBasePaymentXML() { $xml = $this->getBaseXML(); $payment = $xml->addChild('Payment'); $txnList = $payment->addChild('TxnList'); $txnList->addAttribute('count', 1); // One transaction per request supported by current API. $transaction = $txnList->addChil...
php
protected function getBasePaymentXML() { $xml = $this->getBaseXML(); $payment = $xml->addChild('Payment'); $txnList = $payment->addChild('TxnList'); $txnList->addAttribute('count', 1); // One transaction per request supported by current API. $transaction = $txnList->addChil...
[ "protected", "function", "getBasePaymentXML", "(", ")", "{", "$", "xml", "=", "$", "this", "->", "getBaseXML", "(", ")", ";", "$", "payment", "=", "$", "xml", "->", "addChild", "(", "'Payment'", ")", ";", "$", "txnList", "=", "$", "payment", "->", "a...
XML template of a SecurePayMessage Payment. @return \SimpleXMLElement SecurePayMessage with transaction details.
[ "XML", "template", "of", "a", "SecurePayMessage", "Payment", "." ]
f1dc0d1e41b41baccc42cb1202f650be8121878f
https://github.com/thephpleague/omnipay-securepay/blob/f1dc0d1e41b41baccc42cb1202f650be8121878f/src/Message/SecureXMLAbstractRequest.php#L103-L120
189,188
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Storage/Decorator/ArrayDecorator.php
ArrayDecorator.loadStatus
public function loadStatus($serviceName, $attributeName) { // make sure we have the values loaded (request time cache of all service stats) $this->loadStatsArray(); // return if (isset($this->stats[$serviceName][$attributeName])) { return $this->stats[$serviceName][$att...
php
public function loadStatus($serviceName, $attributeName) { // make sure we have the values loaded (request time cache of all service stats) $this->loadStatsArray(); // return if (isset($this->stats[$serviceName][$attributeName])) { return $this->stats[$serviceName][$att...
[ "public", "function", "loadStatus", "(", "$", "serviceName", ",", "$", "attributeName", ")", "{", "// make sure we have the values loaded (request time cache of all service stats)\r", "$", "this", "->", "loadStatsArray", "(", ")", ";", "// return \r", "if", "(", "isset", ...
Loads circuit breaker service status values from array. Only one remote call for all services. @param string $serviceName name of service to load stats for @param string $attributeName name of attribute to load @return string value stored or '' if value was not found @throws Ejsmont\CircuitBreaker\Storage\Sto...
[ "Loads", "circuit", "breaker", "service", "status", "values", "from", "array", ".", "Only", "one", "remote", "call", "for", "all", "services", "." ]
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Storage/Decorator/ArrayDecorator.php#L88-L97
189,189
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Storage/Decorator/ArrayDecorator.php
ArrayDecorator.saveStatus
public function saveStatus($serviceName, $attributeName, $value, $flush = false) { // before writing we load the data no matter what $this->loadStatsArray(); // if this service is unknown add it to dirty array $this->dirtyStats[$serviceName][$attributeName] = $value; $this...
php
public function saveStatus($serviceName, $attributeName, $value, $flush = false) { // before writing we load the data no matter what $this->loadStatsArray(); // if this service is unknown add it to dirty array $this->dirtyStats[$serviceName][$attributeName] = $value; $this...
[ "public", "function", "saveStatus", "(", "$", "serviceName", ",", "$", "attributeName", ",", "$", "value", ",", "$", "flush", "=", "false", ")", "{", "// before writing we load the data no matter what\r", "$", "this", "->", "loadStatsArray", "(", ")", ";", "// i...
We reload values just before saving to reduce race condition time. The updated values are merged with previous values. Then everything is stored back into the storage @param string $serviceName name of service to load stats for @param string $attributeName name of the attribute to load @param string $value ...
[ "We", "reload", "values", "just", "before", "saving", "to", "reduce", "race", "condition", "time", ".", "The", "updated", "values", "are", "merged", "with", "previous", "values", ".", "Then", "everything", "is", "stored", "back", "into", "the", "storage" ]
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Storage/Decorator/ArrayDecorator.php#L112-L138
189,190
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Storage/Decorator/ArrayDecorator.php
ArrayDecorator.loadStatsArray
protected function loadStatsArray() { if (!is_array($this->stats)) { $stats = $this->instance->loadStatus($this->cacheKeyPrefix, $this->cacheKeySuffix); if (!empty($stats)) { $this->stats = unserialize($stats); } // make sure unserialize an...
php
protected function loadStatsArray() { if (!is_array($this->stats)) { $stats = $this->instance->loadStatus($this->cacheKeyPrefix, $this->cacheKeySuffix); if (!empty($stats)) { $this->stats = unserialize($stats); } // make sure unserialize an...
[ "protected", "function", "loadStatsArray", "(", ")", "{", "if", "(", "!", "is_array", "(", "$", "this", "->", "stats", ")", ")", "{", "$", "stats", "=", "$", "this", "->", "instance", "->", "loadStatus", "(", "$", "this", "->", "cacheKeyPrefix", ",", ...
Method that actually loads the stats array from wrapped instance. Loads stats only if need to be loaded. @return void
[ "Method", "that", "actually", "loads", "the", "stats", "array", "from", "wrapped", "instance", ".", "Loads", "stats", "only", "if", "need", "to", "be", "loaded", "." ]
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Storage/Decorator/ArrayDecorator.php#L146-L158
189,191
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Storage/Decorator/ArrayDecorator.php
ArrayDecorator.saveStatsArray
protected function saveStatsArray() { if (is_array($this->stats)) { $this->instance->saveStatus($this->cacheKeyPrefix, $this->cacheKeySuffix, serialize($this->stats), true); } }
php
protected function saveStatsArray() { if (is_array($this->stats)) { $this->instance->saveStatus($this->cacheKeyPrefix, $this->cacheKeySuffix, serialize($this->stats), true); } }
[ "protected", "function", "saveStatsArray", "(", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "stats", ")", ")", "{", "$", "this", "->", "instance", "->", "saveStatus", "(", "$", "this", "->", "cacheKeyPrefix", ",", "$", "this", "->", "cache...
Method that actually saves the stats array in wrapped instance. Saves only if there is dirty service data. @return void
[ "Method", "that", "actually", "saves", "the", "stats", "array", "in", "wrapped", "instance", ".", "Saves", "only", "if", "there", "is", "dirty", "service", "data", "." ]
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Storage/Decorator/ArrayDecorator.php#L166-L170
189,192
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Storage/Adapter/MemcachedAdapter.php
MemcachedAdapter.load
protected function load($key) { try { return $this->memcached->get($key); } catch (\Exception $e) { throw new StorageException("Failed to load memcached key: $key", 1, $e); } }
php
protected function load($key) { try { return $this->memcached->get($key); } catch (\Exception $e) { throw new StorageException("Failed to load memcached key: $key", 1, $e); } }
[ "protected", "function", "load", "(", "$", "key", ")", "{", "try", "{", "return", "$", "this", "->", "memcached", "->", "get", "(", "$", "key", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "throw", "new", "StorageException", ...
Loads item by cache key. @param string $key @return mixed @throws Ejsmont\CircuitBreaker\Storage\StorageException if storage error occurs, handler can not be used
[ "Loads", "item", "by", "cache", "key", "." ]
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Storage/Adapter/MemcachedAdapter.php#L62-L68
189,193
middlewares/http-authentication
src/BasicAuthentication.php
BasicAuthentication.login
private function login(ServerRequestInterface $request) { //Check header $authorization = $this->parseHeader($request->getHeaderLine('Authorization')); if (!$authorization) { return false; } //Check the user if (!isset($this->users[$authorization['userna...
php
private function login(ServerRequestInterface $request) { //Check header $authorization = $this->parseHeader($request->getHeaderLine('Authorization')); if (!$authorization) { return false; } //Check the user if (!isset($this->users[$authorization['userna...
[ "private", "function", "login", "(", "ServerRequestInterface", "$", "request", ")", "{", "//Check header", "$", "authorization", "=", "$", "this", "->", "parseHeader", "(", "$", "request", "->", "getHeaderLine", "(", "'Authorization'", ")", ")", ";", "if", "("...
Check the user credentials and return the username or false. @return false|string
[ "Check", "the", "user", "credentials", "and", "return", "the", "username", "or", "false", "." ]
a91a5909ec6be91192dbfaccc487afcd434be58a
https://github.com/middlewares/http-authentication/blob/a91a5909ec6be91192dbfaccc487afcd434be58a/src/BasicAuthentication.php#L48-L67
189,194
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Storage/Adapter/DummyAdapter.php
DummyAdapter.loadStatus
public function loadStatus($serviceName, $attributeName) { if (isset($this->data[$serviceName][$attributeName])) { return $this->data[$serviceName][$attributeName]; } return ""; }
php
public function loadStatus($serviceName, $attributeName) { if (isset($this->data[$serviceName][$attributeName])) { return $this->data[$serviceName][$attributeName]; } return ""; }
[ "public", "function", "loadStatus", "(", "$", "serviceName", ",", "$", "attributeName", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "data", "[", "$", "serviceName", "]", "[", "$", "attributeName", "]", ")", ")", "{", "return", "$", "this", ...
Loads circuit breaker service status value. @param string $serviceName name of service to load stats for @param string $attributeName name of attribute to load @return string value stored or '' if value was not found
[ "Loads", "circuit", "breaker", "service", "status", "value", "." ]
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Storage/Adapter/DummyAdapter.php#L42-L47
189,195
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Storage/Adapter/DummyAdapter.php
DummyAdapter.saveStatus
public function saveStatus($serviceName, $attributeName, $value, $flush = false) { $this->data[$serviceName][$attributeName] = $value; }
php
public function saveStatus($serviceName, $attributeName, $value, $flush = false) { $this->data[$serviceName][$attributeName] = $value; }
[ "public", "function", "saveStatus", "(", "$", "serviceName", ",", "$", "attributeName", ",", "$", "value", ",", "$", "flush", "=", "false", ")", "{", "$", "this", "->", "data", "[", "$", "serviceName", "]", "[", "$", "attributeName", "]", "=", "$", "...
Saves circuit breaker service status value. @param string $serviceName name of service to load stats for @param string $attributeName name of the attribute to load @param string $value string value loaded or '' if nothing found @param boolean $flush set to true will force immediate save, fals...
[ "Saves", "circuit", "breaker", "service", "status", "value", "." ]
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Storage/Adapter/DummyAdapter.php#L58-L60
189,196
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Factory.php
Factory.getMemcachedInstance
public static function getMemcachedInstance(\Memcached $memcached, $maxFailures = 20, $retryTimeout = 30) { $storage = new ArrayDecorator(new MemcachedAdapter($memcached)); return new CircuitBreaker($storage, $maxFailures, $retryTimeout); }
php
public static function getMemcachedInstance(\Memcached $memcached, $maxFailures = 20, $retryTimeout = 30) { $storage = new ArrayDecorator(new MemcachedAdapter($memcached)); return new CircuitBreaker($storage, $maxFailures, $retryTimeout); }
[ "public", "static", "function", "getMemcachedInstance", "(", "\\", "Memcached", "$", "memcached", ",", "$", "maxFailures", "=", "20", ",", "$", "retryTimeout", "=", "30", ")", "{", "$", "storage", "=", "new", "ArrayDecorator", "(", "new", "MemcachedAdapter", ...
Creates a circuit breaker with same settings for all services using memcached instance as a backend @param Memcached $memcached instance of a connected Memcached object @param int $maxFailures how many times do we allow service to fail before considering it offline @param int $retryTimeout how ma...
[ "Creates", "a", "circuit", "breaker", "with", "same", "settings", "for", "all", "services", "using", "memcached", "instance", "as", "a", "backend" ]
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Factory.php#L67-L70
189,197
middlewares/http-authentication
src/DigestAuthentication.php
DigestAuthentication.isValid
private function isValid(array $authorization, string $method, string $password): bool { $validResponse = md5(sprintf( '%s:%s:%s:%s:%s:%s', md5(sprintf('%s:%s:%s', $authorization['username'], $this->realm, $password)), $authorization['nonce'], $authorization['...
php
private function isValid(array $authorization, string $method, string $password): bool { $validResponse = md5(sprintf( '%s:%s:%s:%s:%s:%s', md5(sprintf('%s:%s:%s', $authorization['username'], $this->realm, $password)), $authorization['nonce'], $authorization['...
[ "private", "function", "isValid", "(", "array", "$", "authorization", ",", "string", "$", "method", ",", "string", "$", "password", ")", ":", "bool", "{", "$", "validResponse", "=", "md5", "(", "sprintf", "(", "'%s:%s:%s:%s:%s:%s'", ",", "md5", "(", "sprin...
Validates the authorization.
[ "Validates", "the", "authorization", "." ]
a91a5909ec6be91192dbfaccc487afcd434be58a
https://github.com/middlewares/http-authentication/blob/a91a5909ec6be91192dbfaccc487afcd434be58a/src/DigestAuthentication.php#L95-L108
189,198
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Storage/Adapter/BaseAdapter.php
BaseAdapter.loadStatus
public function loadStatus($serviceName, $attributeName) { // make sure extension is loaded $this->checkExtension(); // try to load the data $stats = $this->load($this->cachePrefix . $serviceName . $attributeName); // if the value loaded is empty return empty string ...
php
public function loadStatus($serviceName, $attributeName) { // make sure extension is loaded $this->checkExtension(); // try to load the data $stats = $this->load($this->cachePrefix . $serviceName . $attributeName); // if the value loaded is empty return empty string ...
[ "public", "function", "loadStatus", "(", "$", "serviceName", ",", "$", "attributeName", ")", "{", "// make sure extension is loaded\r", "$", "this", "->", "checkExtension", "(", ")", ";", "// try to load the data\r", "$", "stats", "=", "$", "this", "->", "load", ...
Loads circuit breaker service status value. For example failures count or last retry time. Method does not care what are the attribute names. They are not inspected. Any string can be passed as service name and attribute name. @param string $serviceName name of service to load stats for @param string $attributeN...
[ "Loads", "circuit", "breaker", "service", "status", "value", ".", "For", "example", "failures", "count", "or", "last", "retry", "time", ".", "Method", "does", "not", "care", "what", "are", "the", "attribute", "names", ".", "They", "are", "not", "inspected", ...
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Storage/Adapter/BaseAdapter.php#L61-L71
189,199
ejsmont-artur/php-circuit-breaker
src/Ejsmont/CircuitBreaker/Core/CircuitBreaker.php
CircuitBreaker.setServiceSettings
public function setServiceSettings($serviceName, $maxFailures, $retryTimeout) { $this->settings[$serviceName] = array( 'maxFailures' => $maxFailures ? $maxFailures : $this->defaultMaxFailures, 'retryTimeout' => $retryTimeout ? $retryTimeout : $this->defaultRetryTimeout, ); ...
php
public function setServiceSettings($serviceName, $maxFailures, $retryTimeout) { $this->settings[$serviceName] = array( 'maxFailures' => $maxFailures ? $maxFailures : $this->defaultMaxFailures, 'retryTimeout' => $retryTimeout ? $retryTimeout : $this->defaultRetryTimeout, ); ...
[ "public", "function", "setServiceSettings", "(", "$", "serviceName", ",", "$", "maxFailures", ",", "$", "retryTimeout", ")", "{", "$", "this", "->", "settings", "[", "$", "serviceName", "]", "=", "array", "(", "'maxFailures'", "=>", "$", "maxFailures", "?", ...
Use this method only if you want to add server specific threshold and retry timeout. @param StorageInterface $storage storage implementation @param int $maxFailures default threshold, if service fails this many times will be disabled @param int $retryTimeout how many seconds should we w...
[ "Use", "this", "method", "only", "if", "you", "want", "to", "add", "server", "specific", "threshold", "and", "retry", "timeout", "." ]
e733eddfa28b4e42ae34836b07ae149b273b90bd
https://github.com/ejsmont-artur/php-circuit-breaker/blob/e733eddfa28b4e42ae34836b07ae149b273b90bd/src/Ejsmont/CircuitBreaker/Core/CircuitBreaker.php#L73-L79