Passed
Push — main ( 40dc38...b0a2e6 )
by Dimitri
11:06
created
src/Models/BaseModel.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -429,7 +429,7 @@
 block discarded – undo
429 429
      */
430 430
     protected function idValue(array|object $data)
431 431
     {
432
-       if (is_object($data) && isset($data->{$this->primaryKey})) {
432
+        if (is_object($data) && isset($data->{$this->primaryKey})) {
433 433
             return $data->{$this->primaryKey};
434 434
         }
435 435
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Helpers/common.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 // ================================= FONCTIONS D'ACCESSIBILITE ================================= //
26 26
 
27
-if (! function_exists('env')) {
27
+if (!function_exists('env')) {
28 28
     /**
29 29
      * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation
30 30
      * pour les variables d'environnement non prises en charge ou incohérentes
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     }
41 41
 }
42 42
 
43
-if (! function_exists('helper')) {
43
+if (!function_exists('helper')) {
44 44
     /**
45 45
      * Charge un fichier d'aide en mémoire. Prend en charge les assistants d'espace de noms,
46 46
      * à la fois dans et hors du répertoire 'helpers' d'un répertoire à espace de noms.
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     }
59 59
 }
60 60
 
61
-if (! function_exists('model')) {
61
+if (!function_exists('model')) {
62 62
     /**
63 63
      * Simple maniere d'obtenir un modele.
64 64
      *
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @return T
70 70
      */
71
-    function model(string|array $name, ?ConnectionInterface &$conn = null)
71
+    function model(string|array $name, ?ConnectionInterface&$conn = null)
72 72
     {
73 73
         return Load::model($name, $conn);
74 74
     }
75 75
 }
76 76
 
77
-if (! function_exists('service')) {
77
+if (!function_exists('service')) {
78 78
     /**
79 79
      * Permet un accès plus propre au fichier de configuration des services.
80 80
      * Renvoie toujours une instance SHARED de la classe, donc
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     }
92 92
 }
93 93
 
94
-if (! function_exists('single_service')) {
94
+if (!function_exists('single_service')) {
95 95
     /**
96 96
      * Autoriser l'accès propre à un service.
97 97
      * Renvoie toujours une nouvelle instance de la classe.
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     }
106 106
 }
107 107
 
108
-if (! function_exists('show404')) {
108
+if (!function_exists('show404')) {
109 109
     /**
110 110
      * Afficher une page 404 introuvable dans le navigateur
111 111
      */
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     }
116 116
 }
117 117
 
118
-if (! function_exists('config')) {
118
+if (!function_exists('config')) {
119 119
     /**
120 120
      * GET/SET App config
121 121
      *
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     function config(string $config, $value = null, bool $force_set = false)
127 127
     {
128
-        if (! empty($value) || (empty($value) && true === $force_set)) {
128
+        if (!empty($value) || (empty($value) && true === $force_set)) {
129 129
             Config::set($config, $value);
130 130
         }
131 131
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
 // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== //
137 137
 
138
-if (! function_exists('esc')) {
138
+if (!function_exists('esc')) {
139 139
     /**
140 140
      * Effectue un simple échappement automatique des données pour des raisons de sécurité.
141 141
      * Pourrait envisager de rendre cela plus complexe à une date ultérieure.
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     }
163 163
 }
164 164
 
165
-if (! function_exists('h')) {
165
+if (!function_exists('h')) {
166 166
     /**
167 167
      * Méthode pratique pour htmlspecialchars.
168 168
      *
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     }
182 182
 }
183 183
 
184
-if (! function_exists('purify')) {
184
+if (!function_exists('purify')) {
185 185
     /**
186 186
      * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier.
187 187
      * Utilisez facilement plusieurs configurations de purificateur.
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     }
200 200
 }
201 201
 
202
-if (! function_exists('remove_invisible_characters')) {
202
+if (!function_exists('remove_invisible_characters')) {
203 203
     /**
204 204
      * Supprimer les caractères invisibles
205 205
      *
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     }
213 213
 }
214 214
 
215
-if (! function_exists('stringify_attributes')) {
215
+if (!function_exists('stringify_attributes')) {
216 216
     /**
217 217
      * Chaîner les attributs à utiliser dans les balises HTML.
218 218
      *
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
 // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= //
228 228
 
229
-if (! function_exists('on_dev')) {
229
+if (!function_exists('on_dev')) {
230 230
     /**
231 231
      * Testez pour voir si nous sommes dans un environnement de développement.
232 232
      */
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     }
243 243
 }
244 244
 
245
-if (! function_exists('on_prod')) {
245
+if (!function_exists('on_prod')) {
246 246
     /**
247 247
      * Testez pour voir si nous sommes dans un environnement de production.
248 248
      */
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     }
259 259
 }
260 260
 
261
-if (! function_exists('on_test')) {
261
+if (!function_exists('on_test')) {
262 262
     /**
263 263
      * Testez pour voir si nous sommes dans un environnement de test
264 264
      */
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     }
271 271
 }
272 272
 
273
-if (! function_exists('is_cli')) {
273
+if (!function_exists('is_cli')) {
274 274
     /**
275 275
      * Testez pour voir si une demande a été faite à partir de la ligne de commande.
276 276
      */
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     }
281 281
 }
282 282
 
283
-if (! function_exists('is_php')) {
283
+if (!function_exists('is_php')) {
284 284
     /**
285 285
      * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie.
286 286
      */
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     }
291 291
 }
292 292
 
293
-if (! function_exists('is_windows')) {
293
+if (!function_exists('is_windows')) {
294 294
     /**
295 295
      * Déterminez si l'environnement actuel est basé sur Windows.
296 296
      */
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     }
301 301
 }
302 302
 
303
-if (! function_exists('is_https')) {
303
+if (!function_exists('is_https')) {
304 304
     /**
305 305
      * Determines if the application is accessed via an encrypted * (HTTPS) connection.
306 306
      */
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     }
311 311
 }
312 312
 
313
-if (! function_exists('is_localfile')) {
313
+if (!function_exists('is_localfile')) {
314 314
     /**
315 315
      * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non
316 316
      */
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
             return true;
321 321
         }
322 322
 
323
-        return ! preg_match('#^(https?://)#i', $name);
323
+        return !preg_match('#^(https?://)#i', $name);
324 324
     }
325 325
 }
326 326
 
327
-if (! function_exists('is_online')) {
327
+if (!function_exists('is_online')) {
328 328
     /**
329 329
      * Tester si l'application s'exécute en local ou en ligne.
330 330
      */
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     }
335 335
 }
336 336
 
337
-if (! function_exists('is_connected')) {
337
+if (!function_exists('is_connected')) {
338 338
     /**
339 339
      * Verifie si l'utilisateur a une connexion internet active.
340 340
      */
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
     }
345 345
 }
346 346
 
347
-if (! function_exists('is_ajax_request')) {
347
+if (!function_exists('is_ajax_request')) {
348 348
     /**
349 349
      * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH.
350 350
      */
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     }
355 355
 }
356 356
 
357
-if (! function_exists('redirection')) {
357
+if (!function_exists('redirection')) {
358 358
     /**
359 359
      * Redirige l'utilisateur
360 360
      */
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     }
369 369
 }
370 370
 
371
-if (! function_exists('redirect')) {
371
+if (!function_exists('redirect')) {
372 372
     /**
373 373
      * Méthode pratique qui fonctionne avec la $request globale actuelle et
374 374
      * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     {
383 383
         $redirection = Services::redirection();
384 384
 
385
-        if (! empty($uri)) {
385
+        if (!empty($uri)) {
386 386
             return $redirection->route($uri);
387 387
         }
388 388
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     }
391 391
 }
392 392
 
393
-if (! function_exists('link_to')) {
393
+if (!function_exists('link_to')) {
394 394
     /**
395 395
      * Étant donné une chaîne de contrôleur/méthode et tous les paramètres,
396 396
      * tentera de créer l'URL relative à la route correspondante.
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     }
407 407
 }
408 408
 
409
-if (! function_exists('clean_path')) {
409
+if (!function_exists('clean_path')) {
410 410
     /**
411 411
      * Une méthode pratique pour nettoyer les chemins pour
412 412
      * une sortie plus belle. Utile pour les exceptions
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
     }
436 436
 }
437 437
 
438
-if (! function_exists('old')) {
438
+if (!function_exists('old')) {
439 439
     /**
440 440
      * Fournit l'accès à "entrée ancienne" qui a été définie dans la session lors d'un redirect()-withInput().
441 441
      *
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 
463 463
 // ================================= FONCTIONS DE DEBOGAGE ================================= //
464 464
 
465
-if (! function_exists('dd')) {
465
+if (!function_exists('dd')) {
466 466
     /**
467 467
      * Prints a Kint debug report and exits.
468 468
      *
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     }
482 482
 }
483 483
 
484
-if (! function_exists('dump')) {
484
+if (!function_exists('dump')) {
485 485
     /**
486 486
      * Prints a Kint debug report and exits.
487 487
      *
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     }
499 499
 }
500 500
 
501
-if (! function_exists('deprecationWarning')) {
501
+if (!function_exists('deprecationWarning')) {
502 502
     /**
503 503
      * Méthode d'assistance pour générer des avertissements d'obsolescence
504 504
      *
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
     }
515 515
 }
516 516
 
517
-if (! function_exists('logger')) {
517
+if (!function_exists('logger')) {
518 518
     /**
519 519
      * A convenience/compatibility method for logging events through
520 520
      * the Log system.
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
     {
538 538
         $logger = Services::logger();
539 539
 
540
-        if (! empty($level) && ! empty($message)) {
540
+        if (!empty($level) && !empty($message)) {
541 541
             return $logger->log($level, $message, $context);
542 542
         }
543 543
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
     }
546 546
 }
547 547
 
548
-if (! function_exists('cache')) {
548
+if (!function_exists('cache')) {
549 549
     /**
550 550
      * Une méthode pratique qui donne accès au cache
551 551
      * objet. Si aucun paramètre n'est fourni, renverra l'objet,
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
     }
576 576
 }
577 577
 
578
-if (! function_exists('session')) {
578
+if (!function_exists('session')) {
579 579
     /**
580 580
      * Une méthode pratique pour accéder à l'instance de session, ou un élément qui a été défini dans la session.
581 581
      *
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
     }
599 599
 }
600 600
 
601
-if (! function_exists('pr')) {
601
+if (!function_exists('pr')) {
602 602
     /**
603 603
      * print_r() convenience function.
604 604
      *
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
     }
621 621
 }
622 622
 
623
-if (! function_exists('pj')) {
623
+if (!function_exists('pj')) {
624 624
     /**
625 625
      * json pretty print convenience function.
626 626
      *
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
     }
642 642
 }
643 643
 
644
-if (! function_exists('trigger_warning')) {
644
+if (!function_exists('trigger_warning')) {
645 645
     /**
646 646
      * Déclenche un E_USER_WARNING.
647 647
      */
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
     }
652 652
 }
653 653
 
654
-if (! function_exists('vd')) {
654
+if (!function_exists('vd')) {
655 655
     /**
656 656
      * Shortcut to ref, HTML mode
657 657
      *
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
     }
664 664
 }
665 665
 
666
-if (! function_exists('vdt')) {
666
+if (!function_exists('vdt')) {
667 667
     /**
668 668
      * Shortcut to ref, plain text mode
669 669
      *
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 
678 678
 // ================================= FONCTIONS DIVERSES ================================= //
679 679
 
680
-if (! function_exists('force_https')) {
680
+if (!function_exists('force_https')) {
681 681
     /**
682 682
      * Utilisé pour forcer l'accès à une page via HTTPS.
683 683
      * Utilise une redirection standard, plus définira l'en-tête HSTS
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
     }
736 736
 }
737 737
 
738
-if (! function_exists('getTypeName')) {
738
+if (!function_exists('getTypeName')) {
739 739
     /**
740 740
      * Renvoie la classe d'objets ou le type var de ce n'est pas un objet
741 741
      *
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
     }
750 750
 }
751 751
 
752
-if (! function_exists('ip_address')) {
752
+if (!function_exists('ip_address')) {
753 753
     /**
754 754
      * Renvoie l'adresse IP de l'utilisateur actuel
755 755
      */
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
     }
760 760
 }
761 761
 
762
-if (! function_exists('is_really_writable')) {
762
+if (!function_exists('is_really_writable')) {
763 763
     /**
764 764
      * Tests d'inscriptibilité des fichiers
765 765
      */
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
     }
770 770
 }
771 771
 
772
-if (! function_exists('lang')) {
772
+if (!function_exists('lang')) {
773 773
     /**
774 774
      * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater
775 775
      * le résultat avec le MessageFormatter de l'extension intl.
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
     }
781 781
 }
782 782
 
783
-if (! function_exists('namespace_split')) {
783
+if (!function_exists('namespace_split')) {
784 784
     /**
785 785
      * Séparez l'espace de noms du nom de classe.
786 786
      *
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
     }
802 802
 }
803 803
 
804
-if (! function_exists('view_exist')) {
804
+if (!function_exists('view_exist')) {
805 805
     /**
806 806
      * Verifie si un fichier de vue existe. Utile pour limiter les failles include
807 807
      */
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
     }
816 816
 }
817 817
 
818
-if (! function_exists('view')) {
818
+if (!function_exists('view')) {
819 819
     /**
820 820
      * Charge une vue
821 821
      *
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
     }
832 832
 }
833 833
 
834
-if (! function_exists('flash')) {
834
+if (!function_exists('flash')) {
835 835
     /**
836 836
      * Fournisseur d'acces rapide a la classe PHP Flash
837 837
      *
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
     }*/
864 864
 }
865 865
 
866
-if (! function_exists('geo_ip')) {
866
+if (!function_exists('geo_ip')) {
867 867
     /**
868 868
      * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip
869 869
      */
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
     }
874 874
 }
875 875
 
876
-if (! function_exists('to_stream')) {
876
+if (!function_exists('to_stream')) {
877 877
     /**
878 878
      * Créez un nouveau flux basé sur le type d'entrée.
879 879
      *
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
     }
897 897
 }
898 898
 
899
-if (! function_exists('value')) {
899
+if (!function_exists('value')) {
900 900
     /**
901 901
      * Renvoie la valeur par défaut de la valeur donnée.
902 902
      */
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
     }
907 907
 }
908 908
 
909
-if (! function_exists('collect')) {
909
+if (!function_exists('collect')) {
910 910
     /**
911 911
      * Créez une collection à partir de la valeur donnée.
912 912
      */
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
     }
917 917
 }
918 918
 
919
-if (! function_exists('with')) {
919
+if (!function_exists('with')) {
920 920
     /**
921 921
      * Renvoie la valeur donnée, éventuellement transmise via le rappel donné.
922 922
      *
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
     }
929 929
 }
930 930
 
931
-if (! function_exists('tap')) {
931
+if (!function_exists('tap')) {
932 932
     /**
933 933
      * Appelez la Closure donnée avec cette instance puis renvoyez l'instance.
934 934
      */
Please login to merge, or discard this patch.