Passed
Push — main ( 172c86...5eb528 )
by Dimitri
03:20
created
src/Helpers/common.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 // ================================= FONCTIONS D'ACCESSIBILITE ================================= //
27 27
 
28
-if (! function_exists('env')) {
28
+if (!function_exists('env')) {
29 29
     /**
30 30
      * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation
31 31
      * pour les variables d'environnement non prises en charge ou incohérentes
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     }
42 42
 }
43 43
 
44
-if (! function_exists('helper')) {
44
+if (!function_exists('helper')) {
45 45
     /**
46 46
      * Charge un fichier d'aide en mémoire. Prend en charge les assistants d'espace de noms,
47 47
      * à la fois dans et hors du répertoire 'helpers' d'un répertoire à espace de noms.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     }
58 58
 }
59 59
 
60
-if (! function_exists('model')) {
60
+if (!function_exists('model')) {
61 61
     /**
62 62
      * Simple maniere d'obtenir un modele.
63 63
      *
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @return T
69 69
      */
70
-    function model(string|array $name, ?ConnectionInterface &$conn = null)
70
+    function model(string|array $name, ?ConnectionInterface&$conn = null)
71 71
     {
72 72
         return Load::model($name, $conn);
73 73
     }
74 74
 }
75 75
 
76
-if (! function_exists('service')) {
76
+if (!function_exists('service')) {
77 77
     /**
78 78
      * Permet un accès plus propre au fichier de configuration des services.
79 79
      * Renvoie toujours une instance SHARED de la classe, donc
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     }
91 91
 }
92 92
 
93
-if (! function_exists('single_service')) {
93
+if (!function_exists('single_service')) {
94 94
     /**
95 95
      * Autoriser l'accès propre à un service.
96 96
      * Renvoie toujours une nouvelle instance de la classe.
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     }
105 105
 }
106 106
 
107
-if (! function_exists('show404')) {
107
+if (!function_exists('show404')) {
108 108
     /**
109 109
      * Afficher une page 404 introuvable dans le navigateur
110 110
      */
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     }
115 115
 }
116 116
 
117
-if (! function_exists('config')) {
117
+if (!function_exists('config')) {
118 118
     /**
119 119
      * GET/SET App config
120 120
      *
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     function config(string $config, $value = null, bool $force_set = false)
126 126
     {
127
-        if (! empty($value) || (empty($value) && true === $force_set)) {
127
+        if (!empty($value) || (empty($value) && true === $force_set)) {
128 128
             Config::set($config, $value);
129 129
         }
130 130
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== //
136 136
 
137
-if (! function_exists('esc')) {
137
+if (!function_exists('esc')) {
138 138
     /**
139 139
      * Effectue un simple échappement automatique des données pour des raisons de sécurité.
140 140
      * Pourrait envisager de rendre cela plus complexe à une date ultérieure.
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     }
162 162
 }
163 163
 
164
-if (! function_exists('h')) {
164
+if (!function_exists('h')) {
165 165
     /**
166 166
      * Méthode pratique pour htmlspecialchars.
167 167
      *
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     }
181 181
 }
182 182
 
183
-if (! function_exists('purify')) {
183
+if (!function_exists('purify')) {
184 184
     /**
185 185
      * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier.
186 186
      * Utilisez facilement plusieurs configurations de purificateur.
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     }
199 199
 }
200 200
 
201
-if (! function_exists('remove_invisible_characters')) {
201
+if (!function_exists('remove_invisible_characters')) {
202 202
     /**
203 203
      * Supprimer les caractères invisibles
204 204
      *
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     }
212 212
 }
213 213
 
214
-if (! function_exists('stringify_attributes')) {
214
+if (!function_exists('stringify_attributes')) {
215 215
     /**
216 216
      * Chaîner les attributs à utiliser dans les balises HTML.
217 217
      *
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= //
227 227
 
228
-if (! function_exists('on_dev')) {
228
+if (!function_exists('on_dev')) {
229 229
     /**
230 230
      * Testez pour voir si nous sommes dans un environnement de développement.
231 231
      */
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     }
242 242
 }
243 243
 
244
-if (! function_exists('on_prod')) {
244
+if (!function_exists('on_prod')) {
245 245
     /**
246 246
      * Testez pour voir si nous sommes dans un environnement de production.
247 247
      */
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     }
258 258
 }
259 259
 
260
-if (! function_exists('on_test')) {
260
+if (!function_exists('on_test')) {
261 261
     /**
262 262
      * Testez pour voir si nous sommes dans un environnement de test
263 263
      */
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     }
270 270
 }
271 271
 
272
-if (! function_exists('is_cli')) {
272
+if (!function_exists('is_cli')) {
273 273
     /**
274 274
      * Testez pour voir si une demande a été faite à partir de la ligne de commande.
275 275
      */
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     }
280 280
 }
281 281
 
282
-if (! function_exists('is_php')) {
282
+if (!function_exists('is_php')) {
283 283
     /**
284 284
      * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie.
285 285
      */
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     }
290 290
 }
291 291
 
292
-if (! function_exists('is_windows')) {
292
+if (!function_exists('is_windows')) {
293 293
     /**
294 294
      * Déterminez si l'environnement actuel est basé sur Windows.
295 295
      */
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     }
300 300
 }
301 301
 
302
-if (! function_exists('is_https')) {
302
+if (!function_exists('is_https')) {
303 303
     /**
304 304
      * Determines if the application is accessed via an encrypted * (HTTPS) connection.
305 305
      */
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     }
310 310
 }
311 311
 
312
-if (! function_exists('is_localfile')) {
312
+if (!function_exists('is_localfile')) {
313 313
     /**
314 314
      * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non
315 315
      */
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
             return true;
320 320
         }
321 321
 
322
-        return ! preg_match('#^(https?://)#i', $name);
322
+        return !preg_match('#^(https?://)#i', $name);
323 323
     }
324 324
 }
