@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | final protected function success(string $message, bool $badge = true, string $label = 'SUCCESS'): self |
308 | 308 | { |
309 | - if (! $badge) { |
|
309 | + if (!$badge) { |
|
310 | 310 | $this->writer->okBold($label); |
311 | 311 | } else { |
312 | 312 | $this->writer->boldWhiteBgGreen(" {$label} "); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | final protected function warning(string $message, bool $badge = true, string $label = 'WARNING'): self |
322 | 322 | { |
323 | - if (! $badge) { |
|
323 | + if (!$badge) { |
|
324 | 324 | $this->writer->warnBold($label); |
325 | 325 | } else { |
326 | 326 | $this->writer->boldWhiteBgYellow(" {$label} "); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | final protected function info(string $message, bool $badge = true, string $label = 'INFO'): self |
336 | 336 | { |
337 | - if (! $badge) { |
|
337 | + if (!$badge) { |
|
338 | 338 | $this->writer->infoBold($label); |
339 | 339 | } else { |
340 | 340 | $this->writer->boldWhiteBgCyan(" {$label} "); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | final protected function error(string $message, bool $badge = true, string $label = 'ERROR'): self |
350 | 350 | { |
351 | - if (! $badge) { |
|
351 | + if (!$badge) { |
|
352 | 352 | $this->writer->errorBold($label); |
353 | 353 | } else { |
354 | 354 | $this->writer->boldWhiteBgRed(" {$label} "); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | */ |
454 | 454 | final protected function json($data): self |
455 | 455 | { |
456 | - $this->write(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), true); |
|
456 | + $this->write(json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES), true); |
|
457 | 457 | |
458 | 458 | return $this; |
459 | 459 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | */ |
66 | 66 | public function add($middlewares, array $options = []): self |
67 | 67 | { |
68 | - if (! is_array($middlewares)) { |
|
68 | + if (!is_array($middlewares)) { |
|
69 | 69 | $middlewares = [$middlewares]; |
70 | 70 | } |
71 | 71 |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | $group = on_test() ? 'test' : (on_prod() ? 'production' : 'development'); |
58 | 58 | } |
59 | 59 | |
60 | - if (! isset($config[$group]) && strpos($group, 'custom-') === false) { |
|
60 | + if (!isset($config[$group]) && strpos($group, 'custom-') === false) { |
|
61 | 61 | $group = 'default'; |
62 | 62 | } |
63 | 63 | |
64 | - if (is_string($group) && ! isset($config[$group]) && strpos($group, 'custom-') !== 0) { |
|
64 | + if (is_string($group) && !isset($config[$group]) && strpos($group, 'custom-') !== 0) { |
|
65 | 65 | throw new InvalidArgumentException($group . ' is not a valid database connection group.'); |
66 | 66 | } |
67 | 67 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $config = $config[$group]; |
73 | 73 | |
74 | - if (str_contains($config['driver'], 'sqlite') && $config['database'] !== ':memory:' && ! str_contains($config['database'], DS)) { |
|
74 | + if (str_contains($config['driver'], 'sqlite') && $config['database'] !== ':memory:' && !str_contains($config['database'], DS)) { |
|
75 | 75 | $config['database'] = APP_STORAGE_PATH . $config['database']; |
76 | 76 | } |
77 | 77 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | // Si le package "blitz-php/database" n'existe pas on renvoi une fake connection |
95 | 95 | // Ceci est utile juste pour eviter le bug avec le service provider |
96 | - if (! class_exists(Db::class)) { |
|
96 | + if (!class_exists(Db::class)) { |
|
97 | 97 | return static::createMockConnection(); |
98 | 98 | } |
99 | 99 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function expectsJson(): bool |
33 | 33 | { |
34 | - return ($this->ajax() && ! $this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson(); |
|
34 | + return ($this->ajax() && !$this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson(); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -98,7 +98,7 @@ |
||
98 | 98 | return $this->withFile($filepath, ['download' => true, 'name' => $filename]); |
99 | 99 | } |
100 | 100 | |
101 | - if (! empty($data)) { |
|
101 | + if (!empty($data)) { |
|
102 | 102 | return $this->withStringBody($data) |
103 | 103 | ->withType(pathinfo($filename, PATHINFO_EXTENSION)) |
104 | 104 | ->withDownload($filename); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $input = $this->all(); |
88 | 88 | |
89 | 89 | foreach ($keys as $value) { |
90 | - if (! Arr::has($input, $value)) { |
|
90 | + if (!Arr::has($input, $value)) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $keys = is_array($key) ? $key : func_get_args(); |
150 | 150 | |
151 | 151 | foreach ($keys as $value) { |
152 | - if (! $this->isEmptyString($value)) { |
|
152 | + if (!$this->isEmptyString($value)) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | $keys = is_array($key) ? $key : func_get_args(); |
200 | 200 | |
201 | - return ! $this->has($keys); |
|
201 | + return !$this->has($keys); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | $value = $this->input($key); |
228 | 228 | |
229 | - return ! is_bool($value) && ! is_array($value) && trim((string) $value) === ''; |
|
229 | + return !is_bool($value) && !is_array($value) && trim((string) $value) === ''; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | { |
247 | 247 | $input = array_replace_recursive($this->data(), $this->allFiles()); |
248 | 248 | |
249 | - if (! $keys) { |
|
249 | + if (!$keys) { |
|
250 | 250 | return $input; |
251 | 251 | } |
252 | 252 | |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | public function enum(string $key, $enumClass) |
342 | 342 | { |
343 | 343 | if ($this->isNotFilled($key) |
344 | - || ! function_exists('enum_exists') |
|
345 | - || ! enum_exists($enumClass) |
|
346 | - || ! method_exists($enumClass, 'tryFrom')) { |
|
344 | + || !function_exists('enum_exists') |
|
345 | + || !enum_exists($enumClass) |
|
346 | + || !method_exists($enumClass, 'tryFrom')) { |
|
347 | 347 | return null; |
348 | 348 | } |
349 | 349 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | */ |
458 | 458 | public function hasFile(string $key): bool |
459 | 459 | { |
460 | - if (! is_array($files = $this->file($key))) { |
|
460 | + if (!is_array($files = $this->file($key))) { |
|
461 | 461 | $files = [$files]; |
462 | 462 | } |
463 | 463 |
@@ -96,7 +96,7 @@ |
||
96 | 96 | */ |
97 | 97 | public function fullUrl(): string |
98 | 98 | { |
99 | - if (! empty($query = $this->getEnv('QUERY_STRING'))) { |
|
99 | + if (!empty($query = $this->getEnv('QUERY_STRING'))) { |
|
100 | 100 | return $this->url() . '?' . $query; |
101 | 101 | } |
102 | 102 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $route = Services::routes()->reverseRoute($route, ...$params); |
52 | 52 | |
53 | - if (! $route) { |
|
53 | + if (!$route) { |
|
54 | 54 | throw HttpException::invalidRedirectRoute($route); |
55 | 55 | } |
56 | 56 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $errors = [$errors]; |
82 | 82 | } |
83 | 83 | |
84 | - if (! empty($errors)) { |
|
84 | + if (!empty($errors)) { |
|
85 | 85 | $session = Services::session(); |
86 | 86 | $_errors = $session->getFlashdata('errors') ?? []; |
87 | 87 | $session->setFlashdata( |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | return $this->db->table($table); |
233 | 233 | } |
234 | 234 | |
235 | - if (empty($builderTable) && ! empty($this->table)) { |
|
235 | + if (empty($builderTable) && !empty($this->table)) { |
|
236 | 236 | $this->builder = $this->builder->table($this->table); |
237 | 237 | } |
238 | 238 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // S'assurer qu'on a une bonne connxion a la base de donnees |
243 | - if (! $this->db instanceof ConnectionInterface) { |
|
243 | + if (!$this->db instanceof ConnectionInterface) { |
|
244 | 244 | $this->db = Database::connect($this->group); |
245 | 245 | } |
246 | 246 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function create(array|object|null $data = null, bool $returnID = true) |
274 | 274 | { |
275 | - if (! empty($this->tempData['data'])) { |
|
275 | + if (!empty($this->tempData['data'])) { |
|
276 | 276 | if (empty($data)) { |
277 | 277 | $data = $this->tempData['data']; |
278 | 278 | } else { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | { |
316 | 316 | $id = $id ?: $this->primaryKeyValue; |
317 | 317 | |
318 | - if (! empty($this->tempData['data'])) { |
|
318 | + if (!empty($this->tempData['data'])) { |
|
319 | 319 | if (empty($data)) { |
320 | 320 | $data = $this->tempData['data']; |
321 | 321 | } else { |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | return $data->{$this->primaryKey}; |
434 | 434 | } |
435 | 435 | |
436 | - if (is_array($data) && ! empty($data[$this->primaryKey])) { |
|
436 | + if (is_array($data) && !empty($data[$this->primaryKey])) { |
|
437 | 437 | return $data[$this->primaryKey]; |
438 | 438 | } |
439 | 439 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | */ |
447 | 447 | protected function shouldUpdate(array|object $data): bool |
448 | 448 | { |
449 | - return ! empty($this->idValue($data)); |
|
449 | + return !empty($this->idValue($data)); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | |
465 | 465 | // Convertissez toutes les instances de Date en $dateFormat approprié |
466 | 466 | if ($properties) { |
467 | - $properties = array_map(function ($value) { |
|
467 | + $properties = array_map(function($value) { |
|
468 | 468 | if ($value instanceof Date) { |
469 | 469 | return $this->timeToDate($value); |
470 | 470 | } |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $properties = $data->toArray(); |
493 | 493 | } else { |
494 | 494 | $mirror = new ReflectionClass($data); |
495 | - $props = $mirror->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED); |
|
495 | + $props = $mirror->getProperties(ReflectionProperty::IS_PUBLIC|ReflectionProperty::IS_PROTECTED); |
|
496 | 496 | |
497 | 497 | $properties = []; |
498 | 498 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | */ |
547 | 547 | protected function transformDataToArray(array|object|null $data, string $type): array |
548 | 548 | { |
549 | - if (! in_array($type, ['insert', 'update'], true)) { |
|
549 | + if (!in_array($type, ['insert', 'update'], true)) { |
|
550 | 550 | throw new InvalidArgumentException(sprintf('Invalid type "%s" used upon transforming data to array.', $type)); |
551 | 551 | } |
552 | 552 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | |
557 | 557 | // Si $data utilise une classe personnalisée avec des propriétés publiques ou protégées représentant |
558 | 558 | // les éléments de la collection, nous devons les saisir sous forme de tableau. |
559 | - if (is_object($data) && ! $data instanceof stdClass) { |
|
559 | + if (is_object($data) && !$data instanceof stdClass) { |
|
560 | 560 | $data = $this->objectToArray($data, $type === 'update', true); |
561 | 561 | } |
562 | 562 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | } |
568 | 568 | |
569 | 569 | // S'il est toujours vide ici, cela signifie que $data n'a pas changé ou est un objet vide |
570 | - if (! $this->allowEmptyInserts && empty($data)) { |
|
570 | + if (!$this->allowEmptyInserts && empty($data)) { |
|
571 | 571 | throw DataException::emptyDataset($type); |
572 | 572 | } |
573 | 573 |