@@ -66,14 +66,14 @@ |
||
66 | 66 | |
67 | 67 | $directory = dirname($path); |
68 | 68 | |
69 | - if (! is_dir($directory)) { |
|
69 | + if (!is_dir($directory)) { |
|
70 | 70 | mkdir($directory, 0o777, true); |
71 | 71 | } |
72 | 72 | |
73 | 73 | if (file_exists($path)) { |
74 | 74 | $overwrite = (bool) $this->option('f'); |
75 | 75 | |
76 | - if (! $overwrite && ! $this->confirm("Le fichier '{$cleanPath}' existe déjà dans la destination. Le remplacé?")) { |
|
76 | + if (!$overwrite && !$this->confirm("Le fichier '{$cleanPath}' existe déjà dans la destination. Le remplacé?")) { |
|
77 | 77 | $this->error("{$cleanPath} sauté. Si vous souhaitez le remplacer, s'il vous plaît utiliser l'option '-f' ou répondre 'y' à l'invite.")->eol(); |
78 | 78 | |
79 | 79 | return; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | foreach ($data as $key => $value) { |
74 | 74 | $replacementKey = "\n{$key} = {$value}"; |
75 | - if (! str_contains($oldFileContents, $key)) { |
|
75 | + if (!str_contains($oldFileContents, $key)) { |
|
76 | 76 | if (file_put_contents($this->path, $replacementKey, FILE_APPEND) === false) { |
77 | 77 | return false; |
78 | 78 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | - if (! count($data)) { |
|
105 | + if (!count($data)) { |
|
106 | 106 | return false; |
107 | 107 | } |
108 | 108 | |
@@ -139,18 +139,18 @@ discard block |
||
139 | 139 | public function parse(): ?array |
140 | 140 | { |
141 | 141 | // Nous ne voulons pas imposer la présence d'un fichier .env, ils devraient être facultatifs. |
142 | - if (! is_file($this->path)) { |
|
142 | + if (!is_file($this->path)) { |
|
143 | 143 | return null; |
144 | 144 | } |
145 | 145 | |
146 | 146 | // Assurez-vous que le fichier est lisible |
147 | - if (! is_readable($this->path)) { |
|
147 | + if (!is_readable($this->path)) { |
|
148 | 148 | throw new InvalidArgumentException("The .env file is not readable: {$this->path}"); |
149 | 149 | } |
150 | 150 | |
151 | 151 | $vars = []; |
152 | 152 | |
153 | - $lines = file($this->path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
153 | + $lines = file($this->path, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); |
|
154 | 154 | |
155 | 155 | foreach ($lines as $line) { |
156 | 156 | // C'est un commentaire? |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | protected function setVariable(string $name, string $value = '') |
177 | 177 | { |
178 | - if (! getenv($name, true)) { |
|
178 | + if (!getenv($name, true)) { |
|
179 | 179 | putenv("{$name}={$value}"); |
180 | 180 | } |
181 | 181 | if (empty($_ENV[$name])) { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | protected function sanitizeValue(string $value): string |
226 | 226 | { |
227 | - if (! $value) { |
|
227 | + if (!$value) { |
|
228 | 228 | return $value; |
229 | 229 | } |
230 | 230 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | $value = preg_replace_callback( |
282 | 282 | '/\${([a-zA-Z0-9_]+)}/', |
283 | - static function ($matchedPatterns) use ($loader) { |
|
283 | + static function($matchedPatterns) use ($loader) { |
|
284 | 284 | $nestedVariable = $loader->getVariable($matchedPatterns[1]); |
285 | 285 | |
286 | 286 | if (null === $nestedVariable) { |
@@ -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 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | // Si le fichier est dans un espace de noms, nous allons simplement saisir ce fichier et ne pas en rechercher d'autres |
131 | 131 | if (str_contains($name, '\\')) { |
132 | - if (! empty($path = $loader->locateFile($name, 'schemas'))) { |
|
132 | + if (!empty($path = $loader->locateFile($name, 'schemas'))) { |
|
133 | 133 | $file = $path; |
134 | 134 | } |
135 | 135 | } else { |
@@ -147,22 +147,22 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | // Les schema des vendor sont prioritaire, ensuite vienne ceux de l'application |
150 | - if (! empty($vendorSchema)) { |
|
150 | + if (!empty($vendorSchema)) { |
|
151 | 151 | $file = $vendorSchema; |
152 | - } elseif (! empty($appSchema)) { |
|
152 | + } elseif (!empty($appSchema)) { |
|
153 | 153 | $file = $appSchema; |
154 | - } elseif (! empty($systemSchema)) { |
|
154 | + } elseif (!empty($systemSchema)) { |
|
155 | 155 | $file = $systemSchema; |
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - if (! empty($file)) { |
|
159 | + if (!empty($file)) { |
|
160 | 160 | $schema = require $file; |
161 | 161 | } else { |
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 |
@@ -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, 0o775, true); |
486 | 486 | } |
487 | 487 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $debugger = Ignition::make(); |
63 | 63 | |
64 | 64 | $debugger->applicationPath(ROOTPATH) |
65 | - ->shouldDisplayException(! on_prod()) |
|
65 | + ->shouldDisplayException(!on_prod()) |
|
66 | 66 | ->register(); |
67 | 67 | } |
68 | 68 | } |
@@ -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 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function addIf(string $key, Closure $callback): void |
110 | 110 | { |
111 | - if (! $this->has($key)) { |
|
111 | + if (!$this->has($key)) { |
|
112 | 112 | $this->add($key, $callback); |
113 | 113 | } |
114 | 114 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | private function discoveProviders(): void |
226 | 226 | { |
227 | - if (! self::$discovered) { |
|
227 | + if (!self::$discovered) { |
|
228 | 228 | $locator = Services::locator(); |
229 | 229 | $files = array_merge( |
230 | 230 | $locator->search('Config/Providers'), |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $this->config = $config ?? (object) config('toolbar'); |
68 | 68 | |
69 | 69 | foreach ($this->config->collectors as $collector) { |
70 | - if (! class_exists($collector)) { |
|
70 | + if (!class_exists($collector)) { |
|
71 | 71 | logger()->critical( |
72 | 72 | 'Toolbar collector does not exist (' . $collector . ').' |
73 | 73 | . ' Please check $collectors in the app/Config/toolbar.php file.' |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $data['vars']['varData'][esc($heading)] = $varData; |
134 | 134 | } |
135 | 135 | |
136 | - if (! empty($_SESSION)) { |
|
136 | + if (!empty($_SESSION)) { |
|
137 | 137 | foreach ($_SESSION as $key => $value) { |
138 | 138 | // Remplacez les données binaires par une chaîne pour éviter l'échec de json_encode. |
139 | 139 | if (is_string($value) && preg_match('~[^\x20-\x7E\t\r\n]~', $value)) { |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | $output = ''; |
207 | 207 | |
208 | 208 | foreach ($rows as $row) { |
209 | - $hasChildren = isset($row['children']) && ! empty($row['children']); |
|
210 | - $isQuery = isset($row['query']) && ! empty($row['query']); |
|
209 | + $hasChildren = isset($row['children']) && !empty($row['children']); |
|
210 | + $isQuery = isset($row['query']) && !empty($row['query']); |
|
211 | 211 | |
212 | 212 | // Ouvrir la chronologie du contrôleur par défaut |
213 | 213 | $open = $row['name'] === 'Controller'; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | // Le collecter |
274 | 274 | foreach ($collectors as $collector) { |
275 | - if (! $collector['hasTimelineData']) { |
|
275 | + if (!$collector['hasTimelineData']) { |
|
276 | 276 | continue; |
277 | 277 | } |
278 | 278 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | array_multisort(...$sortArray); |
290 | 290 | |
291 | 291 | // Ajouter une heure de fin à chaque élément |
292 | - array_walk($data, static function (&$row) { |
|
292 | + array_walk($data, static function(&$row) { |
|
293 | 293 | $row['end'] = $row['start'] + $row['duration']; |
294 | 294 | }); |
295 | 295 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $element = array_shift($elements); |
309 | 309 | |
310 | 310 | // Si nous avons des enfants derrière nous, récupérez-les et attachez-les-nous |
311 | - while (! empty($elements) && $elements[array_key_first($elements)]['end'] <= $element['end']) { |
|
311 | + while (!empty($elements) && $elements[array_key_first($elements)]['end'] <= $element['end']) { |
|
312 | 312 | $element['children'][] = array_shift($elements); |
313 | 313 | } |
314 | 314 | |
@@ -332,14 +332,14 @@ discard block |
||
332 | 332 | */ |
333 | 333 | protected function collectVarData(): array |
334 | 334 | { |
335 | - if (! ($this->config->collectVarData ?? true)) { |
|
335 | + if (!($this->config->collectVarData ?? true)) { |
|
336 | 336 | return []; |
337 | 337 | } |
338 | 338 | |
339 | 339 | $data = []; |
340 | 340 | |
341 | 341 | foreach ($this->collectors as $collector) { |
342 | - if (! $collector->hasVarData()) { |
|
342 | + if (!$collector->hasVarData()) { |
|
343 | 343 | continue; |
344 | 344 | } |
345 | 345 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | // Si on a desactiver le debogage ou l'affichage de la debugbar, on s'arrete |
377 | - if (! BLITZ_DEBUG || ! $this->config->show_debugbar) { |
|
377 | + if (!BLITZ_DEBUG || !$this->config->show_debugbar) { |
|
378 | 378 | return $response; |
379 | 379 | } |
380 | 380 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | // Mise à jour vers microtime() pour que nous puissions obtenir l'historique |
390 | 390 | $time = sprintf('%.6f', Date::now()->format('U.u')); |
391 | 391 | |
392 | - if (! is_dir($this->debugPath)) { |
|
392 | + if (!is_dir($this->debugPath)) { |
|
393 | 393 | mkdir($this->debugPath, 0o777); |
394 | 394 | } |
395 | 395 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | // Les formats non HTML ne doivent pas inclure la barre de débogage, |
401 | 401 | // puis nous envoyons des en-têtes indiquant où trouver les données de débogage pour cette réponse |
402 | - if ($request->ajax() || ! str_contains($format, 'html')) { |
|
402 | + if ($request->ajax() || !str_contains($format, 'html')) { |
|
403 | 403 | return $response |
404 | 404 | ->withHeader('Debugbar-Time', "{$time}") |
405 | 405 | ->withHeader('Debugbar-Link', site_url("?debugbar_time={$time}")); |
@@ -94,7 +94,7 @@ |
||
94 | 94 | public function getVarData(): array |
95 | 95 | { |
96 | 96 | return [ |
97 | - 'Données de la vues' => array_filter($this->viewer->getData(), static fn ($data) => ! ($data instanceof ErrorBag)), |
|
97 | + 'Données de la vues' => array_filter($this->viewer->getData(), static fn ($data) => !($data instanceof ErrorBag)), |
|
98 | 98 | ]; |
99 | 99 | } |
100 | 100 |