@@ -94,8 +94,8 @@ |
||
94 | 94 | public function getVarData(): array |
95 | 95 | { |
96 | 96 | return [ |
97 | - 'Données de la vues' => array_filter($this->viewer->getData(), function ($data) { |
|
98 | - return ! ($data instanceof ErrorBag); |
|
97 | + 'Données de la vues' => array_filter($this->viewer->getData(), function($data) { |
|
98 | + return !($data instanceof ErrorBag); |
|
99 | 99 | }), |
100 | 100 | ]; |
101 | 101 | } |
@@ -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, 0o777); |
392 | 392 | } |
393 | 393 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | // Les formats non HTML ne doivent pas inclure la barre de débogage, |
399 | 399 | // puis nous envoyons des en-têtes indiquant où trouver les données de débogage pour cette réponse |
400 | - if ($request->isAJAX() || ! str_contains($format, 'html')) { |
|
400 | + if ($request->isAJAX() || !str_contains($format, 'html')) { |
|
401 | 401 | return $response |
402 | 402 | ->withHeader('Debugbar-Time', "{$time}") |
403 | 403 | ->withHeader('Debugbar-Link', site_url("?debugbar_time={$time}")); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $controller = $routes->getDefaultController(); |
179 | 179 | } |
180 | 180 | |
181 | - if (! $fullName && is_string($controller)) { |
|
181 | + if (!$fullName && is_string($controller)) { |
|
182 | 182 | $controller = str_replace($routes->getDefaultNamespace(), '', $controller); |
183 | 183 | } |
184 | 184 | |
@@ -323,14 +323,14 @@ discard block |
||
323 | 323 | return; |
324 | 324 | } |
325 | 325 | |
326 | - if (is_cli() && ! on_test()) { |
|
326 | + if (is_cli() && !on_test()) { |
|
327 | 327 | // @codeCoverageIgnoreStart |
328 | 328 | // $this->request = Services::clirequest($this->config); |
329 | 329 | // @codeCoverageIgnoreEnd |
330 | 330 | } |
331 | 331 | |
332 | 332 | $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'; |
333 | - if (! is_numeric($version)) { |
|
333 | + if (!is_numeric($version)) { |
|
334 | 334 | $version = substr($version, strpos($version, '/') + 1); |
335 | 335 | } |
336 | 336 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // Supposons le succès jusqu'à preuve du contraire. |
350 | 350 | $this->response = Services::response()->withStatus(200); |
351 | 351 | |
352 | - if (! is_cli() || on_test()) { |
|
352 | + if (!is_cli() || on_test()) { |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion()); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | protected function determinePath(): string |
465 | 465 | { |
466 | - if (! empty($this->path)) { |
|
466 | + if (!empty($this->path)) { |
|
467 | 467 | return $this->path; |
468 | 468 | } |
469 | 469 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | // Essayez de charger automatiquement la classe |
507 | - if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
507 | + if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
508 | 508 | throw PageNotFoundException::controllerNotFound($this->controller, $this->method); |
509 | 509 | } |
510 | 510 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | echo $this->outputBufferingEnd(); |
598 | 598 | flush(); |
599 | 599 | |
600 | - throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : ''); |
|
600 | + throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : ''); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | public function storePreviousURL($uri) |
640 | 640 | { |
641 | 641 | // Ignorer les requêtes CLI |
642 | - if (is_cli() && ! on_test()) { |
|
642 | + if (is_cli() && !on_test()) { |
|
643 | 643 | return; // @codeCoverageIgnore |
644 | 644 | } |
645 | 645 | |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | } |
650 | 650 | |
651 | 651 | // Ignorer les reponses non-HTML |
652 | - if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
652 | + if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
653 | 653 | return; |
654 | 654 | } |
655 | 655 | |
@@ -761,11 +761,11 @@ discard block |
||
761 | 761 | */ |
762 | 762 | private function spoofRequestMethod(): callable |
763 | 763 | { |
764 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
764 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
765 | 765 | $post = $request->getParsedBody(); |
766 | 766 | |
767 | 767 | // Ne fonctionne qu'avec les formulaires POST |
768 | - if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) { |
|
768 | + if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) { |
|
769 | 769 | // Accepte seulement PUT, PATCH, DELETE |
770 | 770 | if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) { |
771 | 771 | $request = $request->withMethod($post['_method']); |
@@ -778,15 +778,15 @@ discard block |
||
778 | 778 | |
779 | 779 | private function bootApp(): callable |
780 | 780 | { |
781 | - return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
781 | + return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
782 | 782 | try { |
783 | 783 | $returned = $this->startController($request, $response); |
784 | 784 | |
785 | 785 | // Closure controller has run in startController(). |
786 | - if (! is_callable($this->controller)) { |
|
786 | + if (!is_callable($this->controller)) { |
|
787 | 787 | $controller = $this->createController($request, $response); |
788 | 788 | |
789 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
789 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
790 | 790 | throw PageNotFoundException::methodNotFound($this->method); |
791 | 791 | } |
792 | 792 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function collect(bool $reset = true): array |
37 | 37 | { |
38 | - if (! $reset && $this->cachedRoutes !== []) { |
|
38 | + if (!$reset && $this->cachedRoutes !== []) { |
|
39 | 39 | return $this->cachedRoutes; |
40 | 40 | } |
41 | 41 |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | // Incluez le fichier routesFile s'il n'existe pas. |
264 | 264 | // Ne conserver que pour les fins BC pour l'instant. |
265 | 265 | $routeFiles = $this->routeFiles; |
266 | - if (! in_array($routesFile, $routeFiles, true)) { |
|
266 | + if (!in_array($routesFile, $routeFiles, true)) { |
|
267 | 267 | $routeFiles[] = $routesFile; |
268 | 268 | } |
269 | 269 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $routes = $this; |
272 | 272 | |
273 | 273 | foreach ($routeFiles as $routesFile) { |
274 | - if (! is_file($routesFile)) { |
|
274 | + if (!is_file($routesFile)) { |
|
275 | 275 | logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile)); |
276 | 276 | |
277 | 277 | continue; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function placeholder(array|string $placeholder, ?string $pattern = null): self |
322 | 322 | { |
323 | - if (! is_array($placeholder)) { |
|
323 | + if (!is_array($placeholder)) { |
|
324 | 324 | $placeholder = [$placeholder => $pattern]; |
325 | 325 | } |
326 | 326 | |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @param array|Closure|string $to |
1015 | 1015 | */ |
1016 | - public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self |
|
1016 | + public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self |
|
1017 | 1017 | { |
1018 | 1018 | if (empty($from) || empty($to)) { |
1019 | 1019 | throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.'); |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | $from = $route['from']; |
1200 | 1200 | |
1201 | 1201 | // on ignore les closures |
1202 | - if (! is_string($to)) { |
|
1202 | + if (!is_string($to)) { |
|
1203 | 1203 | continue; |
1204 | 1204 | } |
1205 | 1205 | |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | |
1211 | 1211 | // S'il y a une chance de correspondance, alors ce sera |
1212 | 1212 | // soit avec $search au début de la chaîne $to. |
1213 | - if (! str_starts_with($to, $search)) { |
|
1213 | + if (!str_starts_with($to, $search)) { |
|
1214 | 1214 | continue; |
1215 | 1215 | } |
1216 | 1216 | |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | |
1289 | 1289 | // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés. |
1290 | 1290 | foreach ($matches[0] as $index => $placeholder) { |
1291 | - if (! isset($params[$index])) { |
|
1291 | + if (!isset($params[$index])) { |
|
1292 | 1292 | throw new InvalidArgumentException( |
1293 | 1293 | 'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".' |
1294 | 1294 | ); |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex. |
1300 | 1300 | $pattern = $this->placeholders[$placeholderName] ?? $placeholder; |
1301 | 1301 | |
1302 | - if (! preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1302 | + if (!preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1303 | 1303 | throw RouterException::invalidParameterType(); |
1304 | 1304 | } |
1305 | 1305 | |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | $from = trim($from, '/'); |
1357 | 1357 | } |
1358 | 1358 | |
1359 | - if (is_string($to) && ! str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1359 | + if (is_string($to) && !str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1360 | 1360 | $to = [$to, '__invoke']; |
1361 | 1361 | } |
1362 | 1362 | |
@@ -1382,9 +1382,9 @@ discard block |
||
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | // Limitation du nom d'hôte ? |
1385 | - if (! empty($options['hostname'])) { |
|
1385 | + if (!empty($options['hostname'])) { |
|
1386 | 1386 | // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ? |
1387 | - if (! $this->checkHostname($options['hostname'])) { |
|
1387 | + if (!$this->checkHostname($options['hostname'])) { |
|
1388 | 1388 | return; |
1389 | 1389 | } |
1390 | 1390 | |
@@ -1392,10 +1392,10 @@ discard block |
||
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | // Limitation du nom sous-domaine ? |
1395 | - elseif (! empty($options['subdomain'])) { |
|
1395 | + elseif (!empty($options['subdomain'])) { |
|
1396 | 1396 | // Si nous ne correspondons pas au sous-domaine actuel, alors |
1397 | 1397 | // nous n'avons pas besoin d'ajouter la route. |
1398 | - if (! $this->checkSubdomains($options['subdomain'])) { |
|
1398 | + if (!$this->checkSubdomains($options['subdomain'])) { |
|
1399 | 1399 | return; |
1400 | 1400 | } |
1401 | 1401 | |
@@ -1428,9 +1428,9 @@ discard block |
||
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | // S'il s'agit d'une redirection, aucun traitement |
1431 | - if (! isset($options['redirect']) && is_string($to)) { |
|
1431 | + if (!isset($options['redirect']) && is_string($to)) { |
|
1432 | 1432 | // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut |
1433 | - if (! str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1433 | + if (!str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1434 | 1434 | $namespace = $options['namespace'] ?? $this->defaultNamespace; |
1435 | 1435 | $to = trim($namespace, '\\') . '\\' . $to; |
1436 | 1436 | } |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant |
1448 | 1448 | // pour tenter de router la requête. |
1449 | 1449 | $routeKeyExists = isset($this->routes[$verb][$routeKey]); |
1450 | - if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) { |
|
1450 | + if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) { |
|
1451 | 1451 | return; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | private function checkHostname(string $hostname): bool |
1474 | 1474 | { |
1475 | 1475 | // Les appels CLI ne peuvent pas être sur le nom d'hôte. |
1476 | - if (! isset($this->httpHost) || is_cli()) { |
|
1476 | + if (!isset($this->httpHost) || is_cli()) { |
|
1477 | 1477 | return false; |
1478 | 1478 | } |
1479 | 1479 | |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | private function checkSubdomains($subdomains): bool |
1490 | 1490 | { |
1491 | 1491 | // Les appels CLI ne peuvent pas être sur le sous-domaine. |
1492 | - if (! isset($this->httpHost)) { |
|
1492 | + if (!isset($this->httpHost)) { |
|
1493 | 1493 | return false; |
1494 | 1494 | } |
1495 | 1495 | |
@@ -1497,13 +1497,13 @@ discard block |
||
1497 | 1497 | $this->currentSubdomain = $this->determineCurrentSubdomain(); |
1498 | 1498 | } |
1499 | 1499 | |
1500 | - if (! is_array($subdomains)) { |
|
1500 | + if (!is_array($subdomains)) { |
|
1501 | 1501 | $subdomains = [$subdomains]; |
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant, |
1505 | 1505 | // il nécessite la présence d'un sous-domaine. |
1506 | - if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1506 | + if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1507 | 1507 | return true; |
1508 | 1508 | } |
1509 | 1509 | |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | // sur l'URL sinon parse_url sera mal interprété |
1526 | 1526 | // 'hôte' comme 'chemin'. |
1527 | 1527 | $url = $this->httpHost; |
1528 | - if (! str_starts_with($url, 'http')) { |
|
1528 | + if (!str_starts_with($url, 'http')) { |
|
1529 | 1529 | $url = 'http://' . $url; |
1530 | 1530 | } |
1531 | 1531 | |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | |
1567 | 1567 | private function getControllerName(Closure|string $handler): ?string |
1568 | 1568 | { |
1569 | - if (! is_string($handler)) { |
|
1569 | + if (!is_string($handler)) { |
|
1570 | 1570 | return null; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1625,13 +1625,13 @@ discard block |
||
1625 | 1625 | */ |
1626 | 1626 | private function replaceLocale(string $route, ?string $locale = null): string |
1627 | 1627 | { |
1628 | - if (! str_contains($route, '{locale}')) { |
|
1628 | + if (!str_contains($route, '{locale}')) { |
|
1629 | 1629 | return $route; |
1630 | 1630 | } |
1631 | 1631 | |
1632 | 1632 | // Vérifier les paramètres régionaux non valides |
1633 | 1633 | if ($locale !== null) { |
1634 | - if (! in_array($locale, config('app.supported_locales'), true)) { |
|
1634 | + if (!in_array($locale, config('app.supported_locales'), true)) { |
|
1635 | 1635 | $locale = null; |
1636 | 1636 | } |
1637 | 1637 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | helper('assets'); |
72 | 72 | |
73 | - if (! empty($viewPathLocator)) { |
|
73 | + if (!empty($viewPathLocator)) { |
|
74 | 74 | if (is_string($viewPathLocator)) { |
75 | 75 | $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS; |
76 | 76 | } elseif ($viewPathLocator instanceof Locator) { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $options = (array) $options; |
236 | 236 | |
237 | 237 | $viewPath = $options['viewPath'] ?? $this->viewPath; |
238 | - if (! empty($viewPath)) { |
|
238 | + if (!empty($viewPath)) { |
|
239 | 239 | $file = str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')); |
240 | 240 | } else { |
241 | 241 | $file = $view; |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | |
244 | 244 | $file = Helpers::ensureExt($file, $ext); |
245 | 245 | |
246 | - if (! is_file($file) && $this->locator instanceof Locator) { |
|
246 | + if (!is_file($file) && $this->locator instanceof Locator) { |
|
247 | 247 | $file = $this->locator->locateFile($view, 'Views', empty($ext) ? 'php' : $ext); |
248 | 248 | } |
249 | 249 | |
250 | 250 | $file = realpath($file); |
251 | 251 | |
252 | 252 | // locateFile renverra une chaîne vide si le fichier est introuvable. |
253 | - if (! is_file($file)) { |
|
253 | + if (!is_file($file)) { |
|
254 | 254 | throw ViewException::invalidFile($view); |
255 | 255 | } |
256 | 256 |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $file = $this->viewPath . $view; |
95 | 95 | |
96 | - if (! is_file($file)) { |
|
96 | + if (!is_file($file)) { |
|
97 | 97 | $fileOrig = $file; |
98 | 98 | $file = $this->loader->locateFile($view, 'Views'); |
99 | 99 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function setData(array $data = [], ?string $context = null): self |
167 | 167 | { |
168 | - if (! empty($context)) { |
|
168 | + if (!empty($context)) { |
|
169 | 169 | foreach ($data as $key => &$value) { |
170 | 170 | if (is_array($value)) { |
171 | 171 | foreach ($value as &$obj) { |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | foreach ($matches as $match) { |
274 | 274 | // Loop over each piece of $data, replacing |
275 | 275 | // its contents so that we know what to replace in parse() |
276 | - $str = ''; // holds the new contents for this tag pair. |
|
276 | + $str = ''; // holds the new contents for this tag pair. |
|
277 | 277 | |
278 | 278 | foreach ($data as $row) { |
279 | 279 | // Objects that have a `toArray()` method should be |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if (is_array($val)) { |
296 | 296 | $pair = $this->parsePair($key, $val, $match[1]); |
297 | 297 | |
298 | - if (! empty($pair)) { |
|
298 | + if (!empty($pair)) { |
|
299 | 299 | $pairs[array_keys($pair)[0]] = true; |
300 | 300 | |
301 | 301 | $temp = array_merge($temp, $pair); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | // Now replace our placeholders with the new content. |
317 | 317 | foreach ($temp as $pattern => $content) { |
318 | - $out = $this->replaceSingle($pattern, $content, $out, ! isset($pairs[$pattern])); |
|
318 | + $out = $this->replaceSingle($pattern, $content, $out, !isset($pairs[$pattern])); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | $str .= $out; |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $content = (string) $content; |
486 | 486 | |
487 | 487 | // Replace the content in the template |
488 | - return preg_replace_callback($pattern, function ($matches) use ($content, $escape) { |
|
488 | + return preg_replace_callback($pattern, function($matches) use ($content, $escape) { |
|
489 | 489 | // Check for {! !} syntax to not escape this one. |
490 | 490 | if (str_starts_with($matches[0], '{!') && substr($matches[0], -2) === '!}') { |
491 | 491 | $escape = false; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | // Our regex earlier will leave all chained values on a single line |
506 | 506 | // so we need to break them apart so we can apply them all. |
507 | - $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : []; |
|
507 | + $filters = !empty($matches[1]) ? explode('|', $matches[1]) : []; |
|
508 | 508 | |
509 | 509 | if ($escape && empty($filters) && ($context = $this->shouldAddEscaping($orig))) { |
510 | 510 | $filters[] = "esc({$context})"; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | } |
533 | 533 | } |
534 | 534 | // No pipes, then we know we need to escape |
535 | - elseif (! str_contains($key, '|')) { |
|
535 | + elseif (!str_contains($key, '|')) { |
|
536 | 536 | $escape = 'html'; |
537 | 537 | } |
538 | 538 | // If there's a `noescape` then we're definitely false. |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | $escape = false; |
541 | 541 | } |
542 | 542 | // If no `esc` filter is found, then we'll need to add one. |
543 | - elseif (! preg_match('/\s+esc/', $key)) { |
|
543 | + elseif (!preg_match('/\s+esc/', $key)) { |
|
544 | 544 | $escape = 'html'; |
545 | 545 | } |
546 | 546 | |
@@ -559,10 +559,10 @@ discard block |
||
559 | 559 | preg_match('/\([\w<>=\/\\\,:.\-\s\+]+\)/', $filter, $param); |
560 | 560 | |
561 | 561 | // Remove the () and spaces to we have just the parameter left |
562 | - $param = ! empty($param) ? trim($param[0], '() ') : null; |
|
562 | + $param = !empty($param) ? trim($param[0], '() ') : null; |
|
563 | 563 | |
564 | 564 | // Params can be separated by commas to allow multiple parameters for the filter |
565 | - if (! empty($param)) { |
|
565 | + if (!empty($param)) { |
|
566 | 566 | $param = explode(',', $param); |
567 | 567 | |
568 | 568 | // Clean it up |
@@ -574,10 +574,10 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | // Get our filter name |
577 | - $filter = ! empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter); |
|
577 | + $filter = !empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter); |
|
578 | 578 | |
579 | 579 | $this->config['filters'] ??= []; |
580 | - if (! array_key_exists($filter, $this->config['filters'])) { |
|
580 | + if (!array_key_exists($filter, $this->config['filters'])) { |
|
581 | 581 | continue; |
582 | 582 | } |
583 | 583 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | * $matches[1] = all parameters string in opening tag |
617 | 617 | * $matches[2] = content between the tags to send to the plugin. |
618 | 618 | */ |
619 | - if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) { |
|
619 | + if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) { |
|
620 | 620 | continue; |
621 | 621 | } |
622 | 622 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * the LICENSE file that was distributed with this source code. |
10 | 10 | */ |
11 | 11 | |
12 | -if (! function_exists('css_url')) { |
|
12 | +if (!function_exists('css_url')) { |
|
13 | 13 | /** |
14 | 14 | * CSS URL |
15 | 15 | * |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | $name = str_replace(site_url() . 'css/', '', htmlspecialchars($name)); |
24 | 24 | |
25 | 25 | if (is_localfile($name)) { |
26 | - $name .= (! preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
26 | + $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
27 | 27 | $filename = WEBROOT . 'css' . DS . $name; |
28 | 28 | |
29 | 29 | return site_url() . 'css/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
30 | 30 | } |
31 | 31 | |
32 | - return $name . (! preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
32 | + return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | -if (! function_exists('js_url')) { |
|
36 | +if (!function_exists('js_url')) { |
|
37 | 37 | /** |
38 | 38 | * JS URL |
39 | 39 | * |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | $name = str_replace(site_url() . 'js/', '', htmlspecialchars($name)); |
48 | 48 | |
49 | 49 | if (is_localfile($name)) { |
50 | - $name .= (! preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
50 | + $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
51 | 51 | $filename = WEBROOT . 'js' . DS . $name; |
52 | 52 | |
53 | 53 | return site_url() . 'js/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
54 | 54 | } |
55 | 55 | |
56 | - return $name . (! preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
56 | + return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | -if (! function_exists('lib_css_url')) { |
|
60 | +if (!function_exists('lib_css_url')) { |
|
61 | 61 | /** |
62 | 62 | * LIB CSS URL |
63 | 63 | * |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | ); |
77 | 77 | |
78 | 78 | if (is_localfile($name)) { |
79 | - $name .= (! preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
79 | + $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
80 | 80 | $paths = ['lib', 'vendor', 'plugins']; |
81 | 81 | |
82 | 82 | foreach ($paths as $path) { |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | return $site_url . 'lib/' . $name; |
91 | 91 | } |
92 | 92 | |
93 | - return $name . (! preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
93 | + return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -if (! function_exists('lib_js_url')) { |
|
97 | +if (!function_exists('lib_js_url')) { |
|
98 | 98 | /** |
99 | 99 | * LIB JS URL |
100 | 100 | * |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ); |
114 | 114 | |
115 | 115 | if (is_localfile($name)) { |
116 | - $name .= (! preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
116 | + $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
117 | 117 | $paths = ['lib', 'vendor', 'plugins']; |
118 | 118 | |
119 | 119 | foreach ($paths as $path) { |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | return $site_url . 'lib/' . $name; |
128 | 128 | } |
129 | 129 | |
130 | - return $name . (! preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
130 | + return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | -if (! function_exists('lib_styles')) { |
|
134 | +if (!function_exists('lib_styles')) { |
|
135 | 135 | /** |
136 | 136 | * LIB_STYLES |
137 | 137 | * |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | foreach ($name as $style) { |
151 | 151 | if (is_string($style)) { |
152 | - $style = (! preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
152 | + $style = (!preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
153 | 153 | if (is_file(WEBROOT . 'lib' . DS . str_replace('/', DS, $style))) { |
154 | 154 | $return[] = '<link rel="preload" type="text/css" href="' . lib_css_url($style) . '" as="style"> |
155 | 155 | <link rel="stylesheet" type="text/css" href="' . lib_css_url($style) . '" />'; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | -if (! function_exists('lib_scripts')) { |
|
176 | +if (!function_exists('lib_scripts')) { |
|
177 | 177 | /** |
178 | 178 | * LIB_SCRIPTS |
179 | 179 | * |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | foreach ($name as $script) { |
193 | 193 | if (is_string($script)) { |
194 | - $script = (! preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
194 | + $script = (!preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
195 | 195 | if (is_file(WEBROOT . 'lib' . DS . str_replace('/', DS, $script))) { |
196 | 196 | $return[] = '<script type="text/javascript" src="' . lib_js_url($script) . '"></script>'; |
197 | 197 | } elseif (is_localfile($script)) { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | -if (! function_exists('styles')) { |
|
216 | +if (!function_exists('styles')) { |
|
217 | 217 | /** |
218 | 218 | * STYLES |
219 | 219 | * |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | foreach ($name as $style) { |
233 | 233 | if (is_string($style)) { |
234 | - $style = (! preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
234 | + $style = (!preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
235 | 235 | if (is_file(WEBROOT . 'css' . DS . str_replace('/', DS, $style))) { |
236 | 236 | $return[] = '<link rel="preload" type="text/css" href="' . css_url($style) . '" as="style"> |
237 | 237 | <link rel="stylesheet" type="text/css" href="' . css_url($style) . '" />'; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | -if (! function_exists('scripts')) { |
|
258 | +if (!function_exists('scripts')) { |
|
259 | 259 | /** |
260 | 260 | * SCRIPTS |
261 | 261 | * |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | foreach ($name as $script) { |
275 | 275 | if (is_string($script)) { |
276 | - $script = (! preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
276 | + $script = (!preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
277 | 277 | if (is_file(WEBROOT . 'js' . DS . str_replace('/', DS, $script))) { |
278 | 278 | $return[] = '<script type="text/javascript" src="' . js_url($script) . '"></script>'; |
279 | 279 | } elseif (is_localfile($script)) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | -if (! function_exists('less_url')) { |
|
298 | +if (!function_exists('less_url')) { |
|
299 | 299 | /** |
300 | 300 | * LESS URL |
301 | 301 | * |
@@ -309,17 +309,17 @@ discard block |
||
309 | 309 | $name = str_replace(site_url() . 'less/', '', htmlspecialchars($name)); |
310 | 310 | |
311 | 311 | if (is_localfile($name)) { |
312 | - $name .= (! preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
312 | + $name .= (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
313 | 313 | $filename = WEBROOT . 'less' . DS . $name; |
314 | 314 | |
315 | 315 | return site_url() . 'less/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
316 | 316 | } |
317 | 317 | |
318 | - return $name . (! preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
318 | + return $name . (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | -if (! function_exists('less_styles')) { |
|
322 | +if (!function_exists('less_styles')) { |
|
323 | 323 | /** |
324 | 324 | * LESS_STYLES |
325 | 325 | * |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | |
338 | 338 | foreach ($name as $style) { |
339 | 339 | if (is_string($style)) { |
340 | - $style = (! preg_match('#\.less$#i', $style) ? $style . '.less' : $style); |
|
340 | + $style = (!preg_match('#\.less$#i', $style) ? $style . '.less' : $style); |
|
341 | 341 | if (is_file(WEBROOT . 'less' . DS . str_replace('/', DS, $style))) { |
342 | 342 | $return[] = '<link rel="stylesheet" type="text/less" href="' . less_url($style) . '" />'; |
343 | 343 | } elseif (is_localfile($style)) { |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
362 | -if (! function_exists('img_url')) { |
|
362 | +if (!function_exists('img_url')) { |
|
363 | 363 | /** |
364 | 364 | * IMG URL |
365 | 365 | * |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | } |
387 | 387 | } |
388 | 388 | |
389 | -if (! function_exists('img')) { |
|
389 | +if (!function_exists('img')) { |
|
390 | 390 | /** |
391 | 391 | * IMG |
392 | 392 | * |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | } |
418 | 418 | } |
419 | 419 | |
420 | -if (! function_exists('docs_url')) { |
|
420 | +if (!function_exists('docs_url')) { |
|
421 | 421 | /** |
422 | 422 | * DOCS URL |
423 | 423 | * |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
447 | -if (! function_exists('videos_url')) { |
|
447 | +if (!function_exists('videos_url')) { |
|
448 | 448 | /** |
449 | 449 | * VIDEOS URL |
450 | 450 | * |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
474 | -if (! function_exists('mix')) { |
|
474 | +if (!function_exists('mix')) { |
|
475 | 475 | /** |
476 | 476 | * Obtenez le chemin d'accès à un fichier Mix versionné. |
477 | 477 | * |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | if (is_file($publicPath . $manifestDirectory . '/hot')) { |
497 | 497 | $url = rtrim(file_get_contents($publicPath . $manifestDirectory . '/hot')); |
498 | 498 | |
499 | - if (! empty($customUrl = $customUrl = $config->hot_proxy_url)) { |
|
499 | + if (!empty($customUrl = $customUrl = $config->hot_proxy_url)) { |
|
500 | 500 | return $customUrl . $path; |
501 | 501 | } |
502 | 502 | |
@@ -509,8 +509,8 @@ discard block |
||
509 | 509 | |
510 | 510 | $manifestPath = $publicPath . $manifestDirectory . '/mix-manifest.json'; |
511 | 511 | |
512 | - if (! isset($manifests[$manifestPath])) { |
|
513 | - if (! is_file($manifestPath)) { |
|
512 | + if (!isset($manifests[$manifestPath])) { |
|
513 | + if (!is_file($manifestPath)) { |
|
514 | 514 | throw new Exception('Le manifeste Mix n\'existe pas.'); |
515 | 515 | } |
516 | 516 | |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | |
520 | 520 | $manifest = $manifests[$manifestPath]; |
521 | 521 | |
522 | - if (! isset($manifest[$path])) { |
|
522 | + if (!isset($manifest[$path])) { |
|
523 | 523 | $exception = new Exception("Impossible de localiser le fichier Mix: {$path}."); |
524 | 524 | |
525 | - if (! BLITZ_DEBUG) { |
|
525 | + if (!BLITZ_DEBUG) { |
|
526 | 526 | return $path; |
527 | 527 | } |
528 | 528 |
@@ -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(array|string $name, ?ConnectionInterface &$conn = null) |
|
69 | + function model(array|string $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 | * |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | -if (! function_exists('logger')) { |
|
144 | +if (!function_exists('logger')) { |
|
145 | 145 | /** |
146 | 146 | * Une méthode de commodité pour les événements de journalisation via le système Log. |
147 | 147 | * |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $logger = Services::logger(); |
165 | 165 | |
166 | - if (! empty($level) && ! empty($message)) { |
|
166 | + if (!empty($level) && !empty($message)) { |
|
167 | 167 | return $logger->log($level, $message, $context); |
168 | 168 | } |
169 | 169 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | -if (! function_exists('cache')) { |
|
174 | +if (!function_exists('cache')) { |
|
175 | 175 | /** |
176 | 176 | * Une méthode pratique qui donne accès au cache |
177 | 177 | * objet. Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | -if (! function_exists('session')) { |
|
204 | +if (!function_exists('session')) { |
|
205 | 205 | /** |
206 | 206 | * Une méthode pratique pour accéder à l'instance de session, ou un élément qui a été défini dans la session. |
207 | 207 | * |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== // |
228 | 228 | |
229 | -if (! function_exists('esc')) { |
|
229 | +if (!function_exists('esc')) { |
|
230 | 230 | /** |
231 | 231 | * Effectue un simple échappement automatique des données pour des raisons de sécurité. |
232 | 232 | * Pourrait envisager de rendre cela plus complexe à une date ultérieure. |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | -if (! function_exists('h')) { |
|
256 | +if (!function_exists('h')) { |
|
257 | 257 | /** |
258 | 258 | * Méthode pratique pour htmlspecialchars. |
259 | 259 | * |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | -if (! function_exists('purify')) { |
|
275 | +if (!function_exists('purify')) { |
|
276 | 276 | /** |
277 | 277 | * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier. |
278 | 278 | * Utilisez facilement plusieurs configurations de purificateur. |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
293 | -if (! function_exists('remove_invisible_characters')) { |
|
293 | +if (!function_exists('remove_invisible_characters')) { |
|
294 | 294 | /** |
295 | 295 | * Supprimer les caractères invisibles |
296 | 296 | * |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -if (! function_exists('stringify_attributes')) { |
|
306 | +if (!function_exists('stringify_attributes')) { |
|
307 | 307 | /** |
308 | 308 | * Chaîner les attributs à utiliser dans les balises HTML. |
309 | 309 | * |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= // |
319 | 319 | |
320 | -if (! function_exists('environment')) { |
|
320 | +if (!function_exists('environment')) { |
|
321 | 321 | /** |
322 | 322 | * Renvoi l'environnement d'execution actuel ou determine si on est dans un environnement specifie |
323 | 323 | * |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | } |
356 | 356 | } |
357 | 357 | |
358 | -if (! function_exists('on_dev')) { |
|
358 | +if (!function_exists('on_dev')) { |
|
359 | 359 | /** |
360 | 360 | * Testez pour voir si nous sommes dans un environnement de développement. |
361 | 361 | */ |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | } |
371 | 371 | |
372 | -if (! function_exists('on_prod')) { |
|
372 | +if (!function_exists('on_prod')) { |
|
373 | 373 | /** |
374 | 374 | * Testez pour voir si nous sommes dans un environnement de production. |
375 | 375 | */ |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
386 | -if (! function_exists('on_test')) { |
|
386 | +if (!function_exists('on_test')) { |
|
387 | 387 | /** |
388 | 388 | * Testez pour voir si nous sommes dans un environnement de test |
389 | 389 | */ |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
396 | -if (! function_exists('is_cli')) { |
|
396 | +if (!function_exists('is_cli')) { |
|
397 | 397 | /** |
398 | 398 | * Testez pour voir si une demande a été faite à partir de la ligne de commande. |
399 | 399 | */ |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | -if (! function_exists('is_php')) { |
|
406 | +if (!function_exists('is_php')) { |
|
407 | 407 | /** |
408 | 408 | * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie. |
409 | 409 | */ |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
416 | -if (! function_exists('is_windows')) { |
|
416 | +if (!function_exists('is_windows')) { |
|
417 | 417 | /** |
418 | 418 | * Déterminez si l'environnement actuel est basé sur Windows. |
419 | 419 | */ |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | -if (! function_exists('is_https')) { |
|
426 | +if (!function_exists('is_https')) { |
|
427 | 427 | /** |
428 | 428 | * Determines if the application is accessed via an encrypted * (HTTPS) connection. |
429 | 429 | */ |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | } |
434 | 434 | } |
435 | 435 | |
436 | -if (! function_exists('is_localfile')) { |
|
436 | +if (!function_exists('is_localfile')) { |
|
437 | 437 | /** |
438 | 438 | * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non |
439 | 439 | */ |
@@ -443,11 +443,11 @@ discard block |
||
443 | 443 | return true; |
444 | 444 | } |
445 | 445 | |
446 | - return ! preg_match('#^(https?://)#i', $name); |
|
446 | + return !preg_match('#^(https?://)#i', $name); |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | |
450 | -if (! function_exists('is_online')) { |
|
450 | +if (!function_exists('is_online')) { |
|
451 | 451 | /** |
452 | 452 | * Tester si l'application s'exécute en local ou en ligne. |
453 | 453 | */ |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
460 | -if (! function_exists('is_connected')) { |
|
460 | +if (!function_exists('is_connected')) { |
|
461 | 461 | /** |
462 | 462 | * Verifie si l'utilisateur a une connexion internet active. |
463 | 463 | */ |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | } |
468 | 468 | } |
469 | 469 | |
470 | -if (! function_exists('is_ajax_request')) { |
|
470 | +if (!function_exists('is_ajax_request')) { |
|
471 | 471 | /** |
472 | 472 | * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH. |
473 | 473 | */ |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | } |
478 | 478 | } |
479 | 479 | |
480 | -if (! function_exists('redirection')) { |
|
480 | +if (!function_exists('redirection')) { |
|
481 | 481 | /** |
482 | 482 | * Redirige l'utilisateur |
483 | 483 | */ |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | } |
492 | 492 | } |
493 | 493 | |
494 | -if (! function_exists('redirect')) { |
|
494 | +if (!function_exists('redirect')) { |
|
495 | 495 | /** |
496 | 496 | * Méthode pratique qui fonctionne avec la $request globale actuelle et |
497 | 497 | * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | { |
506 | 506 | $redirection = Services::redirection(); |
507 | 507 | |
508 | - if (! empty($uri)) { |
|
508 | + if (!empty($uri)) { |
|
509 | 509 | return $redirection->route($uri); |
510 | 510 | } |
511 | 511 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | } |
514 | 514 | } |
515 | 515 | |
516 | -if (! function_exists('back')) { |
|
516 | +if (!function_exists('back')) { |
|
517 | 517 | /** |
518 | 518 | * Retourne a la page precedente |
519 | 519 | * |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | } |
526 | 526 | } |
527 | 527 | |
528 | -if (! function_exists('link_to')) { |
|
528 | +if (!function_exists('link_to')) { |
|
529 | 529 | /** |
530 | 530 | * Étant donné une chaîne de contrôleur/méthode et tous les paramètres, |
531 | 531 | * tentera de créer l'URL relative à la route correspondante. |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
548 | -if (! function_exists('clean_path')) { |
|
548 | +if (!function_exists('clean_path')) { |
|
549 | 549 | /** |
550 | 550 | * Une méthode pratique pour nettoyer les chemins pour |
551 | 551 | * une sortie plus belle. Utile pour les exceptions |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | } |
579 | 579 | |
580 | -if (! function_exists('old')) { |
|
580 | +if (!function_exists('old')) { |
|
581 | 581 | /** |
582 | 582 | * Fournit l'accès à "entrée ancienne" qui a été définie dans la session lors d'un redirect()-withInput(). |
583 | 583 | * |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | function old(string $key, $default = null, $escape = 'html') |
591 | 591 | { |
592 | 592 | // Assurez-vous de charger la session |
593 | - if (session_status() === PHP_SESSION_NONE && ! on_test()) { |
|
593 | + if (session_status() === PHP_SESSION_NONE && !on_test()) { |
|
594 | 594 | session(); // @codeCoverageIgnore |
595 | 595 | } |
596 | 596 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | |
606 | 606 | // ================================= FONCTIONS DE DEBOGAGE ================================= // |
607 | 607 | |
608 | -if (! function_exists('deprecationWarning')) { |
|
608 | +if (!function_exists('deprecationWarning')) { |
|
609 | 609 | /** |
610 | 610 | * Méthode d'assistance pour générer des avertissements d'obsolescence |
611 | 611 | * |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | } |
622 | 622 | } |
623 | 623 | |
624 | -if (! function_exists('pr')) { |
|
624 | +if (!function_exists('pr')) { |
|
625 | 625 | /** |
626 | 626 | * print_r() convenience function. |
627 | 627 | * |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | } |
644 | 644 | } |
645 | 645 | |
646 | -if (! function_exists('pj')) { |
|
646 | +if (!function_exists('pj')) { |
|
647 | 647 | /** |
648 | 648 | * json pretty print convenience function. |
649 | 649 | * |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | } |
665 | 665 | } |
666 | 666 | |
667 | -if (! function_exists('trigger_warning')) { |
|
667 | +if (!function_exists('trigger_warning')) { |
|
668 | 668 | /** |
669 | 669 | * Déclenche un E_USER_WARNING. |
670 | 670 | */ |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | |
677 | 677 | // ================================= FONCTIONS DIVERSES ================================= // |
678 | 678 | |
679 | -if (! function_exists('force_https')) { |
|
679 | +if (!function_exists('force_https')) { |
|
680 | 680 | /** |
681 | 681 | * Utilisé pour forcer l'accès à une page via HTTPS. |
682 | 682 | * Utilise une redirection standard, plus définira l'en-tête HSTS |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
737 | -if (! function_exists('get_type_name')) { |
|
737 | +if (!function_exists('get_type_name')) { |
|
738 | 738 | /** |
739 | 739 | * Renvoie la classe d'objets ou le type var de ce n'est pas un objet |
740 | 740 | * |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | } |
749 | 749 | } |
750 | 750 | |
751 | -if (! function_exists('ip_address')) { |
|
751 | +if (!function_exists('ip_address')) { |
|
752 | 752 | /** |
753 | 753 | * Renvoie l'adresse IP de l'utilisateur actuel |
754 | 754 | */ |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | } |
759 | 759 | } |
760 | 760 | |
761 | -if (! function_exists('is_really_writable')) { |
|
761 | +if (!function_exists('is_really_writable')) { |
|
762 | 762 | /** |
763 | 763 | * Tests d'inscriptibilité des fichiers |
764 | 764 | */ |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | } |
769 | 769 | } |
770 | 770 | |
771 | -if (! function_exists('lang')) { |
|
771 | +if (!function_exists('lang')) { |
|
772 | 772 | /** |
773 | 773 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
774 | 774 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | } |
780 | 780 | } |
781 | 781 | |
782 | -if (! function_exists('__')) { |
|
782 | +if (!function_exists('__')) { |
|
783 | 783 | /** |
784 | 784 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
785 | 785 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | } |
793 | 793 | } |
794 | 794 | |
795 | -if (! function_exists('namespace_split')) { |
|
795 | +if (!function_exists('namespace_split')) { |
|
796 | 796 | /** |
797 | 797 | * Séparez l'espace de noms du nom de classe. |
798 | 798 | * |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | } |
814 | 814 | } |
815 | 815 | |
816 | -if (! function_exists('view_exist')) { |
|
816 | +if (!function_exists('view_exist')) { |
|
817 | 817 | /** |
818 | 818 | * Verifie si un fichier de vue existe. Utile pour limiter les failles include |
819 | 819 | */ |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | } |
828 | 828 | } |
829 | 829 | |
830 | -if (! function_exists('view')) { |
|
830 | +if (!function_exists('view')) { |
|
831 | 831 | /** |
832 | 832 | * Charge une vue |
833 | 833 | * |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | } |
844 | 844 | } |
845 | 845 | |
846 | -if (! function_exists('flash')) { |
|
846 | +if (!function_exists('flash')) { |
|
847 | 847 | /** |
848 | 848 | * Fournisseur d'acces rapide a la classe PHP Flash |
849 | 849 | * |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | }*/ |
876 | 876 | } |
877 | 877 | |
878 | -if (! function_exists('geo_ip')) { |
|
878 | +if (!function_exists('geo_ip')) { |
|
879 | 879 | /** |
880 | 880 | * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip |
881 | 881 | */ |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | } |
886 | 886 | } |
887 | 887 | |
888 | -if (! function_exists('to_stream')) { |
|
888 | +if (!function_exists('to_stream')) { |
|
889 | 889 | /** |
890 | 890 | * Créez un nouveau flux basé sur le type d'entrée. |
891 | 891 | * |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | } |
907 | 907 | } |
908 | 908 | |
909 | -if (! function_exists('value')) { |
|
909 | +if (!function_exists('value')) { |
|
910 | 910 | /** |
911 | 911 | * Renvoie la valeur par défaut de la valeur donnée. |
912 | 912 | */ |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | } |
917 | 917 | } |
918 | 918 | |
919 | -if (! function_exists('collect')) { |
|
919 | +if (!function_exists('collect')) { |
|
920 | 920 | /** |
921 | 921 | * Créez une collection à partir de la valeur donnée. |
922 | 922 | */ |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | } |
927 | 927 | } |
928 | 928 | |
929 | -if (! function_exists('with')) { |
|
929 | +if (!function_exists('with')) { |
|
930 | 930 | /** |
931 | 931 | * Renvoie la valeur donnée, éventuellement transmise via le rappel donné. |
932 | 932 | * |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | } |
939 | 939 | } |
940 | 940 | |
941 | -if (! function_exists('tap')) { |
|
941 | +if (!function_exists('tap')) { |
|
942 | 942 | /** |
943 | 943 | * Appelez la Closure donnée avec cette instance puis renvoyez l'instance. |
944 | 944 | */ |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
951 | -if (! function_exists('last')) { |
|
951 | +if (!function_exists('last')) { |
|
952 | 952 | /** |
953 | 953 | * Recupere le dernier element d'un tableau |
954 | 954 | */ |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | } |
959 | 959 | } |
960 | 960 | |
961 | -if (! function_exists('invade')) { |
|
961 | +if (!function_exists('invade')) { |
|
962 | 962 | /** |
963 | 963 | * Cette classe offre une fonction d'invasion qui vous permettra de lire / écrire des propriétés privées d'un objet. |
964 | 964 | * Il vous permettra également de définir, obtenir et appeler des méthodes privées. |