Passed
Push — main ( a9cad4...e1affe )
by Dimitri
03:40
created
src/Helpers/common.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 // ================================= FONCTIONS UTIILITAIRES ESSENTIELLES ================================= //
30 30
 
31
-if (! function_exists('env')) {
31
+if (!function_exists('env')) {
32 32
     /**
33 33
      * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation
34 34
      * pour les variables d'environnement non prises en charge ou incohérentes
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     }
45 45
 }
46 46
 
47
-if (! function_exists('helper')) {
47
+if (!function_exists('helper')) {
48 48
     /**
49 49
      * Charge un fichier d'aide en mémoire. Prend en charge les assistants d'espace de noms,
50 50
      * à la fois dans et hors du répertoire 'helpers' d'un répertoire à espace de noms.
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     }
61 61
 }
62 62
 
63
-if (! function_exists('model')) {
63
+if (!function_exists('model')) {
64 64
     /**
65 65
      * Simple maniere d'obtenir un modele.
66 66
      *
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
      *
71 71
      * @return T
72 72
      */
73
-    function model(array|string $name, ?ConnectionInterface &$conn = null)
73
+    function model(array|string $name, ?ConnectionInterface&$conn = null)
74 74
     {
75 75
         return Load::model($name, $conn);
76 76
     }
77 77
 }
78 78
 
79
-if (! function_exists('service')) {
79
+if (!function_exists('service')) {
80 80
     /**
81 81
      * Permet un accès plus propre au fichier de configuration des services.
82 82
      * Renvoie toujours une instance SHARED de la classe, donc l'appel de la fonction plusieurs fois renvera toujours la même instance.
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     }
98 98
 }
99 99
 
100
-if (! function_exists('single_service')) {
100
+if (!function_exists('single_service')) {
101 101
     /**
102 102
      * Autoriser l'accès propre à un service.
103 103
      * Renvoie toujours une nouvelle instance de la classe.
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     }
118 118
 }
119 119
 
120
-if (! function_exists('show404')) {
120
+if (!function_exists('show404')) {
121 121
     /**
122 122
      * Afficher une page 404 introuvable dans le navigateur
123 123
      */
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     }
128 128
 }
129 129
 
130
-if (! function_exists('command')) {
130
+if (!function_exists('command')) {
131 131
     /**
132 132
      * Exécute une seule commande.
133 133
      * Entrée attendue dans une seule chaîne comme celle qui serait utilisée sur la ligne de commande elle-même :
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     }
190 190
 }
191 191
 
192
-if (! function_exists('config')) {
192
+if (!function_exists('config')) {
193 193
     /**
194 194
      * GET/SET App config
195 195
      *
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     }
218 218
 }
219 219
 
220
-if (! function_exists('logger')) {
220
+if (!function_exists('logger')) {
221 221
     /**
222 222
      * Une méthode de commodité pour les événements de journalisation via le système Log.
223 223
      *
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     }
248 248
 }
249 249
 
250
-if (! function_exists('cache')) {
250
+if (!function_exists('cache')) {
251 251
     /**
252 252
      * Une méthode pratique qui donne accès au cache
253 253
      * objet. Si aucun paramètre n'est fourni, renverra l'objet,
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     }
278 278
 }
279 279
 
280
-if (! function_exists('cookie')) {
280
+if (!function_exists('cookie')) {
281 281
     /**
282 282
      * Une méthode pratique qui donne accès à l'objet cookie.
283 283
      * Si aucun paramètre n'est fourni, renverra l'objet,
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     }
306 306
 }
307 307
 
308
-if (! function_exists('session')) {
308
+if (!function_exists('session')) {
309 309
     /**
310 310
      * Une méthode pratique pour accéder à l'instance de session, ou un élément qui a été défini dans la session.
311 311
      *
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
 // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== //
332 332
 
333
-if (! function_exists('esc')) {
333
+if (!function_exists('esc')) {
334 334
     /**
335 335
      * Effectue un simple échappement automatique des données pour des raisons de sécurité.
336 336
      * Pourrait envisager de rendre cela plus complexe à une date ultérieure.
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     }
358 358
 }
359 359
 
360
-if (! function_exists('h')) {
360
+if (!function_exists('h')) {
361 361
     /**
362 362
      * Méthode pratique pour htmlspecialchars.
363 363
      *
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
     }
377 377
 }
378 378
 
379
-if (! function_exists('purify')) {
379
+if (!function_exists('purify')) {
380 380
     /**
381 381
      * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier.
382 382
      * Utilisez facilement plusieurs configurations de purificateur.
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     }
393 393
 }
394 394
 
395
-if (! function_exists('remove_invisible_characters')) {
395
+if (!function_exists('remove_invisible_characters')) {
396 396
     /**
397 397
      * Supprimer les caractères invisibles
398 398
      *
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     }
406 406
 }
407 407
 
408
-if (! function_exists('stringify_attributes')) {
408
+if (!function_exists('stringify_attributes')) {
409 409
     /**
410 410
      * Chaîner les attributs à utiliser dans les balises HTML.
411 411
      *
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 
420 420
 // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= //
421 421
 
422
-if (! function_exists('environment')) {
422
+if (!function_exists('environment')) {
423 423
     /**
424 424
      * Renvoi l'environnement d'execution actuel ou determine si on est dans un environnement specifie
425 425
      *
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
     }
458 458
 }
459 459
 
460
-if (! function_exists('on_dev')) {
460
+if (!function_exists('on_dev')) {
461 461
     /**
462 462
      * Testez pour voir si nous sommes dans un environnement de développement.
463 463
      */
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     }
472 472
 }
473 473
 
474
-if (! function_exists('on_prod')) {
474
+if (!function_exists('on_prod')) {
475 475
     /**
476 476
      * Testez pour voir si nous sommes dans un environnement de production.
477 477
      */
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
     }
486 486
 }
487 487
 
488
-if (! function_exists('on_test')) {
488
+if (!function_exists('on_test')) {
489 489
     /**
490 490
      * Testez pour voir si nous sommes dans un environnement de test
491 491
      */
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
     }
496 496
 }
497 497
 
498
-if (! function_exists('is_cli')) {
498
+if (!function_exists('is_cli')) {
499 499
     /**
500 500
      * Testez pour voir si une demande a été faite à partir de la ligne de commande.
501 501
      */
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
     }
506 506
 }
507 507
 
508
-if (! function_exists('is_php')) {
508
+if (!function_exists('is_php')) {
509 509
     /**
510 510
      * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie.
511 511
      */
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
     }
516 516
 }
517 517
 
518
-if (! function_exists('is_windows')) {
518
+if (!function_exists('is_windows')) {
519 519
     /**
520 520
      * Déterminez si l'environnement actuel est basé sur Windows.
521 521
      */
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
     }
526 526
 }
527 527
 
528
-if (! function_exists('is_https')) {
528
+if (!function_exists('is_https')) {
529 529
     /**
530 530
      * Determines if the application is accessed via an encrypted * (HTTPS) connection.
531 531
      */
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     }
536 536
 }
537 537
 
538
-if (! function_exists('is_localfile')) {
538
+if (!function_exists('is_localfile')) {
539 539
     /**
540 540
      * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non
541 541
      */
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
             return true;
546 546
         }
547 547
 
548
-        return ! preg_match('#^(https?://)#i', $name);
548
+        return !preg_match('#^(https?://)#i', $name);
549 549
     }
550 550
 }
