@@ -120,7 +120,7 @@ |
||
| 120 | 120 | */ |
| 121 | 121 | protected function validateData(array $data, array $rules, array $messages = []): ValidatedInput |
| 122 | 122 | { |
| 123 | - try { |
|
| 123 | + try { |
|
| 124 | 124 | return Validator::make($data, $rules, $messages)->safe(); |
| 125 | 125 | } catch (DimtrovichValidationException $e) { |
| 126 | 126 | $th = new ValidationException($e->getMessage()); |
@@ -1184,7 +1184,7 @@ |
||
| 1184 | 1184 | return false; |
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | - $name = $this->formatRouteName($search); |
|
| 1187 | + $name = $this->formatRouteName($search); |
|
| 1188 | 1188 | // Les routes nommées ont une priorité plus élevée. |
| 1189 | 1189 | foreach ($this->routesNames as $verb => $collection) { |
| 1190 | 1190 | if (array_key_exists($name, $collection)) { |
@@ -177,27 +177,27 @@ |
||
| 177 | 177 | return $this->addData($key, $context); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - /** |
|
| 180 | + /** |
|
| 181 | 181 | * Ajoute des erreurs à la session en tant que Flashdata. |
| 182 | 182 | */ |
| 183 | 183 | public function withErrors(array|ErrorBag|string $errors): static |
| 184 | 184 | { |
| 185 | - if (is_string($errors)) { |
|
| 186 | - $errors = ['default' => $errors]; |
|
| 187 | - } |
|
| 188 | - if (! ($errors instanceof ErrorBag)) { |
|
| 189 | - $errors = new ErrorBag($errors); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - if (isset(static::$shared['errors']) && static::$shared['errors'] instanceof ErrorBag) { |
|
| 193 | - $messages = array_merge( |
|
| 194 | - static::$shared['errors']->toArray(), |
|
| 195 | - $errors->toArray() |
|
| 196 | - ); |
|
| 197 | - $errors = new ErrorBag($messages); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - $this->share('errors', $errors); |
|
| 185 | + if (is_string($errors)) { |
|
| 186 | + $errors = ['default' => $errors]; |
|
| 187 | + } |
|
| 188 | + if (! ($errors instanceof ErrorBag)) { |
|
| 189 | + $errors = new ErrorBag($errors); |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + if (isset(static::$shared['errors']) && static::$shared['errors'] instanceof ErrorBag) { |
|
| 193 | + $messages = array_merge( |
|
| 194 | + static::$shared['errors']->toArray(), |
|
| 195 | + $errors->toArray() |
|
| 196 | + ); |
|
| 197 | + $errors = new ErrorBag($messages); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + $this->share('errors', $errors); |
|
| 201 | 201 | |
| 202 | 202 | return $this; |
| 203 | 203 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $this->adapter->addData($data, $context); |
| 158 | 158 | |
| 159 | - if (! array_key_exists('errors', $this->getData())) { |
|
| 159 | + if (!array_key_exists('errors', $this->getData())) { |
|
| 160 | 160 | $this->setValidationErrors(); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | if (is_string($errors)) { |
| 186 | 186 | $errors = ['default' => $errors]; |
| 187 | 187 | } |
| 188 | - if (! ($errors instanceof ErrorBag)) { |
|
| 188 | + if (!($errors instanceof ErrorBag)) { |
|
| 189 | 189 | $errors = new ErrorBag($errors); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | $this->adapter->setData($data, $context); |
| 227 | 227 | |
| 228 | - if (! array_key_exists('errors', $this->getData())) { |
|
| 228 | + if (!array_key_exists('errors', $this->getData())) { |
|
| 229 | 229 | $this->setValidationErrors(); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function setAdapter(string $adapter, array $config = []): self |
| 267 | 267 | { |
| 268 | - if (! array_key_exists($adapter, self::$validAdapters)) { |
|
| 268 | + if (!array_key_exists($adapter, self::$validAdapters)) { |
|
| 269 | 269 | $adapter = 'native'; |
| 270 | 270 | } |
| 271 | - if (empty($this->config['adapters']) || ! is_array($this->config['adapters'])) { |
|
| 271 | + if (empty($this->config['adapters']) || !is_array($this->config['adapters'])) { |
|
| 272 | 272 | $this->config['adapters'] = []; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | protected function decorate(string $output): string |
| 326 | 326 | { |
| 327 | 327 | foreach ($this->config['decorators'] as $decorator) { |
| 328 | - if (! is_subclass_of($decorator, ViewDecoratorInterface::class)) { |
|
| 328 | + if (!is_subclass_of($decorator, ViewDecoratorInterface::class)) { |
|
| 329 | 329 | throw ViewException::invalidDecorator($decorator); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -120,9 +120,9 @@ |
||
| 120 | 120 | ['{useStatement}', '{extends}'], |
| 121 | 121 | [$useStatement, $extends], |
| 122 | 122 | [ |
| 123 | - 'type' => $rest, |
|
| 124 | - 'invokable' => $this->option('invokable'), |
|
| 125 | - ] |
|
| 123 | + 'type' => $rest, |
|
| 124 | + 'invokable' => $this->option('invokable'), |
|
| 125 | + ] |
|
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | } |