| @@ -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 @@ 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(); | 
| @@ -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 | } | 
| @@ -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 | |
| @@ -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 | } | 
| @@ -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 | } | 
| @@ -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 | |
| @@ -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 | 
| @@ -78,7 +78,7 @@ discard block | ||
| 78 | 78 | * @param Iterable $config | 
| 79 | 79 | * @param Logger $logger | 
| 80 | 80 | */ | 
| 81 | - public function __construct(?Iterable $config, Logger $logger) | |
| 81 | + public function __construct(? Iterable $config, Logger $logger) | |
| 82 | 82 |      { | 
| 83 | 83 | $this->setOptions($config); | 
| 84 | 84 | $this->logger = $logger; | 
| @@ -93,7 +93,7 @@ discard block | ||
| 93 | 93 | public function connect(): Pdo | 
| 94 | 94 |      { | 
| 95 | 95 | $this->connection = new PdoServer($this->dsn, $this->username, $this->password, $this->options); | 
| 96 | -        $this->logger->info('connection to db server [' . $this->dsn . '] using pdo was succesful', [ | |
| 96 | +        $this->logger->info('connection to db server ['.$this->dsn.'] using pdo was succesful', [ | |
| 97 | 97 | 'category' => get_class($this), | 
| 98 | 98 | ]); | 
| 99 | 99 | |
| @@ -108,7 +108,7 @@ discard block | ||
| 108 | 108 | * @param array $argumnets | 
| 109 | 109 | * @return mixed | 
| 110 | 110 | */ | 
| 111 | - public function __call(string $method, array $arguments=[]) | |
| 111 | + public function __call(string $method, array $arguments = []) | |
| 112 | 112 |      { | 
| 113 | 113 | return call_user_func_array([&$this->connection, $method], $arguments); | 
| 114 | 114 | } | 
| @@ -120,7 +120,7 @@ discard block | ||
| 120 | 120 | * @param Iterable $config | 
| 121 | 121 | * @return Pdo | 
| 122 | 122 | */ | 
| 123 | - public function setOptions(?Iterable $config = null): Pdo | |
| 123 | + public function setOptions(? Iterable $config = null) : Pdo | |
| 124 | 124 |      { | 
| 125 | 125 |          if ($config === null) { | 
| 126 | 126 | return $this; | 
| @@ -138,7 +138,7 @@ discard block | ||
| 138 | 138 | $this->password = (string)$value; | 
| 139 | 139 | break; | 
| 140 | 140 | case 'options': | 
| 141 | -                    foreach($value as $opt => $val) { | |
| 141 | +                    foreach ($value as $opt => $val) { | |
| 142 | 142 | $this->options[$opt] = (string)$val; | 
| 143 | 143 | } | 
| 144 | 144 | break; | 
| @@ -179,7 +179,7 @@ discard block | ||
| 179 | 179 | $link = $this->getResource(); | 
| 180 | 180 | $result = $link->query($query); | 
| 181 | 181 | |
| 182 | -        if($result === false) { | |
| 182 | +        if ($result === false) { | |
| 183 | 183 |              throw new Exception('failed to execute sql query with error '.$link->errorInfo()[2].' ('.$link->errorCode().')'); | 
| 184 | 184 | } | 
| 185 | 185 | |
| @@ -202,7 +202,7 @@ discard block | ||
| 202 | 202 | $link = $this->getResource(); | 
| 203 | 203 | $result = $link->exec($query); | 
| 204 | 204 | |
| 205 | -        if($result === false) { | |
| 205 | +        if ($result === false) { | |
| 206 | 206 |              throw new Exception('failed to execute sql query with error '.$link->errorInfo().' ('.$link->errorCode().')'); | 
| 207 | 207 |          } else { | 
| 208 | 208 |              $this->logger->debug('sql query affected ['.$result.'] rows', [ | 
| @@ -231,12 +231,12 @@ discard block | ||
| 231 | 231 | $link = $this->getResource(); | 
| 232 | 232 | $stmt = $link->prepare($query); | 
| 233 | 233 | |
| 234 | -        if(!($stmt instanceof mysqli_stmt)) { | |
| 234 | +        if (!($stmt instanceof mysqli_stmt)) { | |
| 235 | 235 |              throw new Exception('failed to prepare mysql query with error '.$link->error.' ('.$link->errno.')'); | 
| 236 | 236 | } | 
| 237 | 237 | |
| 238 | 238 | $types = ''; | 
| 239 | -        foreach($values as $attr => $value) { | |
| 239 | +        foreach ($values as $attr => $value) { | |
| 240 | 240 | $types .= 's'; | 
| 241 | 241 | } | 
| 242 | 242 | |