@@ -756,15 +756,15 @@ |
||
| 756 | 756 | return Services::redirection()->back()->withInput()->withErrors($errors)->withStatus($code); |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | - /** |
|
| 760 | - * Verifie que la requete est xhr/fetch pour eviter d'afficher la toolbar dans la reponse |
|
| 761 | - */ |
|
| 762 | - private function isAjaxRequest(): bool |
|
| 763 | - { |
|
| 764 | - return $this->request->expectsJson() || |
|
| 765 | - $this->request->isJson() || |
|
| 766 | - $this->request->is('ajax') || |
|
| 767 | - $this->request->hasHeader('Hx-Request') || |
|
| 768 | - Text::contains($this->response->getType(), ['/json', '+json']); |
|
| 769 | - } |
|
| 759 | + /** |
|
| 760 | + * Verifie que la requete est xhr/fetch pour eviter d'afficher la toolbar dans la reponse |
|
| 761 | + */ |
|
| 762 | + private function isAjaxRequest(): bool |
|
| 763 | + { |
|
| 764 | + return $this->request->expectsJson() || |
|
| 765 | + $this->request->isJson() || |
|
| 766 | + $this->request->is('ajax') || |
|
| 767 | + $this->request->hasHeader('Hx-Request') || |
|
| 768 | + Text::contains($this->response->getType(), ['/json', '+json']); |
|
| 769 | + } |
|
| 770 | 770 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $controller = $routes->getDefaultController(); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if (! $fullName && is_string($controller)) { |
|
| 180 | + if (!$fullName && is_string($controller)) { |
|
| 181 | 181 | $controller = str_replace($routes->getDefaultNamespace(), '', $controller); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -300,14 +300,14 @@ discard block |
||
| 300 | 300 | return; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - if (is_cli() && ! on_test()) { |
|
| 303 | + if (is_cli() && !on_test()) { |
|
| 304 | 304 | // @codeCoverageIgnoreStart |
| 305 | 305 | // $this->request = Services::clirequest($this->config); |
| 306 | 306 | // @codeCoverageIgnoreEnd |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'; |
| 310 | - if (! is_numeric($version)) { |
|
| 310 | + if (!is_numeric($version)) { |
|
| 311 | 311 | $version = substr($version, strpos($version, '/') + 1); |
| 312 | 312 | } |
| 313 | 313 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | // Supposons le succès jusqu'à preuve du contraire. |
| 327 | 327 | $this->response = Services::response()->withStatus(200); |
| 328 | 328 | |
| 329 | - if (! is_cli() || on_test()) { |
|
| 329 | + if (!is_cli() || on_test()) { |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion()); |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | // Essayez de charger automatiquement la classe |
| 426 | - if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
| 426 | + if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
| 427 | 427 | throw PageNotFoundException::controllerNotFound($this->controller, $this->method); |
| 428 | 428 | } |
| 429 | 429 | |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | $this->outputBufferingEnd(); |
| 514 | 514 | |
| 515 | - throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : ''); |
|
| 515 | + throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : ''); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | /** |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | public function storePreviousURL($uri) |
| 555 | 555 | { |
| 556 | 556 | // Ignorer les requêtes CLI |
| 557 | - if (is_cli() && ! on_test()) { |
|
| 557 | + if (is_cli() && !on_test()) { |
|
| 558 | 558 | return; // @codeCoverageIgnore |
| 559 | 559 | } |
| 560 | 560 | |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | // Ignorer les reponses non-HTML |
| 567 | - if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
| 567 | + if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
| 568 | 568 | return; |
| 569 | 569 | } |
| 570 | 570 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | */ |
| 589 | 589 | protected function sendResponse() |
| 590 | 590 | { |
| 591 | - if (! $this->isAjaxRequest()) { |
|
| 591 | + if (!$this->isAjaxRequest()) { |
|
| 592 | 592 | $this->response = Services::toolbar()->prepare( |
| 593 | 593 | $this->getPerformanceStats(), |
| 594 | 594 | $this->request, |
@@ -681,11 +681,11 @@ discard block |
||
| 681 | 681 | */ |
| 682 | 682 | private function spoofRequestMethod(): callable |
| 683 | 683 | { |
| 684 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
| 684 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
| 685 | 685 | $post = $request->getParsedBody(); |
| 686 | 686 | |
| 687 | 687 | // Ne fonctionne qu'avec les formulaires POST |
| 688 | - if ($request->getMethod() === 'POST' && ! empty($post['_method'])) { |
|
| 688 | + if ($request->getMethod() === 'POST' && !empty($post['_method'])) { |
|
| 689 | 689 | // Accepte seulement PUT, PATCH, DELETE |
| 690 | 690 | if (in_array($post['_method'], ['PUT', 'PATCH', 'DELETE'], true)) { |
| 691 | 691 | $request = $request->withMethod($post['_method']); |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | |
| 699 | 699 | private function bootApp(): callable |
| 700 | 700 | { |
| 701 | - return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
| 701 | + return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
| 702 | 702 | Services::set(Request::class, $request); |
| 703 | 703 | Services::set(Response::class, $response); |
| 704 | 704 | |
@@ -706,10 +706,10 @@ discard block |
||
| 706 | 706 | $returned = $this->startController(); |
| 707 | 707 | |
| 708 | 708 | // Les controleur sous forme de Closure sont executes dans startController(). |
| 709 | - if (! is_callable($this->controller)) { |
|
| 709 | + if (!is_callable($this->controller)) { |
|
| 710 | 710 | $controller = $this->createController($request, $response); |
| 711 | 711 | |
| 712 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
| 712 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
| 713 | 713 | throw PageNotFoundException::methodNotFound($this->method); |
| 714 | 714 | } |
| 715 | 715 | |