@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | */ |
31 | 31 | private static array $loaded = []; |
32 | 32 | |
33 | - /** |
|
34 | - * Different registrars decouverts. |
|
35 | - * |
|
36 | - * Les registrars sont des mecanismes permettant aux packages externe de definir un elements de configuration |
|
37 | - */ |
|
38 | - private static array $registrars = []; |
|
33 | + /** |
|
34 | + * Different registrars decouverts. |
|
35 | + * |
|
36 | + * Les registrars sont des mecanismes permettant aux packages externe de definir un elements de configuration |
|
37 | + */ |
|
38 | + private static array $registrars = []; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Drapeau permettant de savoir si la config a deja ete initialiser |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $configurations = (array) require $file; |
143 | 143 | } |
144 | 144 | |
145 | - $configurations = Arr::merge(self::$registrars[$config] ?? [], $configurations); |
|
145 | + $configurations = Arr::merge(self::$registrars[$config] ?? [], $configurations); |
|
146 | 146 | |
147 | 147 | if (empty($schema)) { |
148 | 148 | $schema = self::schema($config); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - $this->loadRegistrar(); |
|
226 | + $this->loadRegistrar(); |
|
227 | 227 | $this->load(['app']); |
228 | 228 | |
229 | 229 | ini_set('log_errors', 1); |
@@ -236,35 +236,35 @@ discard block |
||
236 | 236 | self::$initialized = true; |
237 | 237 | } |
238 | 238 | |
239 | - /** |
|
240 | - * Charges les registrars disponible pour l'application. |
|
241 | - * Les registrars sont des mecanismes permettant aux packages externe de definir un elements de configuration |
|
242 | - */ |
|
243 | - private function loadRegistrar() |
|
244 | - { |
|
245 | - $autoloader = new Autoloader(['psr4' => [APP_NAMESPACE => APP_PATH]]); |
|
246 | - $locator = new Locator($autoloader->initialize()); |
|
247 | - |
|
248 | - $registrarsFiles = $locator->search('Config/Registrar.php'); |
|
249 | - |
|
250 | - foreach ($registrarsFiles as $file) { |
|
251 | - $class = new ReflectionClass($locator->getClassname($file)); |
|
252 | - $methods = $class->getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC); |
|
253 | - |
|
254 | - foreach ($methods as $method) { |
|
255 | - if (!($method->isPublic() && $method->isStatic())) { |
|
256 | - continue; |
|
257 | - } |
|
258 | - |
|
259 | - if (!is_array($result = $method->invoke(null))) { |
|
260 | - continue; |
|
261 | - } |
|
262 | - |
|
263 | - $name = $method->getName(); |
|
264 | - self::$registrars[$name] = Arr::merge(self::$registrars[$name] ?? [], $result); |
|
265 | - } |
|
266 | - } |
|
267 | - } |
|
239 | + /** |
|
240 | + * Charges les registrars disponible pour l'application. |
|
241 | + * Les registrars sont des mecanismes permettant aux packages externe de definir un elements de configuration |
|
242 | + */ |
|
243 | + private function loadRegistrar() |
|
244 | + { |
|
245 | + $autoloader = new Autoloader(['psr4' => [APP_NAMESPACE => APP_PATH]]); |
|
246 | + $locator = new Locator($autoloader->initialize()); |
|
247 | + |
|
248 | + $registrarsFiles = $locator->search('Config/Registrar.php'); |
|
249 | + |
|
250 | + foreach ($registrarsFiles as $file) { |
|
251 | + $class = new ReflectionClass($locator->getClassname($file)); |
|
252 | + $methods = $class->getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC); |
|
253 | + |
|
254 | + foreach ($methods as $method) { |
|
255 | + if (!($method->isPublic() && $method->isStatic())) { |
|
256 | + continue; |
|
257 | + } |
|
258 | + |
|
259 | + if (!is_array($result = $method->invoke(null))) { |
|
260 | + continue; |
|
261 | + } |
|
262 | + |
|
263 | + $name = $method->getName(); |
|
264 | + self::$registrars[$name] = Arr::merge(self::$registrars[$name] ?? [], $result); |
|
265 | + } |
|
266 | + } |
|
267 | + } |
|
268 | 268 | |
269 | 269 | /** |
270 | 270 | * Initialise l'URL |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function exists(string $key): bool |
57 | 57 | { |
58 | - if (! $this->configurator->exists($key)) { |
|
58 | + if (!$this->configurator->exists($key)) { |
|
59 | 59 | $config = explode('.', $key); |
60 | 60 | $this->load($config[0]); |
61 | 61 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function missing(string $key): bool |
80 | 80 | { |
81 | - return ! $this->exists($key); |
|
81 | + return !$this->exists($key); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | if (is_array($config)) { |
122 | 122 | foreach ($config as $key => $value) { |
123 | - if (! is_string($value) || empty($value)) { |
|
123 | + if (!is_string($value) || empty($value)) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | if (is_string($key)) { |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | } |
133 | 133 | self::load($conf, $file); |
134 | 134 | } |
135 | - } elseif (is_string($config) && ! isset(self::$loaded[$config])) { |
|
135 | + } elseif (is_string($config) && !isset(self::$loaded[$config])) { |
|
136 | 136 | if (empty($file)) { |
137 | 137 | $file = self::path($config); |
138 | 138 | } |
139 | 139 | |
140 | 140 | $configurations = []; |
141 | - if (file_exists($file) && ! in_array($file, get_included_files(), true)) { |
|
141 | + if (file_exists($file) && !in_array($file, get_included_files(), true)) { |
|
142 | 142 | $configurations = (array) require $file; |
143 | 143 | } |
144 | 144 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | { |
166 | 166 | if (is_array($accepts_values)) { |
167 | 167 | $accepts_values = '(Accept values: ' . implode('/', $accepts_values) . ')'; |
168 | - } elseif (! is_string($accepts_values)) { |
|
168 | + } elseif (!is_string($accepts_values)) { |
|
169 | 169 | throw new InvalidArgumentException('Misuse of the method ' . __METHOD__); |
170 | 170 | } |
171 | 171 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $schema = require $app_schema; |
208 | 208 | } |
209 | 209 | |
210 | - if (empty($schema) || ! ($schema instanceof Schema)) { |
|
210 | + if (empty($schema) || !($schema instanceof Schema)) { |
|
211 | 211 | $schema = Expect::mixed(); |
212 | 212 | } |
213 | 213 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | |
250 | 250 | foreach ($registrarsFiles as $file) { |
251 | 251 | $class = new ReflectionClass($locator->getClassname($file)); |
252 | - $methods = $class->getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC); |
|
252 | + $methods = $class->getMethods(ReflectionMethod::IS_STATIC|ReflectionMethod::IS_PUBLIC); |
|
253 | 253 | |
254 | 254 | foreach ($methods as $method) { |
255 | 255 | if (!($method->isPublic() && $method->isStatic())) { |
@@ -325,12 +325,12 @@ discard block |
||
325 | 325 | { |
326 | 326 | $config = $this->get('app.show_debugbar', 'auto'); |
327 | 327 | |
328 | - if (! in_array($config, ['auto', true, false], true)) { |
|
328 | + if (!in_array($config, ['auto', true, false], true)) { |
|
329 | 329 | self::exceptBadConfigValue('show_debugbar', ['auto', true, false], 'app'); |
330 | 330 | } |
331 | 331 | |
332 | 332 | if ($config === 'auto') { |
333 | - $this->set('app.show_debugbar', ! is_online()); |
|
333 | + $this->set('app.show_debugbar', !is_online()); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use BlitzPHP\Container\Services; |
13 | 13 | |
14 | -if (! function_exists('directory_map')) { |
|
14 | +if (!function_exists('directory_map')) { |
|
15 | 15 | /** |
16 | 16 | * Créer une carte de répertoire |
17 | 17 | * |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -if (! function_exists('directory_mirror')) { |
|
32 | +if (!function_exists('directory_mirror')) { |
|
33 | 33 | /** |
34 | 34 | * Copie récursivement les fichiers et répertoires du répertoire d'origine |
35 | 35 | * dans le répertoire cible, c'est-à-dire "miroir" son contenu. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | -if (! function_exists('write_file')) { |
|
45 | +if (!function_exists('write_file')) { |
|
46 | 46 | /** |
47 | 47 | * Write File |
48 | 48 | * |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | -if (! function_exists('delete_files')) { |
|
79 | +if (!function_exists('delete_files')) { |
|
80 | 80 | /** |
81 | 81 | * Delete Files |
82 | 82 | * |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | RecursiveIteratorIterator::CHILD_FIRST |
102 | 102 | ) as $object) { |
103 | 103 | $filename = $object->getFilename(); |
104 | - if (! $hidden && $filename[0] === '.') { |
|
104 | + if (!$hidden && $filename[0] === '.') { |
|
105 | 105 | continue; |
106 | 106 | } |
107 | 107 | |
108 | - if (! $htdocs || ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) { |
|
108 | + if (!$htdocs || !preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) { |
|
109 | 109 | $isDir = $object->isDir(); |
110 | 110 | if ($isDir && $delDir) { |
111 | 111 | rmdir($object->getPathname()); |
112 | 112 | |
113 | 113 | continue; |
114 | 114 | } |
115 | - if (! $isDir) { |
|
115 | + if (!$isDir) { |
|
116 | 116 | unlink($object->getPathname()); |
117 | 117 | } |
118 | 118 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | -if (! function_exists('get_filenames')) { |
|
128 | +if (!function_exists('get_filenames')) { |
|
129 | 129 | /** |
130 | 130 | * Get Filenames |
131 | 131 | * |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | RecursiveIteratorIterator::SELF_FIRST |
155 | 155 | ) as $name => $object) { |
156 | 156 | $basename = pathinfo($name, PATHINFO_BASENAME); |
157 | - if (! $hidden && $basename[0] === '.') { |
|
157 | + if (!$hidden && $basename[0] === '.') { |
|
158 | 158 | continue; |
159 | 159 | } |
160 | 160 | |
161 | - if ($includeDir || ! $object->isDir()) { |
|
161 | + if ($includeDir || !$object->isDir()) { |
|
162 | 162 | if ($includePath === false) { |
163 | 163 | $files[] = $basename; |
164 | 164 | } elseif ($includePath === null) { |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | -if (! function_exists('get_dir_file_info')) { |
|
181 | +if (!function_exists('get_dir_file_info')) { |
|
182 | 182 | /** |
183 | 183 | * Get Directory File Information |
184 | 184 | * |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | -if (! function_exists('get_file_info')) { |
|
227 | +if (!function_exists('get_file_info')) { |
|
228 | 228 | /** |
229 | 229 | * Get File Info |
230 | 230 | * |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function get_file_info(string $file, $returnedValues = ['name', 'server_path', 'size', 'date']) |
242 | 242 | { |
243 | - if (! is_file($file)) { |
|
243 | + if (!is_file($file)) { |
|
244 | 244 | return null; |
245 | 245 | } |
246 | 246 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
293 | -if (! function_exists('symbolic_permissions')) { |
|
293 | +if (!function_exists('symbolic_permissions')) { |
|
294 | 294 | /** |
295 | 295 | * Symbolic Permissions |
296 | 296 | * |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
341 | -if (! function_exists('octal_permissions')) { |
|
341 | +if (!function_exists('octal_permissions')) { |
|
342 | 342 | /** |
343 | 343 | * Octal Permissions |
344 | 344 | * |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | -if (! function_exists('same_file')) { |
|
356 | +if (!function_exists('same_file')) { |
|
357 | 357 | /** |
358 | 358 | * Checks if two files both exist and have identical hashes |
359 | 359 | * |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
368 | -if (! function_exists('set_realpath')) { |
|
368 | +if (!function_exists('set_realpath')) { |
|
369 | 369 | /** |
370 | 370 | * Set Realpath |
371 | 371 | * |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | // Resolve the path |
382 | 382 | if (realpath($path) !== false) { |
383 | 383 | $path = realpath($path); |
384 | - } elseif ($checkExistence && ! is_dir($path) && ! is_file($path)) { |
|
384 | + } elseif ($checkExistence && !is_dir($path) && !is_file($path)) { |
|
385 | 385 | throw new InvalidArgumentException('Not a valid path: ' . $path); |
386 | 386 | } |
387 | 387 |