@@ -95,7 +95,7 @@ |
||
| 95 | 95 | ->requireDirectory(APP_PATH, Checker::CHECK_IS_READABLE); |
| 96 | 96 | |
| 97 | 97 | $checker->check(); |
| 98 | - if (! $checker->isSatisfied()) { |
|
| 98 | + if (!$checker->isSatisfied()) { |
|
| 99 | 99 | echo '<h3>An error encourred</h3>'; |
| 100 | 100 | |
| 101 | 101 | exit(implode('<br/> ', $checker->getErrors())); |
@@ -308,14 +308,14 @@ |
||
| 308 | 308 | */ |
| 309 | 309 | private function setFormatter(object $handler, array $allowed, ?string $format = 'json'): object |
| 310 | 310 | { |
| 311 | - if (! method_exists($handler, 'setFormatter')) { |
|
| 311 | + if (!method_exists($handler, 'setFormatter')) { |
|
| 312 | 312 | return $handler; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | if ($format === null || $format === '') { |
| 316 | 316 | $format = 'json'; |
| 317 | 317 | } |
| 318 | - if ($allowed !== [] && ! in_array($format, $allowed, true)) { |
|
| 318 | + if ($allowed !== [] && !in_array($format, $allowed, true)) { |
|
| 319 | 319 | throw new InvalidArgumentException('Invalid formatter for log file handler. Accepts values: ' . implode('/', $allowed)); |
| 320 | 320 | } |
| 321 | 321 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $this->config = $config ?? (object) config('toolbar'); |
| 68 | 68 | |
| 69 | 69 | foreach ($this->config->collectors as $collector) { |
| 70 | - if (! class_exists($collector)) { |
|
| 70 | + if (!class_exists($collector)) { |
|
| 71 | 71 | logger()->critical( |
| 72 | 72 | 'Toolbar collector does not exist (' . $collector . ').' |
| 73 | 73 | . ' Please check $collectors in the app/Config/toolbar.php file.' |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | $output = ''; |
| 207 | 207 | |
| 208 | 208 | foreach ($rows as $row) { |
| 209 | - $hasChildren = isset($row['children']) && ! empty($row['children']); |
|
| 210 | - $isQuery = isset($row['query']) && ! empty($row['query']); |
|
| 209 | + $hasChildren = isset($row['children']) && !empty($row['children']); |
|
| 210 | + $isQuery = isset($row['query']) && !empty($row['query']); |
|
| 211 | 211 | |
| 212 | 212 | // Ouvrir la chronologie du contrôleur par défaut |
| 213 | 213 | $open = $row['name'] === 'Controller'; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | // Le collecter |
| 274 | 274 | foreach ($collectors as $collector) { |
| 275 | - if (! $collector['hasTimelineData']) { |
|
| 275 | + if (!$collector['hasTimelineData']) { |
|
| 276 | 276 | continue; |
| 277 | 277 | } |
| 278 | 278 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | array_multisort(...$sortArray); |
| 290 | 290 | |
| 291 | 291 | // Ajouter une heure de fin à chaque élément |
| 292 | - array_walk($data, static function (&$row): void { |
|
| 292 | + array_walk($data, static function(&$row): void { |
|
| 293 | 293 | $row['end'] = $row['start'] + $row['duration']; |
| 294 | 294 | }); |
| 295 | 295 | |
@@ -332,14 +332,14 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | protected function collectVarData(): array |
| 334 | 334 | { |
| 335 | - if (! ($this->config->collectVarData ?? true)) { |
|
| 335 | + if (!($this->config->collectVarData ?? true)) { |
|
| 336 | 336 | return []; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | $data = []; |
| 340 | 340 | |
| 341 | 341 | foreach ($this->collectors as $collector) { |
| 342 | - if (! $collector->hasVarData()) { |
|
| 342 | + if (!$collector->hasVarData()) { |
|
| 343 | 343 | continue; |
| 344 | 344 | } |
| 345 | 345 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | // Si on a desactiver le debogage ou l'affichage de la debugbar, on s'arrete |
| 377 | - if (! BLITZ_DEBUG || ! $this->config->show_debugbar) { |
|
| 377 | + if (!BLITZ_DEBUG || !$this->config->show_debugbar) { |
|
| 378 | 378 | return $response; |
| 379 | 379 | } |
| 380 | 380 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | // Mise à jour vers microtime() pour que nous puissions obtenir l'historique |
| 390 | 390 | $time = sprintf('%.6f', Date::now()->format('U.u')); |
| 391 | 391 | |
| 392 | - if (! is_dir($this->debugPath)) { |
|
| 392 | + if (!is_dir($this->debugPath)) { |
|
| 393 | 393 | mkdir($this->debugPath, 0o777); |
| 394 | 394 | } |
| 395 | 395 | |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | // Les formats non HTML ne doivent pas inclure la barre de débogage, |
| 401 | 401 | // puis nous envoyons des en-têtes indiquant où trouver les données de débogage pour cette réponse |
| 402 | - if ($request->ajax() || ! str_contains($format, 'html')) { |
|
| 402 | + if ($request->ajax() || !str_contains($format, 'html')) { |
|
| 403 | 403 | return $response |
| 404 | 404 | ->withHeader('Debugbar-Time', "{$time}") |
| 405 | 405 | ->withHeader('Debugbar-Link', site_url("?debugbar_time={$time}")); |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | { |
| 59 | 59 | $debugger = Ignition::make(); |
| 60 | 60 | $debugger->applicationPath(ROOTPATH) |
| 61 | - ->shouldDisplayException(! on_prod()) |
|
| 61 | + ->shouldDisplayException(!on_prod()) |
|
| 62 | 62 | ->register(); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $this->_streamMode = $options['streamMode'] ?? $this->_streamMode; |
| 379 | 379 | |
| 380 | 380 | if (isset($options['stream'])) { |
| 381 | - if (! $options['stream'] instanceof StreamInterface) { |
|
| 381 | + if (!$options['stream'] instanceof StreamInterface) { |
|
| 382 | 382 | throw new InvalidArgumentException('Stream option must be an object that implements StreamInterface'); |
| 383 | 383 | } |
| 384 | 384 | $this->stream = $options['stream']; |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | $this->_setStatus($options['status']); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - if (! isset($options['charset'])) { |
|
| 397 | + if (!isset($options['charset'])) { |
|
| 398 | 398 | $options['charset'] = config('app.charset'); |
| 399 | 399 | } |
| 400 | 400 | $this->_charset = $options['charset']; |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $charset = true; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - if ($charset && ! str_contains($type, ';')) { |
|
| 445 | + if ($charset && !str_contains($type, ';')) { |
|
| 446 | 446 | $this->_setHeader('Content-Type', "{$type}; charset={$this->_charset}"); |
| 447 | 447 | } else { |
| 448 | 448 | $this->_setHeader('Content-Type', $type); |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | protected function _clearHeader(string $header): void |
| 523 | 523 | { |
| 524 | 524 | $normalized = strtolower($header); |
| 525 | - if (! isset($this->headerNames[$normalized])) { |
|
| 525 | + if (!isset($this->headerNames[$normalized])) { |
|
| 526 | 526 | return; |
| 527 | 527 | } |
| 528 | 528 | $original = $this->headerNames[$normalized]; |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | throw HttpException::invalidStatusCode($code); |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | - if (! array_key_exists($code, $this->_statusCodes) && ($reasonPhrase === '' || $reasonPhrase === '0')) { |
|
| 592 | + if (!array_key_exists($code, $this->_statusCodes) && ($reasonPhrase === '' || $reasonPhrase === '0')) { |
|
| 593 | 593 | throw HttpException::unkownStatusCode($code); |
| 594 | 594 | } |
| 595 | 595 | |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | if ($mapped) { |
| 683 | 683 | return is_array($mapped) ? current($mapped) : $mapped; |
| 684 | 684 | } |
| 685 | - if (! str_contains($contentType, '/')) { |
|
| 685 | + if (!str_contains($contentType, '/')) { |
|
| 686 | 686 | throw new InvalidArgumentException(sprintf('`%s` est un content type invalide.', $contentType)); |
| 687 | 687 | } |
| 688 | 688 | |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | */ |
| 766 | 766 | public function withCache($since, $time = '+1 day'): static |
| 767 | 767 | { |
| 768 | - if (! is_int($time)) { |
|
| 768 | + if (!is_int($time)) { |
|
| 769 | 769 | $time = strtotime($time); |
| 770 | 770 | if ($time === false) { |
| 771 | 771 | throw new InvalidArgumentException( |
@@ -1233,7 +1233,7 @@ discard block |
||
| 1233 | 1233 | */ |
| 1234 | 1234 | public function getCookie(string $name): ?array |
| 1235 | 1235 | { |
| 1236 | - if (! $this->hasCookie($name)) { |
|
| 1236 | + if (!$this->hasCookie($name)) { |
|
| 1237 | 1237 | return null; |
| 1238 | 1238 | } |
| 1239 | 1239 | |
@@ -1245,7 +1245,7 @@ discard block |
||
| 1245 | 1245 | */ |
| 1246 | 1246 | public function hasCookie(string $name, ?string $value = null): bool |
| 1247 | 1247 | { |
| 1248 | - if (! $this->_cookies->has($name)) { |
|
| 1248 | + if (!$this->_cookies->has($name)) { |
|
| 1249 | 1249 | return false; |
| 1250 | 1250 | } |
| 1251 | 1251 | |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | |
| 1323 | 1323 | $extension = strtolower($file->getExtension()); |
| 1324 | 1324 | $mapped = $this->getMimeType($extension); |
| 1325 | - if ((! $extension || ! $mapped) && $options['download'] === null) { |
|
| 1325 | + if ((!$extension || !$mapped) && $options['download'] === null) { |
|
| 1326 | 1326 | $options['download'] = true; |
| 1327 | 1327 | } |
| 1328 | 1328 | |
@@ -1384,12 +1384,12 @@ discard block |
||
| 1384 | 1384 | if (str_contains($path, '../') || str_contains($path, '..\\')) { |
| 1385 | 1385 | throw new LoadException('The requested file contains `..` and will not be read.'); |
| 1386 | 1386 | } |
| 1387 | - if (! is_file($path)) { |
|
| 1387 | + if (!is_file($path)) { |
|
| 1388 | 1388 | $path = APP_PATH . $path; |
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | $file = new SplFileInfo($path); |
| 1392 | - if (! $file->isFile() || ! $file->isReadable()) { |
|
| 1392 | + if (!$file->isFile() || !$file->isReadable()) { |
|
| 1393 | 1393 | if (on_dev()) { |
| 1394 | 1394 | throw new LoadException(sprintf('The requested file %s was not found or not readable', $path)); |
| 1395 | 1395 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | // Si cela semble être une URL relative, alors convertissez-la en URL complète |
| 70 | 70 | // pour une meilleure sécurité. |
| 71 | - if (! str_starts_with($uri, 'http')) { |
|
| 71 | + if (!str_starts_with($uri, 'http')) { |
|
| 72 | 72 | $uri = site_url($uri); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | $request = $this->generator->getRequest(); |
| 139 | 139 | |
| 140 | - $intended = $request->method() === 'GET' && ! $request->expectsJson() |
|
| 140 | + $intended = $request->method() === 'GET' && !$request->expectsJson() |
|
| 141 | 141 | ? $this->generator->full() |
| 142 | 142 | : $this->generator->previous(); |
| 143 | 143 | |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | public function validation(array|string $rules, array $messages = []): Validation |
| 66 | 66 | { |
| 67 | 67 | if (is_string($rules)) { |
| 68 | - if (! class_exists($rules) || ! is_subclass_of($rules, DataValidation::class)) { |
|
| 68 | + if (!class_exists($rules) || !is_subclass_of($rules, DataValidation::class)) { |
|
| 69 | 69 | throw new InvalidArgumentException(); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | helper('assets'); |
| 80 | 80 | |
| 81 | - if (! empty($viewPathLocator)) { |
|
| 81 | + if (!empty($viewPathLocator)) { |
|
| 82 | 82 | if (is_string($viewPathLocator)) { |
| 83 | 83 | $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS; |
| 84 | 84 | } elseif ($viewPathLocator instanceof LocatorInterface) { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if (! $this->locator instanceof LocatorInterface && ! is_dir($this->viewPath)) { |
|
| 89 | + if (!$this->locator instanceof LocatorInterface && !is_dir($this->viewPath)) { |
|
| 90 | 90 | $this->viewPath = ''; |
| 91 | 91 | $this->locator = Services::locator(); |
| 92 | 92 | } |
@@ -261,18 +261,18 @@ discard block |
||
| 261 | 261 | $ext ??= $this->ext; |
| 262 | 262 | |
| 263 | 263 | $viewPath = $options['viewPath'] ?? $this->viewPath; |
| 264 | - $file = ! empty($viewPath) ? str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')) : $view; |
|
| 264 | + $file = !empty($viewPath) ? str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')) : $view; |
|
| 265 | 265 | |
| 266 | 266 | $file = Helpers::ensureExt($file, $ext); |
| 267 | 267 | |
| 268 | - if (! is_file($file) && $this->locator instanceof LocatorInterface) { |
|
| 268 | + if (!is_file($file) && $this->locator instanceof LocatorInterface) { |
|
| 269 | 269 | $file = $this->locator->locateFile($view, 'Views', $ext); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | $file = realpath($file); |
| 273 | 273 | |
| 274 | 274 | // locateFile renverra une chaîne vide si le fichier est introuvable. |
| 275 | - if (! is_file($file)) { |
|
| 275 | + if (!is_file($file)) { |
|
| 276 | 276 | throw ViewException::invalidFile($view); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | // Enregistrer les variables actuelles |
| 122 | 122 | $renderVars = $this->renderVars; |
| 123 | 123 | |
| 124 | - $output = (function (): string { |
|
| 124 | + $output = (function(): string { |
|
| 125 | 125 | extract($this->tempData); |
| 126 | 126 | ob_start(); |
| 127 | 127 | include $this->renderVars['file']; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | $this->logPerformance($this->renderVars['start'], microtime(true), $this->renderVars['view']); |
| 144 | 144 | |
| 145 | - if ($this->debug && (! isset($options['debug']) || $options['debug'] === true) && in_array(ViewsCollector::class, config('toolbar.collectors'), true)) { |
|
| 145 | + if ($this->debug && (!isset($options['debug']) || $options['debug'] === true) && in_array(ViewsCollector::class, config('toolbar.collectors'), true)) { |
|
| 146 | 146 | // Nettoyer nos noms de chemins pour les rendre un peu plus propres |
| 147 | 147 | $this->renderVars['file'] = clean_path($this->renderVars['file']); |
| 148 | 148 | $this->renderVars['file'] = ++$this->viewsCount . ' ' . $this->renderVars['file']; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $saveData ??= $this->saveData; |
| 176 | 176 | $this->prepareTemplateData($saveData); |
| 177 | 177 | |
| 178 | - $output = (function (string $view): string { |
|
| 178 | + $output = (function(string $view): string { |
|
| 179 | 179 | extract($this->tempData); |
| 180 | 180 | ob_start(); |
| 181 | 181 | eval('?>' . $view); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | $section = array_pop($this->sectionStack); |
| 319 | 319 | |
| 320 | 320 | // Assurez-vous qu'un tableau existe afin que nous puissions stocker plusieurs entrées pour cela. |
| 321 | - if (! array_key_exists($section, $this->sections)) { |
|
| 321 | + if (!array_key_exists($section, $this->sections)) { |
|
| 322 | 322 | $this->sections[$section] = []; |
| 323 | 323 | } |
| 324 | 324 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | public function show(string $sectionName, bool $preserve = false) |
| 356 | 356 | { |
| 357 | - if (! isset($this->sections[$sectionName])) { |
|
| 357 | + if (!isset($this->sections[$sectionName])) { |
|
| 358 | 358 | echo ''; |
| 359 | 359 | |
| 360 | 360 | return; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | * |
| 398 | 398 | * @alias self::insert() |
| 399 | 399 | */ |
| 400 | - public function include(string $view, ?array $data = [], ?array $options = null, ?bool $saveData = null): string |
|
| 400 | + public function include(string $view, ?array $data = [], ?array $options = null, ?bool $saveData = null) : string |
|
| 401 | 401 | { |
| 402 | 402 | return $this->insert($view, $data, $options, $saveData); |
| 403 | 403 | } |