@@ -129,7 +129,7 @@ |
||
| 129 | 129 | public function response(): ?Response |
| 130 | 130 | { |
| 131 | 131 | $cbs = $this->middlewares; |
| 132 | - $call_eventual_route_at_end_of_chain = function (Request $request, Chain $chain): ?Response { |
|
| 132 | + $call_eventual_route_at_end_of_chain = function(Request $request, Chain $chain): ?Response { |
|
| 133 | 133 | $route = $request->route(); |
| 134 | 134 | if (is_null($route)) { |
| 135 | 135 | if (Environment::get('debug')) { |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | ob_start(); |
| 152 | 152 | try { |
| 153 | 153 | if ($headfile && file_exists($headfile)) { |
| 154 | - (function (string $sldkfjlksejflskjflskdjflskdfj) { |
|
| 154 | + (function(string $sldkfjlksejflskjflskdjflskdfj) { |
|
| 155 | 155 | extract($this->data); |
| 156 | 156 | include $sldkfjlksejflskjflskdjflskdfj; |
| 157 | 157 | })($headfile); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | if ($neckfile && file_exists($neckfile)) { |
| 161 | - (function (string $lidsinqjhsdfytqkwjkasjdksadsdg) { |
|
| 161 | + (function(string $lidsinqjhsdfytqkwjkasjdksadsdg) { |
|
| 162 | 162 | extract($this->data); |
| 163 | 163 | include $lidsinqjhsdfytqkwjkasjdksadsdg; |
| 164 | 164 | })($neckfile); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | if ($footfile && file_exists($footfile)) { |
| 213 | 213 | ob_start(); |
| 214 | 214 | try { |
| 215 | - (function (string $ldkfoskdfosjicyvutwehkshfskjdf) { |
|
| 215 | + (function(string $ldkfoskdfosjicyvutwehkshfskjdf) { |
|
| 216 | 216 | extract($this->data); |
| 217 | 217 | include $ldkfoskdfosjicyvutwehkshfskjdf; |
| 218 | 218 | })($footfile); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | ob_start(); |
| 240 | 240 | try { |
| 241 | 241 | // or another way to hide the file variable? |
| 242 | - (function (string $dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd) { |
|
| 242 | + (function(string $dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd) { |
|
| 243 | 243 | extract($this->data); |
| 244 | 244 | include $dsfjskdfjsdlkfjsdkfjsdkfjsdlkfjsd; |
| 245 | 245 | })($file); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @param string|int $v |
| 141 | 141 | * @return bool |
| 142 | 142 | */ |
| 143 | - function ($v) { |
|
| 143 | + function($v) { |
|
| 144 | 144 | return !is_int($v); |
| 145 | 145 | }, |
| 146 | 146 | \ARRAY_FILTER_USE_KEY |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $url = self::$aliases[$url] ?? $url; |
| 167 | 167 | return static::createRoute( |
| 168 | 168 | $url, |
| 169 | - function (Request $request): ?Response { |
|
| 169 | + function(Request $request): ?Response { |
|
| 170 | 170 | $page = response\Page::fromRequest($request); |
| 171 | 171 | // @TODO BC breaking, but move this? |
| 172 | 172 | return $page->isValid() ? $page : null; |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | public static function find(array $conditions = [], array $options = []): Generator |
| 89 | 89 | { |
| 90 | 90 | $conditions = self::filterByFields($conditions); |
| 91 | - $with = array_key_exists('with', $options) ? (array)$options['with'] : false; |
|
| 91 | + $with = array_key_exists('with', $options) ? (array) $options['with'] : false; |
|
| 92 | 92 | unset($options['with']); |
| 93 | 93 | $result = static::db()->find(static::table(), $conditions, $options); |
| 94 | 94 | $pk = static::pk(); |
| 95 | - $gen = function () use ($result, $pk, $with) { |
|
| 95 | + $gen = function() use ($result, $pk, $with) { |
|
| 96 | 96 | foreach ($result as $row) { |
| 97 | 97 | $model = new static($row); |
| 98 | 98 | if ($with) { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if (empty($fields) === false) { |
| 152 | 152 | $data = array_filter( |
| 153 | 153 | $data, |
| 154 | - function ($key) use ($fields) { |
|
| 154 | + function($key) use ($fields) { |
|
| 155 | 155 | return in_array($key, $fields); |
| 156 | 156 | }, |
| 157 | 157 | ARRAY_FILTER_USE_KEY |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | if (empty($conditions)) { |
| 185 | 185 | return ""; |
| 186 | 186 | } |
| 187 | - $fun = function ($o, $v) use ($conditions) : string { |
|
| 187 | + $fun = function($o, $v) use ($conditions) : string { |
|
| 188 | 188 | if (is_array($conditions[$v])) { |
| 189 | 189 | $qa = []; |
| 190 | 190 | $index = 0; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | private function data(array $data): string |
| 281 | 281 | { |
| 282 | - $fun = function ($o, $v): string { |
|
| 282 | + $fun = function($o, $v): string { |
|
| 283 | 283 | return "{$o}, {$v} = :d_{$v}"; |
| 284 | 284 | }; |
| 285 | 285 | return trim((string) array_reduce(array_keys($data), $fun, ""), ", "); |
@@ -218,7 +218,7 @@ |
||
| 218 | 218 | */ |
| 219 | 219 | protected function progressBar(int $counter, int $total): void |
| 220 | 220 | { |
| 221 | - $length = (int) ( ($counter/$total) * 100 ); |
|
| 221 | + $length = (int) (($counter / $total) * 100); |
|
| 222 | 222 | $active = ($counter === $total) ? '' : '>'; |
| 223 | 223 | $loadbar = sprintf( |
| 224 | 224 | "\r[%-100s] %d%% (%s/%s)", |
@@ -76,8 +76,11 @@ discard block |
||
| 76 | 76 | // Flip no-value option present to a true value |
| 77 | 77 | // A no-value option that is present multiple times converted to a number |
| 78 | 78 | foreach ($args as $key => $value) { |
| 79 | - if ($value === false) $args[$key] = true; |
|
| 80 | - elseif (is_array($value)) $args[$key] = count($args[$key]); |
|
| 79 | + if ($value === false) { |
|
| 80 | + $args[$key] = true; |
|
| 81 | + } elseif (is_array($value)) { |
|
| 82 | + $args[$key] = count($args[$key]); |
|
| 83 | + } |
|
| 81 | 84 | } |
| 82 | 85 | |
| 83 | 86 | // Non present values get false value |
@@ -97,10 +100,11 @@ discard block |
||
| 97 | 100 | */ |
| 98 | 101 | protected function out(string $s): void |
| 99 | 102 | { |
| 100 | - if ($this->echo) |
|
| 101 | - echo $s . PHP_EOL; |
|
| 102 | - else |
|
| 103 | - $this->out .= $s . PHP_EOL; |
|
| 103 | + if ($this->echo) { |
|
| 104 | + echo $s . PHP_EOL; |
|
| 105 | + } else { |
|
| 106 | + $this->out .= $s . PHP_EOL; |
|
| 107 | + } |
|
| 104 | 108 | } |
| 105 | 109 | |
| 106 | 110 | /** |
@@ -111,11 +115,15 @@ discard block |
||
| 111 | 115 | $flags = join(', ', array_keys(array_filter($this->args, function($val): bool { |
| 112 | 116 | return $val === true; |
| 113 | 117 | }))); |
| 114 | - if (empty($flags) == false) $this->out("Flags: [ {$flags} ]"); |
|
| 118 | + if (empty($flags) == false) { |
|
| 119 | + $this->out("Flags: [ {$flags} ]"); |
|
| 120 | + } |
|
| 115 | 121 | $options = urldecode(http_build_query(array_filter($this->args, function($val): bool { |
| 116 | 122 | return is_bool($val) === false; |
| 117 | 123 | }), '', ", ")); |
| 118 | - if (empty($options) == false) $this->out("Options: [ {$options} ]"); |
|
| 124 | + if (empty($options) == false) { |
|
| 125 | + $this->out("Options: [ {$options} ]"); |
|
| 126 | + } |
|
| 119 | 127 | $this->out(""); |
| 120 | 128 | } |
| 121 | 129 | |
@@ -141,7 +149,9 @@ discard block |
||
| 141 | 149 | if (method_exists($this, $command_method) === false) { |
| 142 | 150 | throw new \Exception("Command {$this->command} does not exist"); |
| 143 | 151 | } |
| 144 | - if ($this->verbose()) $this->input(); |
|
| 152 | + if ($this->verbose()) { |
|
| 153 | + $this->input(); |
|
| 154 | + } |
|
| 145 | 155 | $this->$command_method(); |
| 146 | 156 | return $this; |
| 147 | 157 | } |