@@ -53,15 +53,15 @@ |
||
53 | 53 | |
54 | 54 | $viewer->setData($data)->setOptions($options); |
55 | 55 | |
56 | - if (! empty($this->layout) && is_string($this->layout)) { |
|
56 | + if (!empty($this->layout) && is_string($this->layout)) { |
|
57 | 57 | $viewer->setLayout($this->layout); |
58 | 58 | } |
59 | 59 | |
60 | - if (! empty($this->viewDatas) && is_array($this->viewDatas)) { |
|
60 | + if (!empty($this->viewDatas) && is_array($this->viewDatas)) { |
|
61 | 61 | $viewer->addData($this->viewDatas); |
62 | 62 | } |
63 | 63 | |
64 | - if (! is_string($controllerName = Dispatcher::getController(false))) { |
|
64 | + if (!is_string($controllerName = Dispatcher::getController(false))) { |
|
65 | 65 | $controllerName = static::class; |
66 | 66 | } |
67 | 67 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | return $models; |
74 | 74 | } |
75 | 75 | |
76 | - if (! self::isLoaded('models', $model)) { |
|
76 | + if (!self::isLoaded('models', $model)) { |
|
77 | 77 | self::loaded('models', $model, FileLocator::model($model, $connection)); |
78 | 78 | } |
79 | 79 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | private static function isLoaded(string $module, $element): bool |
89 | 89 | { |
90 | - if (! isset(self::$loads[$module]) || ! is_array(self::$loads[$module])) { |
|
90 | + if (!isset(self::$loads[$module]) || !is_array(self::$loads[$module])) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function init() |
38 | 38 | { |
39 | - if (! class_exists('Whoops\Run')) { |
|
39 | + if (!class_exists('Whoops\Run')) { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $whoops = new Run(); |
44 | 44 | |
45 | - if (! is_online()) { |
|
45 | + if (!is_online()) { |
|
46 | 46 | if (Misc::isCommandLine()) { |
47 | 47 | $whoops->pushHandler(new PlainTextHandler()); |
48 | 48 | } elseif (Misc::isAjaxRequest()) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * On log toutes les erreurs |
57 | 57 | */ |
58 | - $whoops->pushHandler(static function (Throwable $exception, Inspector $inspector, RunInterface $run) { |
|
58 | + $whoops->pushHandler(static function(Throwable $exception, Inspector $inspector, RunInterface $run) { |
|
59 | 59 | Services::logger()->error($exception); |
60 | 60 | |
61 | 61 | return Handler::DONE; |
@@ -477,7 +477,7 @@ |
||
477 | 477 | $name = array_shift($arguments); |
478 | 478 | |
479 | 479 | if (empty(static::$instances[$name])) { |
480 | - if (! empty($arguments)) { |
|
480 | + if (!empty($arguments)) { |
|
481 | 481 | static::$instances[$name] = static::factory($name, $arguments); |
482 | 482 | } else { |
483 | 483 | static::$instances[$name] = static::injector()->get($name); |
@@ -125,17 +125,17 @@ |
||
125 | 125 | return static::$instances[Cache::class] = static::factory(Cache::class, compact('config')); |
126 | 126 | } |
127 | 127 | |
128 | - /** |
|
129 | - * La clase Config offre une api fluide por gerer les configurations de l'application |
|
130 | - */ |
|
131 | - public static function config(bool $shared = true): Config |
|
132 | - { |
|
133 | - if (true === $shared && isset(static::$instances[Config::class])) { |
|
128 | + /** |
|
129 | + * La clase Config offre une api fluide por gerer les configurations de l'application |
|
130 | + */ |
|
131 | + public static function config(bool $shared = true): Config |
|
132 | + { |
|
133 | + if (true === $shared && isset(static::$instances[Config::class])) { |
|
134 | 134 | return static::$instances[Config::class]; |
135 | 135 | } |
136 | 136 | |
137 | - return static::$instances[Config::class] = new Config(); |
|
138 | - } |
|
137 | + return static::$instances[Config::class] = new Config(); |
|
138 | + } |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Émetteur de réponse au client |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | // Les providers par défaut du système doivent être ajouté en premier pour que les autres puisse les surcharger |
200 | - if (! empty($systemProvider)) { |
|
200 | + if (!empty($systemProvider)) { |
|
201 | 201 | $providers[] = $systemProvider; |
202 | 202 | } |
203 | 203 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $providers = [...$providers, ...$localIncludes]; |
206 | 206 | |
207 | 207 | // Enfin ceux de l'application doivent remplacer tous les autres |
208 | - if (! empty($appProvider)) { |
|
208 | + if (!empty($appProvider)) { |
|
209 | 209 | $providers[] = $appProvider; |
210 | 210 | } |
211 | 211 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | // Essayez plusieurs fois en cas de mèches persistantes |
128 | 128 | $attempts = 10; |
129 | 129 | |
130 | - while ((bool) $attempts && ! delete_files($directory, true, false, true)) { |
|
130 | + while ((bool) $attempts && !delete_files($directory, true, false, true)) { |
|
131 | 131 | // @codeCoverageIgnoreStart |
132 | 132 | $attempts--; |
133 | 133 | usleep(100000); // .1s |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | // Rechercher un fichier existant |
468 | 468 | if (file_exists($to)) { |
469 | 469 | // S'il n'est pas remplacé ou si les fichiers sont identiques, envisagez de réussir |
470 | - if (! $replace || same_file($from, $to)) { |
|
470 | + if (!$replace || same_file($from, $to)) { |
|
471 | 471 | return; |
472 | 472 | } |
473 | 473 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | } |
482 | 482 | |
483 | 483 | // Assurez-vous que le répertoire existe |
484 | - if (! is_dir($directory = pathinfo($to, PATHINFO_DIRNAME))) { |
|
484 | + if (!is_dir($directory = pathinfo($to, PATHINFO_DIRNAME))) { |
|
485 | 485 | mkdir($directory, 0775, true); |
486 | 486 | } |
487 | 487 |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function addPlaceholder($placeholder, ?string $pattern = null): self |
257 | 257 | { |
258 | - if (! is_array($placeholder)) { |
|
258 | + if (!is_array($placeholder)) { |
|
259 | 259 | $placeholder = [$placeholder => $pattern]; |
260 | 260 | } |
261 | 261 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | foreach ($collection as $name => $r) { |
508 | 508 | $key = key($r['route']); |
509 | 509 | |
510 | - if (! $withName) { |
|
510 | + if (!$withName) { |
|
511 | 511 | $routes[$key] = $r['route'][$key]; |
512 | 512 | } else { |
513 | 513 | $routes[$key] = [ |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * |
889 | 889 | * @param array|Closure|string $to |
890 | 890 | */ |
891 | - public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self |
|
891 | + public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self |
|
892 | 892 | { |
893 | 893 | if (empty($from) || empty($to)) { |
894 | 894 | throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.'); |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | $to = $route['route'][$from]; |
1058 | 1058 | |
1059 | 1059 | // on ignore les closures |
1060 | - if (! is_string($to)) { |
|
1060 | + if (!is_string($to)) { |
|
1061 | 1061 | continue; |
1062 | 1062 | } |
1063 | 1063 | |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | |
1147 | 1147 | // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés. |
1148 | 1148 | foreach ($matches[0] as $index => $pattern) { |
1149 | - if (! preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1149 | + if (!preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1150 | 1150 | throw RouterException::invalidParameterType(); |
1151 | 1151 | } |
1152 | 1152 | |
@@ -1224,9 +1224,9 @@ discard block |
||
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | // Limitation du nom d'hôte ? |
1227 | - if (! empty($options['hostname'])) { |
|
1227 | + if (!empty($options['hostname'])) { |
|
1228 | 1228 | // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ? |
1229 | - if (! $this->checkHostname($options['hostname'])) { |
|
1229 | + if (!$this->checkHostname($options['hostname'])) { |
|
1230 | 1230 | return; |
1231 | 1231 | } |
1232 | 1232 | |
@@ -1234,10 +1234,10 @@ discard block |
||
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | // Limitation du nom sous-domaine ? |
1237 | - elseif (! empty($options['subdomain'])) { |
|
1237 | + elseif (!empty($options['subdomain'])) { |
|
1238 | 1238 | // Si nous ne correspondons pas au sous-domaine actuel, alors |
1239 | 1239 | // nous n'avons pas besoin d'ajouter la route. |
1240 | - if (! $this->checkSubdomains($options['subdomain'])) { |
|
1240 | + if (!$this->checkSubdomains($options['subdomain'])) { |
|
1241 | 1241 | return; |
1242 | 1242 | } |
1243 | 1243 | |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | // S'il s'agit d'une redirection, aucun traitement |
1271 | - if (! isset($options['redirect']) && is_string($to)) { |
|
1271 | + if (!isset($options['redirect']) && is_string($to)) { |
|
1272 | 1272 | // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut |
1273 | 1273 | if (strpos($to, '\\') === false || strpos($to, '\\') > 0) { |
1274 | 1274 | $namespace = $options['namespace'] ?? $this->defaultNamespace; |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | // les routes manuelement définies doivent toujours être la "source de vérité". |
1287 | 1287 | // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant |
1288 | 1288 | // pour tenter de router la requête. |
1289 | - if (isset($this->routes[$verb][$name]) && ! $overwrite) { |
|
1289 | + if (isset($this->routes[$verb][$name]) && !$overwrite) { |
|
1290 | 1290 | return; |
1291 | 1291 | } |
1292 | 1292 | |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | private function checkHostname(string $hostname): bool |
1311 | 1311 | { |
1312 | 1312 | // Les appels CLI ne peuvent pas être sur le nom d'hôte. |
1313 | - if (! isset($this->httpHost) || is_cli()) { |
|
1313 | + if (!isset($this->httpHost) || is_cli()) { |
|
1314 | 1314 | return false; |
1315 | 1315 | } |
1316 | 1316 | |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | private function checkSubdomains($subdomains): bool |
1327 | 1327 | { |
1328 | 1328 | // Les appels CLI ne peuvent pas être sur le sous-domaine. |
1329 | - if (! isset($_SERVER['HTTP_HOST'])) { |
|
1329 | + if (!isset($_SERVER['HTTP_HOST'])) { |
|
1330 | 1330 | return false; |
1331 | 1331 | } |
1332 | 1332 | |
@@ -1334,13 +1334,13 @@ discard block |
||
1334 | 1334 | $this->currentSubdomain = $this->determineCurrentSubdomain(); |
1335 | 1335 | } |
1336 | 1336 | |
1337 | - if (! is_array($subdomains)) { |
|
1337 | + if (!is_array($subdomains)) { |
|
1338 | 1338 | $subdomains = [$subdomains]; |
1339 | 1339 | } |
1340 | 1340 | |
1341 | 1341 | // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant, |
1342 | 1342 | // il nécessite la présence d'un sous-domaine. |
1343 | - if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1343 | + if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1344 | 1344 | return true; |
1345 | 1345 | } |
1346 | 1346 | |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | |
1394 | 1394 | private function getControllerName(Closure|string $handler): ?string |
1395 | 1395 | { |
1396 | - if (! is_string($handler)) { |
|
1396 | + if (!is_string($handler)) { |
|
1397 | 1397 | return null; |
1398 | 1398 | } |
1399 | 1399 | |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | |
1459 | 1459 | // Vérifier les paramètres régionaux non valides |
1460 | 1460 | if ($locale !== null) { |
1461 | - if (! in_array($locale, config('app.supported_locales'), true)) { |
|
1461 | + if (!in_array($locale, config('app.supported_locales'), true)) { |
|
1462 | 1462 | $locale = null; |
1463 | 1463 | } |
1464 | 1464 | } |
@@ -754,51 +754,51 @@ discard block |
||
754 | 754 | |
755 | 755 | if (in_array('index', $methods, true)) { |
756 | 756 | $this->get($name, $newName . '::index', $options + [ |
757 | - 'as' => $name . '.index', |
|
758 | - ]); |
|
757 | + 'as' => $name . '.index', |
|
758 | + ]); |
|
759 | 759 | } |
760 | 760 | if (in_array('new', $methods, true)) { |
761 | 761 | $this->get($name . '/new', $newName . '::new', $options + [ |
762 | - 'as' => $name . '.new', |
|
763 | - ]); |
|
762 | + 'as' => $name . '.new', |
|
763 | + ]); |
|
764 | 764 | } |
765 | 765 | if (in_array('edit', $methods, true)) { |
766 | 766 | $this->get($name . '/' . $id . '/edit', $newName . '::edit/$1', $options + [ |
767 | - 'as' => $name . '.edit', |
|
768 | - ]); |
|
767 | + 'as' => $name . '.edit', |
|
768 | + ]); |
|
769 | 769 | } |
770 | 770 | if (in_array('show', $methods, true)) { |
771 | 771 | $this->get($name . '/' . $id, $newName . '::show/$1', $options + [ |
772 | - 'as' => $name . '.show', |
|
773 | - ]); |
|
772 | + 'as' => $name . '.show', |
|
773 | + ]); |
|
774 | 774 | } |
775 | 775 | if (in_array('create', $methods, true)) { |
776 | 776 | $this->post($name, $newName . '::create', $options + [ |
777 | - 'as' => $name . '.create', |
|
778 | - ]); |
|
777 | + 'as' => $name . '.create', |
|
778 | + ]); |
|
779 | 779 | } |
780 | 780 | if (in_array('update', $methods, true)) { |
781 | - $this->match(['put', 'patch'], $name . '/' . $id, $newName . '::update/$1', $options + [ |
|
782 | - 'as' => $name . '.update', |
|
783 | - ]); |
|
781 | + $this->match(['put', 'patch'], $name . '/' . $id, $newName . '::update/$1', $options + [ |
|
782 | + 'as' => $name . '.update', |
|
783 | + ]); |
|
784 | 784 | } |
785 | 785 | if (in_array('delete', $methods, true)) { |
786 | 786 | $this->delete($name . '/' . $id, $newName . '::delete/$1', $options + [ |
787 | - 'as' => $name . '.delete', |
|
788 | - ]); |
|
787 | + 'as' => $name . '.delete', |
|
788 | + ]); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | // Websafe ? la suppression doit être vérifiée avant la mise à jour en raison du nom de la méthode |
792 | 792 | if (isset($options['websafe'])) { |
793 | 793 | if (in_array('delete', $methods, true)) { |
794 | 794 | $this->post($name . '/' . $id . '/delete', $newName . '::delete/$1', $options + [ |
795 | - 'as' => $name . '.websafe.delete', |
|
796 | - ]); |
|
795 | + 'as' => $name . '.websafe.delete', |
|
796 | + ]); |
|
797 | 797 | } |
798 | 798 | if (in_array('update', $methods, true)) { |
799 | 799 | $this->post($name . '/' . $id, $newName . '::update/$1', $options + [ |
800 | - 'as' => $name . '.websafe.update', |
|
801 | - ]); |
|
800 | + 'as' => $name . '.websafe.update', |
|
801 | + ]); |
|
802 | 802 | } |
803 | 803 | } |
804 | 804 | |
@@ -865,49 +865,49 @@ discard block |
||
865 | 865 | |
866 | 866 | if (in_array('index', $methods, true)) { |
867 | 867 | $this->get($name, $newName . '::index', $options + [ |
868 | - 'as' => $name . '.index', |
|
869 | - ]); |
|
868 | + 'as' => $name . '.index', |
|
869 | + ]); |
|
870 | 870 | } |
871 | 871 | if (in_array('show', $methods, true)) { |
872 | 872 | $this->get($name . '/show/' . $id, $newName . '::show/$1', $options + [ |
873 | - 'as' => $name . '.view' |
|
874 | - ]); |
|
875 | - $this->get($name . '/' . $id, $newName . '::show/$1', $options + [ |
|
876 | - 'as' => $name . '.show' |
|
877 | - ]); |
|
873 | + 'as' => $name . '.view' |
|
874 | + ]); |
|
875 | + $this->get($name . '/' . $id, $newName . '::show/$1', $options + [ |
|
876 | + 'as' => $name . '.show' |
|
877 | + ]); |
|
878 | 878 | } |
879 | 879 | if (in_array('new', $methods, true)) { |
880 | 880 | $this->get($name . '/new', $newName . '::new', $options + [ |
881 | - 'as' => $name . '.new' |
|
882 | - ]); |
|
881 | + 'as' => $name . '.new' |
|
882 | + ]); |
|
883 | 883 | } |
884 | 884 | if (in_array('create', $methods, true)) { |
885 | 885 | $this->post($name . '/create', $newName . '::create', $options + [ |
886 | - 'as' => $name . '.create' |
|
887 | - ]); |
|
888 | - $this->post($name, $newName . '::create', $options + [ |
|
889 | - 'as' => $name . '.store' |
|
890 | - ]); |
|
886 | + 'as' => $name . '.create' |
|
887 | + ]); |
|
888 | + $this->post($name, $newName . '::create', $options + [ |
|
889 | + 'as' => $name . '.store' |
|
890 | + ]); |
|
891 | 891 | } |
892 | 892 | if (in_array('edit', $methods, true)) { |
893 | 893 | $this->get($name . '/edit/' . $id, $newName . '::edit/$1', $options + [ |
894 | - 'as' => $name . '.edit' |
|
895 | - ]); |
|
894 | + 'as' => $name . '.edit' |
|
895 | + ]); |
|
896 | 896 | } |
897 | 897 | if (in_array('update', $methods, true)) { |
898 | 898 | $this->post($name . '/update/' . $id, $newName . '::update/$1', $options + [ |
899 | - 'as' => $name . '.update', |
|
900 | - ]); |
|
899 | + 'as' => $name . '.update', |
|
900 | + ]); |
|
901 | 901 | } |
902 | 902 | if (in_array('remove', $methods, true)) { |
903 | 903 | $this->get($name . '/remove/' . $id, $newName . '::remove/$1', $options + [ |
904 | - 'as' => $name . '.remove', |
|
905 | - ]); |
|
904 | + 'as' => $name . '.remove', |
|
905 | + ]); |
|
906 | 906 | } |
907 | 907 | if (in_array('delete', $methods, true)) { |
908 | 908 | $this->post($name . '/delete/' . $id, $newName . '::delete/$1', $options + [ |
909 | - 'as' => $name . '.delete', |
|
910 | - ]); |
|
909 | + 'as' => $name . '.delete', |
|
910 | + ]); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | return $this; |
@@ -1424,15 +1424,15 @@ discard block |
||
1424 | 1424 | return array_shift($host); |
1425 | 1425 | } |
1426 | 1426 | |
1427 | - /** |
|
1428 | - * Formate le nom des routes |
|
1429 | - */ |
|
1430 | - private function formatRouteName(string $name): string |
|
1431 | - { |
|
1432 | - $name = trim($name, '/'); |
|
1427 | + /** |
|
1428 | + * Formate le nom des routes |
|
1429 | + */ |
|
1430 | + private function formatRouteName(string $name): string |
|
1431 | + { |
|
1432 | + $name = trim($name, '/'); |
|
1433 | 1433 | |
1434 | - return strtolower(str_replace(['/', '\\', '_', '.', ' '], '.', $name)); |
|
1435 | - } |
|
1434 | + return strtolower(str_replace(['/', '\\', '_', '.', ' '], '.', $name)); |
|
1435 | + } |
|
1436 | 1436 | |
1437 | 1437 | private function getControllerName(Closure|string $handler): ?string |
1438 | 1438 | { |
@@ -269,7 +269,7 @@ |
||
269 | 269 | */ |
270 | 270 | private function attribute(string $key, $value): self |
271 | 271 | { |
272 | - if (! in_array($key, $this->allowedAttributes, true)) { |
|
272 | + if (!in_array($key, $this->allowedAttributes, true)) { |
|
273 | 273 | throw new InvalidArgumentException("L'attribute [{$key}] n'existe pas."); |
274 | 274 | } |
275 | 275 |
@@ -647,7 +647,7 @@ |
||
647 | 647 | } |
648 | 648 | |
649 | 649 | return ($action === 'encrypt') ? base64_encode($return) : $return; |
650 | - // On renvoie la chaine encrypter ou decrypter |
|
650 | + // On renvoie la chaine encrypter ou decrypter |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | /** |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | function scl_upLoad($input, $path = '', $size = 2500000, $type = '', $output = '') |
28 | 28 | { |
29 | 29 | // taille par défaut |
30 | - $size = (empty($size) || ! is_numeric($size)) ? 2500000 : $size; |
|
30 | + $size = (empty($size) || !is_numeric($size)) ? 2500000 : $size; |
|
31 | 31 | // Le dossier par defaut est la racine |
32 | - $path = (! empty($path) && ! file_exists($path)) ? '' : htmlspecialchars($path); |
|
32 | + $path = (!empty($path) && !file_exists($path)) ? '' : htmlspecialchars($path); |
|
33 | 33 | |
34 | - if (! is_array($input)) { |
|
34 | + if (!is_array($input)) { |
|
35 | 35 | return [0, 'Entrée non valide']; |
36 | 36 | } |
37 | 37 | if (empty($input['tmp_name']) || empty($input['name']) || empty($input['size'])) { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - if (! in_array(strtolower(pathinfo($input['name'])['extension']), $extensions, true)) { |
|
112 | + if (!in_array(strtolower(pathinfo($input['name'])['extension']), $extensions, true)) { |
|
113 | 113 | return [3, 'Extension non prise en charge']; |
114 | 114 | } |
115 | 115 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $output = 'scl_' . date('Ymd') . '-' . date('His'); |
126 | 126 | $extension = '0.'; |
127 | 127 | } else { // Si on defini le nom de sortie... |
128 | - if (! empty(explode('.', $output)[1]) && in_array(strtolower(explode('.', $output)[1]), $extensions, true)) { // Si l'extension est presente dans ce nom et est valide... |
|
128 | + if (!empty(explode('.', $output)[1]) && in_array(strtolower(explode('.', $output)[1]), $extensions, true)) { // Si l'extension est presente dans ce nom et est valide... |
|
129 | 129 | $out = explode('.', $output); |
130 | 130 | $output = $out[0]; // On enregistre le fichier avec le nom specifié |
131 | 131 | $extension = '1.' . $out[1]; // On enregistre le fichier avec l'extension specifié (changement d'extension) |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | // si le fichier n'a pas été téléchargé |
147 | - if (! move_uploaded_file($input['tmp_name'], $path . $output . '.' . $extension)) { |
|
147 | + if (!move_uploaded_file($input['tmp_name'], $path . $output . '.' . $extension)) { |
|
148 | 148 | return [4, 'Erreur de téléversement']; |
149 | 149 | } |
150 | 150 | |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | function scl_minimizeImg($src, $size = [], $relative = false) |
166 | 166 | { |
167 | 167 | // Si le fichier n'existe pas |
168 | - if (! file_exists($src)) { |
|
168 | + if (!file_exists($src)) { |
|
169 | 169 | return [0, 'Fichier inexistant']; |
170 | 170 | } |
171 | 171 | // Si on n'envoi pas un tableau ou un nombre comme tailles |
172 | - if (empty($size) || (! is_array($size) && ! is_int($size))) { |
|
172 | + if (empty($size) || (!is_array($size) && !is_int($size))) { |
|
173 | 173 | return [1, 'Mauvaises dimensions de redimensionnement']; |
174 | 174 | } |
175 | 175 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | return [2, 'Violation du nombre de dimension']; |
181 | 181 | } |
182 | 182 | // Si l'un des element du tableau n'est pas un nombre |
183 | - if (! is_int($size[0]) || (! empty($size[1]) && ! is_int($size[1]))) { |
|
183 | + if (!is_int($size[0]) || (!empty($size[1]) && !is_int($size[1]))) { |
|
184 | 184 | return [3, 'Type de dimension inconnu']; |
185 | 185 | } |
186 | 186 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | { |
259 | 259 | // Valeurs par défaut |
260 | 260 | $nbr = (empty($nbr)) ? 8 : (int) $nbr; |
261 | - $nbr = (! is_int($nbr)) ? 8 : (int) $nbr; |
|
261 | + $nbr = (!is_int($nbr)) ? 8 : (int) $nbr; |
|
262 | 262 | $nbr = ($nbr < 3 || $nbr > 64) ? 8 : (int) $nbr; |
263 | 263 | |
264 | 264 | switch ($type) { |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | function scl_date($date, $format = 'D, d M Y', $interval = true, $fuseau = 'Europe/Paris') |
317 | 317 | { |
318 | 318 | // Valeurs par défaut |
319 | - $format = (empty($format) || ! is_string($format)) ? 'D, d M Y' : htmlspecialchars(trim($format)); // Le format de sortie, par défaut = D, d M Y |
|
320 | - $fuseau = (empty($fuseau) || ! is_string($fuseau)) ? 'Europe/Paris' : htmlspecialchars(trim($fuseau)); // fuseau horaire |
|
321 | - $interval = (! is_bool($interval)) ? true : $interval; // Specifie si on gere les intervales ou pas |
|
319 | + $format = (empty($format) || !is_string($format)) ? 'D, d M Y' : htmlspecialchars(trim($format)); // Le format de sortie, par défaut = D, d M Y |
|
320 | + $fuseau = (empty($fuseau) || !is_string($fuseau)) ? 'Europe/Paris' : htmlspecialchars(trim($fuseau)); // fuseau horaire |
|
321 | + $interval = (!is_bool($interval)) ? true : $interval; // Specifie si on gere les intervales ou pas |
|
322 | 322 | $interval = ($interval === false) ? false : true; // Specifie si on gere les intervales ou pas |
323 | 323 | |
324 | - $date = new DateTime($date); // On contruit la date |
|
324 | + $date = new DateTime($date); // On contruit la date |
|
325 | 325 | |
326 | 326 | // Si on ne gere pas les intervales |
327 | 327 | if ($interval === false) { |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | function scl_hash($str, $lenght = 128, $key = '') |
494 | 494 | { |
495 | 495 | // Valeur par defaut |
496 | - $lenght = (empty($lenght) || ! is_int($lenght)) ? 128 : $lenght; |
|
496 | + $lenght = (empty($lenght) || !is_int($lenght)) ? 128 : $lenght; |
|
497 | 497 | // Valeurs minimale et maximale pour le haché |
498 | 498 | $lenght = ($lenght < 50) ? 50 : $lenght; |
499 | 499 | $lenght = ($lenght > 200) ? 200 : $lenght; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | // Valeur par defaut |
541 | 541 | $action = strtolower($action); |
542 | 542 | $action = ($action !== 'decrypt') ? 'encrypt' : 'decrypt'; |
543 | - $repeat = (! is_int($repeat) || $repeat < 1) ? 0 : $repeat; |
|
543 | + $repeat = (!is_int($repeat) || $repeat < 1) ? 0 : $repeat; |
|
544 | 544 | |
545 | 545 | $chars = ''; // Les differents caractères entrés |
546 | 546 | $size = strlen($str); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', |
568 | 568 | 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', |
569 | 569 | ]; |
570 | - $chars = explode(' ', $chars); // On transforme la chaine précédement créée en tableau |
|
570 | + $chars = explode(' ', $chars); // On transforme la chaine précédement créée en tableau |
|
571 | 571 | $return = ''; |
572 | 572 | |
573 | 573 | // On parcours tout le dit tableau (ie. on recupere les caracteres un a un) |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | { |
666 | 666 | // Valeur par defaut |
667 | 667 | $str = htmlspecialchars($str); // On protege la chaine |
668 | - $size = (! is_numeric($size)) ? strlen($str) : $size; // Taille à couper |
|
668 | + $size = (!is_numeric($size)) ? strlen($str) : $size; // Taille à couper |
|
669 | 669 | |
670 | 670 | $lenght = strlen($str); // longueur de la chaine |
671 | 671 | if ($lenght > $size) { |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | { |
699 | 699 | // Valeur par defaut |
700 | 700 | $str = htmlspecialchars($str); // On protege la chaine |
701 | - $max = (! is_numeric($max)) ? strlen($str) : $max; // Taille à couper |
|
701 | + $max = (!is_numeric($max)) ? strlen($str) : $max; // Taille à couper |
|
702 | 702 | |
703 | 703 | $length = strlen($str); // Nombre de caractères |
704 | 704 | |
@@ -964,17 +964,17 @@ discard block |
||
964 | 964 | function scl_splitInt($nbr, $pas = 3, $separateur = ' ') |
965 | 965 | { |
966 | 966 | // Valeurs par défaut |
967 | - if (! is_numeric($nbr)) { |
|
967 | + if (!is_numeric($nbr)) { |
|
968 | 968 | return; |
969 | 969 | } |
970 | - $pas = (! empty($pas) && is_int($pas)) ? $pas : 3; |
|
970 | + $pas = (!empty($pas) && is_int($pas)) ? $pas : 3; |
|
971 | 971 | $separateur = (in_array($separateur, ['.', ' ', ',', '-', '/'], true)) ? $separateur : ' '; |
972 | 972 | |
973 | 973 | $return = ''; // Valeur renvoyée |
974 | 974 | |
975 | 975 | $nombre = explode('.', $nbr); |
976 | 976 | $nbr = $nombre[0]; |
977 | - $virgule = (! empty($nombre[1])) ? '.' . $nombre[1] : ''; |
|
977 | + $virgule = (!empty($nombre[1])) ? '.' . $nombre[1] : ''; |
|
978 | 978 | |
979 | 979 | $lenght = strlen($nbr); // nombre de chiffre |
980 | 980 | $nbr = strrev($nbr); // on inverse le nombre |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | |
1226 | 1226 | $return .= $trio[1] . ' ' . $secon[1] . ' ' . $prim[1]; |
1227 | 1227 | |
1228 | - if (! ($cent_c === '0' || $cent_c === '') || ! ($dix_c === '0' || $dix_c === '')) { |
|
1228 | + if (!($cent_c === '0' || $cent_c === '') || !($dix_c === '0' || $dix_c === '')) { |
|
1229 | 1229 | $return .= $trio_c . ' ' . $secon_c; |
1230 | 1230 | } |
1231 | 1231 |