@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | $accept = array_merge($accept, $types); |
1016 | 1016 | } |
1017 | 1017 | |
1018 | - return $accept; |
|
1018 | + return $accept; |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | /** |
@@ -1049,13 +1049,13 @@ discard block |
||
1049 | 1049 | return $accept; |
1050 | 1050 | } |
1051 | 1051 | |
1052 | - foreach ((array) $types as $type) { |
|
1053 | - if (in_array($type, $accept, true)) { |
|
1054 | - return true; |
|
1055 | - } |
|
1056 | - } |
|
1052 | + foreach ((array) $types as $type) { |
|
1053 | + if (in_array($type, $accept, true)) { |
|
1054 | + return true; |
|
1055 | + } |
|
1056 | + } |
|
1057 | 1057 | |
1058 | - return false; |
|
1058 | + return false; |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | /** |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | return trim(config()->get('app.base_url'), '/'); |
83 | 83 | } |
84 | 84 | |
85 | - /** |
|
85 | + /** |
|
86 | 86 | * Obtient le schéma et l'hôte HTTP. |
87 | 87 | * |
88 | 88 | * Si l'URL a été appelée avec une authentification de base, l'utilisateur et |
89 | - * le mot de passe ne sont pas ajoutés à la chaîne générée. |
|
89 | + * le mot de passe ne sont pas ajoutés à la chaîne générée. |
|
90 | 90 | */ |
91 | 91 | public function getSchemeAndHttpHost(): string |
92 | 92 | { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | return collect($patterns)->contains(fn ($pattern) => Text::is($pattern, $path)); |
199 | 199 | } |
200 | 200 | |
201 | - /** |
|
201 | + /** |
|
202 | 202 | * Déterminez si le nom de la route correspond à un modèle donné. |
203 | 203 | * |
204 | 204 | * @param mixed ...$patterns |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function isMethod(array|string $methods): bool |
216 | 216 | { |
217 | - foreach ((array) $methods as $method) { |
|
218 | - if (strtolower($method) === strtolower($this->method())) { |
|
219 | - return true; |
|
220 | - } |
|
221 | - } |
|
217 | + foreach ((array) $methods as $method) { |
|
218 | + if (strtolower($method) === strtolower($this->method())) { |
|
219 | + return true; |
|
220 | + } |
|
221 | + } |
|
222 | 222 | |
223 | 223 | return false; |
224 | 224 | } |
@@ -349,15 +349,15 @@ discard block |
||
349 | 349 | return $this->getUri()->getScheme(); |
350 | 350 | } |
351 | 351 | |
352 | - public function getHost(): string |
|
353 | - { |
|
354 | - return $this->getUri()->getHost(); |
|
355 | - } |
|
352 | + public function getHost(): string |
|
353 | + { |
|
354 | + return $this->getUri()->getHost(); |
|
355 | + } |
|
356 | 356 | |
357 | - public function getPort(): int |
|
358 | - { |
|
359 | - return $this->getUri()->getPort() ?? 80; |
|
360 | - } |
|
357 | + public function getPort(): int |
|
358 | + { |
|
359 | + return $this->getUri()->getPort() ?? 80; |
|
360 | + } |
|
361 | 361 | |
362 | 362 | /** |
363 | 363 | * {@inheritDoc} |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function getSchemeAndHttpHost(): string |
92 | 92 | { |
93 | - return $this->getScheme().'://'.$this->getHttpHost(); |
|
93 | + return $this->getScheme() . '://' . $this->getHttpHost(); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | return $this->getHost(); |
108 | 108 | } |
109 | 109 | |
110 | - return $this->getHost().':'.$port; |
|
110 | + return $this->getHost() . ':' . $port; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function fullUrl(): string |
125 | 125 | { |
126 | - if (! empty($query = $this->getEnv('QUERY_STRING'))) { |
|
126 | + if (!empty($query = $this->getEnv('QUERY_STRING'))) { |
|
127 | 127 | return $this->url() . '?' . $query; |
128 | 128 | } |
129 | 129 |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function view(string $view, ?array $data = [], ?array $options = []): View |
42 | 42 | { |
43 | - $path = ''; |
|
44 | - $data = (array) $data; |
|
45 | - $options = (array) $options; |
|
43 | + $path = ''; |
|
44 | + $data = (array) $data; |
|
45 | + $options = (array) $options; |
|
46 | 46 | |
47 | 47 | // N'est-il pas namespaced ? on cherche le dossier en fonction du controleur |
48 | 48 | if (! str_contains($view, '\\')) { |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | $viewer->addData($this->viewDatas); |
66 | 66 | } |
67 | 67 | |
68 | - if (empty($data['title'])) { |
|
69 | - if (! is_string($controllerName = Dispatcher::getController(false))) { |
|
70 | - $controllerName = static::class; |
|
71 | - } |
|
72 | - $controllerName = str_ireplace(['App\Controllers', 'Controller'], '', $controllerName); |
|
68 | + if (empty($data['title'])) { |
|
69 | + if (! is_string($controllerName = Dispatcher::getController(false))) { |
|
70 | + $controllerName = static::class; |
|
71 | + } |
|
72 | + $controllerName = str_ireplace(['App\Controllers', 'Controller'], '', $controllerName); |
|
73 | 73 | |
74 | - $dbt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); |
|
75 | - $func = isset($dbt[1]['function']) ? $dbt[1]['function'] : Dispatcher::getMethod(); |
|
74 | + $dbt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); |
|
75 | + $func = isset($dbt[1]['function']) ? $dbt[1]['function'] : Dispatcher::getMethod(); |
|
76 | 76 | |
77 | - $viewer->setVar('title', $controllerName . ' - ' . $func); |
|
78 | - } |
|
77 | + $viewer->setVar('title', $controllerName . ' - ' . $func); |
|
78 | + } |
|
79 | 79 | |
80 | 80 | return $viewer->display($path . $view); |
81 | 81 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | final protected function render(array|string $view = '', ?array $data = [], ?array $options = []): ResponseInterface |
87 | 87 | { |
88 | 88 | if (is_array($view)) { |
89 | - $data = $view; |
|
90 | - $options = $data; |
|
89 | + $data = $view; |
|
90 | + $options = $data; |
|
91 | 91 | |
92 | 92 | $dbt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); |
93 | 93 | $view = isset($dbt[1]['function']) ? $dbt[1]['function'] : ''; |
@@ -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); |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | |
58 | 58 | $viewer->setData($data)->setOptions($options); |
59 | 59 | |
60 | - if (! empty($this->layout) && is_string($this->layout)) { |
|
60 | + if (!empty($this->layout) && is_string($this->layout)) { |
|
61 | 61 | $viewer->setLayout($this->layout); |
62 | 62 | } |
63 | 63 | |
64 | - if (! empty($this->viewDatas) && is_array($this->viewDatas)) { |
|
64 | + if (!empty($this->viewDatas) && is_array($this->viewDatas)) { |
|
65 | 65 | $viewer->addData($this->viewDatas); |
66 | 66 | } |
67 | 67 | |
68 | 68 | if (empty($data['title'])) { |
69 | - if (! is_string($controllerName = Dispatcher::getController(false))) { |
|
69 | + if (!is_string($controllerName = Dispatcher::getController(false))) { |
|
70 | 70 | $controllerName = static::class; |
71 | 71 | } |
72 | 72 | $controllerName = str_ireplace(['App\Controllers', 'Controller'], '', $controllerName); |