551 551
 
552
-if (! function_exists('is_online')) {
552
+if (!function_exists('is_online')) {
553 553
     /**
554 554
      * Tester si l'application s'exécute en local ou en ligne.
555 555
      */
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
     }
560 560
 }
561 561
 
562
-if (! function_exists('is_connected')) {
562
+if (!function_exists('is_connected')) {
563 563
     /**
564 564
      * Verifie si l'utilisateur a une connexion internet active.
565 565
      */
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
     }
570 570
 }
571 571
 
572
-if (! function_exists('is_ajax_request')) {
572
+if (!function_exists('is_ajax_request')) {
573 573
     /**
574 574
      * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH.
575 575
      */
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
     }
580 580
 }
581 581
 
582
-if (! function_exists('redirection')) {
582
+if (!function_exists('redirection')) {
583 583
     /**
584 584
      * Redirige l'utilisateur
585 585
      */
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
     }
594 594
 }
595 595
 
596
-if (! function_exists('redirect')) {
596
+if (!function_exists('redirect')) {
597 597
     /**
598 598
      * Méthode pratique qui fonctionne avec la $request globale actuelle et
599 599
      * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
     {
608 608
         $redirection = Services::redirection();
609 609
 
610
-        if (! empty($uri)) {
610
+        if (!empty($uri)) {
611 611
             return $redirection->route($uri);
612 612
         }
613 613
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
     }
616 616
 }
617 617
 
618
-if (! function_exists('back')) {
618
+if (!function_exists('back')) {
619 619
     /**
620 620
      * Retourne a la page precedente
621 621
      *
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
     }
628 628
 }
629 629
 
630
-if (! function_exists('link_to')) {
630
+if (!function_exists('link_to')) {
631 631
     /**
632 632
      * Étant donné une chaîne de contrôleur/méthode et tous les paramètres,
633 633
      * tentera de créer l'URL relative à la route correspondante.
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
     }
648 648
 }
649 649
 
650
-if (! function_exists('clean_path')) {
650
+if (!function_exists('clean_path')) {
651 651
     /**
652 652
      * Une méthode pratique pour nettoyer les chemins pour
653 653
      * une sortie plus belle. Utile pour les exceptions
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
     }
680 680
 }
681 681
 
682
-if (! function_exists('old')) {
682
+if (!function_exists('old')) {
683 683
     /**
684 684
      * Fournit l'accès à "entrée ancienne" qui a été définie dans la session lors d'un redirect()-withInput().
685 685
      *
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
     function old(string $key, $default = null, $escape = 'html')
693 693
     {
694 694
         // Assurez-vous de charger la session
695
-        if (session_status() === PHP_SESSION_NONE && ! on_test()) {
695
+        if (session_status() === PHP_SESSION_NONE && !on_test()) {
696 696
             session(); // @codeCoverageIgnore
697 697
         }
698 698
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 
708 708
 // ================================= FONCTIONS DE DEBOGAGE ================================= //
709 709
 
710
-if (! function_exists('deprecationWarning')) {
710
+if (!function_exists('deprecationWarning')) {
711 711
     /**
712 712
      * Méthode d'assistance pour générer des avertissements d'obsolescence
713 713
      *
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
     }
724 724
 }
725 725
 
726
-if (! function_exists('pr')) {
726
+if (!function_exists('pr')) {
727 727
     /**
728 728
      * print_r() convenience function.
729 729
      *
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
     }
746 746
 }
747 747
 
748
-if (! function_exists('pj')) {
748
+if (!function_exists('pj')) {
749 749
     /**
750 750
      * json pretty print convenience function.
751 751
      *
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
     }
767 767
 }
768 768
 
769
-if (! function_exists('trigger_warning')) {
769
+if (!function_exists('trigger_warning')) {
770 770
     /**
771 771
      * Déclenche un E_USER_WARNING.
772 772
      */
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 
779 779
 // ================================= FONCTIONS DIVERSES ================================= //
780 780
 
781
-if (! function_exists('force_https')) {
781
+if (!function_exists('force_https')) {
782 782
     /**
783 783
      * Utilisé pour forcer l'accès à une page via HTTPS.
784 784
      * Utilise une redirection standard, plus définira l'en-tête HSTS
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 
806 806
         // Si la session est active, nous devons régénérer
807 807
         // l'ID de session pour des raisons de sécurité.
808
-        if (! on_test() && session_status() === PHP_SESSION_ACTIVE) {
808
+        if (!on_test() && session_status() === PHP_SESSION_ACTIVE) {
809 809
             Services::session()->regenerate(); // @codeCoverageIgnore
810 810
         }
811 811
 
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
     }
822 822
 }
823 823
 
824
-if (! function_exists('get_type_name')) {
824
+if (!function_exists('get_type_name')) {
825 825
     /**
826 826
      * Renvoie la classe d'objets ou le type var de ce n'est pas un objet
827 827
      *
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
     }
836 836
 }
837 837
 
838
-if (! function_exists('ip_address')) {
838
+if (!function_exists('ip_address')) {
839 839
     /**
840 840
      * Renvoie l'adresse IP de l'utilisateur actuel
841 841
      */
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
     }
846 846
 }
847 847
 
848
-if (! function_exists('is_really_writable')) {
848
+if (!function_exists('is_really_writable')) {
849 849
     /**
850 850
      * Tests d'inscriptibilité des fichiers
851 851
      */
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
     }
856 856
 }
857 857
 
858
-if (! function_exists('lang')) {
858
+if (!function_exists('lang')) {
859 859
     /**
860 860
      * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater
861 861
      * le résultat avec le MessageFormatter de l'extension intl.
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
     }
867 867
 }
868 868
 
869
-if (! function_exists('__')) {
869
+if (!function_exists('__')) {
870 870
     /**
871 871
      * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater
872 872
      * le résultat avec le MessageFormatter de l'extension intl.
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
     }
880 880
 }
881 881
 
882
-if (! function_exists('namespace_split')) {
882
+if (!function_exists('namespace_split')) {
883 883
     /**
884 884
      * Séparez l'espace de noms du nom de classe.
885 885
      *
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
     }
901 901
 }
902 902
 
903
-if (! function_exists('view_exist')) {
903
+if (!function_exists('view_exist')) {
904 904
     /**
905 905
      * Verifie si un fichier de vue existe. Utile pour limiter les failles include
906 906
      */
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
     }
915 915
 }
916 916
 
917
-if (! function_exists('view')) {
917
+if (!function_exists('view')) {
918 918
     /**
919 919
      * Charge une vue
920 920
      *
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
     }
931 931
 }
932 932
 
933
-if (! function_exists('flash')) {
933
+if (!function_exists('flash')) {
934 934
     /**
935 935
      * Fournisseur d'acces rapide a la classe PHP Flash
936 936
      *
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
     }*/
963 963
 }
964 964
 
965
-if (! function_exists('geo_ip')) {
965
+if (!function_exists('geo_ip')) {
966 966
     /**
967 967
      * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip
968 968
      */
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
     }
973 973
 }
974 974
 
975
-if (! function_exists('to_stream')) {
975
+if (!function_exists('to_stream')) {
976 976
     /**
977 977
      * Créez un nouveau flux basé sur le type d'entrée.
978 978
      *
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
     }
994 994
 }
995 995
 
996
-if (! function_exists('value')) {
996
+if (!function_exists('value')) {
997 997
     /**
998 998
      * Renvoie la valeur par défaut de la valeur donnée.
999 999
      */
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
     }
1004 1004
 }
1005 1005
 
1006
-if (! function_exists('collect')) {
1006
+if (!function_exists('collect')) {
1007 1007
     /**
1008 1008
      * Créez une collection à partir de la valeur donnée.
1009 1009
      */
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
     }
1014 1014
 }
1015 1015
 
1016
-if (! function_exists('with')) {
1016
+if (!function_exists('with')) {
1017 1017
     /**
1018 1018
      * Renvoie la valeur donnée, éventuellement transmise via le rappel donné.
1019 1019
      *
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
     }
1026 1026
 }
1027 1027
 
1028
-if (! function_exists('tap')) {
1028
+if (!function_exists('tap')) {
1029 1029
     /**
1030 1030
      * Appelez la Closure donnée avec cette instance puis renvoyez l'instance.
1031 1031
      */
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
     }
1036 1036
 }
1037 1037
 
1038
-if (! function_exists('last')) {
1038
+if (!function_exists('last')) {
1039 1039
     /**
1040 1040
      * Recupere le dernier element d'un tableau
1041 1041
      */
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
     }
1046 1046
 }
1047 1047
 
1048
-if (! function_exists('invade')) {
1048
+if (!function_exists('invade')) {
1049 1049
     /**
1050 1050
      * Cette classe offre une fonction d'invasion qui vous permettra de lire / écrire des propriétés privées d'un objet.
1051 1051
      * Il vous permettra également de définir, obtenir et appeler des méthodes privées.
Please login to merge, or discard this patch.
src/Middlewares/PerformanceMetrics.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     {
27 27
         $response = $handler->handle($request);
28 28
 
29
-        if (! empty($body = $response->getBody()->getContents())) {
29
+        if (!empty($body = $response->getBody()->getContents())) {
30 30
             $benchmark = Services::timer();
31 31
 
32 32
             $output = str_replace(
Please login to merge, or discard this patch.
src/Middlewares/PageCache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         $response = $handler->handle($request);
38 38
         $content  = $response->getBody()->getContents();
39 39
 
40
-        if (! $response instanceof Redirection) {
40
+        if (!$response instanceof Redirection) {
41 41
             // Mettez-le en cache sans remplacer les mesures de performances afin que nous puissions avoir des mises à jour de vitesse en direct en cours de route.
42 42
             // Doit être exécuté après les filtres pour conserver les en-têtes de réponse.
43 43
             $this->pageCache->make($request, $response->withBody(to_stream($content)));
Please login to merge, or discard this patch.
src/Router/RouteCollection.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         // Incluez le fichier routesFile s'il n'existe pas.
264 264
         // Ne conserver que pour les fins BC pour l'instant.
265 265
         $routeFiles = $this->routeFiles;
266
-        if (! in_array($routesFile, $routeFiles, true)) {
266
+        if (!in_array($routesFile, $routeFiles, true)) {
267 267
             $routeFiles[] = $routesFile;
268 268
         }
269 269
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         $routes = $this;
272 272
 
273 273
         foreach ($routeFiles as $routesFile) {
274
-            if (! is_file($routesFile)) {
274
+            if (!is_file($routesFile)) {
275 275
                 logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile));
276 276
 
277 277
                 continue;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      */
321 321
     public function placeholder(array|string $placeholder, ?string $pattern = null): self
322 322
     {
323
-        if (! is_array($placeholder)) {
323
+        if (!is_array($placeholder)) {
324 324
             $placeholder = [$placeholder => $pattern];
325 325
         }
326 326
 
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
      *
1024 1024
      * @param array|Closure|string $to
1025 1025
      */
1026
-    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self
1026
+    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self
1027 1027
     {
1028 1028
         if (empty($from) || empty($to)) {
1029 1029
             throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.');
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
                 $from = $route['from'];
1215 1215
 
1216 1216
                 // on ignore les closures
1217
-                if (! is_string($to)) {
1217
+                if (!is_string($to)) {
1218 1218
                     continue;
1219 1219
                 }
1220 1220
 
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 
1226 1226
                 // S'il y a une chance de correspondance, alors ce sera
1227 1227
                 // soit avec $search au début de la chaîne $to.
1228
-                if (! str_starts_with($to, $search)) {
1228
+                if (!str_starts_with($to, $search)) {
1229 1229
                     continue;
1230 1230
                 }
1231 1231
 
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 
1302 1302
         // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés.
1303 1303
         foreach ($matches[0] as $index => $placeholder) {
1304
-            if (! isset($params[$index])) {
1304
+            if (!isset($params[$index])) {
1305 1305
                 throw new InvalidArgumentException(
1306 1306
                     'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".'
1307 1307
                 );
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
             // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex.
1313 1313
             $pattern = $this->placeholders[$placeholderName] ?? $placeholder;
1314 1314
 
1315
-            if (! preg_match('#^' . $pattern . '$#u', (string) $params[$index])) {
1315
+            if (!preg_match('#^' . $pattern . '$#u', (string) $params[$index])) {
1316 1316
                 throw RouterException::invalidParameterType();
1317 1317
             }
1318 1318
 
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
             $from = trim($from, '/');
1370 1370
         }
1371 1371
 
1372
-        if (is_string($to) && ! str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) {
1372
+        if (is_string($to) && !str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) {
1373 1373
             $to = [$to, '__invoke'];
1374 1374
         }
1375 1375
 
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
         $options = array_merge($this->currentOptions ?? [], $options ?? []);
1382 1382
 
1383 1383
         if (isset($options['middleware'])) {
1384
-            if (! isset($options['middlewares'])) {
1384
+            if (!isset($options['middlewares'])) {
1385 1385
                 $options['middlewares'] = (array) $options['middleware'];
1386 1386
             }
1387 1387
             unset($options['middleware']);
@@ -1402,9 +1402,9 @@  discard block
 block discarded – undo
1402 1402
         }
1403 1403
 
1404 1404
         // Limitation du nom d'hôte ?
1405
-        if (! empty($options['hostname'])) {
1405
+        if (!empty($options['hostname'])) {
1406 1406
             // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ?
1407
-            if (! $this->checkHostname($options['hostname'])) {
1407
+            if (!$this->checkHostname($options['hostname'])) {
1408 1408
                 return;
1409 1409
             }
1410 1410
 
@@ -1412,10 +1412,10 @@  discard block
 block discarded – undo
1412 1412
         }
1413 1413
 
1414 1414
         // Limitation du nom sous-domaine ?
1415
-        elseif (! empty($options['subdomain'])) {
1415
+        elseif (!empty($options['subdomain'])) {
1416 1416
             // Si nous ne correspondons pas au sous-domaine actuel, alors
1417 1417
             // nous n'avons pas besoin d'ajouter la route.
1418
-            if (! $this->checkSubdomains($options['subdomain'])) {
1418
+            if (!$this->checkSubdomains($options['subdomain'])) {
1419 1419
                 return;
1420 1420
             }
1421 1421
 
@@ -1448,9 +1448,9 @@  discard block
 block discarded – undo
1448 1448
         }
1449 1449
 
1450 1450
         // S'il s'agit d'une redirection, aucun traitement
1451
-        if (! isset($options['redirect']) && is_string($to)) {
1451
+        if (!isset($options['redirect']) && is_string($to)) {
1452 1452
             // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut
1453
-            if (! str_contains($to, '\\') || strpos($to, '\\') > 0) {
1453
+            if (!str_contains($to, '\\') || strpos($to, '\\') > 0) {
1454 1454
                 $namespace = $options['namespace'] ?? $this->defaultNamespace;
1455 1455
                 $to        = trim($namespace, '\\') . '\\' . $to;
1456 1456
             }
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
         // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant
1468 1468
         // pour tenter de router la requête.
1469 1469
         $routeKeyExists = isset($this->routes[$verb][$routeKey]);
1470
-        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) {
1470
+        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) {
1471 1471
             return;
1472 1472
         }
1473 1473
 
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
     private function checkHostname(string $hostname): bool
1494 1494
     {
1495 1495
         // Les appels CLI ne peuvent pas être sur le nom d'hôte.
1496
-        if (! isset($this->httpHost)) {
1496
+        if (!isset($this->httpHost)) {
1497 1497
             return false;
1498 1498
         }
1499 1499
 
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
     private function checkSubdomains($subdomains): bool
1510 1510
     {
1511 1511
         // Les appels CLI ne peuvent pas être sur le sous-domaine.
1512
-        if (! isset($this->httpHost)) {
1512
+        if (!isset($this->httpHost)) {
1513 1513
             return false;
1514 1514
         }
1515 1515
 
@@ -1517,13 +1517,13 @@  discard block
 block discarded – undo
1517 1517
             $this->currentSubdomain = $this->determineCurrentSubdomain();
1518 1518
         }
1519 1519
 
1520
-        if (! is_array($subdomains)) {
1520
+        if (!is_array($subdomains)) {
1521 1521
             $subdomains = [$subdomains];
1522 1522
         }
1523 1523
 
1524 1524
         // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant,
1525 1525
         // il nécessite la présence d'un sous-domaine.
1526
-        if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1526
+        if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1527 1527
             return true;
1528 1528
         }
1529 1529
 
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
         // sur l'URL sinon parse_url sera mal interprété
1546 1546
         // 'hôte' comme 'chemin'.
1547 1547
         $url = $this->httpHost;
1548
-        if (! str_starts_with($url, 'http')) {
1548
+        if (!str_starts_with($url, 'http')) {
1549 1549
             $url = 'http://' . $url;
1550 1550
         }
1551 1551
 
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
 
1587 1587
     private function getControllerName(Closure|string $handler): ?string
1588 1588
     {
1589
-        if (! is_string($handler)) {
1589
+        if (!is_string($handler)) {
1590 1590
             return null;
1591 1591
         }
1592 1592
 
@@ -1645,13 +1645,13 @@  discard block
 block discarded – undo
1645 1645
      */
1646 1646
     private function replaceLocale(string $route, ?string $locale = null): string
1647 1647
     {
1648
-        if (! str_contains($route, '{locale}')) {
1648
+        if (!str_contains($route, '{locale}')) {
1649 1649
             return $route;
1650 1650
         }
1651 1651
 
1652 1652
         // Vérifier les paramètres régionaux non valides
1653 1653
         if ($locale !== null) {
1654
-            if (! in_array($locale, config('app.supported_locales'), true)) {
1654
+            if (!in_array($locale, config('app.supported_locales'), true)) {
1655 1655
                 $locale = null;
1656 1656
             }
1657 1657
         }
Please login to merge, or discard this patch.
src/Router/Dispatcher.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             $controller = $routes->getDefaultController();
176 176
         }
177 177
 
178
-        if (! $fullName && is_string($controller)) {
178
+        if (!$fullName && is_string($controller)) {
179 179
             $controller = str_replace($routes->getDefaultNamespace(), '', $controller);
180 180
         }
181 181
 
@@ -301,14 +301,14 @@  discard block
 block discarded – undo
301 301
             return;
302 302
         }
303 303
 
304
-        if (is_cli() && ! on_test()) {
304
+        if (is_cli() && !on_test()) {
305 305
             // @codeCoverageIgnoreStart
306 306
             // $this->request = Services::clirequest($this->config);
307 307
             // @codeCoverageIgnoreEnd
308 308
         }
309 309
 
310 310
         $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
311
-        if (! is_numeric($version)) {
311
+        if (!is_numeric($version)) {
312 312
             $version = substr($version, strpos($version, '/') + 1);
313 313
         }
314 314
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         // Supposons le succès jusqu'à preuve du contraire.
328 328
         $this->response = Services::response()->withStatus(200);
329 329
 
330
-        if (! is_cli() || on_test()) {
330
+        if (!is_cli() || on_test()) {
331 331
         }
332 332
 
333 333
         $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion());
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         }
425 425
 
426 426
         // Essayez de charger automatiquement la classe
427
-        if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
427
+        if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
428 428
             throw PageNotFoundException::controllerNotFound($this->controller, $this->method);
429 429
         }
430 430
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 
514 514
         $this->outputBufferingEnd();
515 515
 
516
-        throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : '');
516
+        throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : '');
517 517
     }
518 518
 
519 519
     /**
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
     public function storePreviousURL($uri)
556 556
     {
557 557
         // Ignorer les requêtes CLI
558
-        if (is_cli() && ! on_test()) {
558
+        if (is_cli() && !on_test()) {
559 559
             return; // @codeCoverageIgnore
560 560
         }
561 561
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
         }
566 566
 
567 567
         // Ignorer les reponses non-HTML
568
-        if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) {
568
+        if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) {
569 569
             return;
570 570
         }
571 571
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      */
590 590
     protected function sendResponse()
591 591
     {
592
-        if (! ($this->request->expectsJson() || $this->request->isJson() || Text::contains($this->response->getType(), ['/json', '+json']))) {
592
+        if (!($this->request->expectsJson() || $this->request->isJson() || Text::contains($this->response->getType(), ['/json', '+json']))) {
593 593
             $this->response = Services::toolbar()->prepare(
594 594
                 $this->getPerformanceStats(),
595 595
                 $this->request,
@@ -682,11 +682,11 @@  discard block
 block discarded – undo
682 682
      */
683 683
     private function spoofRequestMethod(): callable
684 684
     {
685
-        return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) {
685
+        return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) {
686 686
             $post = $request->getParsedBody();
687 687
 
688 688
             // Ne fonctionne qu'avec les formulaires POST
689
-            if ($request->getMethod() === 'POST' && ! empty($post['_method'])) {
689
+            if ($request->getMethod() === 'POST' && !empty($post['_method'])) {
690 690
                 // Accepte seulement PUT, PATCH, DELETE
691 691
                 if (in_array($post['_method'], ['PUT', 'PATCH', 'DELETE'], true)) {
692 692
                     $request = $request->withMethod($post['_method']);
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 
700 700
     private function bootApp(): callable
701 701
     {
702
-        return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
702
+        return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
703 703
             Services::set(Request::class, $request);
704 704
             Services::set(Response::class, $response);
705 705
 
@@ -707,10 +707,10 @@  discard block
 block discarded – undo
707 707
                 $returned = $this->startController();
708 708
 
709 709
                 // Les controleur sous forme de Closure sont executes dans startController().
710
-                if (! is_callable($this->controller)) {
710
+                if (!is_callable($this->controller)) {
711 711
                     $controller = $this->createController($request, $response);
712 712
 
713
-                    if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) {
713
+                    if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) {
714 714
                         throw PageNotFoundException::methodNotFound($this->method);
715 715
                     }
716 716
 
Please login to merge, or discard this patch.
src/Http/Response.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         $this->_streamMode   = $options['streamMode'] ?? $this->_streamMode;
460 460
 
461 461
         if (isset($options['stream'])) {
462
-            if (! $options['stream'] instanceof StreamInterface) {
462
+            if (!$options['stream'] instanceof StreamInterface) {
463 463
                 throw new InvalidArgumentException('Stream option must be an object that implements StreamInterface');
464 464
             }
465 465
             $this->stream = $options['stream'];
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
             $this->_setStatus($options['status']);
476 476
         }
477 477
 
478
-        if (! isset($options['charset'])) {
478
+        if (!isset($options['charset'])) {
479 479
             $options['charset'] = config('app.charset');
480 480
         }
481 481
         $this->_charset = $options['charset'];
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
             $charset = true;
524 524
         }
525 525
 
526
-        if ($charset && ! str_contains($type, ';')) {
526
+        if ($charset && !str_contains($type, ';')) {
527 527
             $this->_setHeader('Content-Type', "{$type}; charset={$this->_charset}");
528 528
         } else {
529 529
             $this->_setHeader('Content-Type', $type);
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
     protected function _clearHeader(string $header): void
604 604
     {
605 605
         $normalized = strtolower($header);
606
-        if (! isset($this->headerNames[$normalized])) {
606
+        if (!isset($this->headerNames[$normalized])) {
607 607
             return;
608 608
         }
609 609
         $original = $this->headerNames[$normalized];
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
             throw HttpException::invalidStatusCode($code);
671 671
         }
672 672
 
673
-        if (! array_key_exists($code, $this->_statusCodes) && empty($reasonPhrase)) {
673
+        if (!array_key_exists($code, $this->_statusCodes) && empty($reasonPhrase)) {
674 674
             throw HttPException::unkownStatusCode($code);
675 675
         }
676 676
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
         if ($mapped) {
764 764
             return is_array($mapped) ? current($mapped) : $mapped;
765 765
         }
766
-        if (! str_contains($contentType, '/')) {
766
+        if (!str_contains($contentType, '/')) {
767 767
             throw new InvalidArgumentException(sprintf('"%s" is an invalid content type.', $contentType));
768 768
         }
769 769
 
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
      */
847 847
     public function withCache($since, $time = '+1 day'): static
848 848
     {
849
-        if (! is_int($time)) {
849
+        if (!is_int($time)) {
850 850
             $time = strtotime($time);
851 851
             if ($time === false) {
852 852
                 throw new InvalidArgumentException(
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
      */
1315 1315
     public function getCookie(string $name): ?array
1316 1316
     {
1317
-        if (! $this->hasCookie($name)) {
1317
+        if (!$this->hasCookie($name)) {
1318 1318
             return null;
1319 1319
         }
1320 1320
 
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
      */
1327 1327
     public function hasCookie(string $name, ?string $value = null): bool
1328 1328
     {
1329
-        if (! $this->_cookies->has($name)) {
1329
+        if (!$this->_cookies->has($name)) {
1330 1330
             return false;
1331 1331
         }
1332 1332
 
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
         $extension = strtolower($file->getExtension());
1405 1405
         $mapped    = $this->getMimeType($extension);
1406
-        if ((! $extension || ! $mapped) && $options['download'] === null) {
1406
+        if ((!$extension || !$mapped) && $options['download'] === null) {
1407 1407
             $options['download'] = true;
1408 1408
         }
1409 1409
 
@@ -1465,12 +1465,12 @@  discard block
 block discarded – undo
1465 1465
         if (str_contains($path, '../') || str_contains($path, '..\\')) {
1466 1466
             throw new LoadException('The requested file contains `..` and will not be read.');
1467 1467
         }
1468
-        if (! is_file($path)) {
1468
+        if (!is_file($path)) {
1469 1469
             $path = APP_PATH . $path;
1470 1470
         }
1471 1471
 
1472 1472
         $file = new SplFileInfo($path);
1473
-        if (! $file->isFile() || ! $file->isReadable()) {
1473
+        if (!$file->isFile() || !$file->isReadable()) {
1474 1474
             if (on_dev()) {
1475 1475
                 throw new LoadException(sprintf('The requested file %s was not found or not readable', $path));
1476 1476
             }
Please login to merge, or discard this patch.
src/Http/UrlGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     {
257 257
         $route = $this->routes->reverseRoute($name, ...$parameters);
258 258
 
259
-        if (! $route) {
259
+        if (!$route) {
260 260
             throw HttpException::invalidRedirectRoute($route);
261 261
         }
262 262
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
         $route = $this->routes->reverseRoute($action, ...$parameters);
278 278
 
279
-        if (! $route) {
279
+        if (!$route) {
280 280
             throw RouterException::actionNotDefined($action);
281 281
         }
282 282
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      */
348 348
     public function isValidUrl(string $path): bool
349 349
     {
350
-        if (! preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) {
350
+        if (!preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) {
351 351
             return filter_var($path, FILTER_VALIDATE_URL) !== false;
352 352
         }
353 353
 
Please login to merge, or discard this patch.
src/Http/Concerns/ResponseTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function download(SplFileInfo|string $file, ?string $name = null, array $headers = []): static
168 168
     {
169
-        if (is_string($file) && ! is_file($file)) {
169
+        if (is_string($file) && !is_file($file)) {
170 170
             throw new LoadException('The requested file was not found');
171 171
         }
172 172
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function streamDownload(callable|StreamInterface|string $stream, string $name, array $headers = []): static
180 180
     {
181
-        if (! ($stream instanceof StreamInterface)) {
181
+        if (!($stream instanceof StreamInterface)) {
182 182
             $stream = to_stream($stream);
183 183
         }
184 184
 
Please login to merge, or discard this patch.