@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * Get entire simplexml |
| 29 | 29 | * |
| 30 | - * @return mixed |
|
| 30 | + * @return \SimpleXMLElement |
|
| 31 | 31 | */ |
| 32 | 32 | public function getRaw(); |
| 33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * Get from config |
| 37 | 37 | * |
| 38 | 38 | * @param string $name |
| 39 | - * @return mixed |
|
| 39 | + * @return \SimpleXMLElement |
|
| 40 | 40 | */ |
| 41 | 41 | public function __get(string $name); |
| 42 | 42 | |
@@ -53,7 +53,6 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * Get native config format as config instance |
| 55 | 55 | * |
| 56 | - * @param mixed $config |
|
| 57 | 56 | * @return Config |
| 58 | 57 | */ |
| 59 | 58 | public function map($native=null): Config; |
@@ -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 |
@@ -56,5 +56,5 @@ discard block |
||
| 56 | 56 | * @param mixed $config |
| 57 | 57 | * @return Config |
| 58 | 58 | */ |
| 59 | - public function map($native=null): Config; |
|
| 59 | + public function map($native = null): Config; |
|
| 60 | 60 | } |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | /** |
| 82 | 82 | * Merge xml tree's |
| 83 | 83 | * |
| 84 | - * @param SimpleXMLElement $simmplexml_to |
|
| 84 | + * @param SimpleXMLElement $simplexml_to |
|
| 85 | 85 | * @param SimpleXMLElement $simplexml_from |
| 86 | 86 | * @param bool $replace |
| 87 | 87 | * @return bool |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | if (!isset($simplexml_to->{$simplexml_child->getName()})) { |
| 109 | 109 | $simplexml_to->addChild($simplexml_child->getName(), htmlspecialchars((string)$simplexml_child)); |
| 110 | 110 | } elseif($replace === true && count($simplexml_to->{$simplexml_child->getName()}->children()) === 0) { |
| 111 | - $simplexml_to->{$simplexml_child->getName()} = htmlspecialchars((string)$simplexml_child); |
|
| 111 | + $simplexml_to->{$simplexml_child->getName()} = htmlspecialchars((string)$simplexml_child); |
|
| 112 | 112 | } |
| 113 | 113 | } else { |
| 114 | 114 | $this->appendSimplexml($simplexml_to->{$simplexml_child->getName()}, $simplexml_child, $replace); |
@@ -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 |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string $env |
| 31 | 31 | * @return void |
| 32 | 32 | */ |
| 33 | - public function __construct(string $config, string $env='production') |
|
| 33 | + public function __construct(string $config, string $env = 'production') |
|
| 34 | 34 | { |
| 35 | 35 | $config = simplexml_load_file($config); |
| 36 | 36 | if ($this->store === false) { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | while (list(, $node) = each($result)) { |
| 50 | 50 | $path = (string)$node->attributes()->inherits; |
| 51 | 51 | |
| 52 | - if($path === '') { |
|
| 52 | + if ($path === '') { |
|
| 53 | 53 | continue; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | * @param bool $replace |
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | - protected function appendSimplexml(SimpleXMLElement &$simplexml_to, SimpleXMLElement &$simplexml_from, bool $replace=true): bool |
|
| 89 | + protected function appendSimplexml(SimpleXMLElement&$simplexml_to, SimpleXMLElement&$simplexml_from, bool $replace = true): bool |
|
| 90 | 90 | { |
| 91 | - if(count($simplexml_from->children()) === 0) { |
|
| 92 | - if($replace === true && count($simplexml_to->children()) === 0) { |
|
| 91 | + if (count($simplexml_from->children()) === 0) { |
|
| 92 | + if ($replace === true && count($simplexml_to->children()) === 0) { |
|
| 93 | 93 | $simplexml_to[0] = htmlspecialchars((string)$simplexml_from); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | foreach ($simplexml_from->attributes() as $attr_key => $attr_value) { |
| 99 | 99 | if (!isset($attrs[$attr_key])) { |
| 100 | 100 | $simplexml_to->addAttribute($attr_key, (string)$attr_value); |
| 101 | - } elseif($replace===true) { |
|
| 101 | + } elseif ($replace === true) { |
|
| 102 | 102 | $simplexml_to->attributes()->{$attr_key} = (string)$attr_value; |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | if (count($simplexml_child->children()) === 0) { |
| 108 | 108 | if (!isset($simplexml_to->{$simplexml_child->getName()})) { |
| 109 | 109 | $simplexml_to->addChild($simplexml_child->getName(), htmlspecialchars((string)$simplexml_child)); |
| 110 | - } elseif($replace === true && count($simplexml_to->{$simplexml_child->getName()}->children()) === 0) { |
|
| 110 | + } elseif ($replace === true && count($simplexml_to->{$simplexml_child->getName()}->children()) === 0) { |
|
| 111 | 111 | $simplexml_to->{$simplexml_child->getName()} = htmlspecialchars((string)$simplexml_child); |
| 112 | 112 | } |
| 113 | 113 | } else { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | foreach ($simplexml_child->attributes() as $attr_key => $attr_value) { |
| 119 | 119 | if (!isset($attrs[$attr_key])) { |
| 120 | 120 | $simplexml_to->{$simplexml_child->getName()}->addAttribute($attr_key, (string)$attr_value); |
| 121 | - } elseif($replace===true) { |
|
| 121 | + } elseif ($replace === true) { |
|
| 122 | 122 | $simplexml_to->{$simplexml_child->getName()}->attributes()->{$attr_key} = (string)$attr_value; |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | while (list(, $node) = each($result)) { |
| 167 | 167 | $path = (string)$node->attributes()->reference; |
| 168 | 168 | |
| 169 | - if($path === '') { |
|
| 169 | + if ($path === '') { |
|
| 170 | 170 | continue; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @param SimpleXMLElement $xml |
| 191 | 191 | * @return Config |
| 192 | 192 | */ |
| 193 | - public function map($xml=null): Config |
|
| 193 | + public function map($xml = null): Config |
|
| 194 | 194 | { |
| 195 | 195 | if ($xml === null) { |
| 196 | 196 | $xml = $this->store; |
@@ -200,10 +200,10 @@ discard block |
||
| 200 | 200 | foreach ($xml->getNamespaces() + array(null) as $prefix => $namespace) { |
| 201 | 201 | foreach ($xml->attributes($namespace) as $key => $value) { |
| 202 | 202 | if (is_string($prefix)) { |
| 203 | - $key = $prefix . '.' . $key; |
|
| 203 | + $key = $prefix.'.'.$key; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if($key === 'reference') { |
|
| 206 | + if ($key === 'reference') { |
|
| 207 | 207 | continue; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | if (!isset($arr[$name])) { |
| 218 | 218 | $config[$name] = $value; |
| 219 | 219 | } else { |
| 220 | - foreach ((array) $value as $k => $v) { |
|
| 220 | + foreach ((array)$value as $k => $v) { |
|
| 221 | 221 | if (is_numeric($k)) { |
| 222 | 222 | $config[$name][] = $v; |
| 223 | 223 | } else { |
| 224 | 224 | $config[$name][$k] = array_merge( |
| 225 | - (array) $config[$name][$k], |
|
| 226 | - (array) $v |
|
| 225 | + (array)$config[$name][$k], |
|
| 226 | + (array)$v |
|
| 227 | 227 | ); |
| 228 | 228 | } |
| 229 | 229 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $config[$name] = new Config(); |
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | - if ($content = trim((string) $xml)) { |
|
| 235 | + if ($content = trim((string)$xml)) { |
|
| 236 | 236 | $config[] = $content; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | * Forward calls |
| 130 | 130 | * |
| 131 | 131 | * @param array $method |
| 132 | - * @param array $argumnets |
|
| 132 | + * @param array $arguments |
|
| 133 | 133 | * @return mixed |
| 134 | 134 | */ |
| 135 | 135 | public function __call(string $method, array $arguments=[]) |
@@ -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 |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param Iterable $config |
| 97 | 97 | * @param Logger $logger |
| 98 | 98 | */ |
| 99 | - public function __construct(?Iterable $config, Logger $logger) |
|
| 99 | + public function __construct(? Iterable $config, Logger $logger) |
|
| 100 | 100 | { |
| 101 | 101 | $this->setOptions($config); |
| 102 | 102 | $this->logger = $logger; |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | $this->connection->set_charset($this->charset); |
| 115 | 115 | |
| 116 | 116 | if (!$this->connection->connect_errno) { |
| 117 | - $this->logger->info('connection to mysql server [' . $this->host . '] was succesful', [ |
|
| 117 | + $this->logger->info('connection to mysql server ['.$this->host.'] was succesful', [ |
|
| 118 | 118 | 'category' => get_class($this), |
| 119 | 119 | ]); |
| 120 | 120 | } else { |
| 121 | - throw new Exception('failed to connect to mysql server, error: ' . $this->connection->connect_error.' ('.$this->connection->connect_errno.')'); |
|
| 121 | + throw new Exception('failed to connect to mysql server, error: '.$this->connection->connect_error.' ('.$this->connection->connect_errno.')'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | return $this; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param array $argumnets |
| 133 | 133 | * @return mixed |
| 134 | 134 | */ |
| 135 | - public function __call(string $method, array $arguments=[]) |
|
| 135 | + public function __call(string $method, array $arguments = []) |
|
| 136 | 136 | { |
| 137 | 137 | return call_user_func_array([&$this->connection, $method], $arguments); |
| 138 | 138 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @param Iterable $config |
| 145 | 145 | * @return Mysql |
| 146 | 146 | */ |
| 147 | - public function setOptions(?Iterable $config = null): Mysql |
|
| 147 | + public function setOptions(? Iterable $config = null) : Mysql |
|
| 148 | 148 | { |
| 149 | 149 | if ($config === null) { |
| 150 | 150 | return $this; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | $link = $this->getResource(); |
| 208 | 208 | $result = $link->query($query); |
| 209 | 209 | |
| 210 | - if($result === false) { |
|
| 210 | + if ($result === false) { |
|
| 211 | 211 | throw new Exception('failed to execute sql query with error '.$link->error.' ('.$link->errno.')'); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $link = $this->getResource(); |
| 231 | 231 | $result = $link->query($query); |
| 232 | 232 | |
| 233 | - if($result === false) { |
|
| 233 | + if ($result === false) { |
|
| 234 | 234 | throw new Exception('failed to execute sql query with error '.$link->error.' ('.$link->errno.')'); |
| 235 | 235 | } |
| 236 | 236 | |
@@ -255,19 +255,19 @@ discard block |
||
| 255 | 255 | $link = $this->getResource(); |
| 256 | 256 | $stmt = $link->prepare($query); |
| 257 | 257 | |
| 258 | - if(!($stmt instanceof mysqli_stmt)) { |
|
| 258 | + if (!($stmt instanceof mysqli_stmt)) { |
|
| 259 | 259 | throw new Exception('failed to prepare sql query with error '.$link->error.' ('.$link->errno.')'); |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | $types = ''; |
| 263 | - foreach($values as $attr => $value) { |
|
| 263 | + foreach ($values as $attr => $value) { |
|
| 264 | 264 | $types .= 's'; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | $stmt->bind_param($types, ...$values); |
| 268 | 268 | $stmt->execute(); |
| 269 | 269 | |
| 270 | - if($stmt->error) { |
|
| 270 | + if ($stmt->error) { |
|
| 271 | 271 | throw new Exception($stmt->error); |
| 272 | 272 | } |
| 273 | 273 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | /** |
| 167 | 167 | * Get body |
| 168 | 168 | * |
| 169 | - * @return mixed |
|
| 169 | + * @return string |
|
| 170 | 170 | */ |
| 171 | 171 | public function getBody() |
| 172 | 172 | { |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | /** |
| 342 | 342 | * Set the current output format. |
| 343 | 343 | * |
| 344 | - * @param string $foramt a key of $outputForms |
|
| 344 | + * @param string $format a key of $outputForms |
|
| 345 | 345 | * @return Response |
| 346 | 346 | */ |
| 347 | 347 | public function setOutputFormat(string $format): Response |
@@ -276,13 +276,13 @@ |
||
| 276 | 276 | |
| 277 | 277 | |
| 278 | 278 | /** |
| 279 | - * Converts mixed data to XML |
|
| 280 | - * |
|
| 281 | - * @param mixed $data |
|
| 282 | - * @param SimpleXMLElement $xml |
|
| 283 | - * @param string $child_name |
|
| 284 | - * @return string |
|
| 285 | - */ |
|
| 279 | + * Converts mixed data to XML |
|
| 280 | + * |
|
| 281 | + * @param mixed $data |
|
| 282 | + * @param SimpleXMLElement $xml |
|
| 283 | + * @param string $child_name |
|
| 284 | + * @return string |
|
| 285 | + */ |
|
| 286 | 286 | public function toXML($data, Config $xml, string $child_name): string |
| 287 | 287 | { |
| 288 | 288 | if (is_array($data)) { |
@@ -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 |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param bool $body_only |
| 156 | 156 | * @return Response |
| 157 | 157 | */ |
| 158 | - public function setBody($body, bool $body_only=false): Response |
|
| 158 | + public function setBody($body, bool $body_only = false): Response |
|
| 159 | 159 | { |
| 160 | 160 | $this->body = $body; |
| 161 | 161 | $this->body_only = $body_only; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | { |
| 184 | 184 | $this->sendHeaders(); |
| 185 | 185 | $status = Http::STATUS_CODES[$this->code]; |
| 186 | - header('HTTP/1.0 ' . $this->code . ' ' . $status, true, $this->code); |
|
| 186 | + header('HTTP/1.0 '.$this->code.' '.$status, true, $this->code); |
|
| 187 | 187 | |
| 188 | 188 | if ($this->body === null && $this->code == 204) { |
| 189 | 189 | $this->terminate(); |
@@ -271,7 +271,7 @@ |
||
| 271 | 271 | * @param string $class |
| 272 | 272 | * @param string $method |
| 273 | 273 | * @param array $parsed_params |
| 274 | - * @return array |
|
| 274 | + * @return callable |
|
| 275 | 275 | */ |
| 276 | 276 | protected function getParams(string $class, string $method, array $parsed_params): array |
| 277 | 277 | { |
@@ -209,7 +209,7 @@ |
||
| 209 | 209 | } |
| 210 | 210 | } else { |
| 211 | 211 | $this->logger->debug('requested path ['.$this->path.'] does not match route ['.$route->getPath().']', [ |
| 212 | - 'category' => get_class($this), |
|
| 212 | + 'category' => get_class($this), |
|
| 213 | 213 | ]); |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -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 |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param array $constructor |
| 183 | 183 | * @return bool |
| 184 | 184 | */ |
| 185 | - public function run(array $constructor=[]): bool |
|
| 185 | + public function run(array $constructor = []): bool |
|
| 186 | 186 | { |
| 187 | 187 | $this->logger->info('execute requested route ['.$this->path.']', [ |
| 188 | 188 | 'category' => get_class($this), |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | if (!empty($body)) { |
| 287 | 287 | $json_params = json_decode($body, true); |
| 288 | 288 | } else { |
| 289 | - $parts = explode('&', $_SERVER['QUERY_STRING']); |
|
| 289 | + $parts = explode('&', $_SERVER['QUERY_STRING']); |
|
| 290 | 290 | if (!empty($parts)) { |
| 291 | 291 | $json_params = json_decode(urldecode($parts[0]), true); |
| 292 | 292 | } |
@@ -197,7 +197,7 @@ |
||
| 197 | 197 | * @param string $date_format |
| 198 | 198 | * @param string $level |
| 199 | 199 | * @param array $context |
| 200 | - * @return void |
|
| 200 | + * @return string |
|
| 201 | 201 | */ |
| 202 | 202 | protected function _format(string $message, string $format, string $date_format, string $level, array $context=[]): string |
| 203 | 203 | { |
@@ -165,7 +165,7 @@ |
||
| 165 | 165 | foreach ($this->adapter as $adapter) { |
| 166 | 166 | $prio = $adapter->getLevel(); |
| 167 | 167 | |
| 168 | - if (self::PRIORITIES[$level] <= $prio) { |
|
| 168 | + if (self::PRIORITIES[$level] <= $prio) { |
|
| 169 | 169 | $msg = $this->_format($message, $adapter->getFormat(), $adapter->getDateFormat(), $level, $context); |
| 170 | 170 | $adapter->log($level, $msg); |
| 171 | 171 | } |
@@ -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 |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param Iterable $config |
| 58 | 58 | * @return void |
| 59 | 59 | */ |
| 60 | - public function __construct(?Iterable $config=null) |
|
| 60 | + public function __construct(? Iterable $config = null) |
|
| 61 | 61 | { |
| 62 | 62 | $this->setOptions($config); |
| 63 | 63 | } |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | * @param Iterable $config |
| 70 | 70 | * @return Log |
| 71 | 71 | */ |
| 72 | - public function setOptions(?Iterable $config=null) |
|
| 72 | + public function setOptions(? Iterable $config = null) |
|
| 73 | 73 | { |
| 74 | - if($config === null) { |
|
| 74 | + if ($config === null) { |
|
| 75 | 75 | return $this; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - foreach($config as $option => $value) { |
|
| 79 | - if(!isset($value['enabled']) || $value['enabled'] === '1') { |
|
| 78 | + foreach ($config as $option => $value) { |
|
| 79 | + if (!isset($value['enabled']) || $value['enabled'] === '1') { |
|
| 80 | 80 | $this->addAdapter($option, $value['class'], $value['config']); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | * @param Iterable $config |
| 106 | 106 | * @return AdapterInterface |
| 107 | 107 | */ |
| 108 | - public function addAdapter(string $name, string $class, ?Iterable $config=null): AdapterInterface |
|
| 108 | + public function addAdapter(string $name, string $class, ? Iterable $config = null) : AdapterInterface |
|
| 109 | 109 | { |
| 110 | - if($this->hasAdapter($name)) { |
|
| 110 | + if ($this->hasAdapter($name)) { |
|
| 111 | 111 | throw new Exception('log adapter '.$name.' is already registered'); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $adapter = new $class($config); |
| 115 | - if(!($adapter instanceof AdapterInterface)) { |
|
| 115 | + if (!($adapter instanceof AdapterInterface)) { |
|
| 116 | 116 | throw new Exception('log adapter must include AdapterInterface interface'); |
| 117 | 117 | } |
| 118 | 118 | $this->adapter[$name] = $adapter; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function getAdapter(string $name): AdapterInterface |
| 130 | 130 | { |
| 131 | - if(!$this->hasAdapter($name)) { |
|
| 131 | + if (!$this->hasAdapter($name)) { |
|
| 132 | 132 | throw new Exception('log adapter '.$name.' is not registered'); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -142,14 +142,14 @@ discard block |
||
| 142 | 142 | * @param array $adapters |
| 143 | 143 | * @return array |
| 144 | 144 | */ |
| 145 | - public function getAdapters(array $adapters=[]): array |
|
| 145 | + public function getAdapters(array $adapters = []): array |
|
| 146 | 146 | { |
| 147 | - if(empty($adapter)) { |
|
| 147 | + if (empty($adapter)) { |
|
| 148 | 148 | return $this->adapter; |
| 149 | 149 | } else { |
| 150 | 150 | $list = []; |
| 151 | - foreach($adapter as $name) { |
|
| 152 | - if(!$this->hasAdapter($name)) { |
|
| 151 | + foreach ($adapter as $name) { |
|
| 152 | + if (!$this->hasAdapter($name)) { |
|
| 153 | 153 | throw new Exception('log adapter '.$name.' is not registered'); |
| 154 | 154 | } |
| 155 | 155 | $list[$name] = $this->adapter[$name]; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param array $context |
| 170 | 170 | * @return bool |
| 171 | 171 | */ |
| 172 | - public function log($level, $message, array $context=[]): bool |
|
| 172 | + public function log($level, $message, array $context = []): bool |
|
| 173 | 173 | { |
| 174 | 174 | if (!array_key_exists($level, self::PRIORITIES)) { |
| 175 | 175 | throw new Exception('log level '.$level.' is unkown'); |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | * @param array $context |
| 213 | 213 | * @return void |
| 214 | 214 | */ |
| 215 | - protected function _format(string $message, string $format, string $date_format, string $level, array $context=[]): string |
|
| 215 | + protected function _format(string $message, string $format, string $date_format, string $level, array $context = []): string |
|
| 216 | 216 | { |
| 217 | - $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function ($match) use ($message, $level, $date_format, $context) { |
|
| 217 | + $parsed = preg_replace_callback('/(\{(([a-z]\.*)+)\})/', function($match) use ($message, $level, $date_format, $context) { |
|
| 218 | 218 | $key = ''; |
| 219 | 219 | $context = array_merge($this->context, $context); |
| 220 | 220 | |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | $replace = []; |
| 238 | 238 | foreach ($context as $key => $val) { |
| 239 | 239 | if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) { |
| 240 | - $replace['{' . $key . '}'] = $val; |
|
| 240 | + $replace['{'.$key.'}'] = $val; |
|
| 241 | 241 | } else { |
| 242 | - $replace['{' . $key . '}'] = json_encode($val); |
|
| 242 | + $replace['{'.$key.'}'] = json_encode($val); |
|
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
@@ -48,7 +48,6 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * Create adapter |
| 50 | 50 | * |
| 51 | - * @param Iterable $options |
|
| 52 | 51 | * @return void |
| 53 | 52 | */ |
| 54 | 53 | public function __construct(?Iterable $config=null) |
@@ -91,7 +90,6 @@ discard block |
||
| 91 | 90 | /** |
| 92 | 91 | * Set options |
| 93 | 92 | * |
| 94 | - * @param Iterable $options |
|
| 95 | 93 | * @return AdapterInterface |
| 96 | 94 | */ |
| 97 | 95 | public function setOptions(?Iterable $config=null): AdapterInterface |
@@ -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 |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param Iterable $options |
| 54 | 54 | * @return void |
| 55 | 55 | */ |
| 56 | - public function __construct(?Iterable $config=null) |
|
| 56 | + public function __construct(? Iterable $config = null) |
|
| 57 | 57 | { |
| 58 | 58 | $this->setOptions($config); |
| 59 | 59 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param Iterable $options |
| 97 | 97 | * @return AdapterInterface |
| 98 | 98 | */ |
| 99 | - public function setOptions(?Iterable $config=null): AdapterInterface |
|
| 99 | + public function setOptions(? Iterable $config = null) : AdapterInterface |
|
| 100 | 100 | { |
| 101 | 101 | if ($config === null) { |
| 102 | 102 | return $this; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | break; |
| 110 | 110 | |
| 111 | 111 | case 'level': |
| 112 | - if(!is_numeric($val)) { |
|
| 112 | + if (!is_numeric($val)) { |
|
| 113 | 113 | throw new Exception('log level must be a number'); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -26,7 +26,6 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * Create adapter |
| 28 | 28 | * |
| 29 | - * @param Iterable $options |
|
| 30 | 29 | * @return void |
| 31 | 30 | */ |
| 32 | 31 | public function __construct(?Iterable $config=null); |
@@ -57,7 +56,6 @@ discard block |
||
| 57 | 56 | /** |
| 58 | 57 | * Set options |
| 59 | 58 | * |
| 60 | - * @param Iterable $options |
|
| 61 | 59 | * @return AdapterInterface |
| 62 | 60 | */ |
| 63 | 61 | public function setOptions(?Iterable $config=null): AdapterInterface; |
@@ -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 |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param Iterable $options |
| 30 | 30 | * @return void |
| 31 | 31 | */ |
| 32 | - public function __construct(?Iterable $config=null); |
|
| 32 | + public function __construct(? Iterable $config = null); |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -60,5 +60,5 @@ discard block |
||
| 60 | 60 | * @param Iterable $options |
| 61 | 61 | * @return AdapterInterface |
| 62 | 62 | */ |
| 63 | - public function setOptions(?Iterable $config=null): AdapterInterface; |
|
| 63 | + public function setOptions(? Iterable $config = null) : AdapterInterface; |
|
| 64 | 64 | } |
@@ -31,7 +31,6 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * Set options |
| 33 | 33 | * |
| 34 | - * @param Iterable $options |
|
| 35 | 34 | * @return AdapterInterface |
| 36 | 35 | */ |
| 37 | 36 | public function setOptions(?Iterable $config=null): AdapterInterface |
@@ -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 |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param Iterable $options |
| 35 | 35 | * @return AdapterInterface |
| 36 | 36 | */ |
| 37 | - public function setOptions(?Iterable $config=null): AdapterInterface |
|
| 37 | + public function setOptions(? Iterable $config = null) : AdapterInterface |
|
| 38 | 38 | { |
| 39 | 39 | parent::setOptions($config); |
| 40 | 40 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function log(string $priority, string $message): bool |
| 67 | 67 | { |
| 68 | - if(!is_resource($this->resource)) { |
|
| 68 | + if (!is_resource($this->resource)) { |
|
| 69 | 69 | return false; |
| 70 | 70 | } |
| 71 | 71 | |