@@ -80,49 +80,49 @@ discard block |
||
80 | 80 | */ |
81 | 81 | defined('LAYOUT_PATH') || define('LAYOUT_PATH', VIEW_PATH . 'layouts' . DS); |
82 | 82 | |
83 | -if (! defined('SERVICE_PATH')) { |
|
83 | +if (!defined('SERVICE_PATH')) { |
|
84 | 84 | /** |
85 | 85 | * Services directory path |
86 | 86 | */ |
87 | 87 | define('SERVICE_PATH', APP_PATH . 'services' . DS); |
88 | 88 | } |
89 | 89 | |
90 | -if (! defined('LOG_PATH')) { |
|
90 | +if (!defined('LOG_PATH')) { |
|
91 | 91 | /** |
92 | 92 | * Application logs files storage path |
93 | 93 | */ |
94 | 94 | define('LOG_PATH', STORAGE_PATH . 'logs' . DS); |
95 | 95 | } |
96 | 96 | |
97 | -if (! defined('DATABASE_PATH')) { |
|
97 | +if (!defined('DATABASE_PATH')) { |
|
98 | 98 | /** |
99 | 99 | * Database storage directory path |
100 | 100 | */ |
101 | 101 | define('DATABASE_PATH', STORAGE_PATH . 'database' . DS); |
102 | 102 | } |
103 | 103 | |
104 | -if (! defined('DB_MIGRATION_PATH')) { |
|
104 | +if (!defined('DB_MIGRATION_PATH')) { |
|
105 | 105 | /** |
106 | 106 | * Database migrations storage path |
107 | 107 | */ |
108 | 108 | define('DB_MIGRATION_PATH', RESOURCE_PATH . 'database' . DS . 'migrations' . DS); |
109 | 109 | } |
110 | 110 | |
111 | -if (! defined('DB_SEED_PATH')) { |
|
111 | +if (!defined('DB_SEED_PATH')) { |
|
112 | 112 | /** |
113 | 113 | * Database seeds storage path |
114 | 114 | */ |
115 | 115 | define('DB_SEED_PATH', RESOURCE_PATH . 'database' . DS . 'seeds' . DS); |
116 | 116 | } |
117 | 117 | |
118 | -if (! defined('DB_DUMP_PATH')) { |
|
118 | +if (!defined('DB_DUMP_PATH')) { |
|
119 | 119 | /** |
120 | 120 | * Database backup storage path |
121 | 121 | */ |
122 | 122 | define('DB_DUMP_PATH', DATABASE_PATH . 'dump' . DS); |
123 | 123 | } |
124 | 124 | |
125 | -if (! defined('DB_CACHE_PATH')) { |
|
125 | +if (!defined('DB_CACHE_PATH')) { |
|
126 | 126 | /** |
127 | 127 | * Database cache directory path |
128 | 128 | */ |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | */ |
145 | 145 | defined('SECOND') || define('SECOND', 1); |
146 | 146 | defined('MINUTE') || define('MINUTE', 60); |
147 | -defined('HOUR') || define('HOUR', 3600); |
|
148 | -defined('DAY') || define('DAY', 86400); |
|
149 | -defined('WEEK') || define('WEEK', 604800); |
|
150 | -defined('MONTH') || define('MONTH', 2592000); |
|
151 | -defined('YEAR') || define('YEAR', 31536000); |
|
147 | +defined('HOUR') || define('HOUR', 3600); |
|
148 | +defined('DAY') || define('DAY', 86400); |
|
149 | +defined('WEEK') || define('WEEK', 604800); |
|
150 | +defined('MONTH') || define('MONTH', 2592000); |
|
151 | +defined('YEAR') || define('YEAR', 31536000); |
|
152 | 152 | defined('DECADE') || define('DECADE', 315360000); |
153 | 153 | |
154 | 154 | /** |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | * - BSD sysexits.h: http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits |
170 | 170 | * - Bash scripting: http://tldp.org/LDP/abs/html/exitcodes.html |
171 | 171 | */ |
172 | -defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // pas d'erreurs |
|
173 | -defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // erreur generique |
|
174 | -defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // erreur de configuration |
|
175 | -defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // fichier non trouvé |
|
176 | -defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // classe inconnue |
|
172 | +defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // pas d'erreurs |
|
173 | +defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // erreur generique |
|
174 | +defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // erreur de configuration |
|
175 | +defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // fichier non trouvé |
|
176 | +defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // classe inconnue |
|
177 | 177 | defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // membre de classe inconnu |
178 | -defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // saisie utilisateur invalide |
|
179 | -defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // erreur de base de données |
|
180 | -defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // code d'erreur attribué automatiquement le plus bas |
|
181 | -defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // code d'erreur attribué automatiquement le plus élevé |
|
178 | +defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // saisie utilisateur invalide |
|
179 | +defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // erreur de base de données |
|
180 | +defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // code d'erreur attribué automatiquement le plus bas |
|
181 | +defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // code d'erreur attribué automatiquement le plus élevé |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | use InvalidArgumentException; |
16 | 16 | use Transliterator; |
17 | 17 | |
18 | -if (! defined('MB_ENABLED')) { |
|
18 | +if (!defined('MB_ENABLED')) { |
|
19 | 19 | if (extension_loaded('mbstring')) { |
20 | 20 | define('MB_ENABLED', true); |
21 | 21 | // mbstring.internal_encoding est obsolète à partir de PHP 5.6 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | define('MB_ENABLED', false); |
29 | 29 | } |
30 | 30 | } |
31 | -if (! defined('ICONV_ENABLED')) { |
|
31 | +if (!defined('ICONV_ENABLED')) { |
|
32 | 32 | if (extension_loaded('iconv')) { |
33 | 33 | define('ICONV_ENABLED', true); |
34 | 34 | // iconv.internal_encoding est obsolète à partir de PHP 5.6 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $converter = preg_replace('#Case$#i', '', $converter); |
108 | 108 | $converter = str_replace('to', '', strtolower($converter)); |
109 | 109 | |
110 | - if (! in_array($converter, $available_case, true)) { |
|
110 | + if (!in_array($converter, $available_case, true)) { |
|
111 | 111 | throw new InvalidArgumentException("Invalid converter type: `{$converter}`"); |
112 | 112 | } |
113 | 113 | |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | public static function cleanInsert(string $str, array $options): string |
161 | 161 | { |
162 | 162 | $clean = $options['clean']; |
163 | - if (! $clean) { |
|
163 | + if (!$clean) { |
|
164 | 164 | return $str; |
165 | 165 | } |
166 | 166 | if ($clean === true) { |
167 | 167 | $clean = ['method' => 'text']; |
168 | 168 | } |
169 | - if (! is_array($clean)) { |
|
169 | + if (!is_array($clean)) { |
|
170 | 170 | $clean = ['method' => $options['clean']]; |
171 | 171 | } |
172 | 172 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | public static function containsAll(string $haystack, array $needles): bool |
260 | 260 | { |
261 | 261 | foreach ($needles as $needle) { |
262 | - if (! static::contains($haystack, $needle)) { |
|
262 | + if (!static::contains($haystack, $needle)) { |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | } |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | return $options['clean'] ? static::cleanInsert($str, $options) : $str; |
460 | 460 | } |
461 | 461 | |
462 | - if (! isset($format)) { |
|
462 | + if (!isset($format)) { |
|
463 | 463 | $format = sprintf( |
464 | 464 | '/(?<!%s)%s%%s%s/', |
465 | 465 | preg_quote($options['escape'], '/'), |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | $str = str_replace($tmpHash, $tmpValue, $str); |
497 | 497 | } |
498 | 498 | |
499 | - if (! isset($options['format']) && isset($options['before'])) { |
|
499 | + if (!isset($options['format']) && isset($options['before'])) { |
|
500 | 500 | $str = str_replace($options['escape'] . $options['before'], $options['before'], $str); |
501 | 501 | } |
502 | 502 | |
@@ -797,8 +797,8 @@ discard block |
||
797 | 797 | $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
798 | 798 | $replace = preg_replace_callback( |
799 | 799 | $pattern, |
800 | - static function ($match) use ($strlen) { |
|
801 | - $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
|
800 | + static function($match) use ($strlen) { |
|
801 | + $utf8 = html_entity_decode($match[0], ENT_HTML5|ENT_QUOTES, 'UTF-8'); |
|
802 | 802 | |
803 | 803 | return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
804 | 804 | }, |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | $result = ''; |
859 | 859 | |
860 | 860 | $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i'; |
861 | - $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
861 | + $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); |
|
862 | 862 | |
863 | 863 | foreach ($parts as $part) { |
864 | 864 | $offset = 0; |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | if ($offset !== 0 || $totalLength + $len > $length) { |
880 | 880 | if ( |
881 | 881 | strpos($part, '&') === 0 && preg_match($pattern, $part) |
882 | - && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') |
|
882 | + && $part !== html_entity_decode($part, ENT_HTML5|ENT_QUOTES, 'UTF-8') |
|
883 | 883 | ) { |
884 | 884 | // Entities cannot be passed substr. |
885 | 885 | continue; |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | } |
935 | 935 | |
936 | 936 | $truncate = mb_substr($text, mb_strlen($text) - $length + mb_strlen($ellipsis)); |
937 | - if (! $exact) { |
|
937 | + if (!$exact) { |
|
938 | 938 | $spacepos = mb_strpos($truncate, ' '); |
939 | 939 | $truncate = $spacepos === false ? '' : trim(mb_substr($truncate, $spacepos)); |
940 | 940 | } |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | } |
990 | 990 | if ($tmpOffset !== -1) { |
991 | 991 | $buffer .= substr($data, $offset, ($tmpOffset - $offset)); |
992 | - if (! $depth && $data[$tmpOffset] === $separator) { |
|
992 | + if (!$depth && $data[$tmpOffset] === $separator) { |
|
993 | 993 | $results[] = $buffer; |
994 | 994 | $buffer = ''; |
995 | 995 | } else { |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | } |
1005 | 1005 | } else { |
1006 | 1006 | if ($data[$tmpOffset] === $leftBound) { |
1007 | - if (! $open) { |
|
1007 | + if (!$open) { |
|
1008 | 1008 | $depth++; |
1009 | 1009 | $open = true; |
1010 | 1010 | } else { |
@@ -1018,11 +1018,11 @@ discard block |
||
1018 | 1018 | $offset = $length + 1; |
1019 | 1019 | } |
1020 | 1020 | } |
1021 | - if (empty($results) && ! empty($buffer)) { |
|
1021 | + if (empty($results) && !empty($buffer)) { |
|
1022 | 1022 | $results[] = $buffer; |
1023 | 1023 | } |
1024 | 1024 | |
1025 | - if (! empty($results)) { |
|
1025 | + if (!empty($results)) { |
|
1026 | 1026 | return array_map('trim', $results); |
1027 | 1027 | } |
1028 | 1028 | |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | */ |
1063 | 1063 | public static function transliterate(string $string, $transliterator = null) |
1064 | 1064 | { |
1065 | - if (! $transliterator) { |
|
1065 | + if (!$transliterator) { |
|
1066 | 1066 | $transliterator = static::$_defaultTransliterator ?: static::$_defaultTransliteratorId; |
1067 | 1067 | } |
1068 | 1068 | |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | $default = [ |
1094 | 1094 | 'ellipsis' => '...', 'exact' => true, 'html' => false, 'trimWidth' => false, |
1095 | 1095 | ]; |
1096 | - if (! empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') { |
|
1096 | + if (!empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') { |
|
1097 | 1097 | $default['ellipsis'] = "\xe2\x80\xa6"; |
1098 | 1098 | } |
1099 | 1099 | $options += $default; |
@@ -1113,12 +1113,12 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | foreach ($tags as $tag) { |
1115 | 1115 | $contentLength = 0; |
1116 | - if (! in_array($tag[2], static::$_defaultHtmlNoCount, true)) { |
|
1116 | + if (!in_array($tag[2], static::$_defaultHtmlNoCount, true)) { |
|
1117 | 1117 | $contentLength = self::strlen($tag[3], $options); |
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | if ($truncate === '') { |
1121 | - if (! preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) { |
|
1121 | + if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) { |
|
1122 | 1122 | if (preg_match('/<[\w]+[^>]*>/', $tag[0])) { |
1123 | 1123 | array_unshift($openTags, $tag[2]); |
1124 | 1124 | } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) { |
@@ -1164,13 +1164,13 @@ discard block |
||
1164 | 1164 | |
1165 | 1165 | $result = self::substr($text, 0, $length - $ellipsisLength, $options); |
1166 | 1166 | |
1167 | - if (! $options['exact']) { |
|
1167 | + if (!$options['exact']) { |
|
1168 | 1168 | if (self::substr($text, $length - $ellipsisLength, 1, $options) !== ' ') { |
1169 | 1169 | $result = self::removeLastWord($result); |
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 | // If result is empty, then we don't need to count ellipsis in the cut. |
1173 | - if (! strlen($result)) { |
|
1173 | + if (!strlen($result)) { |
|
1174 | 1174 | $result = self::substr($text, 0, $length, $options); |
1175 | 1175 | } |
1176 | 1176 | } |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | { |
1202 | 1202 | preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $value, $matches); |
1203 | 1203 | |
1204 | - if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) { |
|
1204 | + if (!isset($matches[0]) || static::length($value) === static::length($matches[0])) { |
|
1205 | 1205 | return $value; |
1206 | 1206 | } |
1207 | 1207 | |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | { |
1352 | 1352 | static $languageSpecific; |
1353 | 1353 | |
1354 | - if (! isset($languageSpecific)) { |
|
1354 | + if (!isset($languageSpecific)) { |
|
1355 | 1355 | $languageSpecific = [ |
1356 | 1356 | 'bg' => [ |
1357 | 1357 | ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'], |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | ['ae', 'oe', 'aa', 'Ae', 'Oe', 'Aa'], |
1363 | 1363 | ], |
1364 | 1364 | 'de' => [ |
1365 | - ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], |
|
1365 | + ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'], |
|
1366 | 1366 | ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], |
1367 | 1367 | ], |
1368 | 1368 | 'he' => [ |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | '/us$/i' => 'uses', |
46 | 46 | '/(alias)$/i' => '\1es', |
47 | 47 | '/(ax|cris|test)is$/i' => '\1es', |
48 | - '/(m)an$/' => '\1en', // man, woman, spokesman |
|
49 | - '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
50 | - '/(octop)us$/' => '\1i', // octopus |
|
48 | + '/(m)an$/' => '\1en', // man, woman, spokesman |
|
49 | + '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
50 | + '/(octop)us$/' => '\1i', // octopus |
|
51 | 51 | '/s$/' => 's', |
52 | 52 | '/^$/' => '', |
53 | 53 | '/$/' => 's', |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | |
433 | 433 | return $value; |
434 | 434 | } |
435 | - if (! isset(static::$_cache[$type][$key])) { |
|
435 | + if (!isset(static::$_cache[$type][$key])) { |
|
436 | 436 | return false; |
437 | 437 | } |
438 | 438 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | return static::$_cache['pluralize'][$word]; |
513 | 513 | } |
514 | 514 | |
515 | - if (! isset(static::$_cache['irregular']['pluralize'])) { |
|
515 | + if (!isset(static::$_cache['irregular']['pluralize'])) { |
|
516 | 516 | static::$_cache['irregular']['pluralize'] = '(?:' . implode('|', array_keys(static::$_irregular)) . ')'; |
517 | 517 | } |
518 | 518 | |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | return static::$_cache['pluralize'][$word]; |
524 | 524 | } |
525 | 525 | |
526 | - if (! isset(static::$_cache['uninflected'])) { |
|
526 | + if (!isset(static::$_cache['uninflected'])) { |
|
527 | 527 | static::$_cache['uninflected'] = '(?:' . implode('|', static::$_uninflected) . ')'; |
528 | 528 | } |
529 | 529 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | return static::$_cache['singularize'][$word]; |
558 | 558 | } |
559 | 559 | |
560 | - if (! isset(static::$_cache['irregular']['singular'])) { |
|
560 | + if (!isset(static::$_cache['irregular']['singular'])) { |
|
561 | 561 | static::$_cache['irregular']['singular'] = '(?:' . implode('|', static::$_irregular) . ')'; |
562 | 562 | } |
563 | 563 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | return static::$_cache['singularize'][$word]; |
569 | 569 | } |
570 | 570 | |
571 | - if (! isset(static::$_cache['uninflected'])) { |
|
571 | + if (!isset(static::$_cache['uninflected'])) { |
|
572 | 572 | static::$_cache['uninflected'] = '(?:' . implode('|', static::$_uninflected) . ')'; |
573 | 573 | } |
574 | 574 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | foreach ($paths as $path) { |
45 | 45 | if (file_exists($path)) { |
46 | - if (! in_array($path, get_included_files(), true)) { |
|
46 | + if (!in_array($path, get_included_files(), true)) { |
|
47 | 47 | $languages = array_merge($languages, (array) require($path)); |
48 | 48 | } |
49 | 49 | $file_exist = true; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | throw LoadException::libraryNotFound($lib); |
121 | 121 | } |
122 | 122 | |
123 | - if (true !== $file_syst && ! class_exists($lib)) { |
|
123 | + if (true !== $file_syst && !class_exists($lib)) { |
|
124 | 124 | throw LoadException::libraryDontExist($lib); |
125 | 125 | } |
126 | 126 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | 'preferApp' => true, |
143 | 143 | ], $options); |
144 | 144 | |
145 | - if (! preg_match('#Model$#', $model)) { |
|
145 | + if (!preg_match('#Model$#', $model)) { |
|
146 | 146 | $model .= 'Model'; |
147 | 147 | } |
148 | 148 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $model = APP_NAMESPACE . '\\Models\\' . $model; |
154 | 154 | } |
155 | 155 | |
156 | - if (! class_exists($model)) { |
|
156 | + if (!class_exists($model)) { |
|
157 | 157 | throw LoadException::modelNotFound($model); |
158 | 158 | } |
159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $controller = explode('/', $controller); |
172 | 172 | |
173 | 173 | $con = ucfirst(end($controller)); |
174 | - $con = (! preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
174 | + $con = (!preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
175 | 175 | $controller[count($controller) - 1] = $con; |
176 | 176 | |
177 | 177 | foreach ($controller as $key => &$value) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $path = CONTROLLER_PATH . Helpers::ensureExt(implode(DS, $controller), 'php'); |
184 | 184 | |
185 | - if (! file_exists($path)) { |
|
185 | + if (!file_exists($path)) { |
|
186 | 186 | throw LoadException::controllerNotFound(str_replace('Controller', '', $con), $path); |
187 | 187 | } |
188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if (class_exists($class_namespaced, false)) { |
194 | 194 | return Injector::make($class_namespaced); |
195 | 195 | } |
196 | - if (! class_exists($con, false)) { |
|
196 | + if (!class_exists($con, false)) { |
|
197 | 197 | throw LoadException::controllerDontExist(str_replace('Controller', '', $con), $path); |
198 | 198 | } |
199 | 199 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | protected static function verifyPreferApp(array $options, string $name): bool |
223 | 223 | { |
224 | 224 | // Tout element sans restriction passe |
225 | - if (! $options['preferApp']) { |
|
225 | + if (!$options['preferApp']) { |
|
226 | 226 | return true; |
227 | 227 | } |
228 | 228 |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | |
40 | 40 | // services système |
41 | 41 | $filename = SYST_PATH . 'Constants' . DS . 'providers.php'; |
42 | - if (! file_exists($filename)) { |
|
42 | + if (!file_exists($filename)) { |
|
43 | 43 | throw LoadException::providersDefinitionDontExist($filename); |
44 | 44 | } |
45 | - if (! in_array($filename, get_included_files(), true)) { |
|
45 | + if (!in_array($filename, get_included_files(), true)) { |
|
46 | 46 | $providers = array_merge($providers, require $filename); |
47 | 47 | } |
48 | 48 | |
49 | 49 | // services de l'application |
50 | 50 | $filename = CONFIG_PATH . 'providers.php'; |
51 | - if (file_exists($filename) && ! in_array($filename, get_included_files(), true)) { |
|
51 | + if (file_exists($filename) && !in_array($filename, get_included_files(), true)) { |
|
52 | 52 | $providers = array_merge($providers, require $filename); |
53 | 53 | } |
54 | 54 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return $models; |
98 | 98 | } |
99 | 99 | |
100 | - if (! self::isLoaded('models', $model)) { |
|
100 | + if (!self::isLoaded('models', $model)) { |
|
101 | 101 | self::loaded('models', $model, FileLocator::model($model, $options, $connection)); |
102 | 102 | } |
103 | 103 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $locale ??= config('app.language'); |
113 | 113 | |
114 | - if (! self::isLoaded('langs', $file . $locale)) { |
|
114 | + if (!self::isLoaded('langs', $file . $locale)) { |
|
115 | 115 | self::loaded('langs', $file . $locale, FileLocator::lang($file, $locale)); |
116 | 116 | } |
117 | 117 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | private static function isLoaded(string $module, $element): bool |
127 | 127 | { |
128 | - if (! isset(self::$loads[$module]) || ! is_array(self::$loads[$module])) { |
|
128 | + if (!isset(self::$loads[$module]) || !is_array(self::$loads[$module])) { |
|
129 | 129 | return false; |
130 | 130 | } |
131 | 131 |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $this->getModel(); |
93 | 93 | |
94 | - if (! empty($this->helpers)) { |
|
94 | + if (!empty($this->helpers)) { |
|
95 | 95 | helper($this->helpers); |
96 | 96 | } |
97 | 97 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | $this->modelName = is_object($which) ? null : $which; |
110 | 110 | } |
111 | 111 | |
112 | - if (empty($this->model) && ! empty($this->modelName) && class_exists($this->modelName)) { |
|
112 | + if (empty($this->model) && !empty($this->modelName) && class_exists($this->modelName)) { |
|
113 | 113 | $this->model = model($this->modelName); |
114 | 114 | } |
115 | 115 | |
116 | - if (! empty($this->model) && empty($this->modelName)) { |
|
116 | + if (!empty($this->model) && empty($this->modelName)) { |
|
117 | 117 | $this->modelName = get_class($this->model); |
118 | 118 | } |
119 | 119 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | private function getModel() |
153 | 153 | { |
154 | - if (! empty($this->modelName)) { |
|
154 | + if (!empty($this->modelName)) { |
|
155 | 155 | $model = $this->modelName; |
156 | 156 | } else { |
157 | 157 | $model = str_replace('Controller', 'Model', static::class); |
@@ -152,19 +152,19 @@ |
||
152 | 152 | */ |
153 | 153 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
154 | 154 | { |
155 | - if (! in_array($request->getMethod(), $this->methods, true)) { |
|
155 | + if (!in_array($request->getMethod(), $this->methods, true)) { |
|
156 | 156 | return $handler->handle($request); |
157 | 157 | } |
158 | 158 | |
159 | 159 | [$type] = explode(';', $request->getHeaderLine('Content-Type')); |
160 | 160 | $type = strtolower($type); |
161 | - if (! isset($this->parsers[$type])) { |
|
161 | + if (!isset($this->parsers[$type])) { |
|
162 | 162 | return $handler->handle($request); |
163 | 163 | } |
164 | 164 | |
165 | 165 | $parser = $this->parsers[$type]; |
166 | 166 | $result = $parser($request->getBody()->getContents()); |
167 | - if (! is_array($result)) { |
|
167 | + if (!is_array($result)) { |
|
168 | 168 | throw HttpException::badRequest(); |
169 | 169 | } |
170 | 170 | $request = $request->withParsedBody($result); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $controller = $routes->getDefaultController(); |
172 | 172 | } |
173 | 173 | |
174 | - if (! $fullName && is_string($controller)) { |
|
174 | + if (!$fullName && is_string($controller)) { |
|
175 | 175 | $controller = str_replace($routes->getDefaultNamespace(), '', $controller); |
176 | 176 | } |
177 | 177 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | require_once $routes_file; |
273 | 273 | } |
274 | 274 | } |
275 | - if (empty($routes) || ! ($routes instanceof RouteCollection)) { |
|
275 | + if (empty($routes) || !($routes instanceof RouteCollection)) { |
|
276 | 276 | $routes = Services::routes(); |
277 | 277 | } |
278 | 278 | |
@@ -282,14 +282,14 @@ discard block |
||
282 | 282 | $routeMiddlewares = (array) $this->dispatchRoutes($routes); |
283 | 283 | |
284 | 284 | // The bootstrapping in a middleware |
285 | - $this->middleware->append(function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
285 | + $this->middleware->append(function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
286 | 286 | $returned = $this->startController($request, $response); |
287 | 287 | |
288 | 288 | // Closure controller has run in startController(). |
289 | - if (! is_callable($this->controller)) { |
|
289 | + if (!is_callable($this->controller)) { |
|
290 | 290 | $controller = $this->createController($request, $response); |
291 | 291 | |
292 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
292 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
293 | 293 | throw PageNotFoundException::methodNotFound($this->method); |
294 | 294 | } |
295 | 295 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | $this->gatherOutput($this->middleware->handle($this->request)); |
329 | 329 | |
330 | - if (! $returnResponse) { |
|
330 | + if (!$returnResponse) { |
|
331 | 331 | $this->sendResponse(); |
332 | 332 | } |
333 | 333 | |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | return; |
376 | 376 | } |
377 | 377 | |
378 | - if (is_cli() && ! on_test()) { |
|
378 | + if (is_cli() && !on_test()) { |
|
379 | 379 | // @codeCoverageIgnoreStart |
380 | 380 | // $this->request = Services::clirequest($this->config); |
381 | 381 | // @codeCoverageIgnoreEnd |
382 | 382 | } |
383 | 383 | |
384 | 384 | $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'; |
385 | - if (! is_numeric($version)) { |
|
385 | + if (!is_numeric($version)) { |
|
386 | 386 | $version = substr($version, strpos($version, '/') + 1); |
387 | 387 | } |
388 | 388 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | // Supposons le succès jusqu'à preuve du contraire. |
402 | 402 | $this->response = Services::response()->withStatus(200); |
403 | 403 | |
404 | - if (! is_cli() || on_test()) { |
|
404 | + if (!is_cli() || on_test()) { |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion()); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | { |
438 | 438 | if ($cachedResponse = Services::cache()->read($this->generateCacheName())) { |
439 | 439 | $cachedResponse = unserialize($cachedResponse); |
440 | - if (! is_array($cachedResponse) || ! isset($cachedResponse['output']) || ! isset($cachedResponse['headers'])) { |
|
440 | + if (!is_array($cachedResponse) || !isset($cachedResponse['output']) || !isset($cachedResponse['headers'])) { |
|
441 | 441 | throw new FrameworkException('Error unserializing page cache'); |
442 | 442 | } |
443 | 443 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | */ |
567 | 567 | protected function determinePath(): string |
568 | 568 | { |
569 | - if (! empty($this->path)) { |
|
569 | + if (!empty($this->path)) { |
|
570 | 570 | return $this->path; |
571 | 571 | } |
572 | 572 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | } |
619 | 619 | |
620 | 620 | // Essayez de charger automatiquement la classe |
621 | - if (! class_exists($this->controller, true) || $this->method[0] === '_') { |
|
621 | + if (!class_exists($this->controller, true) || $this->method[0] === '_') { |
|
622 | 622 | throw PageNotFoundException::controllerNotFound($this->controller, $this->method); |
623 | 623 | } |
624 | 624 | |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | // Affiche l'erreur 404 |
707 | 707 | $this->response = $this->response->withStatus($e->getCode()); |
708 | 708 | |
709 | - if (! on_test()) { |
|
709 | + if (!on_test()) { |
|
710 | 710 | // @codeCoverageIgnoreStart |
711 | 711 | if (ob_get_level() > 0) { |
712 | 712 | ob_end_flush(); |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | ob_end_flush(); // @codeCoverageIgnore |
719 | 719 | } |
720 | 720 | |
721 | - throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : ''); |
|
721 | + throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : ''); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | /** |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | public function storePreviousURL($uri) |
774 | 774 | { |
775 | 775 | // Ignorer les requêtes CLI |
776 | - if (is_cli() && ! on_test()) { |
|
776 | + if (is_cli() && !on_test()) { |
|
777 | 777 | return; // @codeCoverageIgnore |
778 | 778 | } |
779 | 779 | |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | $this->middleware->prepend($this->spoofRequestMethod()); |
838 | 838 | |
839 | 839 | $middlewaresFile = CONFIG_PATH . 'middlewares.php'; |
840 | - if (file_exists($middlewaresFile) && ! in_array($middlewaresFile, get_included_files(), true)) { |
|
840 | + if (file_exists($middlewaresFile) && !in_array($middlewaresFile, get_included_files(), true)) { |
|
841 | 841 | $middleware = require $middlewaresFile; |
842 | 842 | if (is_callable($middleware)) { |
843 | 843 | $middlewareQueue = $middleware($this->middleware, $this->request); |
@@ -854,11 +854,11 @@ discard block |
||
854 | 854 | */ |
855 | 855 | private function spoofRequestMethod(): callable |
856 | 856 | { |
857 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
857 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
858 | 858 | $post = $request->getParsedBody(); |
859 | 859 | |
860 | 860 | // Ne fonctionne qu'avec les formulaires POST |
861 | - if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) { |
|
861 | + if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) { |
|
862 | 862 | // Accepte seulement PUT, PATCH, DELETE |
863 | 863 | if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) { |
864 | 864 | $request = $request->withMethod($post['_method']); |
@@ -63,12 +63,12 @@ |
||
63 | 63 | $group = on_test() ? 'test' : (on_prod() ? 'production' : 'development'); |
64 | 64 | } |
65 | 65 | |
66 | - if (! isset($config[$group])) { |
|
66 | + if (!isset($config[$group])) { |
|
67 | 67 | $group = 'default'; |
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | - if (is_string($group) && ! isset($config[$group]) && strpos($group, 'custom-') !== 0) { |
|
71 | + if (is_string($group) && !isset($config[$group]) && strpos($group, 'custom-') !== 0) { |
|
72 | 72 | throw new InvalidArgumentException($group . ' is not a valid database connection group.'); |
73 | 73 | } |
74 | 74 |