325 325
 
326
-if (! function_exists('is_online')) {
326
+if (!function_exists('is_online')) {
327 327
     /**
328 328
      * Tester si l'application s'exécute en local ou en ligne.
329 329
      */
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     }
334 334
 }
335 335
 
336
-if (! function_exists('is_connected')) {
336
+if (!function_exists('is_connected')) {
337 337
     /**
338 338
      * Verifie si l'utilisateur a une connexion internet active.
339 339
      */
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
     }
344 344
 }
345 345
 
346
-if (! function_exists('is_ajax_request')) {
346
+if (!function_exists('is_ajax_request')) {
347 347
     /**
348 348
      * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH.
349 349
      */
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     }
354 354
 }
355 355
 
356
-if (! function_exists('redirection')) {
356
+if (!function_exists('redirection')) {
357 357
     /**
358 358
      * Redirige l'utilisateur
359 359
      */
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     }
368 368
 }
369 369
 
370
-if (! function_exists('redirect')) {
370
+if (!function_exists('redirect')) {
371 371
     /**
372 372
      * Méthode pratique qui fonctionne avec la $request globale actuelle et
373 373
      * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
     {
382 382
         $redirection = Services::redirection();
383 383
 
384
-        if (! empty($uri)) {
384
+        if (!empty($uri)) {
385 385
             return $redirection->route($uri);
386 386
         }
387 387
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     }
390 390
 }
391 391
 
392
-if (! function_exists('link_to')) {
392
+if (!function_exists('link_to')) {
393 393
     /**
394 394
      * Étant donné une chaîne de contrôleur/méthode et tous les paramètres,
395 395
      * tentera de créer l'URL relative à la route correspondante.
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     }
410 410
 }
411 411
 
412
-if (! function_exists('clean_path')) {
412
+if (!function_exists('clean_path')) {
413 413
     /**
414 414
      * Une méthode pratique pour nettoyer les chemins pour
415 415
      * une sortie plus belle. Utile pour les exceptions
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     }
442 442
 }
443 443
 
444
-if (! function_exists('old')) {
444
+if (!function_exists('old')) {
445 445
     /**
446 446
      * Fournit l'accès à "entrée ancienne" qui a été définie dans la session lors d'un redirect()-withInput().
447 447
      *
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
     function old(string $key, ?string $default = null, $escape = 'html')
454 454
     {
455 455
         // Assurez-vous de charger la session
456
-        if (session_status() === PHP_SESSION_NONE && ! on_test()) {
456
+        if (session_status() === PHP_SESSION_NONE && !on_test()) {
457 457
             session(); // @codeCoverageIgnore
458 458
         }
459 459
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 
469 469
 // ================================= FONCTIONS DE DEBOGAGE ================================= //
470 470
 
471
-if (! function_exists('dd')) {
471
+if (!function_exists('dd')) {
472 472
     /**
473 473
      * Prints a Kint debug report and exits.
474 474
      *
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
     }
488 488
 }
489 489
 
490
-if (! function_exists('dump')) {
490
+if (!function_exists('dump')) {
491 491
     /**
492 492
      * Prints a Kint debug report and exits.
493 493
      *
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
     }
505 505
 }
506 506
 
507
-if (! function_exists('deprecationWarning')) {
507
+if (!function_exists('deprecationWarning')) {
508 508
     /**
509 509
      * Méthode d'assistance pour générer des avertissements d'obsolescence
510 510
      *
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     }
521 521
 }
522 522
 
523
-if (! function_exists('logger')) {
523
+if (!function_exists('logger')) {
524 524
     /**
525 525
      * A convenience/compatibility method for logging events through
526 526
      * the Log system.
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
     {
544 544
         $logger = Services::logger();
545 545
 
546
-        if (! empty($level) && ! empty($message)) {
546
+        if (!empty($level) && !empty($message)) {
547 547
             return $logger->log($level, $message, $context);
548 548
         }
549 549
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
     }
552 552
 }
553 553
 
554
-if (! function_exists('cache')) {
554
+if (!function_exists('cache')) {
555 555
     /**
556 556
      * Une méthode pratique qui donne accès au cache
557 557
      * objet. Si aucun paramètre n'est fourni, renverra l'objet,
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
     }
582 582
 }
583 583
 
584
-if (! function_exists('session')) {
584
+if (!function_exists('session')) {
585 585
     /**
586 586
      * Une méthode pratique pour accéder à l'instance de session, ou un élément qui a été défini dans la session.
587 587
      *
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
     }
605 605
 }
606 606
 
607
-if (! function_exists('pr')) {
607
+if (!function_exists('pr')) {
608 608
     /**
609 609
      * print_r() convenience function.
610 610
      *
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     }
627 627
 }
628 628
 
629
-if (! function_exists('pj')) {
629
+if (!function_exists('pj')) {
630 630
     /**
631 631
      * json pretty print convenience function.
632 632
      *
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
     }
648 648
 }
649 649
 
650
-if (! function_exists('trigger_warning')) {
650
+if (!function_exists('trigger_warning')) {
651 651
     /**
652 652
      * Déclenche un E_USER_WARNING.
653 653
      */
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
     }
658 658
 }
