@@ -60,8 +60,8 @@ |
||
| 60 | 60 | * Convert to bash color |
| 61 | 61 | * |
| 62 | 62 | * @param string $string |
| 63 | - * @param string $forderground_color |
|
| 64 | - * @param string $backgrond_coilor |
|
| 63 | + * @param string $foreground_color |
|
| 64 | + * @param string $background_color |
|
| 65 | 65 | * @return string |
| 66 | 66 | */ |
| 67 | 67 | public function getColoredString(string $string, string $foreground_color = null, string $background_color = null): string |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -70,15 +70,15 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // Check if given foreground color found |
| 72 | 72 | if (isset($this->foreground_colors[$foreground_color])) { |
| 73 | - $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; |
|
| 73 | + $colored_string .= "\033[".$this->foreground_colors[$foreground_color]."m"; |
|
| 74 | 74 | } |
| 75 | 75 | // Check if given background color found |
| 76 | 76 | if (isset($this->background_colors[$background_color])) { |
| 77 | - $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; |
|
| 77 | + $colored_string .= "\033[".$this->background_colors[$background_color]."m"; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // Add string and end coloring |
| 81 | - $colored_string .= $string . "\033[0m"; |
|
| 81 | + $colored_string .= $string."\033[0m"; |
|
| 82 | 82 | |
| 83 | 83 | return $colored_string; |
| 84 | 84 | } |
@@ -39,7 +39,6 @@ |
||
| 39 | 39 | /** |
| 40 | 40 | * Set options |
| 41 | 41 | * |
| 42 | - * @param Iterable $options |
|
| 43 | 42 | * @return AdapterInterface |
| 44 | 43 | */ |
| 45 | 44 | public function setOptions(?Iterable $config=null) |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param Iterable $options |
| 43 | 43 | * @return AdapterInterface |
| 44 | 44 | */ |
| 45 | - public function setOptions(?Iterable $config=null) |
|
| 45 | + public function setOptions(? Iterable $config = null) |
|
| 46 | 46 | { |
| 47 | 47 | parent::setOptions($options); |
| 48 | 48 | |
@@ -196,7 +196,7 @@ |
||
| 196 | 196 | * @param string $date_format |
| 197 | 197 | * @param string $level |
| 198 | 198 | * @param array $context |
| 199 | - * @return void |
|
| 199 | + * @return string |
|
| 200 | 200 | */ |
| 201 | 201 | protected function _format(string $message, string $format, string $date_format, string $level, array $context=[]): string |
| 202 | 202 | { |
@@ -164,7 +164,7 @@ |
||
| 164 | 164 | foreach ($this->adapter as $adapter) { |
| 165 | 165 | $prio = $adapter->getLevel(); |
| 166 | 166 | |
| 167 | - if (self::PRIORITIES[$level] <= $prio) { |
|
| 167 | + if (self::PRIORITIES[$level] <= $prio) { |
|
| 168 | 168 | $msg = $this->_format($message, $adapter->getFormat(), $adapter->getDateFormat(), $level, $context); |
| 169 | 169 | $adapter->log($level, $msg); |
| 170 | 170 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param Iterable $config |
| 56 | 56 | * @return void |
| 57 | 57 | */ |
| 58 | - public function __construct(?Iterable $config=null) |
|
| 58 | + public function __construct(? Iterable $config = null) |
|
| 59 | 59 | { |
| 60 | 60 | $this->setOptions($config); |
| 61 | 61 | } |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | * @param Iterable $config |
| 68 | 68 | * @return Logger |
| 69 | 69 | */ |
| 70 | - public function setOptions(?Iterable $config=null) |
|
| 70 | + public function setOptions(? Iterable $config = null) |
|
| 71 | 71 | { |
| 72 | - if($config === null) { |
|
| 72 | + if ($config === null) { |
|
| 73 | 73 | return $this; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - foreach($config as $option => $value) { |
|
| 77 | - if(isset($value['enabled']) && $value['enabled'] === '1') { |
|
| 76 | + foreach ($config as $option => $value) { |
|
| 77 | + if (isset($value['enabled']) && $value['enabled'] === '1') { |
|
| 78 | 78 | $this->addAdapter($option, $value['class'], $value['config']); |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | * @param Iterable $config |
| 92 | 92 | * @return AdapterInterface |
| 93 | 93 | */ |
| 94 | - public function addAdapter(string $name, string $class, ?Iterable $config=null): AdapterInterface |
|
| 94 | + public function addAdapter(string $name, string $class, ? Iterable $config = null) : AdapterInterface |
|
| 95 | 95 | { |
| 96 | - if(isset($this->adapter[$name])) { |
|
| 96 | + if (isset($this->adapter[$name])) { |
|
| 97 | 97 | throw new Exception\InvalidArgument('log adapter '.$name.' is already registered'); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $adapter = new $class($config); |
| 101 | - if(!($adapter instanceof AdapterInterface)) { |
|
| 101 | + if (!($adapter instanceof AdapterInterface)) { |
|
| 102 | 102 | throw new Exception\InvalidArgument('log adapter must include AdapterInterface interface'); |
| 103 | 103 | } |
| 104 | 104 | $this->adapter[$name] = $adapter; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function getAdapter(string $name): AdapterInterface |
| 116 | 116 | { |
| 117 | - if(!isset($this->adapter[$name])) { |
|
| 117 | + if (!isset($this->adapter[$name])) { |
|
| 118 | 118 | throw new Exception('log adapter '.$name.' is not registered'); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | * @param array $adapters |
| 129 | 129 | * @return array |
| 130 | 130 | */ |
| 131 | - public function getAdapters(array $adapters=[]): array |
|
| 131 | + public function getAdapters(array $adapters = []): array |
|
| 132 | 132 | { |
| 133 | - if(empty($adapter)) { |
|
| 133 | + if (empty($adapter)) { |
|
| 134 | 134 | return $this->adapter; |
| 135 | 135 | } else { |
| 136 | 136 | $list = []; |
| 137 | - foreach($adapter as $name) { |
|
| 138 | - if(!isset($this->adapter[$name])) { |
|
| 137 | + foreach ($adapter as $name) { |
|
| 138 | + if (!isset($this->adapter[$name])) { |
|
| 139 | 139 | throw new Exception('log adapter '.$name.' is not registered'); |
| 140 | 140 | } |
| 141 | 141 | $list[$name] = $this->adapter[$name]; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param array $context |
| 156 | 156 | * @return bool |
| 157 | 157 | */ |
| 158 | - public function log($level, $message, array $context=[]): bool |
|
| 158 | + public function log($level, $message, array $context = []): bool |
|
| 159 | 159 | { |
| 160 | 160 | if (!array_key_exists($level, self::PRIORITIES)) { |
| 161 | 161 | throw new Exception\InvalidArgument('log level '.$level.' is unkown'); |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | * @param array $context |
| 199 | 199 | * @return void |
| 200 | 200 | */ |
| 201 | - protected function _format(string $message, string $format, string $date_format, string $level, array $context=[]): string |
|
| 201 | + protected function _format(string $message, string $format, string $date_format, string $level, array $context = []): string |
|
| 202 | 202 | { |
| 203 | - $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) use ($message, $level, $date_format, $context) { |
|
| 203 | + $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) use ($message, $level, $date_format, $context) { |
|
| 204 | 204 | $key = ''; |
| 205 | 205 | $context = array_merge($this->context, $context); |
| 206 | 206 | |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | $replace = []; |
| 224 | 224 | foreach ($context as $key => $val) { |
| 225 | 225 | if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) { |
| 226 | - $replace['{' . $key . '}'] = $val; |
|
| 226 | + $replace['{'.$key.'}'] = $val; |
|
| 227 | 227 | } else { |
| 228 | - $replace['{' . $key . '}'] = json_encode($val); |
|
| 228 | + $replace['{'.$key.'}'] = json_encode($val); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param array $params |
| 73 | 73 | * @return void |
| 74 | 74 | */ |
| 75 | - public function __construct(string $path, $class, ?string $method=null, array $params=[]) |
|
| 75 | + public function __construct(string $path, $class, ? string $method = null, array $params = []) |
|
| 76 | 76 | { |
| 77 | 77 | $this->setPath($path); |
| 78 | 78 | $this->setClass($class); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function match(): bool |
| 90 | 90 | { |
| 91 | - $regex = preg_replace_callback('#({([A-Z0-9a-z]+)\:\#(.+?)\#})|\{(.+?)\}#', function ($match) { |
|
| 91 | + $regex = preg_replace_callback('#({([A-Z0-9a-z]+)\:\#(.+?)\#})|\{(.+?)\}#', function($match) { |
|
| 92 | 92 | if (count($match) === 4) { |
| 93 | 93 | return '(?<'.$match[2].'>'.$match[3].'+)'; |
| 94 | 94 | } else { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param array $constructor |
| 118 | 118 | * @return array |
| 119 | 119 | */ |
| 120 | - public function getCallable($constructor=[]): array |
|
| 120 | + public function getCallable($constructor = []): array |
|
| 121 | 121 | { |
| 122 | 122 | if (is_object($this->class)) { |
| 123 | 123 | $instance = $this->class; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param string $name |
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | - protected function _buildMethodName(?string $name): string |
|
| 142 | + protected function _buildMethodName(? string $name) : string |
|
| 143 | 143 | { |
| 144 | 144 | $result = $this->router->getVerb(); |
| 145 | 145 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param string $method |
| 265 | 265 | * @return Route |
| 266 | 266 | */ |
| 267 | - public function setMethod(?string $method): Route |
|
| 267 | + public function setMethod(? string $method) : Route |
|
| 268 | 268 | { |
| 269 | 269 | $this->method = $method; |
| 270 | 270 | return $this; |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * @param bool $next |
| 313 | 313 | * @return Route |
| 314 | 314 | */ |
| 315 | - public function continuePropagation($next=true): Route |
|
| 315 | + public function continuePropagation($next = true): Route |
|
| 316 | 316 | { |
| 317 | 317 | $this->continue_propagation = (bool)$next; |
| 318 | 318 | return $this; |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Micro |