@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | // Toujours là ? Ensuite, nous pouvons essayer de faire correspondre l'URI avec |
| 160 | 160 | // Contrôleurs/répertoires, mais l'application peut ne pas |
| 161 | 161 | // vouloir ceci, comme dans le cas des API. |
| 162 | - if (! $this->collection->shouldAutoRoute()) { |
|
| 162 | + if (!$this->collection->shouldAutoRoute()) { |
|
| 163 | 163 | $verb = strtolower($this->collection->getHTTPVerb()); |
| 164 | 164 | |
| 165 | 165 | throw new PageNotFoundException("Can't find a route for '{$verb}: {$uri}'."); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public function controllerName() |
| 189 | 189 | { |
| 190 | - if (! is_string($this->controller)) { |
|
| 190 | + if (!is_string($this->controller)) { |
|
| 191 | 191 | return $this->controller; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | return [ |
| 223 | 223 | $routeArray[0], // Controller |
| 224 | - $routeArray[1] ?? 'index', // Method |
|
| 224 | + $routeArray[1] ?? 'index', // Method |
|
| 225 | 225 | ]; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | // Cette route est-elle censée rediriger vers une autre ? |
| 346 | 346 | if ($this->collection->isRedirect($routeKey)) { |
| 347 | 347 | // remplacement des groupes de routes correspondants par des références : post/([0-9]+) -> post/$1 |
| 348 | - $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function () { |
|
| 348 | + $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function() { |
|
| 349 | 349 | static $i = 1; |
| 350 | 350 | |
| 351 | 351 | return '$' . $i++; |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | // Utilisons-nous Closures ? Si tel est le cas, nous devons collecter les paramètres dans un tableau |
| 372 | 372 | // afin qu'ils puissent être transmis ultérieurement à la méthode du contrôleur. |
| 373 | - if (! is_string($handler) && is_callable($handler)) { |
|
| 373 | + if (!is_string($handler) && is_callable($handler)) { |
|
| 374 | 374 | $this->controller = $handler; |
| 375 | 375 | |
| 376 | 376 | // Supprime la chaîne d'origine du tableau matches |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | // $this->method contient déjà le nom de la méthode par défaut, |
| 466 | 466 | // donc ne l'écrasez pas avec le vide. |
| 467 | - if (! empty($method)) { |
|
| 467 | + if (!empty($method)) { |
|
| 468 | 468 | $this->setMethod($method); |
| 469 | 469 | } |
| 470 | 470 | |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | $this->method = $this->collection->getDefaultMethod(); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - if (! is_file(CONTROLLER_PATH . $this->directory . $this->makeController($class) . '.php')) { |
|
| 490 | + if (!is_file(CONTROLLER_PATH . $this->directory . $this->makeController($class) . '.php')) { |
|
| 491 | 491 | return; |
| 492 | 492 | } |
| 493 | 493 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public function addPlaceholder($placeholder, ?string $pattern = null): self |
| 221 | 221 | { |
| 222 | - if (! is_array($placeholder)) { |
|
| 222 | + if (!is_array($placeholder)) { |
|
| 223 | 223 | $placeholder = [$placeholder => $pattern]; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | foreach ($collection as $name => $r) { |
| 406 | 406 | $key = key($r['route']); |
| 407 | 407 | |
| 408 | - if (! $withName) { |
|
| 408 | + if (!$withName) { |
|
| 409 | 409 | $routes[$key] = $r['route'][$key]; |
| 410 | 410 | } else { |
| 411 | 411 | $routes[$key] = [ |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | * |
| 787 | 787 | * @param array|Closure|string $to |
| 788 | 788 | */ |
| 789 | - public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self |
|
| 789 | + public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self |
|
| 790 | 790 | { |
| 791 | 791 | if (empty($from) || empty($to)) { |
| 792 | 792 | throw new InvalidArgumentException('You must supply the parameters: from, to.'); |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | $to = $route['route'][$from]; |
| 932 | 932 | |
| 933 | 933 | // on ignore les closures |
| 934 | - if (! is_string($to)) { |
|
| 934 | + if (!is_string($to)) { |
|
| 935 | 935 | continue; |
| 936 | 936 | } |
| 937 | 937 | |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | // Construire notre chaîne résultante, en insérant les $params dans |
| 1014 | 1014 | // les endroits appropriés. |
| 1015 | 1015 | foreach ($matches[0] as $index => $pattern) { |
| 1016 | - if (! preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
| 1016 | + if (!preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
| 1017 | 1017 | throw RouterException::invalidParameterType(); |
| 1018 | 1018 | } |
| 1019 | 1019 | |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | 1060 | // Limitation du nom d'hôte ? |
| 1061 | - if (! empty($options['hostname'])) { |
|
| 1061 | + if (!empty($options['hostname'])) { |
|
| 1062 | 1062 | // @todo determine if there's a way to whitelist hosts? |
| 1063 | 1063 | if (isset($_SERVER['HTTP_HOST']) && strtolower($_SERVER['HTTP_HOST']) !== strtolower($options['hostname'])) { |
| 1064 | 1064 | return; |
@@ -1068,10 +1068,10 @@ discard block |
||
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | // Limitation du nom sous-domaine ? |
| 1071 | - elseif (! empty($options['subdomain'])) { |
|
| 1071 | + elseif (!empty($options['subdomain'])) { |
|
| 1072 | 1072 | // Si nous ne correspondons pas au sous-domaine actuel, alors |
| 1073 | 1073 | // nous n'avons pas besoin d'ajouter la route. |
| 1074 | - if (! $this->checkSubdomains($options['subdomain'])) { |
|
| 1074 | + if (!$this->checkSubdomains($options['subdomain'])) { |
|
| 1075 | 1075 | return; |
| 1076 | 1076 | } |
| 1077 | 1077 | |
@@ -1102,7 +1102,7 @@ discard block |
||
| 1102 | 1102 | } |
| 1103 | 1103 | |
| 1104 | 1104 | // S'il s'agit d'une redirection, aucun traitement |
| 1105 | - if (! isset($options['redirect']) && is_string($to)) { |
|
| 1105 | + if (!isset($options['redirect']) && is_string($to)) { |
|
| 1106 | 1106 | // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut |
| 1107 | 1107 | if (strpos($to, '\\') === false || strpos($to, '\\') > 0) { |
| 1108 | 1108 | $namespace = $options['namespace'] ?? $this->defaultNamespace; |
@@ -1120,7 +1120,7 @@ discard block |
||
| 1120 | 1120 | // les routes manuelement définies doivent toujours être la "source de vérité". |
| 1121 | 1121 | // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant |
| 1122 | 1122 | // pour tenter de router la requête. |
| 1123 | - if (isset($this->routes[$verb][$name]) && ! $overwrite) { |
|
| 1123 | + if (isset($this->routes[$verb][$name]) && !$overwrite) { |
|
| 1124 | 1124 | return; |
| 1125 | 1125 | } |
| 1126 | 1126 | |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | private function checkSubdomains($subdomains): bool |
| 1146 | 1146 | { |
| 1147 | 1147 | // Les appels CLI ne peuvent pas être sur le sous-domaine. |
| 1148 | - if (! isset($_SERVER['HTTP_HOST'])) { |
|
| 1148 | + if (!isset($_SERVER['HTTP_HOST'])) { |
|
| 1149 | 1149 | return false; |
| 1150 | 1150 | } |
| 1151 | 1151 | |
@@ -1153,13 +1153,13 @@ discard block |
||
| 1153 | 1153 | $this->currentSubdomain = $this->determineCurrentSubdomain(); |
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | - if (! is_array($subdomains)) { |
|
| 1156 | + if (!is_array($subdomains)) { |
|
| 1157 | 1157 | $subdomains = [$subdomains]; |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant, |
| 1161 | 1161 | // il nécessite la présence d'un sous-domaine. |
| 1162 | - if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
| 1162 | + if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
| 1163 | 1163 | return true; |
| 1164 | 1164 | } |
| 1165 | 1165 | |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | $controllers = []; |
| 1286 | 1286 | |
| 1287 | 1287 | foreach ($routes as $handler) { |
| 1288 | - if (! is_string($handler)) { |
|
| 1288 | + if (!is_string($handler)) { |
|
| 1289 | 1289 | continue; |
| 1290 | 1290 | } |
| 1291 | 1291 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | parent::init($config); |
| 71 | 71 | |
| 72 | 72 | if ($this->_config['path'] === null) { |
| 73 | - $this->_config['path'] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'blitz-php' .DIRECTORY_SEPARATOR .'cache' . DIRECTORY_SEPARATOR; |
|
| 73 | + $this->_config['path'] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'blitz-php' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR; |
|
| 74 | 74 | } |
| 75 | 75 | if (substr($this->_config['path'], -1) !== DIRECTORY_SEPARATOR) { |
| 76 | 76 | $this->_config['path'] .= DIRECTORY_SEPARATOR; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function set($key, $value, $ttl = null): bool |
| 89 | 89 | { |
| 90 | - if ($value === '' || ! $this->_init) { |
|
| 90 | + if ($value === '' || !$this->_init) { |
|
| 91 | 91 | return false; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if (! empty($this->_config['serialize'])) { |
|
| 100 | + if (!empty($this->_config['serialize'])) { |
|
| 101 | 101 | $value = serialize($value); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | $key = $this->_key($key); |
| 132 | 132 | |
| 133 | - if (! $this->_init || $this->_setKey($key) === false) { |
|
| 133 | + if (!$this->_init || $this->_setKey($key) === false) { |
|
| 134 | 134 | return $default; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $data = trim($data); |
| 169 | 169 | |
| 170 | - if ($data !== '' && ! empty($this->_config['serialize'])) { |
|
| 170 | + if ($data !== '' && !empty($this->_config['serialize'])) { |
|
| 171 | 171 | $data = unserialize($data); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | $key = $this->_key($key); |
| 183 | 183 | |
| 184 | - if ($this->_setKey($key) === false || ! $this->_init) { |
|
| 184 | + if ($this->_setKey($key) === false || !$this->_init) { |
|
| 185 | 185 | return false; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | public function clear(): bool |
| 205 | 205 | { |
| 206 | - if (! $this->_init) { |
|
| 206 | + if (!$this->_init) { |
|
| 207 | 207 | return false; |
| 208 | 208 | } |
| 209 | 209 | $this->_File = null; |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | $realPath = $fileInfo->getRealPath(); |
| 231 | - if (! $realPath) { |
|
| 231 | + if (!$realPath) { |
|
| 232 | 232 | unset($fileInfo); |
| 233 | 233 | |
| 234 | 234 | continue; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $path = $realPath . DIRECTORY_SEPARATOR; |
| 238 | - if (! in_array($path, $cleared, true)) { |
|
| 238 | + if (!in_array($path, $cleared, true)) { |
|
| 239 | 239 | $this->_clearDirectory($path); |
| 240 | 240 | $cleared[] = $path; |
| 241 | 241 | } |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | protected function _clearDirectory(string $path): void |
| 258 | 258 | { |
| 259 | - if (! is_dir($path)) { |
|
| 259 | + if (!is_dir($path)) { |
|
| 260 | 260 | return; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | $dir = dir($path); |
| 264 | - if (! $dir) { |
|
| 264 | + if (!$dir) { |
|
| 265 | 265 | return; |
| 266 | 266 | } |
| 267 | 267 | |
@@ -327,13 +327,13 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | $dir = $this->_config['path'] . $groups; |
| 329 | 329 | |
| 330 | - if (! is_dir($dir)) { |
|
| 330 | + if (!is_dir($dir)) { |
|
| 331 | 331 | mkdir($dir, 0775, true); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | $path = new SplFileInfo($dir . $key); |
| 335 | 335 | |
| 336 | - if (! $createKey && ! $path->isFile()) { |
|
| 336 | + if (!$createKey && !$path->isFile()) { |
|
| 337 | 337 | return false; |
| 338 | 338 | } |
| 339 | 339 | if ( |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | unset($path); |
| 354 | 354 | |
| 355 | - if (! $exists && ! chmod($this->_File->getPathname(), (int) $this->_config['mask'])) { |
|
| 355 | + if (!$exists && !chmod($this->_File->getPathname(), (int) $this->_config['mask'])) { |
|
| 356 | 356 | trigger_error(sprintf( |
| 357 | 357 | 'Could not apply permission mask "%s" on cache file "%s"', |
| 358 | 358 | $this->_File->getPathname(), |
@@ -372,14 +372,14 @@ discard block |
||
| 372 | 372 | $dir = new SplFileInfo($this->_config['path']); |
| 373 | 373 | $path = $dir->getPathname(); |
| 374 | 374 | $success = true; |
| 375 | - if (! is_dir($path)) { |
|
| 375 | + if (!is_dir($path)) { |
|
| 376 | 376 | // phpcs:disable |
| 377 | 377 | $success = @mkdir($path, 0775, true); |
| 378 | 378 | // phpcs:enable |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | $isWritableDir = ($dir->isDir() && $dir->isWritable()); |
| 382 | - if (! $success || ($this->_init && ! $isWritableDir)) { |
|
| 382 | + if (!$success || ($this->_init && !$isWritableDir)) { |
|
| 383 | 383 | $this->_init = false; |
| 384 | 384 | trigger_error(sprintf( |
| 385 | 385 | '%s is not writable', |
@@ -423,8 +423,8 @@ discard block |
||
| 423 | 423 | ); |
| 424 | 424 | $filtered = new CallbackFilterIterator( |
| 425 | 425 | $contents, |
| 426 | - static function (SplFileInfo $current) use ($group, $prefix) { |
|
| 427 | - if (! $current->isFile()) { |
|
| 426 | + static function(SplFileInfo $current) use ($group, $prefix) { |
|
| 427 | + if (!$current->isFile()) { |
|
| 428 | 428 | return false; |
| 429 | 429 | } |
| 430 | 430 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $returned = $payload->data ?? $payload; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if (! $full) { |
|
| 117 | + if (!$full) { |
|
| 118 | 118 | unset($returned->iat, $returned->iss, $returned->exp); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | $authorization = self::getAuthorization(); |
| 146 | 146 | |
| 147 | - if (! empty($authorization) && preg_match('/Bearer\s(\S+)/', $authorization, $matches)) { |
|
| 147 | + if (!empty($authorization) && preg_match('/Bearer\s(\S+)/', $authorization, $matches)) { |
|
| 148 | 148 | return $matches[1]; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $this->getModel(); |
| 94 | 94 | |
| 95 | - if (! empty($this->helpers)) { |
|
| 95 | + if (!empty($this->helpers)) { |
|
| 96 | 96 | helper($this->helpers); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | $this->modelName = is_object($which) ? null : $which; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if (empty($this->model) && ! empty($this->modelName) && class_exists($this->modelName)) { |
|
| 113 | + if (empty($this->model) && !empty($this->modelName) && class_exists($this->modelName)) { |
|
| 114 | 114 | // $this->model = model($this->modelName); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if (! empty($this->model) && empty($this->modelName)) { |
|
| 117 | + if (!empty($this->model) && empty($this->modelName)) { |
|
| 118 | 118 | $this->modelName = get_class($this->model); |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | private function getModel() |
| 154 | 154 | { |
| 155 | - if (! empty($this->modelName)) { |
|
| 155 | + if (!empty($this->modelName)) { |
|
| 156 | 156 | $this->setModel($this->modelName); |
| 157 | 157 | |
| 158 | 158 | return; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $this->config = (object) config('rest'); |
| 73 | 73 | |
| 74 | 74 | $locale = $this->config->language ?? null; |
| 75 | - $this->locale = ! empty($locale) ? $locale : $this->request->getLocale(); |
|
| 75 | + $this->locale = !empty($locale) ? $locale : $this->request->getLocale(); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function _remap(string $method, array $params = []) |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $class = static::class; |
| 81 | 81 | |
| 82 | 82 | // Bien sûr qu'il existe, mais peuvent-ils en faire quelque chose ? |
| 83 | - if (! method_exists($class, $method)) { |
|
| 83 | + if (!method_exists($class, $method)) { |
|
| 84 | 84 | return $this->respondNotImplemented($this->_translate('notImplemented', [$class, $method])); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | return Services::injector()->call([$instance, $method], (array) $params); |
| 103 | 103 | } catch (Throwable $ex) { |
| 104 | - if (! on_dev()) { |
|
| 104 | + if (!on_dev()) { |
|
| 105 | 105 | $url = explode('?', $this->request->getRequestTarget())[0]; |
| 106 | 106 | |
| 107 | 107 | return $this->respondBadRequest($this->_translate('badUsed', [$url])); |
@@ -150,18 +150,18 @@ discard block |
||
| 150 | 150 | final protected function respondFail(?string $message = "Une erreur s'est produite", ?int $status = StatusCode::INTERNAL_ERROR, int|string|null $code = null, array $errors = []) |
| 151 | 151 | { |
| 152 | 152 | $message = $message ?: "Une erreur s'est produite"; |
| 153 | - $code = ! empty($code) ? $code : $status; |
|
| 153 | + $code = !empty($code) ? $code : $status; |
|
| 154 | 154 | |
| 155 | 155 | $response = [ |
| 156 | 156 | $this->config->field['message'] ?? 'message' => $message, |
| 157 | 157 | ]; |
| 158 | - if (! empty($this->config->field['status'])) { |
|
| 158 | + if (!empty($this->config->field['status'])) { |
|
| 159 | 159 | $response[$this->config->field['status']] = false; |
| 160 | 160 | } |
| 161 | - if (! empty($this->config->field['code'])) { |
|
| 161 | + if (!empty($this->config->field['code'])) { |
|
| 162 | 162 | $response[$this->config->field['code']] = $code; |
| 163 | 163 | } |
| 164 | - if (! empty($errors)) { |
|
| 164 | + if (!empty($errors)) { |
|
| 165 | 165 | $response[$this->config->field['errors'] ?? 'errors'] = $errors; |
| 166 | 166 | } |
| 167 | 167 | |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | final protected function respondSuccess(?string $message = 'Resultat', $result = null, ?int $status = StatusCode::OK) |
| 183 | 183 | { |
| 184 | 184 | $message = $message ?: 'Resultat'; |
| 185 | - $status = ! empty($status) ? $status : StatusCode::OK; |
|
| 185 | + $status = !empty($status) ? $status : StatusCode::OK; |
|
| 186 | 186 | |
| 187 | 187 | $response = [ |
| 188 | 188 | $this->config->field['message'] ?? 'message' => $message, |
| 189 | 189 | ]; |
| 190 | - if (! empty($this->config->field['status'])) { |
|
| 190 | + if (!empty($this->config->field['status'])) { |
|
| 191 | 191 | $response[$this->config->field['status']] = true; |
| 192 | 192 | } |
| 193 | 193 | if (is_array($result)) { |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | final protected function allowedMethods(string ...$methods): self |
| 301 | 301 | { |
| 302 | - if (! empty($methods)) { |
|
| 302 | + if (!empty($methods)) { |
|
| 303 | 303 | $this->config->allowed_methods = array_map(static fn ($str) => strtoupper($str), $methods); |
| 304 | 304 | } |
| 305 | 305 | |
@@ -397,13 +397,13 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | // Si la méthode de format existe, appelle et renvoie la sortie dans ce format |
| 400 | - if (! empty($mime)) { |
|
| 400 | + if (!empty($mime)) { |
|
| 401 | 401 | $output = Formatter::type($mime)->format($data); |
| 402 | 402 | |
| 403 | 403 | // Définit l'en-tête du format |
| 404 | 404 | // Ensuite, vérifiez si le client a demandé un rappel, et si la sortie contient ce rappel : |
| 405 | 405 | $callback = $this->request->getQuery('callback'); |
| 406 | - if (! empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) { |
|
| 406 | + if (!empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) { |
|
| 407 | 407 | $this->response = $this->response->withType($this->mimes['jsonp']); |
| 408 | 408 | } else { |
| 409 | 409 | $this->response = $this->response->withType($mime === $this->mimes['array'] ? $this->mimes['json'] : $mime); |
@@ -459,22 +459,22 @@ discard block |
||
| 459 | 459 | private function checkProcess(): bool|ResponseInterface |
| 460 | 460 | { |
| 461 | 461 | // Verifie si la requete est en ajax |
| 462 | - if (! $this->request->is('ajax') && $this->config->ajax_only) { |
|
| 462 | + if (!$this->request->is('ajax') && $this->config->ajax_only) { |
|
| 463 | 463 | return $this->respondNotAcceptable($this->_translate('ajaxOnly')); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | // Verifie si la requete est en https |
| 467 | - if (! $this->request->is('https') && $this->config->force_https) { |
|
| 467 | + if (!$this->request->is('https') && $this->config->force_https) { |
|
| 468 | 468 | return $this->respondForbidden($this->_translate('unsupported')); |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | // Verifie si la methode utilisee pour la requete est autorisee |
| 472 | - if (! in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) { |
|
| 472 | + if (!in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) { |
|
| 473 | 473 | return $this->respondNotAcceptable($this->_translate('unknownMethod')); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | // Verifie que l'ip qui emet la requete n'est pas dans la blacklist |
| 477 | - if (! empty($this->config->ip_blacklis)) { |
|
| 477 | + if (!empty($this->config->ip_blacklis)) { |
|
| 478 | 478 | $this->config->ip_blacklist = implode(',', $this->config->ip_blacklist); |
| 479 | 479 | |
| 480 | 480 | // Correspond à une adresse IP dans une liste noire, par ex. 127.0.0.0, 0.0.0.0 |
@@ -487,20 +487,20 @@ discard block |
||
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | // Verifie que l'ip qui emet la requete est dans la whitelist |
| 490 | - if (! empty($this->config->ip_whitelist)) { |
|
| 490 | + if (!empty($this->config->ip_whitelist)) { |
|
| 491 | 491 | $whitelist = $this->config->ip_whitelist; |
| 492 | 492 | array_push($whitelist, '127.0.0.1', '0.0.0.0'); |
| 493 | 493 | |
| 494 | 494 | // coupez les espaces de début et de fin des ip |
| 495 | 495 | $whitelist = array_map('trim', $whitelist); |
| 496 | 496 | |
| 497 | - if (! in_array($this->request->clientIp(), $whitelist, true)) { |
|
| 497 | + if (!in_array($this->request->clientIp(), $whitelist, true)) { |
|
| 498 | 498 | return $this->respondUnauthorized($this->_translate('ipUnauthorized')); |
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | // Verifie l'authentification du client |
| 503 | - if (false !== $this->config->auth && ! $this->request->is('options')) { |
|
| 503 | + if (false !== $this->config->auth && !$this->request->is('options')) { |
|
| 504 | 504 | if ('bearer' === strtolower($this->config->auth)) { |
| 505 | 505 | $token = $this->getBearerToken(); |
| 506 | 506 | if (empty($token)) { |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // ================================= ================================= // |
| 26 | 26 | |
| 27 | -if (! function_exists('site_url')) { |
|
| 27 | +if (!function_exists('site_url')) { |
|
| 28 | 28 | /** |
| 29 | 29 | * Renvoie une URL de site telle que définie par la configuration de l'application. |
| 30 | 30 | * |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if (! function_exists('base_url')) { |
|
| 51 | +if (!function_exists('base_url')) { |
|
| 52 | 52 | /** |
| 53 | 53 | * Renvoie l'URL de base telle que définie par la configuration de l'application. |
| 54 | 54 | * Les URL de base sont des URL de site coupées sans la page d'index. |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | -if (! function_exists('current_url')) { |
|
| 70 | +if (!function_exists('current_url')) { |
|
| 71 | 71 | /** |
| 72 | 72 | * Renvoie l'URL complète (y compris les segments) de la page où cette fonction est placée |
| 73 | 73 | * |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -if (! function_exists('previous_url')) { |
|
| 97 | +if (!function_exists('previous_url')) { |
|
| 98 | 98 | /** |
| 99 | 99 | * Renvoie l'URL précédente sur laquelle se trouvait le visiteur actuel. Pour des raisons de sécurité |
| 100 | 100 | * nous vérifions d'abord une variable de session enregistrée, si elle existe, et l'utilisons. |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | -if (! function_exists('uri_string')) { |
|
| 122 | +if (!function_exists('uri_string')) { |
|
| 123 | 123 | /** |
| 124 | 124 | * Renvoie la partie chemin de l'URL actuelle |
| 125 | 125 | * |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | -if (! function_exists('index_page')) { |
|
| 136 | +if (!function_exists('index_page')) { |
|
| 137 | 137 | /** |
| 138 | 138 | * Renvoie la "index_page" de votre fichier de configuration |
| 139 | 139 | */ |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | -if (! function_exists('anchor')) { |
|
| 146 | +if (!function_exists('anchor')) { |
|
| 147 | 147 | /** |
| 148 | 148 | * Crée une ancre basée sur l'URL locale. |
| 149 | 149 | * |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | -if (! function_exists('anchor_popup')) { |
|
| 171 | +if (!function_exists('anchor_popup')) { |
|
| 172 | 172 | /** |
| 173 | 173 | * Lien d'ancrage - Version contextuelle |
| 174 | 174 | * |
@@ -191,12 +191,12 @@ discard block |
||
| 191 | 191 | return '<a href="' . $siteUrl . '" onclick="window.open(\'' . $siteUrl . "', '_blank'); return false;\">" . $title . '</a>'; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if (! is_array($attributes)) { |
|
| 194 | + if (!is_array($attributes)) { |
|
| 195 | 195 | $attributes = [$attributes]; |
| 196 | 196 | |
| 197 | 197 | // Ref: http://www.w3schools.com/jsref/met_win_open.asp |
| 198 | 198 | $windowName = '_blank'; |
| 199 | - } elseif (! empty($attributes['window_name'])) { |
|
| 199 | + } elseif (!empty($attributes['window_name'])) { |
|
| 200 | 200 | $windowName = $attributes['window_name']; |
| 201 | 201 | unset($attributes['window_name']); |
| 202 | 202 | } else { |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | -if (! function_exists('mailto')) { |
|
| 219 | +if (!function_exists('mailto')) { |
|
| 220 | 220 | /** |
| 221 | 221 | * Lien Mailto |
| 222 | 222 | * |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | -if (! function_exists('safe_mailto')) { |
|
| 236 | +if (!function_exists('safe_mailto')) { |
|
| 237 | 237 | /** |
| 238 | 238 | * Lien Mailto codé |
| 239 | 239 | * |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | -if (! function_exists('auto_link')) { |
|
| 325 | +if (!function_exists('auto_link')) { |
|
| 326 | 326 | /** |
| 327 | 327 | * Lien automatique |
| 328 | 328 | * |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | function auto_link(string $str, string $type = 'both', bool $popup = false): string |
| 338 | 338 | { |
| 339 | 339 | // Recherche et remplace tous les URLs. |
| 340 | - if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { |
|
| 340 | + if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE|PREG_SET_ORDER)) { |
|
| 341 | 341 | // Définissez notre HTML cible si vous utilisez des liens contextuels. |
| 342 | 342 | $target = ($popup) ? ' target="_blank"' : ''; |
| 343 | 343 | |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | -if (! function_exists('prep_url')) { |
|
| 371 | +if (!function_exists('prep_url')) { |
|
| 372 | 372 | /** |
| 373 | 373 | * Ajoute simplement la partie http:// ou https:// si aucun schéma n'est inclus. |
| 374 | 374 | * |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | -if (! function_exists('url_title')) { |
|
| 396 | +if (!function_exists('url_title')) { |
|
| 397 | 397 | /** |
| 398 | 398 | * Créer un titre d'URL |
| 399 | 399 | * |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | -if (! function_exists('mb_url_title')) { |
|
| 432 | +if (!function_exists('mb_url_title')) { |
|
| 433 | 433 | /** |
| 434 | 434 | * Créer un titre d'URL qui prend en compte les caractères accentués |
| 435 | 435 | * |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | } |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | -if (! function_exists('url_to')) { |
|
| 451 | +if (!function_exists('url_to')) { |
|
| 452 | 452 | /** |
| 453 | 453 | * Obtenir l'URL complète et absolue d'une méthode de contrôleur |
| 454 | 454 | * (avec arguments supplémentaires) |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | */ |
| 462 | 462 | function url_to(string $controller, ...$args): string |
| 463 | 463 | { |
| 464 | - if (! $route = link_to($controller, ...$args)) { |
|
| 464 | + if (!$route = link_to($controller, ...$args)) { |
|
| 465 | 465 | $explode = explode('::', $controller); |
| 466 | 466 | |
| 467 | 467 | if (isset($explode[1])) { |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | -if (! function_exists('url_is')) { |
|
| 478 | +if (!function_exists('url_is')) { |
|
| 479 | 479 | /** |
| 480 | 480 | * Détermine si le chemin d'URL actuel contient le chemin donné. |
| 481 | 481 | * Il peut contenir un caractère générique (*) qui autorisera tout caractère valide. |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | -if (! function_exists('clean_url')) { |
|
| 496 | +if (!function_exists('clean_url')) { |
|
| 497 | 497 | function clean_url(string $url): string |
| 498 | 498 | { |
| 499 | 499 | return Helpers::cleanUrl($url); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | use BlitzPHP\Loader\Filesystem; |
| 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 | |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | */ |
| 94 | 94 | function show404(string $message = 'The page you requested was not found.', string $heading = 'Page Not Found', array $params = []) |
| 95 | 95 | { |
| 96 | - throw PageNotFoundException::pageNotFound($message); |
|
| 96 | + throw PageNotFoundException::pageNotFound($message); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | // ================================= FONCTIONS D'ACCESSIBILITE ================================= // |
| 23 | 23 | |
| 24 | -if (! function_exists('env')) { |
|
| 24 | +if (!function_exists('env')) { |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -if (! function_exists('helper')) { |
|
| 41 | +if (!function_exists('helper')) { |
|
| 42 | 42 | /** |
| 43 | 43 | * Charge un fichier d'aide en mémoire. Prend en charge les assistants d'espace de noms, |
| 44 | 44 | * à 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('service')) { |
|
| 59 | +if (!function_exists('service')) { |
|
| 60 | 60 | /** |
| 61 | 61 | * Permet un accès plus propre au fichier de configuration des services. |
| 62 | 62 | * Renvoie toujours une instance SHARED de la classe, donc |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | -if (! function_exists('single_service')) { |
|
| 76 | +if (!function_exists('single_service')) { |
|
| 77 | 77 | /** |
| 78 | 78 | * Autoriser l'accès propre à un service. |
| 79 | 79 | * Renvoie toujours une nouvelle instance de la classe. |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | -if (! function_exists('show404')) { |
|
| 90 | +if (!function_exists('show404')) { |
|
| 91 | 91 | /** |
| 92 | 92 | * Afficher une page 404 introuvable dans le navigateur |
| 93 | 93 | */ |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | -if (! function_exists('config')) { |
|
| 100 | +if (!function_exists('config')) { |
|
| 101 | 101 | /** |
| 102 | 102 | * GET/SET App config |
| 103 | 103 | * |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | function config(string $config, $value = null, bool $force_set = false) |
| 109 | 109 | { |
| 110 | - if (! empty($value) || (empty($value) && true === $force_set)) { |
|
| 110 | + if (!empty($value) || (empty($value) && true === $force_set)) { |
|
| 111 | 111 | Config::set($config, $value); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== // |
| 119 | 119 | |
| 120 | -if (! function_exists('esc')) { |
|
| 120 | +if (!function_exists('esc')) { |
|
| 121 | 121 | /** |
| 122 | 122 | * Effectue un simple échappement automatique des données pour des raisons de sécurité. |
| 123 | 123 | * Pourrait envisager de rendre cela plus complexe à une date ultérieure. |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | -if (! function_exists('h')) { |
|
| 147 | +if (!function_exists('h')) { |
|
| 148 | 148 | /** |
| 149 | 149 | * Méthode pratique pour htmlspecialchars. |
| 150 | 150 | * |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | -if (! function_exists('purify')) { |
|
| 166 | +if (!function_exists('purify')) { |
|
| 167 | 167 | /** |
| 168 | 168 | * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier. |
| 169 | 169 | * Utilisez facilement plusieurs configurations de purificateur. |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | -if (! function_exists('remove_invisible_characters')) { |
|
| 184 | +if (!function_exists('remove_invisible_characters')) { |
|
| 185 | 185 | /** |
| 186 | 186 | * Supprimer les caractères invisibles |
| 187 | 187 | * |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | -if (! function_exists('stringify_attributes')) { |
|
| 197 | +if (!function_exists('stringify_attributes')) { |
|
| 198 | 198 | /** |
| 199 | 199 | * Chaîner les attributs à utiliser dans les balises HTML. |
| 200 | 200 | * |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= // |
| 210 | 210 | |
| 211 | -if (! function_exists('on_dev')) { |
|
| 211 | +if (!function_exists('on_dev')) { |
|
| 212 | 212 | /** |
| 213 | 213 | * Testez pour voir si nous sommes dans un environnement de développement. |
| 214 | 214 | */ |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | -if (! function_exists('on_prod')) { |
|
| 227 | +if (!function_exists('on_prod')) { |
|
| 228 | 228 | /** |
| 229 | 229 | * Testez pour voir si nous sommes dans un environnement de production. |
| 230 | 230 | */ |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | -if (! function_exists('on_test')) { |
|
| 243 | +if (!function_exists('on_test')) { |
|
| 244 | 244 | /** |
| 245 | 245 | * Testez pour voir si nous sommes dans un environnement de test |
| 246 | 246 | */ |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | -if (! function_exists('is_cli')) { |
|
| 255 | +if (!function_exists('is_cli')) { |
|
| 256 | 256 | /** |
| 257 | 257 | * Testez pour voir si une demande a été faite à partir de la ligne de commande. |
| 258 | 258 | */ |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | -if (! function_exists('is_php')) { |
|
| 265 | +if (!function_exists('is_php')) { |
|
| 266 | 266 | /** |
| 267 | 267 | * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie. |
| 268 | 268 | */ |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | -if (! function_exists('is_windows')) { |
|
| 275 | +if (!function_exists('is_windows')) { |
|
| 276 | 276 | /** |
| 277 | 277 | * Déterminez si l'environnement actuel est basé sur Windows. |
| 278 | 278 | */ |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | -if (! function_exists('is_https')) { |
|
| 285 | +if (!function_exists('is_https')) { |
|
| 286 | 286 | /** |
| 287 | 287 | * Determines if the application is accessed via an encrypted * (HTTPS) connection. |
| 288 | 288 | */ |
@@ -292,13 +292,13 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | -if (! function_exists('is_localfile')) { |
|
| 295 | +if (!function_exists('is_localfile')) { |
|
| 296 | 296 | /** |
| 297 | 297 | * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non |
| 298 | 298 | */ |
| 299 | 299 | function is_localfile(string $name): bool |
| 300 | 300 | { |
| 301 | - if (preg_match('#^'.base_url().'#i', $name)) { |
|
| 301 | + if (preg_match('#^' . base_url() . '#i', $name)) { |
|
| 302 | 302 | return true; |
| 303 | 303 | } |
| 304 | 304 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | -if (! function_exists('is_online')) { |
|
| 309 | +if (!function_exists('is_online')) { |
|
| 310 | 310 | /** |
| 311 | 311 | * Tester si l'application s'exécute en local ou en ligne. |
| 312 | 312 | */ |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | -if (! function_exists('is_ajax_request')) { |
|
| 319 | +if (!function_exists('is_ajax_request')) { |
|
| 320 | 320 | /** |
| 321 | 321 | * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH. |
| 322 | 322 | */ |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | -if (! function_exists('redirection')) { |
|
| 329 | +if (!function_exists('redirection')) { |
|
| 330 | 330 | /** |
| 331 | 331 | * Redirige l'utilisateur |
| 332 | 332 | */ |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | -if (! function_exists('redirect')) { |
|
| 343 | +if (!function_exists('redirect')) { |
|
| 344 | 344 | /** |
| 345 | 345 | * Méthode pratique qui fonctionne avec la $request globale actuelle et |
| 346 | 346 | * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | { |
| 355 | 355 | $redirection = Services::redirection(); |
| 356 | 356 | |
| 357 | - if (! empty($uri)) { |
|
| 357 | + if (!empty($uri)) { |
|
| 358 | 358 | return $redirection->route($uri); |
| 359 | 359 | } |
| 360 | 360 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | -if (! function_exists('link_to')) { |
|
| 365 | +if (!function_exists('link_to')) { |
|
| 366 | 366 | /** |
| 367 | 367 | * Étant donné une chaîne de contrôleur/méthode et tous les paramètres, |
| 368 | 368 | * tentera de créer l'URL relative à la route correspondante. |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | -if (! function_exists('clean_path')) { |
|
| 381 | +if (!function_exists('clean_path')) { |
|
| 382 | 382 | /** |
| 383 | 383 | * Une méthode pratique pour nettoyer les chemins pour |
| 384 | 384 | * une sortie plus belle. Utile pour les exceptions |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | // ================================= FONCTIONS DE DEBOGAGE ================================= // |
| 411 | 411 | |
| 412 | -if (! function_exists('dd')) { |
|
| 412 | +if (!function_exists('dd')) { |
|
| 413 | 413 | /** |
| 414 | 414 | * Prints a Kint debug report and exits. |
| 415 | 415 | * |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | -if (! function_exists('dump')) { |
|
| 431 | +if (!function_exists('dump')) { |
|
| 432 | 432 | /** |
| 433 | 433 | * Prints a Kint debug report and exits. |
| 434 | 434 | * |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | -if (! function_exists('deprecationWarning')) { |
|
| 448 | +if (!function_exists('deprecationWarning')) { |
|
| 449 | 449 | /** |
| 450 | 450 | * Méthode d'assistance pour générer des avertissements d'obsolescence |
| 451 | 451 | * |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | -if (! function_exists('logger')) { |
|
| 464 | +if (!function_exists('logger')) { |
|
| 465 | 465 | /** |
| 466 | 466 | * A convenience/compatibility method for logging events through |
| 467 | 467 | * the Log system. |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | { |
| 485 | 485 | $logger = Services::logger(); |
| 486 | 486 | |
| 487 | - if (! empty($level) && ! empty($message)) { |
|
| 487 | + if (!empty($level) && !empty($message)) { |
|
| 488 | 488 | return $logger->log($level, $message, $context); |
| 489 | 489 | } |
| 490 | 490 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | -if (! function_exists('cache')) { |
|
| 495 | +if (!function_exists('cache')) { |
|
| 496 | 496 | /** |
| 497 | 497 | * Une méthode pratique qui donne accès au cache |
| 498 | 498 | * objet. Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | } |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | -if (! function_exists('pr')) { |
|
| 525 | +if (!function_exists('pr')) { |
|
| 526 | 526 | /** |
| 527 | 527 | * print_r() convenience function. |
| 528 | 528 | * |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | } |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | -if (! function_exists('pj')) { |
|
| 547 | +if (!function_exists('pj')) { |
|
| 548 | 548 | /** |
| 549 | 549 | * json pretty print convenience function. |
| 550 | 550 | * |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | -if (! function_exists('trigger_warning')) { |
|
| 568 | +if (!function_exists('trigger_warning')) { |
|
| 569 | 569 | /** |
| 570 | 570 | * Déclenche un E_USER_WARNING. |
| 571 | 571 | */ |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | -if (! function_exists('vd')) { |
|
| 578 | +if (!function_exists('vd')) { |
|
| 579 | 579 | /** |
| 580 | 580 | * Shortcut to ref, HTML mode |
| 581 | 581 | * |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | } |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | -if (! function_exists('vdt')) { |
|
| 590 | +if (!function_exists('vdt')) { |
|
| 591 | 591 | /** |
| 592 | 592 | * Shortcut to ref, plain text mode |
| 593 | 593 | * |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | // ================================= FONCTIONS DIVERSES ================================= // |
| 603 | 603 | |
| 604 | -if (! function_exists('force_https')) { |
|
| 604 | +if (!function_exists('force_https')) { |
|
| 605 | 605 | /** |
| 606 | 606 | * Utilisé pour forcer l'accès à une page via HTTPS. |
| 607 | 607 | * Utilise une redirection standard, plus définira l'en-tête HSTS |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | } |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | -if (! function_exists('getTypeName')) { |
|
| 660 | +if (!function_exists('getTypeName')) { |
|
| 661 | 661 | /** |
| 662 | 662 | * Renvoie la classe d'objets ou le type var de ce n'est pas un objet |
| 663 | 663 | * |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | -if (! function_exists('ip_address')) { |
|
| 674 | +if (!function_exists('ip_address')) { |
|
| 675 | 675 | /** |
| 676 | 676 | * Renvoie l'adresse IP de l'utilisateur actuel |
| 677 | 677 | */ |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | } |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | -if (! function_exists('is_really_writable')) { |
|
| 684 | +if (!function_exists('is_really_writable')) { |
|
| 685 | 685 | /** |
| 686 | 686 | * Tests d'inscriptibilité des fichiers |
| 687 | 687 | */ |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | -if (! function_exists('lang')) { |
|
| 695 | +if (!function_exists('lang')) { |
|
| 696 | 696 | /** |
| 697 | 697 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
| 698 | 698 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | } |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | -if (! function_exists('namespaceSplit')) { |
|
| 711 | +if (!function_exists('namespaceSplit')) { |
|
| 712 | 712 | /** |
| 713 | 713 | * Séparez l'espace de noms du nom de classe. |
| 714 | 714 | * |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | -if (! function_exists('view_exist')) { |
|
| 732 | +if (!function_exists('view_exist')) { |
|
| 733 | 733 | /** |
| 734 | 734 | * Verifie si un fichier de vue existe. Utile pour limiter les failles include |
| 735 | 735 | */ |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | } |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | -if (! function_exists('view')) { |
|
| 746 | +if (!function_exists('view')) { |
|
| 747 | 747 | /** |
| 748 | 748 | * Charge une vue |
| 749 | 749 | * |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | -if (! function_exists('flash')) { |
|
| 762 | +if (!function_exists('flash')) { |
|
| 763 | 763 | /** |
| 764 | 764 | * Fournisseur d'acces rapide a la classe PHP Flash |
| 765 | 765 | * |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | }*/ |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | -if (! function_exists('geo_ip')) { |
|
| 794 | +if (!function_exists('geo_ip')) { |
|
| 795 | 795 | /** |
| 796 | 796 | * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip |
| 797 | 797 | */ |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | } |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | -if (! function_exists('to_stream')) { |
|
| 804 | +if (!function_exists('to_stream')) { |
|
| 805 | 805 | /** |
| 806 | 806 | * Créez un nouveau flux basé sur le type d'entrée. |
| 807 | 807 | * |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | } |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | -if (! function_exists('value')) { |
|
| 827 | +if (!function_exists('value')) { |
|
| 828 | 828 | /** |
| 829 | 829 | * Renvoie la valeur par défaut de la valeur donnée. |
| 830 | 830 | * |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | } |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | -if (! function_exists('with')) { |
|
| 841 | +if (!function_exists('with')) { |
|
| 842 | 842 | /** |
| 843 | 843 | * Renvoie la valeur donnée, éventuellement transmise via le rappel donné. |
| 844 | 844 | * |