@@ -172,11 +172,11 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $authority = $this->host; |
| 174 | 174 | |
| 175 | - if (! empty($this->getUserInfo())) { |
|
| 175 | + if (!empty($this->getUserInfo())) { |
|
| 176 | 176 | $authority = $this->getUserInfo() . '@' . $authority; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if (! empty($this->port) && ! $ignorePort) { |
|
| 179 | + if (!empty($this->port) && !$ignorePort) { |
|
| 180 | 180 | // N'ajoute pas de port s'il s'agit d'un port standard pour ce schéma |
| 181 | 181 | if ($this->port !== $this->defaultPorts[$this->scheme]) { |
| 182 | 182 | $authority .= ':' . $this->port; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | $userInfo = $this->user; |
| 197 | 197 | |
| 198 | - if ($this->showPassword === true && ! empty($this->password)) { |
|
| 198 | + if ($this->showPassword === true && !empty($this->password)) { |
|
| 199 | 199 | $userInfo .= ':' . $this->password; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $vars = $this->query; |
| 246 | 246 | |
| 247 | 247 | if (array_key_exists('except', $options)) { |
| 248 | - if (! is_array($options['except'])) { |
|
| 248 | + if (!is_array($options['except'])) { |
|
| 249 | 249 | $options['except'] = [$options['except']]; |
| 250 | 250 | } |
| 251 | 251 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | } elseif (array_key_exists('only', $options)) { |
| 256 | 256 | $temp = []; |
| 257 | 257 | |
| 258 | - if (! is_array($options['only'])) { |
|
| 258 | + if (!is_array($options['only'])) { |
|
| 259 | 259 | $options['only'] = [$options['only']]; |
| 260 | 260 | } |
| 261 | 261 | |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | public static function createURIString(?string $scheme = null, ?string $authority = null, ?string $path = null, ?string $query = null, ?string $fragment = null): string |
| 357 | 357 | { |
| 358 | 358 | $uri = ''; |
| 359 | - if (! empty($scheme)) { |
|
| 359 | + if (!empty($scheme)) { |
|
| 360 | 360 | $uri .= $scheme . '://'; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - if (! empty($authority)) { |
|
| 363 | + if (!empty($authority)) { |
|
| 364 | 364 | $uri .= $authority; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | { |
| 387 | 387 | $parts = parse_url($str); |
| 388 | 388 | |
| 389 | - if (empty($parts['host']) && ! empty($parts['path'])) { |
|
| 389 | + if (empty($parts['host']) && !empty($parts['path'])) { |
|
| 390 | 390 | $parts['host'] = $parts['path']; |
| 391 | 391 | unset($parts['path']); |
| 392 | 392 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | // Ne peut pas avoir de début ? |
| 534 | - if (! empty($query) && strpos($query, '?') === 0) { |
|
| 534 | + if (!empty($query) && strpos($query, '?') === 0) { |
|
| 535 | 535 | $query = substr($query, 1); |
| 536 | 536 | } |
| 537 | 537 | |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $temp = []; |
| 597 | 597 | |
| 598 | 598 | foreach ($this->query as $key => $value) { |
| 599 | - if (! in_array($key, $params, true)) { |
|
| 599 | + if (!in_array($key, $params, true)) { |
|
| 600 | 600 | continue; |
| 601 | 601 | } |
| 602 | 602 | |
@@ -667,19 +667,19 @@ discard block |
||
| 667 | 667 | */ |
| 668 | 668 | protected function applyParts(array $parts) |
| 669 | 669 | { |
| 670 | - if (! empty($parts['host'])) { |
|
| 670 | + if (!empty($parts['host'])) { |
|
| 671 | 671 | $this->host = $parts['host']; |
| 672 | 672 | } |
| 673 | - if (! empty($parts['user'])) { |
|
| 673 | + if (!empty($parts['user'])) { |
|
| 674 | 674 | $this->user = $parts['user']; |
| 675 | 675 | } |
| 676 | - if (! empty($parts['path'])) { |
|
| 676 | + if (!empty($parts['path'])) { |
|
| 677 | 677 | $this->path = $this->filterPath($parts['path']); |
| 678 | 678 | } |
| 679 | - if (! empty($parts['query'])) { |
|
| 679 | + if (!empty($parts['query'])) { |
|
| 680 | 680 | $this->setQuery($parts['query']); |
| 681 | 681 | } |
| 682 | - if (! empty($parts['fragment'])) { |
|
| 682 | + if (!empty($parts['fragment'])) { |
|
| 683 | 683 | $this->fragment = $parts['fragment']; |
| 684 | 684 | } |
| 685 | 685 | |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | $this->password = $parts['pass']; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - if (! empty($parts['path'])) { |
|
| 704 | + if (!empty($parts['path'])) { |
|
| 705 | 705 | $this->segments = explode('/', trim($parts['path'], '/')); |
| 706 | 706 | } |
| 707 | 707 | } |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | $transformed = clone $relative; |
| 729 | 729 | |
| 730 | 730 | // 5.2.2 Transformer les références dans une méthode non stricte (pas de schéma) |
| 731 | - if (! empty($relative->getAuthority())) { |
|
| 731 | + if (!empty($relative->getAuthority())) { |
|
| 732 | 732 | $transformed->setAuthority($relative->getAuthority()) |
| 733 | 733 | ->setPath($relative->getPath()) |
| 734 | 734 | ->setQuery($relative->getQuery()); |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | */ |
| 769 | 769 | protected function mergePaths(self $base, self $reference): string |
| 770 | 770 | { |
| 771 | - if (! empty($base->getAuthority()) && empty($base->getPath())) { |
|
| 771 | + if (!empty($base->getAuthority()) && empty($base->getPath())) { |
|
| 772 | 772 | return '/' . ltrim($reference->getPath(), '/ '); |
| 773 | 773 | } |
| 774 | 774 | |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $controllerName = $this->controllerName(); |
| 103 | 103 | |
| 104 | - if (! $this->isValidSegment($controllerName)) { |
|
| 104 | + if (!$this->isValidSegment($controllerName)) { |
|
| 105 | 105 | throw new PageNotFoundException($this->controller . ' is not a valid controller name'); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Utilise le nom de la méthode s'il existe. |
| 109 | 109 | // Si ce n'est pas le cas, ce n'est pas grave - le nom de la méthode par défaut |
| 110 | 110 | // a déjà été défini. |
| 111 | - if (! empty($segments)) { |
|
| 111 | + if (!empty($segments)) { |
|
| 112 | 112 | $this->setMethod(array_shift($segments) ?: $this->method); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | /** @var array $params An array of params to the controller method. */ |
| 121 | 121 | $params = []; |
| 122 | 122 | |
| 123 | - if (! empty($segments)) { |
|
| 123 | + if (!empty($segments)) { |
|
| 124 | 124 | $params = $segments; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $controller = strtolower($controller); |
| 135 | 135 | |
| 136 | 136 | foreach ($this->protectedControllers as $controllerInRoute) { |
| 137 | - if (! is_string($controllerInRoute)) { |
|
| 137 | + if (!is_string($controllerInRoute)) { |
|
| 138 | 138 | continue; |
| 139 | 139 | } |
| 140 | 140 | if (strtolower($controllerInRoute) !== $controller) { |
@@ -196,14 +196,14 @@ discard block |
||
| 196 | 196 | $this->translateURIDashes ? str_replace('-', '_', $segments[0]) : $segments[0] |
| 197 | 197 | ); |
| 198 | 198 | // dès que nous rencontrons un segment non conforme à PSR-4, arrêtons la recherche |
| 199 | - if (! $this->isValidSegment($segmentConvert)) { |
|
| 199 | + if (!$this->isValidSegment($segmentConvert)) { |
|
| 200 | 200 | return $segments; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $test = CONTROLLER_PATH . $this->directory . $segmentConvert; |
| 204 | 204 | |
| 205 | 205 | // tant que chaque segment n'est *pas* un fichier de contrôleur mais correspond à un répertoire, ajoutez-le à $this->répertoire |
| 206 | - if (! is_file($test . '.php') && is_dir($test)) { |
|
| 206 | + if (!is_file($test . '.php') && is_dir($test)) { |
|
| 207 | 207 | $this->setDirectory($segmentConvert, true, false); |
| 208 | 208 | array_shift($segments); |
| 209 | 209 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $segments = explode('/', trim($dir, '/')); |
| 245 | 245 | |
| 246 | 246 | foreach ($segments as $segment) { |
| 247 | - if (! $this->isValidSegment($segment)) { |
|
| 247 | + if (!$this->isValidSegment($segment)) { |
|
| 248 | 248 | return; |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | public function directory(): string |
| 265 | 265 | { |
| 266 | - return ! empty($this->directory) ? $this->directory : ''; |
|
| 266 | + return !empty($this->directory) ? $this->directory : ''; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | private function controllerName() |
| 275 | 275 | { |
| 276 | - if (! is_string($this->controller)) { |
|
| 276 | + if (!is_string($this->controller)) { |
|
| 277 | 277 | return $this->controller; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | use BlitzPHP\Loader\Filesystem; |
| 13 | 13 | |
| 14 | -if (! function_exists('directory_map')) { |
|
| 14 | +if (!function_exists('directory_map')) { |
|
| 15 | 15 | /** |
| 16 | 16 | * Créer une carte de répertoire |
| 17 | 17 | * |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -if (! function_exists('directory_mirror')) { |
|
| 32 | +if (!function_exists('directory_mirror')) { |
|
| 33 | 33 | /** |
| 34 | 34 | * Copie récursivement les fichiers et répertoires du répertoire d'origine |
| 35 | 35 | * dans le répertoire cible, c'est-à-dire "miroir" son contenu. |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -if (! function_exists('write_file')) { |
|
| 45 | +if (!function_exists('write_file')) { |
|
| 46 | 46 | /** |
| 47 | 47 | * Write File |
| 48 | 48 | * |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | -if (! function_exists('delete_files')) { |
|
| 79 | +if (!function_exists('delete_files')) { |
|
| 80 | 80 | /** |
| 81 | 81 | * Delete Files |
| 82 | 82 | * |
@@ -101,18 +101,18 @@ discard block |
||
| 101 | 101 | RecursiveIteratorIterator::CHILD_FIRST |
| 102 | 102 | ) as $object) { |
| 103 | 103 | $filename = $object->getFilename(); |
| 104 | - if (! $hidden && $filename[0] === '.') { |
|
| 104 | + if (!$hidden && $filename[0] === '.') { |
|
| 105 | 105 | continue; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if (! $htdocs || ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) { |
|
| 108 | + if (!$htdocs || !preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) { |
|
| 109 | 109 | $isDir = $object->isDir(); |
| 110 | 110 | if ($isDir && $delDir) { |
| 111 | 111 | rmdir($object->getPathname()); |
| 112 | 112 | |
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | - if (! $isDir) { |
|
| 115 | + if (!$isDir) { |
|
| 116 | 116 | unlink($object->getPathname()); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | -if (! function_exists('get_filenames')) { |
|
| 128 | +if (!function_exists('get_filenames')) { |
|
| 129 | 129 | /** |
| 130 | 130 | * Get Filenames |
| 131 | 131 | * |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | RecursiveIteratorIterator::SELF_FIRST |
| 155 | 155 | ) as $name => $object) { |
| 156 | 156 | $basename = pathinfo($name, PATHINFO_BASENAME); |
| 157 | - if (! $hidden && $basename[0] === '.') { |
|
| 157 | + if (!$hidden && $basename[0] === '.') { |
|
| 158 | 158 | continue; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if ($includeDir || ! $object->isDir()) { |
|
| 161 | + if ($includeDir || !$object->isDir()) { |
|
| 162 | 162 | if ($includePath === false) { |
| 163 | 163 | $files[] = $basename; |
| 164 | 164 | } elseif ($includePath === null) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | -if (! function_exists('get_dir_file_info')) { |
|
| 181 | +if (!function_exists('get_dir_file_info')) { |
|
| 182 | 182 | /** |
| 183 | 183 | * Get Directory File Information |
| 184 | 184 | * |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | -if (! function_exists('get_file_info')) { |
|
| 227 | +if (!function_exists('get_file_info')) { |
|
| 228 | 228 | /** |
| 229 | 229 | * Get File Info |
| 230 | 230 | * |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | function get_file_info(string $file, $returnedValues = ['name', 'server_path', 'size', 'date']) |
| 242 | 242 | { |
| 243 | - if (! is_file($file)) { |
|
| 243 | + if (!is_file($file)) { |
|
| 244 | 244 | return null; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | -if (! function_exists('symbolic_permissions')) { |
|
| 293 | +if (!function_exists('symbolic_permissions')) { |
|
| 294 | 294 | /** |
| 295 | 295 | * Symbolic Permissions |
| 296 | 296 | * |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | -if (! function_exists('octal_permissions')) { |
|
| 341 | +if (!function_exists('octal_permissions')) { |
|
| 342 | 342 | /** |
| 343 | 343 | * Octal Permissions |
| 344 | 344 | * |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | -if (! function_exists('same_file')) { |
|
| 356 | +if (!function_exists('same_file')) { |
|
| 357 | 357 | /** |
| 358 | 358 | * Checks if two files both exist and have identical hashes |
| 359 | 359 | * |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | -if (! function_exists('set_realpath')) { |
|
| 368 | +if (!function_exists('set_realpath')) { |
|
| 369 | 369 | /** |
| 370 | 370 | * Set Realpath |
| 371 | 371 | * |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | // Resolve the path |
| 382 | 382 | if (realpath($path) !== false) { |
| 383 | 383 | $path = realpath($path); |
| 384 | - } elseif ($checkExistence && ! is_dir($path) && ! is_file($path)) { |
|
| 384 | + } elseif ($checkExistence && !is_dir($path) && !is_file($path)) { |
|
| 385 | 385 | throw new InvalidArgumentException('Not a valid path: ' . $path); |
| 386 | 386 | } |
| 387 | 387 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $file = $this->viewPath . $view; |
| 98 | 98 | |
| 99 | - if (! is_file($file)) { |
|
| 99 | + if (!is_file($file)) { |
|
| 100 | 100 | $fileOrig = $file; |
| 101 | 101 | $file = $this->loader->locateFile($view, 'Views'); |
| 102 | 102 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function setData(array $data = [], ?string $context = null): self |
| 173 | 173 | { |
| 174 | - if (! empty($context)) { |
|
| 174 | + if (!empty($context)) { |
|
| 175 | 175 | foreach ($data as $key => &$value) { |
| 176 | 176 | if (is_array($value)) { |
| 177 | 177 | foreach ($value as &$obj) { |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | foreach ($matches as $match) { |
| 280 | 280 | // Loop over each piece of $data, replacing |
| 281 | 281 | // its contents so that we know what to replace in parse() |
| 282 | - $str = ''; // holds the new contents for this tag pair. |
|
| 282 | + $str = ''; // holds the new contents for this tag pair. |
|
| 283 | 283 | |
| 284 | 284 | foreach ($data as $row) { |
| 285 | 285 | // Objects that have a `toArray()` method should be |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | if (is_array($val)) { |
| 302 | 302 | $pair = $this->parsePair($key, $val, $match[1]); |
| 303 | 303 | |
| 304 | - if (! empty($pair)) { |
|
| 304 | + if (!empty($pair)) { |
|
| 305 | 305 | $pairs[array_keys($pair)[0]] = true; |
| 306 | 306 | |
| 307 | 307 | $temp = array_merge($temp, $pair); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | // Now replace our placeholders with the new content. |
| 323 | 323 | foreach ($temp as $pattern => $content) { |
| 324 | - $out = $this->replaceSingle($pattern, $content, $out, ! isset($pairs[$pattern])); |
|
| 324 | + $out = $this->replaceSingle($pattern, $content, $out, !isset($pairs[$pattern])); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | $str .= $out; |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | $content = (string) $content; |
| 492 | 492 | |
| 493 | 493 | // Replace the content in the template |
| 494 | - return preg_replace_callback($pattern, function ($matches) use ($content, $escape) { |
|
| 494 | + return preg_replace_callback($pattern, function($matches) use ($content, $escape) { |
|
| 495 | 495 | // Check for {! !} syntax to not escape this one. |
| 496 | 496 | if (strpos($matches[0], '{!') === 0 && substr($matches[0], -2) === '!}') { |
| 497 | 497 | $escape = false; |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | |
| 511 | 511 | // Our regex earlier will leave all chained values on a single line |
| 512 | 512 | // so we need to break them apart so we can apply them all. |
| 513 | - $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : []; |
|
| 513 | + $filters = !empty($matches[1]) ? explode('|', $matches[1]) : []; |
|
| 514 | 514 | |
| 515 | 515 | if ($escape && empty($filters) && ($context = $this->shouldAddEscaping($orig))) { |
| 516 | 516 | $filters[] = "esc({$context})"; |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $escape = false; |
| 547 | 547 | } |
| 548 | 548 | // If no `esc` filter is found, then we'll need to add one. |
| 549 | - elseif (! preg_match('/\s+esc/', $key)) { |
|
| 549 | + elseif (!preg_match('/\s+esc/', $key)) { |
|
| 550 | 550 | $escape = 'html'; |
| 551 | 551 | } |
| 552 | 552 | |
@@ -565,10 +565,10 @@ discard block |
||
| 565 | 565 | preg_match('/\([\w<>=\/\\\,:.\-\s\+]+\)/', $filter, $param); |
| 566 | 566 | |
| 567 | 567 | // Remove the () and spaces to we have just the parameter left |
| 568 | - $param = ! empty($param) ? trim($param[0], '() ') : null; |
|
| 568 | + $param = !empty($param) ? trim($param[0], '() ') : null; |
|
| 569 | 569 | |
| 570 | 570 | // Params can be separated by commas to allow multiple parameters for the filter |
| 571 | - if (! empty($param)) { |
|
| 571 | + if (!empty($param)) { |
|
| 572 | 572 | $param = explode(',', $param); |
| 573 | 573 | |
| 574 | 574 | // Clean it up |
@@ -580,10 +580,10 @@ discard block |
||
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | // Get our filter name |
| 583 | - $filter = ! empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter); |
|
| 583 | + $filter = !empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter); |
|
| 584 | 584 | |
| 585 | 585 | $this->config['filters'] ??= []; |
| 586 | - if (! array_key_exists($filter, $this->config['filters'])) { |
|
| 586 | + if (!array_key_exists($filter, $this->config['filters'])) { |
|
| 587 | 587 | continue; |
| 588 | 588 | } |
| 589 | 589 | |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | * $matches[1] = all parameters string in opening tag |
| 623 | 623 | * $matches[2] = content between the tags to send to the plugin. |
| 624 | 624 | */ |
| 625 | - if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) { |
|
| 625 | + if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) { |
|
| 626 | 626 | continue; |
| 627 | 627 | } |
| 628 | 628 | |
@@ -84,14 +84,14 @@ |
||
| 84 | 84 | $command = is_string($command) ? $command : 'command:name'; |
| 85 | 85 | $type = is_string($type) ? $type : 'basic'; |
| 86 | 86 | |
| 87 | - if (! in_array($type, ['basic', 'generator'], true)) { |
|
| 87 | + if (!in_array($type, ['basic', 'generator'], true)) { |
|
| 88 | 88 | // @codeCoverageIgnoreStart |
| 89 | 89 | $type = $this->choice(lang('CLI.generator.commandType'), ['basic', 'generator'], 'basic'); |
| 90 | 90 | $this->eol(); |
| 91 | 91 | // @codeCoverageIgnoreEnd |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (! is_string($group)) { |
|
| 94 | + if (!is_string($group)) { |
|
| 95 | 95 | $group = $type === 'generator' ? 'Generators' : 'BlitzPHP'; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $this->getModel(); |
| 93 | 93 | |
| 94 | - if (! empty($this->helpers)) { |
|
| 94 | + if (!empty($this->helpers)) { |
|
| 95 | 95 | helper($this->helpers); |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | $this->modelName = is_object($which) ? null : $which; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if (empty($this->model) && ! empty($this->modelName) && class_exists($this->modelName)) { |
|
| 112 | + if (empty($this->model) && !empty($this->modelName) && class_exists($this->modelName)) { |
|
| 113 | 113 | $this->model = model($this->modelName); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if (! empty($this->model) && empty($this->modelName)) { |
|
| 116 | + if (!empty($this->model) && empty($this->modelName)) { |
|
| 117 | 117 | $this->modelName = get_class($this->model); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | private function getModel() |
| 153 | 153 | { |
| 154 | - if (! empty($this->modelName)) { |
|
| 154 | + if (!empty($this->modelName)) { |
|
| 155 | 155 | $model = $this->modelName; |
| 156 | 156 | } else { |
| 157 | 157 | $model = str_replace('Controller', 'Model', static::class); |
@@ -152,19 +152,19 @@ |
||
| 152 | 152 | */ |
| 153 | 153 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
| 154 | 154 | { |
| 155 | - if (! in_array($request->getMethod(), $this->methods, true)) { |
|
| 155 | + if (!in_array($request->getMethod(), $this->methods, true)) { |
|
| 156 | 156 | return $handler->handle($request); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | [$type] = explode(';', $request->getHeaderLine('Content-Type')); |
| 160 | 160 | $type = strtolower($type); |
| 161 | - if (! isset($this->parsers[$type])) { |
|
| 161 | + if (!isset($this->parsers[$type])) { |
|
| 162 | 162 | return $handler->handle($request); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $parser = $this->parsers[$type]; |
| 166 | 166 | $result = $parser($request->getBody()->getContents()); |
| 167 | - if (! is_array($result)) { |
|
| 167 | + if (!is_array($result)) { |
|
| 168 | 168 | throw HttpException::badRequest(); |
| 169 | 169 | } |
| 170 | 170 | $request = $request->withParsedBody($result); |
@@ -82,9 +82,9 @@ |
||
| 82 | 82 | */ |
| 83 | 83 | public function setMethods(?array $methods): self |
| 84 | 84 | { |
| 85 | - if (is_array($methods)) { |
|
| 86 | - $this->methods = $methods; |
|
| 87 | - } |
|
| 85 | + if (is_array($methods)) { |
|
| 86 | + $this->methods = $methods; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | return $this; |
| 90 | 90 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | 'AllowMethods' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'], |
| 29 | 29 | 'AllowHeaders' => true, |
| 30 | 30 | 'ExposeHeaders' => false, |
| 31 | - 'MaxAge' => 86400, // 1 day |
|
| 31 | + 'MaxAge' => 86400, // 1 day |
|
| 32 | 32 | ]; |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if (! count($data)) { |
|
| 89 | + if (!count($data)) { |
|
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -118,18 +118,18 @@ discard block |
||
| 118 | 118 | public function parse(): ?array |
| 119 | 119 | { |
| 120 | 120 | // Nous ne voulons pas imposer la présence d'un fichier .env, ils devraient être facultatifs. |
| 121 | - if (! is_file($this->path)) { |
|
| 121 | + if (!is_file($this->path)) { |
|
| 122 | 122 | return null; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // Assurez-vous que le fichier est lisible |
| 126 | - if (! is_readable($this->path)) { |
|
| 126 | + if (!is_readable($this->path)) { |
|
| 127 | 127 | throw new InvalidArgumentException("The .env file is not readable: {$this->path}"); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $vars = []; |
| 131 | 131 | |
| 132 | - $lines = file($this->path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 132 | + $lines = file($this->path, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); |
|
| 133 | 133 | |
| 134 | 134 | foreach ($lines as $line) { |
| 135 | 135 | // C'est un commentaire? |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | protected function setVariable(string $name, string $value = '') |
| 156 | 156 | { |
| 157 | - if (! getenv($name, true)) { |
|
| 157 | + if (!getenv($name, true)) { |
|
| 158 | 158 | putenv("{$name}={$value}"); |
| 159 | 159 | } |
| 160 | 160 | if (empty($_ENV[$name])) { |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | protected function sanitizeValue(string $value): string |
| 205 | 205 | { |
| 206 | - if (! $value) { |
|
| 206 | + if (!$value) { |
|
| 207 | 207 | return $value; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | $value = preg_replace_callback( |
| 261 | 261 | '/\${([a-zA-Z0-9_]+)}/', |
| 262 | - static function ($matchedPatterns) use ($loader) { |
|
| 262 | + static function($matchedPatterns) use ($loader) { |
|
| 263 | 263 | $nestedVariable = $loader->getVariable($matchedPatterns[1]); |
| 264 | 264 | |
| 265 | 265 | if (null === $nestedVariable) { |