@@ -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 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | // Essayez plusieurs fois en cas de mèches persistantes |
| 128 | 128 | $attempts = 10; |
| 129 | 129 | |
| 130 | - while ((bool) $attempts && ! delete_files($directory, true, false, true)) { |
|
| 130 | + while ((bool) $attempts && !delete_files($directory, true, false, true)) { |
|
| 131 | 131 | // @codeCoverageIgnoreStart |
| 132 | 132 | $attempts--; |
| 133 | 133 | usleep(100000); // .1s |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | // Rechercher un fichier existant |
| 468 | 468 | if (file_exists($to)) { |
| 469 | 469 | // S'il n'est pas remplacé ou si les fichiers sont identiques, envisagez de réussir |
| 470 | - if (! $replace || same_file($from, $to)) { |
|
| 470 | + if (!$replace || same_file($from, $to)) { |
|
| 471 | 471 | return; |
| 472 | 472 | } |
| 473 | 473 | |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | // Assurez-vous que le répertoire existe |
| 484 | - if (! is_dir($directory = pathinfo($to, PATHINFO_DIRNAME))) { |
|
| 484 | + if (!is_dir($directory = pathinfo($to, PATHINFO_DIRNAME))) { |
|
| 485 | 485 | mkdir($directory, 0775, true); |
| 486 | 486 | } |
| 487 | 487 | |
@@ -647,7 +647,7 @@ |
||
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | return ($action === 'encrypt') ? base64_encode($return) : $return; |
| 650 | - // On renvoie la chaine encrypter ou decrypter |
|
| 650 | + // On renvoie la chaine encrypter ou decrypter |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | /** |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | function scl_upLoad($input, $path = '', $size = 2500000, $type = '', $output = '') |
| 28 | 28 | { |
| 29 | 29 | // taille par défaut |
| 30 | - $size = (empty($size) || ! is_numeric($size)) ? 2500000 : $size; |
|
| 30 | + $size = (empty($size) || !is_numeric($size)) ? 2500000 : $size; |
|
| 31 | 31 | // Le dossier par defaut est la racine |
| 32 | - $path = (! empty($path) && ! file_exists($path)) ? '' : htmlspecialchars($path); |
|
| 32 | + $path = (!empty($path) && !file_exists($path)) ? '' : htmlspecialchars($path); |
|
| 33 | 33 | |
| 34 | - if (! is_array($input)) { |
|
| 34 | + if (!is_array($input)) { |
|
| 35 | 35 | return [0, 'Entrée non valide']; |
| 36 | 36 | } |
| 37 | 37 | if (empty($input['tmp_name']) || empty($input['name']) || empty($input['size'])) { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if (! in_array(strtolower(pathinfo($input['name'])['extension']), $extensions, true)) { |
|
| 112 | + if (!in_array(strtolower(pathinfo($input['name'])['extension']), $extensions, true)) { |
|
| 113 | 113 | return [3, 'Extension non prise en charge']; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $output = 'scl_' . date('Ymd') . '-' . date('His'); |
| 126 | 126 | $extension = '0.'; |
| 127 | 127 | } else { // Si on defini le nom de sortie... |
| 128 | - if (! empty(explode('.', $output)[1]) && in_array(strtolower(explode('.', $output)[1]), $extensions, true)) { // Si l'extension est presente dans ce nom et est valide... |
|
| 128 | + if (!empty(explode('.', $output)[1]) && in_array(strtolower(explode('.', $output)[1]), $extensions, true)) { // Si l'extension est presente dans ce nom et est valide... |
|
| 129 | 129 | $out = explode('.', $output); |
| 130 | 130 | $output = $out[0]; // On enregistre le fichier avec le nom specifié |
| 131 | 131 | $extension = '1.' . $out[1]; // On enregistre le fichier avec l'extension specifié (changement d'extension) |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // si le fichier n'a pas été téléchargé |
| 147 | - if (! move_uploaded_file($input['tmp_name'], $path . $output . '.' . $extension)) { |
|
| 147 | + if (!move_uploaded_file($input['tmp_name'], $path . $output . '.' . $extension)) { |
|
| 148 | 148 | return [4, 'Erreur de téléversement']; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | function scl_minimizeImg($src, $size = [], $relative = false) |
| 166 | 166 | { |
| 167 | 167 | // Si le fichier n'existe pas |
| 168 | - if (! file_exists($src)) { |
|
| 168 | + if (!file_exists($src)) { |
|
| 169 | 169 | return [0, 'Fichier inexistant']; |
| 170 | 170 | } |
| 171 | 171 | // Si on n'envoi pas un tableau ou un nombre comme tailles |
| 172 | - if (empty($size) || (! is_array($size) && ! is_int($size))) { |
|
| 172 | + if (empty($size) || (!is_array($size) && !is_int($size))) { |
|
| 173 | 173 | return [1, 'Mauvaises dimensions de redimensionnement']; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | return [2, 'Violation du nombre de dimension']; |
| 181 | 181 | } |
| 182 | 182 | // Si l'un des element du tableau n'est pas un nombre |
| 183 | - if (! is_int($size[0]) || (! empty($size[1]) && ! is_int($size[1]))) { |
|
| 183 | + if (!is_int($size[0]) || (!empty($size[1]) && !is_int($size[1]))) { |
|
| 184 | 184 | return [3, 'Type de dimension inconnu']; |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | // Valeurs par défaut |
| 260 | 260 | $nbr = (empty($nbr)) ? 8 : (int) $nbr; |
| 261 | - $nbr = (! is_int($nbr)) ? 8 : (int) $nbr; |
|
| 261 | + $nbr = (!is_int($nbr)) ? 8 : (int) $nbr; |
|
| 262 | 262 | $nbr = ($nbr < 3 || $nbr > 64) ? 8 : (int) $nbr; |
| 263 | 263 | |
| 264 | 264 | switch ($type) { |
@@ -316,12 +316,12 @@ discard block |
||
| 316 | 316 | function scl_date($date, $format = 'D, d M Y', $interval = true, $fuseau = 'Europe/Paris') |
| 317 | 317 | { |
| 318 | 318 | // Valeurs par défaut |
| 319 | - $format = (empty($format) || ! is_string($format)) ? 'D, d M Y' : htmlspecialchars(trim($format)); // Le format de sortie, par défaut = D, d M Y |
|
| 320 | - $fuseau = (empty($fuseau) || ! is_string($fuseau)) ? 'Europe/Paris' : htmlspecialchars(trim($fuseau)); // fuseau horaire |
|
| 321 | - $interval = (! is_bool($interval)) ? true : $interval; // Specifie si on gere les intervales ou pas |
|
| 319 | + $format = (empty($format) || !is_string($format)) ? 'D, d M Y' : htmlspecialchars(trim($format)); // Le format de sortie, par défaut = D, d M Y |
|
| 320 | + $fuseau = (empty($fuseau) || !is_string($fuseau)) ? 'Europe/Paris' : htmlspecialchars(trim($fuseau)); // fuseau horaire |
|
| 321 | + $interval = (!is_bool($interval)) ? true : $interval; // Specifie si on gere les intervales ou pas |
|
| 322 | 322 | $interval = ($interval === false) ? false : true; // Specifie si on gere les intervales ou pas |
| 323 | 323 | |
| 324 | - $date = new DateTime($date); // On contruit la date |
|
| 324 | + $date = new DateTime($date); // On contruit la date |
|
| 325 | 325 | |
| 326 | 326 | // Si on ne gere pas les intervales |
| 327 | 327 | if ($interval === false) { |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | function scl_hash($str, $lenght = 128, $key = '') |
| 494 | 494 | { |
| 495 | 495 | // Valeur par defaut |
| 496 | - $lenght = (empty($lenght) || ! is_int($lenght)) ? 128 : $lenght; |
|
| 496 | + $lenght = (empty($lenght) || !is_int($lenght)) ? 128 : $lenght; |
|
| 497 | 497 | // Valeurs minimale et maximale pour le haché |
| 498 | 498 | $lenght = ($lenght < 50) ? 50 : $lenght; |
| 499 | 499 | $lenght = ($lenght > 200) ? 200 : $lenght; |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | // Valeur par defaut |
| 541 | 541 | $action = strtolower($action); |
| 542 | 542 | $action = ($action !== 'decrypt') ? 'encrypt' : 'decrypt'; |
| 543 | - $repeat = (! is_int($repeat) || $repeat < 1) ? 0 : $repeat; |
|
| 543 | + $repeat = (!is_int($repeat) || $repeat < 1) ? 0 : $repeat; |
|
| 544 | 544 | |
| 545 | 545 | $chars = ''; // Les differents caractères entrés |
| 546 | 546 | $size = strlen($str); |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', |
| 568 | 568 | 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', |
| 569 | 569 | ]; |
| 570 | - $chars = explode(' ', $chars); // On transforme la chaine précédement créée en tableau |
|
| 570 | + $chars = explode(' ', $chars); // On transforme la chaine précédement créée en tableau |
|
| 571 | 571 | $return = ''; |
| 572 | 572 | |
| 573 | 573 | // On parcours tout le dit tableau (ie. on recupere les caracteres un a un) |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | { |
| 666 | 666 | // Valeur par defaut |
| 667 | 667 | $str = htmlspecialchars($str); // On protege la chaine |
| 668 | - $size = (! is_numeric($size)) ? strlen($str) : $size; // Taille à couper |
|
| 668 | + $size = (!is_numeric($size)) ? strlen($str) : $size; // Taille à couper |
|
| 669 | 669 | |
| 670 | 670 | $lenght = strlen($str); // longueur de la chaine |
| 671 | 671 | if ($lenght > $size) { |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | { |
| 699 | 699 | // Valeur par defaut |
| 700 | 700 | $str = htmlspecialchars($str); // On protege la chaine |
| 701 | - $max = (! is_numeric($max)) ? strlen($str) : $max; // Taille à couper |
|
| 701 | + $max = (!is_numeric($max)) ? strlen($str) : $max; // Taille à couper |
|
| 702 | 702 | |
| 703 | 703 | $length = strlen($str); // Nombre de caractères |
| 704 | 704 | |
@@ -964,17 +964,17 @@ discard block |
||
| 964 | 964 | function scl_splitInt($nbr, $pas = 3, $separateur = ' ') |
| 965 | 965 | { |
| 966 | 966 | // Valeurs par défaut |
| 967 | - if (! is_numeric($nbr)) { |
|
| 967 | + if (!is_numeric($nbr)) { |
|
| 968 | 968 | return; |
| 969 | 969 | } |
| 970 | - $pas = (! empty($pas) && is_int($pas)) ? $pas : 3; |
|
| 970 | + $pas = (!empty($pas) && is_int($pas)) ? $pas : 3; |
|
| 971 | 971 | $separateur = (in_array($separateur, ['.', ' ', ',', '-', '/'], true)) ? $separateur : ' '; |
| 972 | 972 | |
| 973 | 973 | $return = ''; // Valeur renvoyée |
| 974 | 974 | |
| 975 | 975 | $nombre = explode('.', $nbr); |
| 976 | 976 | $nbr = $nombre[0]; |
| 977 | - $virgule = (! empty($nombre[1])) ? '.' . $nombre[1] : ''; |
|
| 977 | + $virgule = (!empty($nombre[1])) ? '.' . $nombre[1] : ''; |
|
| 978 | 978 | |
| 979 | 979 | $lenght = strlen($nbr); // nombre de chiffre |
| 980 | 980 | $nbr = strrev($nbr); // on inverse le nombre |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | |
| 1226 | 1226 | $return .= $trio[1] . ' ' . $secon[1] . ' ' . $prim[1]; |
| 1227 | 1227 | |
| 1228 | - if (! ($cent_c === '0' || $cent_c === '') || ! ($dix_c === '0' || $dix_c === '')) { |
|
| 1228 | + if (!($cent_c === '0' || $cent_c === '') || !($dix_c === '0' || $dix_c === '')) { |
|
| 1229 | 1229 | $return .= $trio_c . ' ' . $secon_c; |
| 1230 | 1230 | } |
| 1231 | 1231 | |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | } elseif ($rest) { |
| 98 | 98 | $rest = is_string($rest) ? $rest : 'controller'; |
| 99 | 99 | |
| 100 | - if (! in_array($rest, ['controller', 'presenter'], true)) { |
|
| 100 | + if (!in_array($rest, ['controller', 'presenter'], true)) { |
|
| 101 | 101 | // @codeCoverageIgnoreStart |
| 102 | 102 | $rest = $this->choice(lang('CLI.generator.parentClass'), ['controller', 'presenter']); |
| 103 | 103 | $this->newLine(); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | </span> |
| 43 | 43 | |
| 44 | 44 | <?php foreach ($collectors as $c) : ?> |
| 45 | - <?php if (! $c['isEmpty'] && ($c['hasTabContent'] || $c['hasLabel'])) : ?> |
|
| 45 | + <?php if (!$c['isEmpty'] && ($c['hasTabContent'] || $c['hasLabel'])) : ?> |
|
| 46 | 46 | <span class="blitzphp-label"> |
| 47 | 47 | <a href="javascript: void(0)" data-tab="blitzphp-<?= $c['titleSafe'] ?>"> |
| 48 | 48 | <img src="<?= $c['icon'] ?>"> |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | <!-- Collector-provided Tabs --> |
| 104 | 104 | <?php foreach ($collectors as $c) : ?> |
| 105 | - <?php if (! $c['isEmpty']) : ?> |
|
| 105 | + <?php if (!$c['isEmpty']) : ?> |
|
| 106 | 106 | <?php if ($c['hasTabContent']) : ?> |
| 107 | 107 | <div id="blitzphp-<?= $c['titleSafe'] ?>" class="tab"> |
| 108 | 108 | <h2><?= $c['title'] ?> <span><?= $c['titleDetails'] ?></span></h2> |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | </a> |
| 150 | 150 | |
| 151 | 151 | <?php if (isset($vars['session'])) : ?> |
| 152 | - <?php if (! empty($vars['session'])) : ?> |
|
| 152 | + <?php if (!empty($vars['session'])) : ?> |
|
| 153 | 153 | <table id="session_table"> |
| 154 | 154 | <tbody> |
| 155 | 155 | <?php foreach ($vars['session'] as $key => $value) : ?> |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $this->config = $config ?? (object) config('toolbar'); |
| 67 | 67 | |
| 68 | 68 | foreach ($this->config->collectors as $collector) { |
| 69 | - if (! class_exists($collector)) { |
|
| 69 | + if (!class_exists($collector)) { |
|
| 70 | 70 | logger()->critical( |
| 71 | 71 | 'Toolbar collector does not exist (' . $collector . ').' |
| 72 | 72 | . ' Please check $collectors in the app/Config/toolbar.php file.' |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $data['vars']['varData'][esc($heading)] = $varData; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if (! empty($_SESSION)) { |
|
| 135 | + if (!empty($_SESSION)) { |
|
| 136 | 136 | foreach ($_SESSION as $key => $value) { |
| 137 | 137 | // Remplacez les données binaires par une chaîne pour éviter l'échec de json_encode. |
| 138 | 138 | if (is_string($value) && preg_match('~[^\x20-\x7E\t\r\n]~', $value)) { |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | $output = ''; |
| 206 | 206 | |
| 207 | 207 | foreach ($rows as $row) { |
| 208 | - $hasChildren = isset($row['children']) && ! empty($row['children']); |
|
| 209 | - $isQuery = isset($row['query']) && ! empty($row['query']); |
|
| 208 | + $hasChildren = isset($row['children']) && !empty($row['children']); |
|
| 209 | + $isQuery = isset($row['query']) && !empty($row['query']); |
|
| 210 | 210 | |
| 211 | 211 | // Ouvrir la chronologie du contrôleur par défaut |
| 212 | 212 | $open = $row['name'] === 'Controller'; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | // Le collecter |
| 273 | 273 | foreach ($collectors as $collector) { |
| 274 | - if (! $collector['hasTimelineData']) { |
|
| 274 | + if (!$collector['hasTimelineData']) { |
|
| 275 | 275 | continue; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | array_multisort(...$sortArray); |
| 289 | 289 | |
| 290 | 290 | // Ajouter une heure de fin à chaque élément |
| 291 | - array_walk($data, static function (&$row) { |
|
| 291 | + array_walk($data, static function(&$row) { |
|
| 292 | 292 | $row['end'] = $row['start'] + $row['duration']; |
| 293 | 293 | }); |
| 294 | 294 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $element = array_shift($elements); |
| 308 | 308 | |
| 309 | 309 | // Si nous avons des enfants derrière nous, récupérez-les et attachez-les-nous |
| 310 | - while (! empty($elements) && $elements[array_key_first($elements)]['end'] <= $element['end']) { |
|
| 310 | + while (!empty($elements) && $elements[array_key_first($elements)]['end'] <= $element['end']) { |
|
| 311 | 311 | $element['children'][] = array_shift($elements); |
| 312 | 312 | } |
| 313 | 313 | |
@@ -331,14 +331,14 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | protected function collectVarData(): array |
| 333 | 333 | { |
| 334 | - if (! ($this->config->collectVarData ?? true)) { |
|
| 334 | + if (!($this->config->collectVarData ?? true)) { |
|
| 335 | 335 | return []; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | $data = []; |
| 339 | 339 | |
| 340 | 340 | foreach ($this->collectors as $collector) { |
| 341 | - if (! $collector->hasVarData()) { |
|
| 341 | + if (!$collector->hasVarData()) { |
|
| 342 | 342 | continue; |
| 343 | 343 | } |
| 344 | 344 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // Si on a desactiver le debogage ou l'affichage de la debugbar, on s'arrete |
| 375 | - if (! BLITZ_DEBUG || ! $this->config->show_debugbar) { |
|
| 375 | + if (!BLITZ_DEBUG || !$this->config->show_debugbar) { |
|
| 376 | 376 | return $response; |
| 377 | 377 | } |
| 378 | 378 | |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | // Mise à jour vers microtime() pour que nous puissions obtenir l'historique |
| 388 | 388 | $time = sprintf('%.6f', Date::now()->format('U.u')); |
| 389 | 389 | |
| 390 | - if (! is_dir($this->debugPath)) { |
|
| 390 | + if (!is_dir($this->debugPath)) { |
|
| 391 | 391 | mkdir($this->debugPath, 0777); |
| 392 | 392 | } |
| 393 | 393 | |
@@ -25,49 +25,49 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | private static array $loaded = []; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Drapeau permettant de savoir si la config a deja ete initialiser |
|
| 30 | - */ |
|
| 31 | - private static bool $initialized = false; |
|
| 28 | + /** |
|
| 29 | + * Drapeau permettant de savoir si la config a deja ete initialiser |
|
| 30 | + */ |
|
| 31 | + private static bool $initialized = false; |
|
| 32 | 32 | |
| 33 | - private Configurator $configurator; |
|
| 33 | + private Configurator $configurator; |
|
| 34 | 34 | |
| 35 | 35 | public function __construct() |
| 36 | 36 | { |
| 37 | - $this->configurator = new Configurator(); |
|
| 38 | - $this->initialize(); |
|
| 37 | + $this->configurator = new Configurator(); |
|
| 38 | + $this->initialize(); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - /** |
|
| 41 | + /** |
|
| 42 | 42 | * Détermine si une clé de configuration existe. |
| 43 | 43 | */ |
| 44 | - public function exists(string $key): bool |
|
| 45 | - { |
|
| 46 | - if (! $this->configurator->exists($key)) { |
|
| 47 | - $config = explode('.', $key); |
|
| 48 | - $this->load($config[0]); |
|
| 44 | + public function exists(string $key): bool |
|
| 45 | + { |
|
| 46 | + if (! $this->configurator->exists($key)) { |
|
| 47 | + $config = explode('.', $key); |
|
| 48 | + $this->load($config[0]); |
|
| 49 | 49 | |
| 50 | - return $this->configurator->exists(implode('.', $config)); |
|
| 51 | - } |
|
| 50 | + return $this->configurator->exists(implode('.', $config)); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - return true; |
|
| 54 | - } |
|
| 53 | + return true; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 56 | + /** |
|
| 57 | 57 | * Détermine s'il y'a une clé de configuration. |
| 58 | 58 | */ |
| 59 | - public function has(string $key): bool |
|
| 60 | - { |
|
| 61 | - return $this->exists($key); |
|
| 62 | - } |
|
| 59 | + public function has(string $key): bool |
|
| 60 | + { |
|
| 61 | + return $this->exists($key); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 64 | + /** |
|
| 65 | 65 | * Détermine s'il manque une clé de configuration. |
| 66 | 66 | */ |
| 67 | - public function missing(string $key): bool |
|
| 68 | - { |
|
| 69 | - return ! $this->exists($key); |
|
| 70 | - } |
|
| 67 | + public function missing(string $key): bool |
|
| 68 | + { |
|
| 69 | + return ! $this->exists($key); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * Renvoyer une configuration de l'application |
@@ -80,21 +80,21 @@ discard block |
||
| 80 | 80 | return $this->configurator->get($key); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if (func_num_args() > 1) { |
|
| 84 | - return $default; |
|
| 85 | - } |
|
| 83 | + if (func_num_args() > 1) { |
|
| 84 | + return $default; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - $path = explode('.', $key); |
|
| 87 | + $path = explode('.', $key); |
|
| 88 | 88 | |
| 89 | - throw ConfigException::notFound(implode(' » ', $path)); |
|
| 90 | - } |
|
| 89 | + throw ConfigException::notFound(implode(' » ', $path)); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * Définir une configuration de l'application |
| 94 | 94 | */ |
| 95 | 95 | public function set(string $key, $value) |
| 96 | 96 | { |
| 97 | - $this->configurator->set($key, $value); |
|
| 97 | + $this->configurator->set($key, $value); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | $schema = self::schema($config); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $this->configurator->addSchema($config, $schema, false); |
|
| 136 | - $this->configurator->merge([$config => (array) $configurations]); |
|
| 135 | + $this->configurator->addSchema($config, $schema, false); |
|
| 136 | + $this->configurator->merge([$config => (array) $configurations]); |
|
| 137 | 137 | |
| 138 | 138 | self::$loaded[$config] = $file; |
| 139 | 139 | } |
@@ -163,17 +163,17 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $path = preg_replace('#\.php$#', '', $path); |
| 165 | 165 | |
| 166 | - if (file_exists($file = CONFIG_PATH . $path . '.php')) { |
|
| 167 | - return $file; |
|
| 168 | - } |
|
| 166 | + if (file_exists($file = CONFIG_PATH . $path . '.php')) { |
|
| 167 | + return $file; |
|
| 168 | + } |
|
| 169 | 169 | |
| 170 | - $paths = Services::locator()->search('Config/' . $path); |
|
| 170 | + $paths = Services::locator()->search('Config/' . $path); |
|
| 171 | 171 | |
| 172 | - if (isset($paths[0]) && file_exists($path[0])) { |
|
| 173 | - return $paths[0]; |
|
| 174 | - } |
|
| 172 | + if (isset($paths[0]) && file_exists($path[0])) { |
|
| 173 | + return $paths[0]; |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - return ''; |
|
| 176 | + return ''; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | private function initialize() |
| 205 | 205 | { |
| 206 | - if (self::$initialized) { |
|
| 207 | - return; |
|
| 208 | - } |
|
| 206 | + if (self::$initialized) { |
|
| 207 | + return; |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - $this->load(['app']); |
|
| 210 | + $this->load(['app']); |
|
| 211 | 211 | |
| 212 | 212 | ini_set('log_errors', 1); |
| 213 | 213 | ini_set('error_log', LOG_PATH . 'blitz-logs'); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $this->initializeEnvironment(); |
| 217 | 217 | $this->initializeDebugbar(); |
| 218 | 218 | |
| 219 | - self::$initialized = true; |
|
| 219 | + self::$initialized = true; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function exists(string $key): bool |
| 45 | 45 | { |
| 46 | - if (! $this->configurator->exists($key)) { |
|
| 46 | + if (!$this->configurator->exists($key)) { |
|
| 47 | 47 | $config = explode('.', $key); |
| 48 | 48 | $this->load($config[0]); |
| 49 | 49 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function missing(string $key): bool |
| 68 | 68 | { |
| 69 | - return ! $this->exists($key); |
|
| 69 | + return !$this->exists($key); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | if (is_array($config)) { |
| 108 | 108 | foreach ($config as $key => $value) { |
| 109 | - if (! is_string($value) || empty($value)) { |
|
| 109 | + if (!is_string($value) || empty($value)) { |
|
| 110 | 110 | continue; |
| 111 | 111 | } |
| 112 | 112 | if (is_string($key)) { |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | self::load($conf, $file); |
| 120 | 120 | } |
| 121 | - } elseif (is_string($config) && ! isset(self::$loaded[$config])) { |
|
| 121 | + } elseif (is_string($config) && !isset(self::$loaded[$config])) { |
|
| 122 | 122 | if (empty($file)) { |
| 123 | 123 | $file = self::path($config); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $configurations = []; |
| 127 | - if (file_exists($file) && ! in_array($file, get_included_files(), true)) { |
|
| 127 | + if (file_exists($file) && !in_array($file, get_included_files(), true)) { |
|
| 128 | 128 | $configurations = (array) require $file; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | if (is_array($accepts_values)) { |
| 151 | 151 | $accepts_values = '(Accept values: ' . implode('/', $accepts_values) . ')'; |
| 152 | - } elseif (! is_string($accepts_values)) { |
|
| 152 | + } elseif (!is_string($accepts_values)) { |
|
| 153 | 153 | throw new InvalidArgumentException('Misuse of the method ' . __METHOD__); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $schema = require $app_schema; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if (empty($schema) || ! ($schema instanceof Schema)) { |
|
| 194 | + if (empty($schema) || !($schema instanceof Schema)) { |
|
| 195 | 195 | $schema = Expect::mixed(); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -278,12 +278,12 @@ discard block |
||
| 278 | 278 | { |
| 279 | 279 | $config = $this->get('app.show_debugbar', 'auto'); |
| 280 | 280 | |
| 281 | - if (! in_array($config, ['auto', true, false], true)) { |
|
| 281 | + if (!in_array($config, ['auto', true, false], true)) { |
|
| 282 | 282 | self::exceptBadConfigValue('show_debugbar', ['auto', true, false], 'app'); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | if ($config === 'auto') { |
| 286 | - $this->set('app.show_debugbar', ! is_online()); |
|
| 286 | + $this->set('app.show_debugbar', !is_online()); |
|
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -115,18 +115,18 @@ |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if (! function_exists('config')) { |
| 118 | - /** |
|
| 118 | + /** |
|
| 119 | 119 | * GET/SET App config |
| 120 | 120 | * |
| 121 | 121 | * @return Config|mixed|void |
| 122 | 122 | */ |
| 123 | 123 | function config(array|string|null $key = null, $default = null) |
| 124 | 124 | { |
| 125 | - $config = Services::config(); |
|
| 125 | + $config = Services::config(); |
|
| 126 | 126 | |
| 127 | - if (null === $key) { |
|
| 128 | - return $config; |
|
| 129 | - } |
|
| 127 | + if (null === $key) { |
|
| 128 | + return $config; |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | 131 | if (is_string($key)) { |
| 132 | 132 | return $config->get($key, $default); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // ================================= FONCTIONS UTIILITAIRES ESSENTIELLES ================================= // |
| 26 | 26 | |
| 27 | -if (! function_exists('env')) { |
|
| 27 | +if (!function_exists('env')) { |
|
| 28 | 28 | /** |
| 29 | 29 | * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation |
| 30 | 30 | * pour les variables d'environnement non prises en charge ou incohérentes |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | -if (! function_exists('helper')) { |
|
| 43 | +if (!function_exists('helper')) { |
|
| 44 | 44 | /** |
| 45 | 45 | * Charge un fichier d'aide en mémoire. Prend en charge les assistants d'espace de noms, |
| 46 | 46 | * à la fois dans et hors du répertoire 'helpers' d'un répertoire à espace de noms. |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | -if (! function_exists('model')) { |
|
| 59 | +if (!function_exists('model')) { |
|
| 60 | 60 | /** |
| 61 | 61 | * Simple maniere d'obtenir un modele. |
| 62 | 62 | * |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return T |
| 68 | 68 | */ |
| 69 | - function model(string|array $name, ?ConnectionInterface &$conn = null) |
|
| 69 | + function model(string|array $name, ?ConnectionInterface&$conn = null) |
|
| 70 | 70 | { |
| 71 | 71 | return Load::model($name, $conn); |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -if (! function_exists('service')) { |
|
| 75 | +if (!function_exists('service')) { |
|
| 76 | 76 | /** |
| 77 | 77 | * Permet un accès plus propre au fichier de configuration des services. |
| 78 | 78 | * Renvoie toujours une instance SHARED de la classe, donc |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | -if (! function_exists('single_service')) { |
|
| 92 | +if (!function_exists('single_service')) { |
|
| 93 | 93 | /** |
| 94 | 94 | * Autoriser l'accès propre à un service. |
| 95 | 95 | * Renvoie toujours une nouvelle instance de la classe. |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | -if (! function_exists('show404')) { |
|
| 106 | +if (!function_exists('show404')) { |
|
| 107 | 107 | /** |
| 108 | 108 | * Afficher une page 404 introuvable dans le navigateur |
| 109 | 109 | */ |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | -if (! function_exists('config')) { |
|
| 116 | +if (!function_exists('config')) { |
|
| 117 | 117 | /** |
| 118 | 118 | * GET/SET App config |
| 119 | 119 | * |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | -if (! function_exists('logger')) { |
|
| 142 | +if (!function_exists('logger')) { |
|
| 143 | 143 | /** |
| 144 | 144 | * Une méthode de commodité pour les événements de journalisation via le système Log. |
| 145 | 145 | * |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | $logger = Services::logger(); |
| 163 | 163 | |
| 164 | - if (! empty($level) && ! empty($message)) { |
|
| 164 | + if (!empty($level) && !empty($message)) { |
|
| 165 | 165 | return $logger->log($level, $message, $context); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | -if (! function_exists('cache')) { |
|
| 172 | +if (!function_exists('cache')) { |
|
| 173 | 173 | /** |
| 174 | 174 | * Une méthode pratique qui donne accès au cache |
| 175 | 175 | * objet. Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | -if (! function_exists('session')) { |
|
| 202 | +if (!function_exists('session')) { |
|
| 203 | 203 | /** |
| 204 | 204 | * Une méthode pratique pour accéder à l'instance de session, ou un élément qui a été défini dans la session. |
| 205 | 205 | * |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== // |
| 226 | 226 | |
| 227 | -if (! function_exists('esc')) { |
|
| 227 | +if (!function_exists('esc')) { |
|
| 228 | 228 | /** |
| 229 | 229 | * Effectue un simple échappement automatique des données pour des raisons de sécurité. |
| 230 | 230 | * Pourrait envisager de rendre cela plus complexe à une date ultérieure. |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | -if (! function_exists('h')) { |
|
| 254 | +if (!function_exists('h')) { |
|
| 255 | 255 | /** |
| 256 | 256 | * Méthode pratique pour htmlspecialchars. |
| 257 | 257 | * |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | -if (! function_exists('purify')) { |
|
| 273 | +if (!function_exists('purify')) { |
|
| 274 | 274 | /** |
| 275 | 275 | * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier. |
| 276 | 276 | * Utilisez facilement plusieurs configurations de purificateur. |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | -if (! function_exists('remove_invisible_characters')) { |
|
| 291 | +if (!function_exists('remove_invisible_characters')) { |
|
| 292 | 292 | /** |
| 293 | 293 | * Supprimer les caractères invisibles |
| 294 | 294 | * |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | -if (! function_exists('stringify_attributes')) { |
|
| 304 | +if (!function_exists('stringify_attributes')) { |
|
| 305 | 305 | /** |
| 306 | 306 | * Chaîner les attributs à utiliser dans les balises HTML. |
| 307 | 307 | * |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= // |
| 317 | 317 | |
| 318 | -if (! function_exists('environment')) { |
|
| 318 | +if (!function_exists('environment')) { |
|
| 319 | 319 | /** |
| 320 | 320 | * Renvoi l'environnement d'execution actuel ou determine si on est dans un environnement specifie |
| 321 | 321 | * |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | -if (! function_exists('on_dev')) { |
|
| 356 | +if (!function_exists('on_dev')) { |
|
| 357 | 357 | /** |
| 358 | 358 | * Testez pour voir si nous sommes dans un environnement de développement. |
| 359 | 359 | */ |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | -if (! function_exists('on_prod')) { |
|
| 370 | +if (!function_exists('on_prod')) { |
|
| 371 | 371 | /** |
| 372 | 372 | * Testez pour voir si nous sommes dans un environnement de production. |
| 373 | 373 | */ |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | -if (! function_exists('on_test')) { |
|
| 384 | +if (!function_exists('on_test')) { |
|
| 385 | 385 | /** |
| 386 | 386 | * Testez pour voir si nous sommes dans un environnement de test |
| 387 | 387 | */ |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | -if (! function_exists('is_cli')) { |
|
| 394 | +if (!function_exists('is_cli')) { |
|
| 395 | 395 | /** |
| 396 | 396 | * Testez pour voir si une demande a été faite à partir de la ligne de commande. |
| 397 | 397 | */ |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | -if (! function_exists('is_php')) { |
|
| 404 | +if (!function_exists('is_php')) { |
|
| 405 | 405 | /** |
| 406 | 406 | * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie. |
| 407 | 407 | */ |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | -if (! function_exists('is_windows')) { |
|
| 414 | +if (!function_exists('is_windows')) { |
|
| 415 | 415 | /** |
| 416 | 416 | * Déterminez si l'environnement actuel est basé sur Windows. |
| 417 | 417 | */ |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | -if (! function_exists('is_https')) { |
|
| 424 | +if (!function_exists('is_https')) { |
|
| 425 | 425 | /** |
| 426 | 426 | * Determines if the application is accessed via an encrypted * (HTTPS) connection. |
| 427 | 427 | */ |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | -if (! function_exists('is_localfile')) { |
|
| 434 | +if (!function_exists('is_localfile')) { |
|
| 435 | 435 | /** |
| 436 | 436 | * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non |
| 437 | 437 | */ |
@@ -441,11 +441,11 @@ discard block |
||
| 441 | 441 | return true; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - return ! preg_match('#^(https?://)#i', $name); |
|
| 444 | + return !preg_match('#^(https?://)#i', $name); |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | -if (! function_exists('is_online')) { |
|
| 448 | +if (!function_exists('is_online')) { |
|
| 449 | 449 | /** |
| 450 | 450 | * Tester si l'application s'exécute en local ou en ligne. |
| 451 | 451 | */ |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | -if (! function_exists('is_connected')) { |
|
| 458 | +if (!function_exists('is_connected')) { |
|
| 459 | 459 | /** |
| 460 | 460 | * Verifie si l'utilisateur a une connexion internet active. |
| 461 | 461 | */ |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | -if (! function_exists('is_ajax_request')) { |
|
| 468 | +if (!function_exists('is_ajax_request')) { |
|
| 469 | 469 | /** |
| 470 | 470 | * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH. |
| 471 | 471 | */ |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | -if (! function_exists('redirection')) { |
|
| 478 | +if (!function_exists('redirection')) { |
|
| 479 | 479 | /** |
| 480 | 480 | * Redirige l'utilisateur |
| 481 | 481 | */ |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | -if (! function_exists('redirect')) { |
|
| 492 | +if (!function_exists('redirect')) { |
|
| 493 | 493 | /** |
| 494 | 494 | * Méthode pratique qui fonctionne avec la $request globale actuelle et |
| 495 | 495 | * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | { |
| 504 | 504 | $redirection = Services::redirection(); |
| 505 | 505 | |
| 506 | - if (! empty($uri)) { |
|
| 506 | + if (!empty($uri)) { |
|
| 507 | 507 | return $redirection->route($uri); |
| 508 | 508 | } |
| 509 | 509 | |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | -if (! function_exists('back')) { |
|
| 514 | +if (!function_exists('back')) { |
|
| 515 | 515 | /** |
| 516 | 516 | * Retourne a la page precedente |
| 517 | 517 | */ |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | -if (! function_exists('link_to')) { |
|
| 524 | +if (!function_exists('link_to')) { |
|
| 525 | 525 | /** |
| 526 | 526 | * Étant donné une chaîne de contrôleur/méthode et tous les paramètres, |
| 527 | 527 | * tentera de créer l'URL relative à la route correspondante. |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | } |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | -if (! function_exists('clean_path')) { |
|
| 544 | +if (!function_exists('clean_path')) { |
|
| 545 | 545 | /** |
| 546 | 546 | * Une méthode pratique pour nettoyer les chemins pour |
| 547 | 547 | * une sortie plus belle. Utile pour les exceptions |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | -if (! function_exists('old')) { |
|
| 576 | +if (!function_exists('old')) { |
|
| 577 | 577 | /** |
| 578 | 578 | * Fournit l'accès à "entrée ancienne" qui a été définie dans la session lors d'un redirect()-withInput(). |
| 579 | 579 | * |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | function old(string $key, $default = null, $escape = 'html') |
| 586 | 586 | { |
| 587 | 587 | // Assurez-vous de charger la session |
| 588 | - if (session_status() === PHP_SESSION_NONE && ! on_test()) { |
|
| 588 | + if (session_status() === PHP_SESSION_NONE && !on_test()) { |
|
| 589 | 589 | session(); // @codeCoverageIgnore |
| 590 | 590 | } |
| 591 | 591 | |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | |
| 601 | 601 | // ================================= FONCTIONS DE DEBOGAGE ================================= // |
| 602 | 602 | |
| 603 | -if (! function_exists('deprecationWarning')) { |
|
| 603 | +if (!function_exists('deprecationWarning')) { |
|
| 604 | 604 | /** |
| 605 | 605 | * Méthode d'assistance pour générer des avertissements d'obsolescence |
| 606 | 606 | * |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | -if (! function_exists('pr')) { |
|
| 619 | +if (!function_exists('pr')) { |
|
| 620 | 620 | /** |
| 621 | 621 | * print_r() convenience function. |
| 622 | 622 | * |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | } |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | -if (! function_exists('pj')) { |
|
| 641 | +if (!function_exists('pj')) { |
|
| 642 | 642 | /** |
| 643 | 643 | * json pretty print convenience function. |
| 644 | 644 | * |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | } |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | -if (! function_exists('trigger_warning')) { |
|
| 662 | +if (!function_exists('trigger_warning')) { |
|
| 663 | 663 | /** |
| 664 | 664 | * Déclenche un E_USER_WARNING. |
| 665 | 665 | */ |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | |
| 672 | 672 | // ================================= FONCTIONS DIVERSES ================================= // |
| 673 | 673 | |
| 674 | -if (! function_exists('force_https')) { |
|
| 674 | +if (!function_exists('force_https')) { |
|
| 675 | 675 | /** |
| 676 | 676 | * Utilisé pour forcer l'accès à une page via HTTPS. |
| 677 | 677 | * Utilise une redirection standard, plus définira l'en-tête HSTS |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | -if (! function_exists('get_type_name')) { |
|
| 732 | +if (!function_exists('get_type_name')) { |
|
| 733 | 733 | /** |
| 734 | 734 | * Renvoie la classe d'objets ou le type var de ce n'est pas un objet |
| 735 | 735 | * |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | } |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | -if (! function_exists('ip_address')) { |
|
| 746 | +if (!function_exists('ip_address')) { |
|
| 747 | 747 | /** |
| 748 | 748 | * Renvoie l'adresse IP de l'utilisateur actuel |
| 749 | 749 | */ |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | -if (! function_exists('is_really_writable')) { |
|
| 756 | +if (!function_exists('is_really_writable')) { |
|
| 757 | 757 | /** |
| 758 | 758 | * Tests d'inscriptibilité des fichiers |
| 759 | 759 | */ |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | } |
| 764 | 764 | } |
| 765 | 765 | |
| 766 | -if (! function_exists('lang')) { |
|
| 766 | +if (!function_exists('lang')) { |
|
| 767 | 767 | /** |
| 768 | 768 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
| 769 | 769 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | } |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | -if (! function_exists('__')) { |
|
| 777 | +if (!function_exists('__')) { |
|
| 778 | 778 | /** |
| 779 | 779 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
| 780 | 780 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | } |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | -if (! function_exists('namespace_split')) { |
|
| 790 | +if (!function_exists('namespace_split')) { |
|
| 791 | 791 | /** |
| 792 | 792 | * Séparez l'espace de noms du nom de classe. |
| 793 | 793 | * |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | } |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | -if (! function_exists('view_exist')) { |
|
| 811 | +if (!function_exists('view_exist')) { |
|
| 812 | 812 | /** |
| 813 | 813 | * Verifie si un fichier de vue existe. Utile pour limiter les failles include |
| 814 | 814 | */ |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | -if (! function_exists('view')) { |
|
| 825 | +if (!function_exists('view')) { |
|
| 826 | 826 | /** |
| 827 | 827 | * Charge une vue |
| 828 | 828 | * |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | } |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | -if (! function_exists('flash')) { |
|
| 841 | +if (!function_exists('flash')) { |
|
| 842 | 842 | /** |
| 843 | 843 | * Fournisseur d'acces rapide a la classe PHP Flash |
| 844 | 844 | * |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | }*/ |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | -if (! function_exists('geo_ip')) { |
|
| 873 | +if (!function_exists('geo_ip')) { |
|
| 874 | 874 | /** |
| 875 | 875 | * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip |
| 876 | 876 | */ |
@@ -880,7 +880,7 @@ discard block |
||
| 880 | 880 | } |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | -if (! function_exists('to_stream')) { |
|
| 883 | +if (!function_exists('to_stream')) { |
|
| 884 | 884 | /** |
| 885 | 885 | * Créez un nouveau flux basé sur le type d'entrée. |
| 886 | 886 | * |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | } |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | -if (! function_exists('value')) { |
|
| 906 | +if (!function_exists('value')) { |
|
| 907 | 907 | /** |
| 908 | 908 | * Renvoie la valeur par défaut de la valeur donnée. |
| 909 | 909 | */ |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | } |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | -if (! function_exists('collect')) { |
|
| 916 | +if (!function_exists('collect')) { |
|
| 917 | 917 | /** |
| 918 | 918 | * Créez une collection à partir de la valeur donnée. |
| 919 | 919 | */ |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | } |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | -if (! function_exists('with')) { |
|
| 926 | +if (!function_exists('with')) { |
|
| 927 | 927 | /** |
| 928 | 928 | * Renvoie la valeur donnée, éventuellement transmise via le rappel donné. |
| 929 | 929 | * |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | } |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | -if (! function_exists('tap')) { |
|
| 938 | +if (!function_exists('tap')) { |
|
| 939 | 939 | /** |
| 940 | 940 | * Appelez la Closure donnée avec cette instance puis renvoyez l'instance. |
| 941 | 941 | */ |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | -if (! function_exists('last')) { |
|
| 948 | +if (!function_exists('last')) { |
|
| 949 | 949 | /** |
| 950 | 950 | * Recupere le dernier element d'un tableau |
| 951 | 951 | */ |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | } |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | -if (! function_exists('invade')) { |
|
| 958 | +if (!function_exists('invade')) { |
|
| 959 | 959 | /** |
| 960 | 960 | * Cette classe offre une fonction d'invasion qui vous permettra de lire / écrire des propriétés privées d'un objet. |
| 961 | 961 | * Il vous permettra également de définir, obtenir et appeler des méthodes privées. |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - /** |
|
| 108 | + /** |
|
| 109 | 109 | * Charge un fichier d'aide en mémoire. |
| 110 | 110 | * Prend en charge les helpers d'espace de noms, à la fois dans et hors du répertoire 'helpers' d'un répertoire d'espace de noms. |
| 111 | 111 | */ |
@@ -115,53 +115,53 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $loader = Services::locator(); |
| 117 | 117 | |
| 118 | - // Stockez nos versions de schame système et d'application afin que nous puissions contrôler l'ordre de chargement. |
|
| 119 | - $systemSchema = null; |
|
| 120 | - $appSchema = null; |
|
| 121 | - $vendorSchema = null; |
|
| 118 | + // Stockez nos versions de schame système et d'application afin que nous puissions contrôler l'ordre de chargement. |
|
| 119 | + $systemSchema = null; |
|
| 120 | + $appSchema = null; |
|
| 121 | + $vendorSchema = null; |
|
| 122 | 122 | |
| 123 | - // Le fichier de schema qui sera finalement utiliser |
|
| 124 | - $file = null; |
|
| 123 | + // Le fichier de schema qui sera finalement utiliser |
|
| 124 | + $file = null; |
|
| 125 | 125 | |
| 126 | - // Vérifiez si ce schama a déjà été chargé |
|
| 127 | - if (in_array($name, $loadedSchema, true)) { |
|
| 126 | + // Vérifiez si ce schama a déjà été chargé |
|
| 127 | + if (in_array($name, $loadedSchema, true)) { |
|
| 128 | 128 | return $loadedSchema[$name]; |
| 129 | - } |
|
| 130 | - |
|
| 131 | - // Si le fichier est dans un espace de noms, nous allons simplement saisir ce fichier et ne pas en rechercher d'autres |
|
| 132 | - if (strpos($name, '\\') !== false) { |
|
| 133 | - if (!empty($path = $loader->locateFile($name, 'schemas'))) { |
|
| 134 | - $file = $path; |
|
| 135 | - } |
|
| 136 | - } else { |
|
| 137 | - // Pas d'espaces de noms, donc recherchez dans tous les emplacements disponibles |
|
| 138 | - $paths = $loader->search('schemas/' . $name); |
|
| 139 | - |
|
| 140 | - foreach ($paths as $path) { |
|
| 141 | - if (strpos($path, CONFIG_PATH . 'schemas' . DS) === 0) { |
|
| 142 | - $appSchema = $path; |
|
| 143 | - } elseif (strpos($path, SYST_PATH . 'Constants' . DS . 'schemas' . DS) === 0) { |
|
| 144 | - $systemSchema = $path; |
|
| 145 | - } else { |
|
| 146 | - $vendorSchema = $path; |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - // Les schema des vendor sont prioritaire, ensuite vienne ceux de l'application |
|
| 151 | - if (!empty($vendorSchema)) { |
|
| 152 | - $file = $vendorSchema; |
|
| 153 | - } else if (!empty($appSchema)) { |
|
| 154 | - $file = $appSchema; |
|
| 155 | - } else if (!empty($systemSchema)) { |
|
| 156 | - $file = $systemSchema; |
|
| 157 | - } |
|
| 158 | 129 | } |
| 159 | 130 | |
| 160 | - if (!empty($file)) { |
|
| 161 | - $schema = require($file); |
|
| 162 | - } else { |
|
| 163 | - $schema = null; |
|
| 164 | - } |
|
| 131 | + // Si le fichier est dans un espace de noms, nous allons simplement saisir ce fichier et ne pas en rechercher d'autres |
|
| 132 | + if (strpos($name, '\\') !== false) { |
|
| 133 | + if (!empty($path = $loader->locateFile($name, 'schemas'))) { |
|
| 134 | + $file = $path; |
|
| 135 | + } |
|
| 136 | + } else { |
|
| 137 | + // Pas d'espaces de noms, donc recherchez dans tous les emplacements disponibles |
|
| 138 | + $paths = $loader->search('schemas/' . $name); |
|
| 139 | + |
|
| 140 | + foreach ($paths as $path) { |
|
| 141 | + if (strpos($path, CONFIG_PATH . 'schemas' . DS) === 0) { |
|
| 142 | + $appSchema = $path; |
|
| 143 | + } elseif (strpos($path, SYST_PATH . 'Constants' . DS . 'schemas' . DS) === 0) { |
|
| 144 | + $systemSchema = $path; |
|
| 145 | + } else { |
|
| 146 | + $vendorSchema = $path; |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + // Les schema des vendor sont prioritaire, ensuite vienne ceux de l'application |
|
| 151 | + if (!empty($vendorSchema)) { |
|
| 152 | + $file = $vendorSchema; |
|
| 153 | + } else if (!empty($appSchema)) { |
|
| 154 | + $file = $appSchema; |
|
| 155 | + } else if (!empty($systemSchema)) { |
|
| 156 | + $file = $systemSchema; |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + if (!empty($file)) { |
|
| 161 | + $schema = require($file); |
|
| 162 | + } else { |
|
| 163 | + $schema = null; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | 166 | if (empty($schema) || ! ($schema instanceof Schema)) { |
| 167 | 167 | $schema = Expect::mixed(); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $loader = Services::locator(); |
| 40 | 40 | |
| 41 | - if (! is_array($filenames)) { |
|
| 41 | + if (!is_array($filenames)) { |
|
| 42 | 42 | $filenames = [$filenames]; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Les helpers au niveau de l'application doivent remplacer tous les autres |
| 85 | - if (! empty($appHelper)) { |
|
| 85 | + if (!empty($appHelper)) { |
|
| 86 | 86 | $includes[] = $appHelper; |
| 87 | 87 | $loaded[] = $filename; |
| 88 | 88 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $includes = [...$includes, ...$localIncludes]; |
| 92 | 92 | |
| 93 | 93 | // Et celui par défaut du système doit être ajouté en dernier. |
| 94 | - if (! empty($systemHelper)) { |
|
| 94 | + if (!empty($systemHelper)) { |
|
| 95 | 95 | $includes[] = $systemHelper; |
| 96 | 96 | $loaded[] = $filename; |
| 97 | 97 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $schema = null; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if (empty($schema) || ! ($schema instanceof Schema)) { |
|
| 165 | + if (empty($schema) || !($schema instanceof Schema)) { |
|
| 166 | 166 | $schema = Expect::mixed(); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -180,16 +180,16 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public static function model(string $model, ?ConnectionInterface $connection = null) |
| 182 | 182 | { |
| 183 | - if (! class_exists($model) && ! Text::endsWith($model, 'Model')) { |
|
| 183 | + if (!class_exists($model) && !Text::endsWith($model, 'Model')) { |
|
| 184 | 184 | $model .= 'Model'; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if (! class_exists($model)) { |
|
| 187 | + if (!class_exists($model)) { |
|
| 188 | 188 | $model = str_replace(APP_NAMESPACE . '\\Models\\', '', $model); |
| 189 | 189 | $model = APP_NAMESPACE . '\\Models\\' . $model; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - if (! class_exists($model)) { |
|
| 192 | + if (!class_exists($model)) { |
|
| 193 | 193 | throw LoadException::modelNotFound($model); |
| 194 | 194 | } |
| 195 | 195 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | protected static function verifyPreferApp(array $options, string $name): bool |
| 219 | 219 | { |
| 220 | 220 | // Tout element sans restriction passe |
| 221 | - if (! $options['preferApp']) { |
|
| 221 | + if (!$options['preferApp']) { |
|
| 222 | 222 | return true; |
| 223 | 223 | } |
| 224 | 224 | |