@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | public function seek(int $position): void |
| 253 | 253 | { |
| 254 | - if (! isset($this->queue[$position])) { |
|
| 254 | + if (!isset($this->queue[$position])) { |
|
| 255 | 255 | throw new OutOfBoundsException(sprintf('Invalid seek position (%s).', $position)); |
| 256 | 256 | } |
| 257 | 257 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function current(): MiddlewareInterface |
| 273 | 273 | { |
| 274 | - if (! isset($this->queue[$this->position])) { |
|
| 274 | + if (!isset($this->queue[$this->position])) { |
|
| 275 | 275 | throw new OutOfBoundsException(sprintf('Position actuelle non valide (%s).', $this->position)); |
| 276 | 276 | } |
| 277 | 277 | |
@@ -343,8 +343,8 @@ discard block |
||
| 343 | 343 | public function resolveGroups() |
| 344 | 344 | { |
| 345 | 345 | foreach ($this->queue as $queue) { |
| 346 | - if (is_string($queue) && ! empty($this->groups[$queue])) { |
|
| 347 | - if (! is_array($this->groups[$queue])) { |
|
| 346 | + if (is_string($queue) && !empty($this->groups[$queue])) { |
|
| 347 | + if (!is_array($this->groups[$queue])) { |
|
| 348 | 348 | continue; |
| 349 | 349 | } |
| 350 | 350 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | final public function success(string $message, bool $badge = true, string $label = 'SUCCESS'): self |
| 306 | 306 | { |
| 307 | - if (! $badge) { |
|
| 307 | + if (!$badge) { |
|
| 308 | 308 | $this->writer->okBold($label); |
| 309 | 309 | } else { |
| 310 | 310 | $this->writer->boldWhiteBgGreen(" {$label} "); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | final public function warning(string $message, bool $badge = true, string $label = 'WARNING'): self |
| 320 | 320 | { |
| 321 | - if (! $badge) { |
|
| 321 | + if (!$badge) { |
|
| 322 | 322 | $this->writer->warnBold($label); |
| 323 | 323 | } else { |
| 324 | 324 | $this->writer->boldWhiteBgYellow(" {$label} "); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | final public function info(string $message, bool $badge = true, string $label = 'INFO'): self |
| 334 | 334 | { |
| 335 | - if (! $badge) { |
|
| 335 | + if (!$badge) { |
|
| 336 | 336 | $this->writer->infoBold($label); |
| 337 | 337 | } else { |
| 338 | 338 | $this->writer->boldWhiteBgCyan(" {$label} "); |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | final public function error(string $message, bool $badge = true, string $label = 'ERROR'): self |
| 348 | 348 | { |
| 349 | - if (! $badge) { |
|
| 349 | + if (!$badge) { |
|
| 350 | 350 | $this->writer->errorBold($label); |
| 351 | 351 | } else { |
| 352 | 352 | $this->writer->boldWhiteBgRed(" {$label} "); |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | final public function json($data): self |
| 451 | 451 | { |
| 452 | - $this->write(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), true); |
|
| 452 | + $this->write(json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES), true); |
|
| 453 | 453 | |
| 454 | 454 | return $this; |
| 455 | 455 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $possibleView2 = $directory . $viewName . '.php'; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if ($view !== '' && ! is_file($view)) { |
|
| 82 | + if ($view !== '' && !is_file($view)) { |
|
| 83 | 83 | $directory = dirname((new ReflectionClass($this))->getFileName()) . DIRECTORY_SEPARATOR; |
| 84 | 84 | |
| 85 | 85 | $view = $directory . $view . '.php'; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $foundView = current($candidateViews); |
| 101 | 101 | |
| 102 | - return (function () use ($properties, $foundView): string { |
|
| 102 | + return (function() use ($properties, $foundView): string { |
|
| 103 | 103 | extract($properties); |
| 104 | 104 | ob_start(); |
| 105 | 105 | include $foundView; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $key = $this->_key($key); |
| 75 | 75 | |
| 76 | - if (! isset($this->cache[$key])) { |
|
| 76 | + if (!isset($this->cache[$key])) { |
|
| 77 | 77 | return false; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | if ($data === null) { |
| 113 | 113 | $data = 0; |
| 114 | - } elseif (! is_int($data)) { |
|
| 114 | + } elseif (!is_int($data)) { |
|
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | if ($data === null) { |
| 131 | 131 | $data = 0; |
| 132 | - } elseif (! is_int($data)) { |
|
| 132 | + } elseif (!is_int($data)) { |
|
| 133 | 133 | return false; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | public function getMetaData(string $key): ?array |
| 175 | 175 | { |
| 176 | 176 | // n'existe pas, retourne null |
| 177 | - if (! array_key_exists($key, $this->expirations)) { |
|
| 177 | + if (!array_key_exists($key, $this->expirations)) { |
|
| 178 | 178 | return null; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | return $base . $fullname; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if ($plugin || ! static::_classExistsInBase($fullname, 'BlitzPHP')) { |
|
| 70 | + if ($plugin || !static::_classExistsInBase($fullname, 'BlitzPHP')) { |
|
| 71 | 71 | return null; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $loader = Services::locator(); |
| 39 | 39 | |
| 40 | - if (! is_array($filenames)) { |
|
| 40 | + if (!is_array($filenames)) { |
|
| 41 | 41 | $filenames = [$filenames]; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // Les helpers au niveau de l'application doivent remplacer tous les autres |
| 84 | - if (! empty($appHelper)) { |
|
| 84 | + if (!empty($appHelper)) { |
|
| 85 | 85 | $includes[] = $appHelper; |
| 86 | 86 | $loaded[] = $filename; |
| 87 | 87 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $includes = [...$includes, ...$localIncludes]; |
| 91 | 91 | |
| 92 | 92 | // Et celui par défaut du système doit être ajouté en dernier. |
| 93 | - if (! empty($systemHelper)) { |
|
| 93 | + if (!empty($systemHelper)) { |
|
| 94 | 94 | $includes[] = $systemHelper; |
| 95 | 95 | $loaded[] = $filename; |
| 96 | 96 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | // Si le fichier est dans un espace de noms, nous allons simplement saisir ce fichier et ne pas en rechercher d'autres |
| 130 | 130 | if (str_contains($name, '\\')) { |
| 131 | - if (! empty($path = $loader->locateFile($name, 'schemas'))) { |
|
| 131 | + if (!empty($path = $loader->locateFile($name, 'schemas'))) { |
|
| 132 | 132 | $file = $path; |
| 133 | 133 | } |
| 134 | 134 | } else { |
@@ -146,18 +146,18 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Les schema des vendor sont prioritaire, ensuite vienne ceux de l'application |
| 149 | - if (! empty($vendorSchema)) { |
|
| 149 | + if (!empty($vendorSchema)) { |
|
| 150 | 150 | $file = $vendorSchema; |
| 151 | - } elseif (! empty($appSchema)) { |
|
| 151 | + } elseif (!empty($appSchema)) { |
|
| 152 | 152 | $file = $appSchema; |
| 153 | - } elseif (! empty($systemSchema)) { |
|
| 153 | + } elseif (!empty($systemSchema)) { |
|
| 154 | 154 | $file = $systemSchema; |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $schema = ! empty($file) ? require $file : null; |
|
| 158 | + $schema = !empty($file) ? require $file : null; |
|
| 159 | 159 | |
| 160 | - if (empty($schema) || ! ($schema instanceof Schema)) { |
|
| 160 | + if (empty($schema) || !($schema instanceof Schema)) { |
|
| 161 | 161 | $schema = Expect::mixed(); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -175,16 +175,16 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public static function model(string $model, ?ConnectionInterface $connection = null) |
| 177 | 177 | { |
| 178 | - if (! class_exists($model) && ! Text::endsWith($model, 'Model')) { |
|
| 178 | + if (!class_exists($model) && !Text::endsWith($model, 'Model')) { |
|
| 179 | 179 | $model .= 'Model'; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if (! class_exists($model)) { |
|
| 182 | + if (!class_exists($model)) { |
|
| 183 | 183 | $model = str_replace(APP_NAMESPACE . '\\Models\\', '', $model); |
| 184 | 184 | $model = APP_NAMESPACE . '\\Models\\' . $model; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if (! class_exists($model)) { |
|
| 187 | + if (!class_exists($model)) { |
|
| 188 | 188 | throw LoadException::modelNotFound($model); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | protected static function verifyPreferApp(array $options, string $name): bool |
| 214 | 214 | { |
| 215 | 215 | // Tout element sans restriction passe |
| 216 | - if (! $options['preferApp']) { |
|
| 216 | + if (!$options['preferApp']) { |
|
| 217 | 217 | return true; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | foreach ($data as $key => $value) { |
| 74 | 74 | $replacementKey = "\n{$key} = {$value}"; |
| 75 | - if (! str_contains($oldFileContents, $key)) { |
|
| 75 | + if (!str_contains($oldFileContents, $key)) { |
|
| 76 | 76 | if (file_put_contents($this->path, $replacementKey, FILE_APPEND) === false) { |
| 77 | 77 | return false; |
| 78 | 78 | } |
@@ -139,18 +139,18 @@ discard block |
||
| 139 | 139 | public function parse(): ?array |
| 140 | 140 | { |
| 141 | 141 | // Nous ne voulons pas imposer la présence d'un fichier .env, ils devraient être facultatifs. |
| 142 | - if (! is_file($this->path)) { |
|
| 142 | + if (!is_file($this->path)) { |
|
| 143 | 143 | return null; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // Assurez-vous que le fichier est lisible |
| 147 | - if (! is_readable($this->path)) { |
|
| 147 | + if (!is_readable($this->path)) { |
|
| 148 | 148 | throw new InvalidArgumentException("The .env file is not readable: {$this->path}"); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $vars = []; |
| 152 | 152 | |
| 153 | - $lines = file($this->path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 153 | + $lines = file($this->path, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); |
|
| 154 | 154 | |
| 155 | 155 | foreach ($lines as $line) { |
| 156 | 156 | // C'est un commentaire? |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | protected function setVariable(string $name, string $value = '') |
| 177 | 177 | { |
| 178 | - if (! getenv($name, true)) { |
|
| 178 | + if (!getenv($name, true)) { |
|
| 179 | 179 | putenv("{$name}={$value}"); |
| 180 | 180 | } |
| 181 | 181 | if (empty($_ENV[$name])) { |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | $value = preg_replace_callback( |
| 282 | 282 | '/\${([a-zA-Z0-9_]+)}/', |
| 283 | - static function ($matchedPatterns) use ($loader) { |
|
| 283 | + static function($matchedPatterns) use ($loader) { |
|
| 284 | 284 | $nestedVariable = $loader->getVariable($matchedPatterns[1]); |
| 285 | 285 | |
| 286 | 286 | if (null === $nestedVariable) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $options = (array) $options; |
| 46 | 46 | |
| 47 | 47 | // N'est-il pas namespaced ? on cherche le dossier en fonction du controleur |
| 48 | - if (! str_contains($view, '\\')) { |
|
| 48 | + if (!str_contains($view, '\\')) { |
|
| 49 | 49 | $reflection = new ReflectionClass(static::class); |
| 50 | 50 | ['dirname' => $dirname, 'filename' => $filename] = pathinfo($reflection->getFileName()); |
| 51 | 51 | $dirname = str_ireplace('Controllers', 'Views', $dirname); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $dirname = implode('Views', $parts); |
| 60 | 60 | $path = implode(DS, [$dirname, $filename]) . DS; |
| 61 | 61 | |
| 62 | - if (! is_dir($path)) { |
|
| 62 | + if (!is_dir($path)) { |
|
| 63 | 63 | $path = implode(DS, [$dirname]) . DS; |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if (empty($data['title'])) { |
| 80 | - if (! is_string($controllerName = Dispatcher::getController(false))) { |
|
| 80 | + if (!is_string($controllerName = Dispatcher::getController(false))) { |
|
| 81 | 81 | $controllerName = static::class; |
| 82 | 82 | } |
| 83 | 83 | $controllerName = str_ireplace(['App\Controllers', 'Controller'], '', $controllerName); |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | $this->modelName = is_object($which) ? null : $which; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if (empty($this->model) && ! empty($this->modelName) && class_exists($this->modelName)) { |
|
| 165 | + if (empty($this->model) && !empty($this->modelName) && class_exists($this->modelName)) { |
|
| 166 | 166 | $this->model = model($this->modelName); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if (! empty($this->model) && empty($this->modelName)) { |
|
| 169 | + if (!empty($this->model) && empty($this->modelName)) { |
|
| 170 | 170 | $this->modelName = $this->model::class; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | private function getModel() |
| 206 | 206 | { |
| 207 | - $model = ! empty($this->modelName) ? $this->modelName : str_replace('Controller', 'Model', static::class); |
|
| 207 | + $model = !empty($this->modelName) ? $this->modelName : str_replace('Controller', 'Model', static::class); |
|
| 208 | 208 | |
| 209 | 209 | if (class_exists($model)) { |
| 210 | 210 | $this->setModel($model); |