@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // ================================= ================================= // |
| 26 | 26 | |
| 27 | -if (! function_exists('site_url')) { |
|
| 27 | +if (!function_exists('site_url')) { |
|
| 28 | 28 | /** |
| 29 | 29 | * Renvoie une URL de site telle que définie par la configuration de l'application. |
| 30 | 30 | * |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if (! function_exists('base_url')) { |
|
| 51 | +if (!function_exists('base_url')) { |
|
| 52 | 52 | /** |
| 53 | 53 | * Renvoie l'URL de base telle que définie par la configuration de l'application. |
| 54 | 54 | * Les URL de base sont des URL de site coupées sans la page d'index. |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | -if (! function_exists('current_url')) { |
|
| 70 | +if (!function_exists('current_url')) { |
|
| 71 | 71 | /** |
| 72 | 72 | * Renvoie l'URL complète (y compris les segments) de la page où cette fonction est placée |
| 73 | 73 | * |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -if (! function_exists('previous_url')) { |
|
| 97 | +if (!function_exists('previous_url')) { |
|
| 98 | 98 | /** |
| 99 | 99 | * Renvoie l'URL précédente sur laquelle se trouvait le visiteur actuel. Pour des raisons de sécurité |
| 100 | 100 | * nous vérifions d'abord une variable de session enregistrée, si elle existe, et l'utilisons. |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | -if (! function_exists('uri_string')) { |
|
| 122 | +if (!function_exists('uri_string')) { |
|
| 123 | 123 | /** |
| 124 | 124 | * Renvoie la partie chemin de l'URL actuelle |
| 125 | 125 | * |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | -if (! function_exists('index_page')) { |
|
| 136 | +if (!function_exists('index_page')) { |
|
| 137 | 137 | /** |
| 138 | 138 | * Renvoie la "index_page" de votre fichier de configuration |
| 139 | 139 | */ |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | -if (! function_exists('anchor')) { |
|
| 146 | +if (!function_exists('anchor')) { |
|
| 147 | 147 | /** |
| 148 | 148 | * Crée une ancre basée sur l'URL locale. |
| 149 | 149 | * |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | -if (! function_exists('anchor_popup')) { |
|
| 171 | +if (!function_exists('anchor_popup')) { |
|
| 172 | 172 | /** |
| 173 | 173 | * Lien d'ancrage - Version contextuelle |
| 174 | 174 | * |
@@ -191,12 +191,12 @@ discard block |
||
| 191 | 191 | return '<a href="' . $siteUrl . '" onclick="window.open(\'' . $siteUrl . "', '_blank'); return false;\">" . $title . '</a>'; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if (! is_array($attributes)) { |
|
| 194 | + if (!is_array($attributes)) { |
|
| 195 | 195 | $attributes = [$attributes]; |
| 196 | 196 | |
| 197 | 197 | // Ref: http://www.w3schools.com/jsref/met_win_open.asp |
| 198 | 198 | $windowName = '_blank'; |
| 199 | - } elseif (! empty($attributes['window_name'])) { |
|
| 199 | + } elseif (!empty($attributes['window_name'])) { |
|
| 200 | 200 | $windowName = $attributes['window_name']; |
| 201 | 201 | unset($attributes['window_name']); |
| 202 | 202 | } else { |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | -if (! function_exists('mailto')) { |
|
| 219 | +if (!function_exists('mailto')) { |
|
| 220 | 220 | /** |
| 221 | 221 | * Lien Mailto |
| 222 | 222 | * |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | -if (! function_exists('safe_mailto')) { |
|
| 236 | +if (!function_exists('safe_mailto')) { |
|
| 237 | 237 | /** |
| 238 | 238 | * Lien Mailto codé |
| 239 | 239 | * |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | -if (! function_exists('auto_link')) { |
|
| 325 | +if (!function_exists('auto_link')) { |
|
| 326 | 326 | /** |
| 327 | 327 | * Lien automatique |
| 328 | 328 | * |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | function auto_link(string $str, string $type = 'both', bool $popup = false): string |
| 338 | 338 | { |
| 339 | 339 | // Recherche et remplace tous les URLs. |
| 340 | - if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { |
|
| 340 | + if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE|PREG_SET_ORDER)) { |
|
| 341 | 341 | // Définissez notre HTML cible si vous utilisez des liens contextuels. |
| 342 | 342 | $target = ($popup) ? ' target="_blank"' : ''; |
| 343 | 343 | |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | -if (! function_exists('prep_url')) { |
|
| 371 | +if (!function_exists('prep_url')) { |
|
| 372 | 372 | /** |
| 373 | 373 | * Ajoute simplement la partie http:// ou https:// si aucun schéma n'est inclus. |
| 374 | 374 | * |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | -if (! function_exists('url_title')) { |
|
| 396 | +if (!function_exists('url_title')) { |
|
| 397 | 397 | /** |
| 398 | 398 | * Créer un titre d'URL |
| 399 | 399 | * |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | -if (! function_exists('mb_url_title')) { |
|
| 432 | +if (!function_exists('mb_url_title')) { |
|
| 433 | 433 | /** |
| 434 | 434 | * Créer un titre d'URL qui prend en compte les caractères accentués |
| 435 | 435 | * |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | -if (! function_exists('url_to')) { |
|
| 451 | +if (!function_exists('url_to')) { |
|
| 452 | 452 | /** |
| 453 | 453 | * Obtenir l'URL complète et absolue d'une méthode de contrôleur |
| 454 | 454 | * (avec arguments supplémentaires) |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | */ |
| 462 | 462 | function url_to(string $controller, ...$args): string |
| 463 | 463 | { |
| 464 | - if (! $route = link_to($controller, ...$args)) { |
|
| 464 | + if (!$route = link_to($controller, ...$args)) { |
|
| 465 | 465 | $explode = explode('::', $controller); |
| 466 | 466 | |
| 467 | 467 | if (isset($explode[1])) { |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | -if (! function_exists('url_is')) { |
|
| 478 | +if (!function_exists('url_is')) { |
|
| 479 | 479 | /** |
| 480 | 480 | * Détermine si le chemin d'URL actuel contient le chemin donné. |
| 481 | 481 | * Il peut contenir un caractère générique (*) qui autorisera tout caractère valide. |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | -if (! function_exists('link_active')) { |
|
| 496 | +if (!function_exists('link_active')) { |
|
| 497 | 497 | /** |
| 498 | 498 | * Lien actif dans la navbar |
| 499 | 499 | * Un peut comme le router-active-link de vuejs |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | return $active_class; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | - if (! $exact && preg_match('#^' . $path . '/?#i', $current_section)) { |
|
| 511 | + if (!$exact && preg_match('#^' . $path . '/?#i', $current_section)) { |
|
| 512 | 512 | return $active_class; |
| 513 | 513 | } |
| 514 | 514 | |
@@ -520,14 +520,14 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | -if (! function_exists('clean_url')) { |
|
| 523 | +if (!function_exists('clean_url')) { |
|
| 524 | 524 | function clean_url(string $url): string |
| 525 | 525 | { |
| 526 | 526 | return Helpers::cleanUrl($url); |
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | -if (! function_exists('is_absolute_link')) { |
|
| 530 | +if (!function_exists('is_absolute_link')) { |
|
| 531 | 531 | /** |
| 532 | 532 | * Verifies si un chemin donnée est une url absolue ou relative |
| 533 | 533 | */ |
@@ -106,10 +106,10 @@ |
||
| 106 | 106 | */ |
| 107 | 107 | function previous_url(bool $returnObject = false) |
| 108 | 108 | { |
| 109 | - /** @var UrlGenerator $generator */ |
|
| 110 | - $generator = service(UrlGenerator::class); |
|
| 109 | + /** @var UrlGenerator $generator */ |
|
| 110 | + $generator = service(UrlGenerator::class); |
|
| 111 | 111 | |
| 112 | - $referer = $generator->previous(); |
|
| 112 | + $referer = $generator->previous(); |
|
| 113 | 113 | |
| 114 | 114 | return $returnObject ? Services::uri($referer) : $referer; |
| 115 | 115 | } |
@@ -752,59 +752,59 @@ discard block |
||
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | - $routeName = $name; |
|
| 756 | - if (isset($options['as']) || isset($options['name'])) { |
|
| 757 | - $routeName = trim($options['as'] ?? $options['name'], " ."); |
|
| 758 | - unset($options['name'], $options['as']); |
|
| 759 | - } |
|
| 755 | + $routeName = $name; |
|
| 756 | + if (isset($options['as']) || isset($options['name'])) { |
|
| 757 | + $routeName = trim($options['as'] ?? $options['name'], " ."); |
|
| 758 | + unset($options['name'], $options['as']); |
|
| 759 | + } |
|
| 760 | 760 | |
| 761 | 761 | if (in_array('index', $methods, true)) { |
| 762 | 762 | $this->get($name, $newName . '::index', $options + [ |
| 763 | - 'as' => $routeName . '.index', |
|
| 764 | - ]); |
|
| 763 | + 'as' => $routeName . '.index', |
|
| 764 | + ]); |
|
| 765 | 765 | } |
| 766 | 766 | if (in_array('new', $methods, true)) { |
| 767 | 767 | $this->get($name . '/new', $newName . '::new', $options + [ |
| 768 | - 'as' => $routeName . '.new', |
|
| 769 | - ]); |
|
| 768 | + 'as' => $routeName . '.new', |
|
| 769 | + ]); |
|
| 770 | 770 | } |
| 771 | 771 | if (in_array('edit', $methods, true)) { |
| 772 | 772 | $this->get($name . '/' . $id . '/edit', $newName . '::edit/$1', $options + [ |
| 773 | - 'as' => $routeName . '.edit', |
|
| 774 | - ]); |
|
| 773 | + 'as' => $routeName . '.edit', |
|
| 774 | + ]); |
|
| 775 | 775 | } |
| 776 | 776 | if (in_array('show', $methods, true)) { |
| 777 | 777 | $this->get($name . '/' . $id, $newName . '::show/$1', $options + [ |
| 778 | - 'as' => $routeName . '.show', |
|
| 779 | - ]); |
|
| 778 | + 'as' => $routeName . '.show', |
|
| 779 | + ]); |
|
| 780 | 780 | } |
| 781 | 781 | if (in_array('create', $methods, true)) { |
| 782 | 782 | $this->post($name, $newName . '::create', $options + [ |
| 783 | - 'as' => $routeName . '.create', |
|
| 784 | - ]); |
|
| 783 | + 'as' => $routeName . '.create', |
|
| 784 | + ]); |
|
| 785 | 785 | } |
| 786 | 786 | if (in_array('update', $methods, true)) { |
| 787 | - $this->match(['put', 'patch'], $name . '/' . $id, $newName . '::update/$1', $options + [ |
|
| 788 | - 'as' => $routeName . '.update', |
|
| 789 | - ]); |
|
| 787 | + $this->match(['put', 'patch'], $name . '/' . $id, $newName . '::update/$1', $options + [ |
|
| 788 | + 'as' => $routeName . '.update', |
|
| 789 | + ]); |
|
| 790 | 790 | } |
| 791 | 791 | if (in_array('delete', $methods, true)) { |
| 792 | 792 | $this->delete($name . '/' . $id, $newName . '::delete/$1', $options + [ |
| 793 | - 'as' => $routeName . '.delete', |
|
| 794 | - ]); |
|
| 793 | + 'as' => $routeName . '.delete', |
|
| 794 | + ]); |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | // Websafe ? la suppression doit être vérifiée avant la mise à jour en raison du nom de la méthode |
| 798 | 798 | if (isset($options['websafe'])) { |
| 799 | 799 | if (in_array('delete', $methods, true)) { |
| 800 | 800 | $this->post($name . '/' . $id . '/delete', $newName . '::delete/$1', $options + [ |
| 801 | - 'as' => $routeName . '.websafe.delete', |
|
| 802 | - ]); |
|
| 801 | + 'as' => $routeName . '.websafe.delete', |
|
| 802 | + ]); |
|
| 803 | 803 | } |
| 804 | 804 | if (in_array('update', $methods, true)) { |
| 805 | 805 | $this->post($name . '/' . $id, $newName . '::update/$1', $options + [ |
| 806 | - 'as' => $routeName . '.websafe.update', |
|
| 807 | - ]); |
|
| 806 | + 'as' => $routeName . '.websafe.update', |
|
| 807 | + ]); |
|
| 808 | 808 | } |
| 809 | 809 | } |
| 810 | 810 | |
@@ -869,57 +869,57 @@ discard block |
||
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | - $routeName = $name; |
|
| 873 | - if (isset($options['as']) || isset($options['name'])) { |
|
| 874 | - $routeName = trim($options['as'] ?? $options['name'], " ."); |
|
| 875 | - unset($options['name'], $options['as']); |
|
| 876 | - } |
|
| 872 | + $routeName = $name; |
|
| 873 | + if (isset($options['as']) || isset($options['name'])) { |
|
| 874 | + $routeName = trim($options['as'] ?? $options['name'], " ."); |
|
| 875 | + unset($options['name'], $options['as']); |
|
| 876 | + } |
|
| 877 | 877 | |
| 878 | 878 | if (in_array('index', $methods, true)) { |
| 879 | 879 | $this->get($name, $newName . '::index', $options + [ |
| 880 | - 'as' => $routeName . '.index', |
|
| 881 | - ]); |
|
| 880 | + 'as' => $routeName . '.index', |
|
| 881 | + ]); |
|
| 882 | 882 | } |
| 883 | 883 | if (in_array('show', $methods, true)) { |
| 884 | 884 | $this->get($name . '/show/' . $id, $newName . '::show/$1', $options + [ |
| 885 | - 'as' => $routeName . '.view' |
|
| 886 | - ]); |
|
| 887 | - $this->get($name . '/' . $id, $newName . '::show/$1', $options + [ |
|
| 888 | - 'as' => $routeName . '.show' |
|
| 889 | - ]); |
|
| 885 | + 'as' => $routeName . '.view' |
|
| 886 | + ]); |
|
| 887 | + $this->get($name . '/' . $id, $newName . '::show/$1', $options + [ |
|
| 888 | + 'as' => $routeName . '.show' |
|
| 889 | + ]); |
|
| 890 | 890 | } |
| 891 | 891 | if (in_array('new', $methods, true)) { |
| 892 | 892 | $this->get($name . '/new', $newName . '::new', $options + [ |
| 893 | - 'as' => $routeName . '.new' |
|
| 894 | - ]); |
|
| 893 | + 'as' => $routeName . '.new' |
|
| 894 | + ]); |
|
| 895 | 895 | } |
| 896 | 896 | if (in_array('create', $methods, true)) { |
| 897 | 897 | $this->post($name . '/create', $newName . '::create', $options + [ |
| 898 | - 'as' => $routeName . '.create' |
|
| 899 | - ]); |
|
| 900 | - $this->post($name, $newName . '::create', $options + [ |
|
| 901 | - 'as' => $routeName . '.store' |
|
| 902 | - ]); |
|
| 898 | + 'as' => $routeName . '.create' |
|
| 899 | + ]); |
|
| 900 | + $this->post($name, $newName . '::create', $options + [ |
|
| 901 | + 'as' => $routeName . '.store' |
|
| 902 | + ]); |
|
| 903 | 903 | } |
| 904 | 904 | if (in_array('edit', $methods, true)) { |
| 905 | 905 | $this->get($name . '/edit/' . $id, $newName . '::edit/$1', $options + [ |
| 906 | - 'as' => $routeName . '.edit' |
|
| 907 | - ]); |
|
| 906 | + 'as' => $routeName . '.edit' |
|
| 907 | + ]); |
|
| 908 | 908 | } |
| 909 | 909 | if (in_array('update', $methods, true)) { |
| 910 | 910 | $this->post($name . '/update/' . $id, $newName . '::update/$1', $options + [ |
| 911 | - 'as' => $routeName . '.update', |
|
| 912 | - ]); |
|
| 911 | + 'as' => $routeName . '.update', |
|
| 912 | + ]); |
|
| 913 | 913 | } |
| 914 | 914 | if (in_array('remove', $methods, true)) { |
| 915 | 915 | $this->get($name . '/remove/' . $id, $newName . '::remove/$1', $options + [ |
| 916 | - 'as' => $routeName . '.remove', |
|
| 917 | - ]); |
|
| 916 | + 'as' => $routeName . '.remove', |
|
| 917 | + ]); |
|
| 918 | 918 | } |
| 919 | 919 | if (in_array('delete', $methods, true)) { |
| 920 | 920 | $this->post($name . '/delete/' . $id, $newName . '::delete/$1', $options + [ |
| 921 | - 'as' => $routeName . '.delete', |
|
| 922 | - ]); |
|
| 921 | + 'as' => $routeName . '.delete', |
|
| 922 | + ]); |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | return $this; |
@@ -1436,15 +1436,15 @@ discard block |
||
| 1436 | 1436 | return array_shift($host); |
| 1437 | 1437 | } |
| 1438 | 1438 | |
| 1439 | - /** |
|
| 1440 | - * Formate le nom des routes |
|
| 1441 | - */ |
|
| 1442 | - private function formatRouteName(string $name): string |
|
| 1443 | - { |
|
| 1444 | - $name = trim($name, '/'); |
|
| 1439 | + /** |
|
| 1440 | + * Formate le nom des routes |
|
| 1441 | + */ |
|
| 1442 | + private function formatRouteName(string $name): string |
|
| 1443 | + { |
|
| 1444 | + $name = trim($name, '/'); |
|
| 1445 | 1445 | |
| 1446 | - return strtolower(str_replace(['/', '\\', '_', '.', ' '], '.', $name)); |
|
| 1447 | - } |
|
| 1446 | + return strtolower(str_replace(['/', '\\', '_', '.', ' '], '.', $name)); |
|
| 1447 | + } |
|
| 1448 | 1448 | |
| 1449 | 1449 | private function getControllerName(Closure|string $handler): ?string |
| 1450 | 1450 | { |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $this->collection->presenter($name, $this->attributes + $options); |
| 205 | 205 | |
| 206 | - $this->attributes = []; |
|
| 206 | + $this->attributes = []; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | { |
| 242 | 242 | $this->collection->resource($name, $this->attributes + $options); |
| 243 | 243 | |
| 244 | - $this->attributes = []; |
|
| 244 | + $this->attributes = []; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | { |
| 290 | 290 | $this->collection->{$method}($from, $to, $this->attributes + $options); |
| 291 | 291 | |
| 292 | - $this->attributes = []; |
|
| 292 | + $this->attributes = []; |
|
| 293 | 293 | |
| 294 | 294 | return $this; |
| 295 | 295 | } |
@@ -759,13 +759,13 @@ discard block |
||
| 759 | 759 | $uri = Services::uri($uri, false); |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | - Services::session()->setPreviousUrl(Uri::createURIString( |
|
| 763 | - $uri->getScheme(), |
|
| 764 | - $uri->getAuthority(), |
|
| 765 | - $uri->getPath(), |
|
| 766 | - $uri->getQuery(), |
|
| 767 | - $uri->getFragment() |
|
| 768 | - )); |
|
| 762 | + Services::session()->setPreviousUrl(Uri::createURIString( |
|
| 763 | + $uri->getScheme(), |
|
| 764 | + $uri->getAuthority(), |
|
| 765 | + $uri->getPath(), |
|
| 766 | + $uri->getQuery(), |
|
| 767 | + $uri->getFragment() |
|
| 768 | + )); |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | /** |
@@ -797,9 +797,9 @@ discard block |
||
| 797 | 797 | return $returned; |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | - if ($returned instanceof Responsable) { |
|
| 801 | - return $returned->toResponse($this->request); |
|
| 802 | - } |
|
| 800 | + if ($returned instanceof Responsable) { |
|
| 801 | + return $returned->toResponse($this->request); |
|
| 802 | + } |
|
| 803 | 803 | |
| 804 | 804 | if (is_object($returned)) { |
| 805 | 805 | if (method_exists($returned, '__toString')) { |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | |
| 918 | 918 | |
| 919 | 919 | if (is_string($_this->controller)) { |
| 920 | - if (strtoupper($request->getMethod()) === 'POST') { |
|
| 920 | + if (strtoupper($request->getMethod()) === 'POST') { |
|
| 921 | 921 | if (is_subclass_of($_this->controller, RestController::class)) { |
| 922 | 922 | return $_this->formatResponse($response->withStatus($code), [ |
| 923 | 923 | 'success' => false, |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | 'errors' => $errors, |
| 926 | 926 | ]); |
| 927 | 927 | } |
| 928 | - if (is_subclass_of($_this->controller, BaseController::class)) { |
|
| 928 | + if (is_subclass_of($_this->controller, BaseController::class)) { |
|
| 929 | 929 | return Services::redirection()->back()->withInput()->withErrors($errors)->withStatus($code); |
| 930 | 930 | } |
| 931 | 931 | } |
@@ -21,24 +21,24 @@ discard block |
||
| 21 | 21 | protected $message = ':attribute :value has been used'; |
| 22 | 22 | protected $fillableParams = ['table', 'column', 'ignore']; |
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * The name of the ID column. |
| 26 | 26 | */ |
| 27 | 27 | protected string $idColumn = 'id'; |
| 28 | 28 | |
| 29 | - protected string $deletedAtColumn = ''; |
|
| 29 | + protected string $deletedAtColumn = ''; |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | public function __construct(protected ConnectionInterface $db) |
| 33 | 33 | { |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - /** |
|
| 36 | + /** |
|
| 37 | 37 | * Ignore the given ID during the unique check. |
| 38 | 38 | */ |
| 39 | 39 | public function ignore(mixed $id, ?string $idColumn = null): self |
| 40 | 40 | { |
| 41 | - if (class_exists(Model::class) && $id instanceof BaseEntity) { |
|
| 41 | + if (class_exists(Model::class) && $id instanceof BaseEntity) { |
|
| 42 | 42 | return $this->ignoreEntity($id, $idColumn); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -49,23 +49,23 @@ discard block |
||
| 49 | 49 | return $this; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - /** |
|
| 52 | + /** |
|
| 53 | 53 | * Ignore the given model during the unique check. |
| 54 | 54 | */ |
| 55 | 55 | public function ignoreEntity(BaseEntity $entity, ?string $idColumn = null): self |
| 56 | 56 | { |
| 57 | - $this->idColumn = $idColumn ?? $entity->getKeyName(); |
|
| 57 | + $this->idColumn = $idColumn ?? $entity->getKeyName(); |
|
| 58 | 58 | $this->params['ignore'] = $entity->{$this->idColumn}; |
| 59 | 59 | |
| 60 | 60 | return $this; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - /** |
|
| 63 | + /** |
|
| 64 | 64 | * Ignore soft deleted models during the unique check. |
| 65 | 65 | */ |
| 66 | 66 | public function withoutTrashed(string $deletedAtColumn = 'deleted_at'): self |
| 67 | 67 | { |
| 68 | - $this->deletedAtColumn = $deletedAtColumn; |
|
| 68 | + $this->deletedAtColumn = $deletedAtColumn; |
|
| 69 | 69 | |
| 70 | 70 | return $this; |
| 71 | 71 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | $column = $this->parameter('column'); |
| 80 | 80 | $column = $column ?: $this->getAttribute()->getKey(); |
| 81 | 81 | |
| 82 | - $builder = $this->db->table($table)->where($column, $value); |
|
| 82 | + $builder = $this->db->table($table)->where($column, $value); |
|
| 83 | 83 | |
| 84 | - if ($ignore) { |
|
| 85 | - $builder->where($this->idColumn . ' !=', $ignore); |
|
| 86 | - } |
|
| 87 | - if ('' !== $this->deletedAtColumn) { |
|
| 88 | - $builder->where($this->deletedAtColumn . ' IS NULL'); |
|
| 89 | - } |
|
| 84 | + if ($ignore) { |
|
| 85 | + $builder->where($this->idColumn . ' !=', $ignore); |
|
| 86 | + } |
|
| 87 | + if ('' !== $this->deletedAtColumn) { |
|
| 88 | + $builder->where($this->deletedAtColumn . ' IS NULL'); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | return $builder->count() === 0; |
| 92 | 92 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | public function ignoreEntity(BaseEntity $entity, ?string $idColumn = null): self |
| 56 | 56 | { |
| 57 | - $this->idColumn = $idColumn ?? $entity->getKeyName(); |
|
| 57 | + $this->idColumn = $idColumn ?? $entity->getKeyName(); |
|
| 58 | 58 | $this->params['ignore'] = $entity->{$this->idColumn}; |
| 59 | 59 | |
| 60 | 60 | return $this; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | class UrlGenerator |
| 27 | 27 | { |
| 28 | - use Macroable; |
|
| 28 | + use Macroable; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * The forced URL root. |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function __construct(protected RouteCollectionInterface $routes, protected Request $request, protected ?string $assetRoot = null) |
| 92 | 92 | { |
| 93 | - $this->setRequest($request); |
|
| 93 | + $this->setRequest($request); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -241,18 +241,18 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | 243 | * Get the URL to a named route. |
| 244 | - * |
|
| 244 | + * |
|
| 245 | 245 | * @return string|false |
| 246 | 246 | */ |
| 247 | 247 | public function route(string $name, array $parameters = [], bool $absolute = true) |
| 248 | 248 | { |
| 249 | - $route = $this->routes->reverseRoute($name, ...$parameters); |
|
| 249 | + $route = $this->routes->reverseRoute($name, ...$parameters); |
|
| 250 | 250 | |
| 251 | 251 | if (! $route) { |
| 252 | 252 | throw HttpException::invalidRedirectRoute($route); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - return $absolute ? site_url($route) : $route; |
|
| 255 | + return $absolute ? site_url($route) : $route; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $this->cachedRoot = null; |
| 411 | 411 | $this->cachedScheme = null; |
| 412 | 412 | |
| 413 | - return $this; |
|
| 413 | + return $this; |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | return call_user_func($this->sessionResolver); |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - return Services::session(); |
|
| 435 | + return Services::session(); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | [$path, $query] = $this->extractQueryString($path); |
| 164 | 164 | |
| 165 | 165 | return $this->format( |
| 166 | - $root, '/'.trim($path.'/'.$tail, '/') |
|
| 167 | - ).$query; |
|
| 166 | + $root, '/' . trim($path . '/' . $tail, '/') |
|
| 167 | + ) . $query; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | // for asset paths, but only for routes to endpoints in the application. |
| 190 | 190 | $root = $this->assetRoot ?: $this->formatRoot($this->formatScheme($secure)); |
| 191 | 191 | |
| 192 | - return $this->removeIndex($root).'/'.trim($path, '/'); |
|
| 192 | + return $this->removeIndex($root) . '/' . trim($path, '/'); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | // for asset paths, but only for routes to endpoints in the application. |
| 211 | 211 | $root = $this->formatRoot($this->formatScheme($secure), $root); |
| 212 | 212 | |
| 213 | - return $this->removeIndex($root).'/'.trim($path, '/'); |
|
| 213 | + return $this->removeIndex($root) . '/' . trim($path, '/'); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | $i = 'index.php'; |
| 222 | 222 | |
| 223 | - return Text::contains($root, $i) ? str_replace('/'.$i, '', $root) : $root; |
|
| 223 | + return Text::contains($root, $i) ? str_replace('/' . $i, '', $root) : $root; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if (null === $this->cachedScheme) { |
| 236 | - $this->cachedScheme = $this->forceScheme ?: $this->request->getScheme().'://'; |
|
| 236 | + $this->cachedScheme = $this->forceScheme ?: $this->request->getScheme() . '://'; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | return $this->cachedScheme; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | { |
| 249 | 249 | $route = $this->routes->reverseRoute($name, ...$parameters); |
| 250 | 250 | |
| 251 | - if (! $route) { |
|
| 251 | + if (!$route) { |
|
| 252 | 252 | throw HttpException::invalidRedirectRoute($route); |
| 253 | 253 | } |
| 254 | 254 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | $start = Text::startsWith($root, 'http://') ? 'http://' : 'https://'; |
| 298 | 298 | |
| 299 | - return preg_replace('~'.$start.'~', $scheme, $root, 1); |
|
| 299 | + return preg_replace('~' . $start . '~', $scheme, $root, 1); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public function format($root, $path, $route = null) |
| 311 | 311 | { |
| 312 | - $path = '/'.trim($path, '/'); |
|
| 312 | + $path = '/' . trim($path, '/'); |
|
| 313 | 313 | |
| 314 | 314 | if ($this->formatHostUsing) { |
| 315 | 315 | $root = call_user_func($this->formatHostUsing, $root, $route); |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | $path = call_user_func($this->formatPathUsing, $path, $route); |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - return trim($root.$path, '/'); |
|
| 322 | + return trim($root . $path, '/'); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | public function isValidUrl(string $path): bool |
| 329 | 329 | { |
| 330 | - if (! preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) { |
|
| 330 | + if (!preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) { |
|
| 331 | 331 | return filter_var($path, FILTER_VALIDATE_URL) !== false; |
| 332 | 332 | } |
| 333 | 333 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | { |
| 342 | 342 | $this->cachedScheme = null; |
| 343 | 343 | |
| 344 | - $this->forceScheme = $scheme ? $scheme.'://' : null; |
|
| 344 | + $this->forceScheme = $scheme ? $scheme . '://' : null; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | public function pathFormatter() |
| 389 | 389 | { |
| 390 | - return $this->formatPathUsing ?: function ($path) { |
|
| 390 | + return $this->formatPathUsing ?: function($path) { |
|
| 391 | 391 | return $path; |
| 392 | 392 | }; |
| 393 | 393 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | $request = $this->generator->getRequest(); |
| 118 | 118 | |
| 119 | - $intended = $request->method() === 'GET' && ! $request->expectsJson() |
|
| 119 | + $intended = $request->method() === 'GET' && !$request->expectsJson() |
|
| 120 | 120 | ? $this->generator->full() |
| 121 | 121 | : $this->generator->previous(); |
| 122 | 122 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $errors = [$errors]; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - if (! empty($errors)) { |
|
| 173 | + if (!empty($errors)) { |
|
| 174 | 174 | $_errors = $this->session->getFlashdata('errors') ?? []; |
| 175 | 175 | $this->session->setFlashdata( |
| 176 | 176 | 'errors', |
@@ -293,10 +293,10 @@ |
||
| 293 | 293 | return $this->all(); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - public function getScheme(): string |
|
| 297 | - { |
|
| 298 | - return $this->getUri()->getScheme(); |
|
| 299 | - } |
|
| 296 | + public function getScheme(): string |
|
| 297 | + { |
|
| 298 | + return $this->getUri()->getScheme(); |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * {@inheritDoc} |
@@ -25,7 +25,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | * |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== // |
| 144 | 144 | |
| 145 | -if (! function_exists('esc')) { |
|
| 145 | +if (!function_exists('esc')) { |
|
| 146 | 146 | /** |
| 147 | 147 | * Effectue un simple échappement automatique des données pour des raisons de sécurité. |
| 148 | 148 | * Pourrait envisager de rendre cela plus complexe à une date ultérieure. |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | -if (! function_exists('h')) { |
|
| 172 | +if (!function_exists('h')) { |
|
| 173 | 173 | /** |
| 174 | 174 | * Méthode pratique pour htmlspecialchars. |
| 175 | 175 | * |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | -if (! function_exists('purify')) { |
|
| 191 | +if (!function_exists('purify')) { |
|
| 192 | 192 | /** |
| 193 | 193 | * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier. |
| 194 | 194 | * Utilisez facilement plusieurs configurations de purificateur. |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | -if (! function_exists('remove_invisible_characters')) { |
|
| 209 | +if (!function_exists('remove_invisible_characters')) { |
|
| 210 | 210 | /** |
| 211 | 211 | * Supprimer les caractères invisibles |
| 212 | 212 | * |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | -if (! function_exists('stringify_attributes')) { |
|
| 222 | +if (!function_exists('stringify_attributes')) { |
|
| 223 | 223 | /** |
| 224 | 224 | * Chaîner les attributs à utiliser dans les balises HTML. |
| 225 | 225 | * |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= // |
| 235 | 235 | |
| 236 | -if (! function_exists('on_dev')) { |
|
| 236 | +if (!function_exists('on_dev')) { |
|
| 237 | 237 | /** |
| 238 | 238 | * Testez pour voir si nous sommes dans un environnement de développement. |
| 239 | 239 | */ |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | -if (! function_exists('on_prod')) { |
|
| 252 | +if (!function_exists('on_prod')) { |
|
| 253 | 253 | /** |
| 254 | 254 | * Testez pour voir si nous sommes dans un environnement de production. |
| 255 | 255 | */ |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | -if (! function_exists('on_test')) { |
|
| 268 | +if (!function_exists('on_test')) { |
|
| 269 | 269 | /** |
| 270 | 270 | * Testez pour voir si nous sommes dans un environnement de test |
| 271 | 271 | */ |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | -if (! function_exists('is_cli')) { |
|
| 280 | +if (!function_exists('is_cli')) { |
|
| 281 | 281 | /** |
| 282 | 282 | * Testez pour voir si une demande a été faite à partir de la ligne de commande. |
| 283 | 283 | */ |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | -if (! function_exists('is_php')) { |
|
| 290 | +if (!function_exists('is_php')) { |
|
| 291 | 291 | /** |
| 292 | 292 | * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie. |
| 293 | 293 | */ |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | -if (! function_exists('is_windows')) { |
|
| 300 | +if (!function_exists('is_windows')) { |
|
| 301 | 301 | /** |
| 302 | 302 | * Déterminez si l'environnement actuel est basé sur Windows. |
| 303 | 303 | */ |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | -if (! function_exists('is_https')) { |
|
| 310 | +if (!function_exists('is_https')) { |
|
| 311 | 311 | /** |
| 312 | 312 | * Determines if the application is accessed via an encrypted * (HTTPS) connection. |
| 313 | 313 | */ |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | -if (! function_exists('is_localfile')) { |
|
| 320 | +if (!function_exists('is_localfile')) { |
|
| 321 | 321 | /** |
| 322 | 322 | * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non |
| 323 | 323 | */ |
@@ -327,11 +327,11 @@ discard block |
||
| 327 | 327 | return true; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - return ! preg_match('#^(https?://)#i', $name); |
|
| 330 | + return !preg_match('#^(https?://)#i', $name); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | -if (! function_exists('is_online')) { |
|
| 334 | +if (!function_exists('is_online')) { |
|
| 335 | 335 | /** |
| 336 | 336 | * Tester si l'application s'exécute en local ou en ligne. |
| 337 | 337 | */ |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | -if (! function_exists('is_connected')) { |
|
| 344 | +if (!function_exists('is_connected')) { |
|
| 345 | 345 | /** |
| 346 | 346 | * Verifie si l'utilisateur a une connexion internet active. |
| 347 | 347 | */ |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | -if (! function_exists('is_ajax_request')) { |
|
| 354 | +if (!function_exists('is_ajax_request')) { |
|
| 355 | 355 | /** |
| 356 | 356 | * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH. |
| 357 | 357 | */ |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | -if (! function_exists('redirection')) { |
|
| 364 | +if (!function_exists('redirection')) { |
|
| 365 | 365 | /** |
| 366 | 366 | * Redirige l'utilisateur |
| 367 | 367 | */ |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | -if (! function_exists('redirect')) { |
|
| 378 | +if (!function_exists('redirect')) { |
|
| 379 | 379 | /** |
| 380 | 380 | * Méthode pratique qui fonctionne avec la $request globale actuelle et |
| 381 | 381 | * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | { |
| 390 | 390 | $redirection = Services::redirection(); |
| 391 | 391 | |
| 392 | - if (! empty($uri)) { |
|
| 392 | + if (!empty($uri)) { |
|
| 393 | 393 | return $redirection->route($uri); |
| 394 | 394 | } |
| 395 | 395 | |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | -if (! function_exists('back')) { |
|
| 400 | +if (!function_exists('back')) { |
|
| 401 | 401 | /** |
| 402 | 402 | * Retourne a la page precedente |
| 403 | 403 | */ |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | -if (! function_exists('link_to')) { |
|
| 410 | +if (!function_exists('link_to')) { |
|
| 411 | 411 | /** |
| 412 | 412 | * Étant donné une chaîne de contrôleur/méthode et tous les paramètres, |
| 413 | 413 | * tentera de créer l'URL relative à la route correspondante. |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | -if (! function_exists('clean_path')) { |
|
| 430 | +if (!function_exists('clean_path')) { |
|
| 431 | 431 | /** |
| 432 | 432 | * Une méthode pratique pour nettoyer les chemins pour |
| 433 | 433 | * une sortie plus belle. Utile pour les exceptions |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | -if (! function_exists('old')) { |
|
| 462 | +if (!function_exists('old')) { |
|
| 463 | 463 | /** |
| 464 | 464 | * Fournit l'accès à "entrée ancienne" qui a été définie dans la session lors d'un redirect()-withInput(). |
| 465 | 465 | * |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | function old(string $key, ?string $default = null, $escape = 'html') |
| 472 | 472 | { |
| 473 | 473 | // Assurez-vous de charger la session |
| 474 | - if (session_status() === PHP_SESSION_NONE && ! on_test()) { |
|
| 474 | + if (session_status() === PHP_SESSION_NONE && !on_test()) { |
|
| 475 | 475 | session(); // @codeCoverageIgnore |
| 476 | 476 | } |
| 477 | 477 | |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | |
| 487 | 487 | // ================================= FONCTIONS DE DEBOGAGE ================================= // |
| 488 | 488 | |
| 489 | -if (! function_exists('dd')) { |
|
| 489 | +if (!function_exists('dd')) { |
|
| 490 | 490 | /** |
| 491 | 491 | * Prints a Kint debug report and exits. |
| 492 | 492 | * |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | } |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | -if (! function_exists('dump')) { |
|
| 508 | +if (!function_exists('dump')) { |
|
| 509 | 509 | /** |
| 510 | 510 | * Prints a Kint debug report and exits. |
| 511 | 511 | * |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | } |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | -if (! function_exists('deprecationWarning')) { |
|
| 525 | +if (!function_exists('deprecationWarning')) { |
|
| 526 | 526 | /** |
| 527 | 527 | * Méthode d'assistance pour générer des avertissements d'obsolescence |
| 528 | 528 | * |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | } |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | -if (! function_exists('logger')) { |
|
| 541 | +if (!function_exists('logger')) { |
|
| 542 | 542 | /** |
| 543 | 543 | * A convenience/compatibility method for logging events through |
| 544 | 544 | * the Log system. |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | { |
| 562 | 562 | $logger = Services::logger(); |
| 563 | 563 | |
| 564 | - if (! empty($level) && ! empty($message)) { |
|
| 564 | + if (!empty($level) && !empty($message)) { |
|
| 565 | 565 | return $logger->log($level, $message, $context); |
| 566 | 566 | } |
| 567 | 567 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | -if (! function_exists('cache')) { |
|
| 572 | +if (!function_exists('cache')) { |
|
| 573 | 573 | /** |
| 574 | 574 | * Une méthode pratique qui donne accès au cache |
| 575 | 575 | * objet. Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | } |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | -if (! function_exists('session')) { |
|
| 602 | +if (!function_exists('session')) { |
|
| 603 | 603 | /** |
| 604 | 604 | * Une méthode pratique pour accéder à l'instance de session, ou un élément qui a été défini dans la session. |
| 605 | 605 | * |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | -if (! function_exists('pr')) { |
|
| 625 | +if (!function_exists('pr')) { |
|
| 626 | 626 | /** |
| 627 | 627 | * print_r() convenience function. |
| 628 | 628 | * |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | } |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | -if (! function_exists('pj')) { |
|
| 647 | +if (!function_exists('pj')) { |
|
| 648 | 648 | /** |
| 649 | 649 | * json pretty print convenience function. |
| 650 | 650 | * |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | -if (! function_exists('trigger_warning')) { |
|
| 668 | +if (!function_exists('trigger_warning')) { |
|
| 669 | 669 | /** |
| 670 | 670 | * Déclenche un E_USER_WARNING. |
| 671 | 671 | */ |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | } |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | -if (! function_exists('vd')) { |
|
| 678 | +if (!function_exists('vd')) { |
|
| 679 | 679 | /** |
| 680 | 680 | * Shortcut to ref, HTML mode |
| 681 | 681 | * |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | -if (! function_exists('vdt')) { |
|
| 690 | +if (!function_exists('vdt')) { |
|
| 691 | 691 | /** |
| 692 | 692 | * Shortcut to ref, plain text mode |
| 693 | 693 | * |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | // ================================= FONCTIONS DIVERSES ================================= // |
| 703 | 703 | |
| 704 | -if (! function_exists('force_https')) { |
|
| 704 | +if (!function_exists('force_https')) { |
|
| 705 | 705 | /** |
| 706 | 706 | * Utilisé pour forcer l'accès à une page via HTTPS. |
| 707 | 707 | * Utilise une redirection standard, plus définira l'en-tête HSTS |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | -if (! function_exists('getTypeName')) { |
|
| 762 | +if (!function_exists('getTypeName')) { |
|
| 763 | 763 | /** |
| 764 | 764 | * Renvoie la classe d'objets ou le type var de ce n'est pas un objet |
| 765 | 765 | * |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | -if (! function_exists('ip_address')) { |
|
| 776 | +if (!function_exists('ip_address')) { |
|
| 777 | 777 | /** |
| 778 | 778 | * Renvoie l'adresse IP de l'utilisateur actuel |
| 779 | 779 | */ |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | } |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | -if (! function_exists('is_really_writable')) { |
|
| 786 | +if (!function_exists('is_really_writable')) { |
|
| 787 | 787 | /** |
| 788 | 788 | * Tests d'inscriptibilité des fichiers |
| 789 | 789 | */ |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | } |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | -if (! function_exists('lang')) { |
|
| 796 | +if (!function_exists('lang')) { |
|
| 797 | 797 | /** |
| 798 | 798 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
| 799 | 799 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | } |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | -if (! function_exists('__')) { |
|
| 807 | +if (!function_exists('__')) { |
|
| 808 | 808 | /** |
| 809 | 809 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
| 810 | 810 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | } |
| 818 | 818 | } |
| 819 | 819 | |
| 820 | -if (! function_exists('namespace_split')) { |
|
| 820 | +if (!function_exists('namespace_split')) { |
|
| 821 | 821 | /** |
| 822 | 822 | * Séparez l'espace de noms du nom de classe. |
| 823 | 823 | * |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | } |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | -if (! function_exists('view_exist')) { |
|
| 841 | +if (!function_exists('view_exist')) { |
|
| 842 | 842 | /** |
| 843 | 843 | * Verifie si un fichier de vue existe. Utile pour limiter les failles include |
| 844 | 844 | */ |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | -if (! function_exists('view')) { |
|
| 855 | +if (!function_exists('view')) { |
|
| 856 | 856 | /** |
| 857 | 857 | * Charge une vue |
| 858 | 858 | * |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | } |
| 869 | 869 | } |
| 870 | 870 | |
| 871 | -if (! function_exists('flash')) { |
|
| 871 | +if (!function_exists('flash')) { |
|
| 872 | 872 | /** |
| 873 | 873 | * Fournisseur d'acces rapide a la classe PHP Flash |
| 874 | 874 | * |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | }*/ |
| 901 | 901 | } |
| 902 | 902 | |
| 903 | -if (! function_exists('geo_ip')) { |
|
| 903 | +if (!function_exists('geo_ip')) { |
|
| 904 | 904 | /** |
| 905 | 905 | * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip |
| 906 | 906 | */ |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | } |
| 911 | 911 | } |
| 912 | 912 | |
| 913 | -if (! function_exists('to_stream')) { |
|
| 913 | +if (!function_exists('to_stream')) { |
|
| 914 | 914 | /** |
| 915 | 915 | * Créez un nouveau flux basé sur le type d'entrée. |
| 916 | 916 | * |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | } |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | -if (! function_exists('value')) { |
|
| 936 | +if (!function_exists('value')) { |
|
| 937 | 937 | /** |
| 938 | 938 | * Renvoie la valeur par défaut de la valeur donnée. |
| 939 | 939 | */ |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | } |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | -if (! function_exists('collect')) { |
|
| 946 | +if (!function_exists('collect')) { |
|
| 947 | 947 | /** |
| 948 | 948 | * Créez une collection à partir de la valeur donnée. |
| 949 | 949 | */ |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | } |
| 954 | 954 | } |
| 955 | 955 | |
| 956 | -if (! function_exists('with')) { |
|
| 956 | +if (!function_exists('with')) { |
|
| 957 | 957 | /** |
| 958 | 958 | * Renvoie la valeur donnée, éventuellement transmise via le rappel donné. |
| 959 | 959 | * |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | -if (! function_exists('tap')) { |
|
| 968 | +if (!function_exists('tap')) { |
|
| 969 | 969 | /** |
| 970 | 970 | * Appelez la Closure donnée avec cette instance puis renvoyez l'instance. |
| 971 | 971 | */ |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | } |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | -if (! function_exists('last')) { |
|
| 978 | +if (!function_exists('last')) { |
|
| 979 | 979 | /** |
| 980 | 980 | * Recupere le dernier element d'un tableau |
| 981 | 981 | */ |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | } |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | -if (! function_exists('invade')) { |
|
| 988 | +if (!function_exists('invade')) { |
|
| 989 | 989 | /** |
| 990 | 990 | * Cette classe offre une fonction d'invasion qui vous permettra de lire / écrire des propriétés privées d'un objet. |
| 991 | 991 | * Il vous permettra également de définir, obtenir et appeler des méthodes privées. |