659 659
 
660
-if (! function_exists('vd')) {
660
+if (!function_exists('vd')) {
661 661
     /**
662 662
      * Shortcut to ref, HTML mode
663 663
      *
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
     }
670 670
 }
671 671
 
672
-if (! function_exists('vdt')) {
672
+if (!function_exists('vdt')) {
673 673
     /**
674 674
      * Shortcut to ref, plain text mode
675 675
      *
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 
684 684
 // ================================= FONCTIONS DIVERSES ================================= //
685 685
 
686
-if (! function_exists('force_https')) {
686
+if (!function_exists('force_https')) {
687 687
     /**
688 688
      * Utilisé pour forcer l'accès à une page via HTTPS.
689 689
      * Utilise une redirection standard, plus définira l'en-tête HSTS
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
     }
742 742
 }
743 743
 
744
-if (! function_exists('getTypeName')) {
744
+if (!function_exists('getTypeName')) {
745 745
     /**
746 746
      * Renvoie la classe d'objets ou le type var de ce n'est pas un objet
747 747
      *
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
     }
756 756
 }
757 757
 
758
-if (! function_exists('ip_address')) {
758
+if (!function_exists('ip_address')) {
759 759
     /**
760 760
      * Renvoie l'adresse IP de l'utilisateur actuel
761 761
      */
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
     }
766 766
 }
767 767
 
768
-if (! function_exists('is_really_writable')) {
768
+if (!function_exists('is_really_writable')) {
769 769
     /**
770 770
      * Tests d'inscriptibilité des fichiers
771 771
      */
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
     }
776 776
 }
777 777
 
778
-if (! function_exists('lang')) {
778
+if (!function_exists('lang')) {
779 779
     /**
780 780
      * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater
781 781
      * le résultat avec le MessageFormatter de l'extension intl.
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
     }
787 787
 }
788 788
 
789
-if (! function_exists('__')) {
789
+if (!function_exists('__')) {
790 790
     /**
791 791
      * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater
792 792
      * le résultat avec le MessageFormatter de l'extension intl.
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
     }
800 800
 }
801 801
 
802
-if (! function_exists('namespace_split')) {
802
+if (!function_exists('namespace_split')) {
803 803
     /**
804 804
      * Séparez l'espace de noms du nom de classe.
805 805
      *
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
     }
821 821
 }
822 822
 
823
-if (! function_exists('view_exist')) {
823
+if (!function_exists('view_exist')) {
824 824
     /**
825 825
      * Verifie si un fichier de vue existe. Utile pour limiter les failles include
826 826
      */
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
     }
835 835
 }
836 836
 
837
-if (! function_exists('view')) {
837
+if (!function_exists('view')) {
838 838
     /**
839 839
      * Charge une vue
840 840
      *
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
     }
851 851
 }
852 852
 
853
-if (! function_exists('flash')) {
853
+if (!function_exists('flash')) {
854 854
     /**
855 855
      * Fournisseur d'acces rapide a la classe PHP Flash
856 856
      *
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
     }*/
883 883
 }
884 884
 
885
-if (! function_exists('geo_ip')) {
885
+if (!function_exists('geo_ip')) {
886 886
     /**
887 887
      * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip
888 888
      */
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
     }
893 893
 }
894 894
 
895
-if (! function_exists('to_stream')) {
895
+if (!function_exists('to_stream')) {
896 896
     /**
897 897
      * Créez un nouveau flux basé sur le type d'entrée.
898 898
      *
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
     }
916 916
 }
917 917
 
918
-if (! function_exists('value')) {
918
+if (!function_exists('value')) {
919 919
     /**
920 920
      * Renvoie la valeur par défaut de la valeur donnée.
921 921
      */
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
     }
926 926
 }
927 927
 
928
-if (! function_exists('collect')) {
928
+if (!function_exists('collect')) {
929 929
     /**
930 930
      * Créez une collection à partir de la valeur donnée.
931 931
      */
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
     }
936 936
 }
937 937
 
938
-if (! function_exists('with')) {
938
+if (!function_exists('with')) {
939 939
     /**
940 940
      * Renvoie la valeur donnée, éventuellement transmise via le rappel donné.
941 941
      *
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
     }
948 948
 }
949 949
 
950
-if (! function_exists('tap')) {
950
+if (!function_exists('tap')) {
951 951
     /**
952 952
      * Appelez la Closure donnée avec cette instance puis renvoyez l'instance.
953 953
      */
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
     }
958 958
 }
959 959
 
960
-if (! function_exists('last')) {
960
+if (!function_exists('last')) {
961 961
     /**
962 962
      * Recupere le dernier element d'un tableau
963 963
      */
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
     }
968 968
 }
969 969
 
970
-if (! function_exists('invade')) {
970
+if (!function_exists('invade')) {
971 971
     /**
972 972
      * Cette classe offre une fonction d'invasion qui vous permettra de lire / écrire des propriétés privées d'un objet.
973 973
      * Il vous permettra également de définir, obtenir et appeler des méthodes privées.
Please login to merge, or discard this patch.