@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | foreach ($paths as $path) { |
| 45 | 45 | if (file_exists($path)) { |
| 46 | - if (! in_array($path, get_included_files(), true)) { |
|
| 46 | + if (!in_array($path, get_included_files(), true)) { |
|
| 47 | 47 | $languages = array_merge($languages, (array) require($path)); |
| 48 | 48 | } |
| 49 | 49 | $file_exist = true; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | throw LoadException::libraryNotFound($lib); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - if (true !== $file_syst && ! class_exists($lib)) { |
|
| 123 | + if (true !== $file_syst && !class_exists($lib)) { |
|
| 124 | 124 | throw LoadException::libraryDontExist($lib); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | 'preferApp' => true, |
| 143 | 143 | ], $options); |
| 144 | 144 | |
| 145 | - if (! preg_match('#Model$#', $model)) { |
|
| 145 | + if (!preg_match('#Model$#', $model)) { |
|
| 146 | 146 | $model .= 'Model'; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $model = APP_NAMESPACE . '\\Models\\' . $model; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if (! class_exists($model)) { |
|
| 156 | + if (!class_exists($model)) { |
|
| 157 | 157 | throw LoadException::modelNotFound($model); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $controller = explode('/', $controller); |
| 172 | 172 | |
| 173 | 173 | $con = ucfirst(end($controller)); |
| 174 | - $con = (! preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
| 174 | + $con = (!preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
| 175 | 175 | $controller[count($controller) - 1] = $con; |
| 176 | 176 | |
| 177 | 177 | foreach ($controller as $key => &$value) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $path = CONTROLLER_PATH . Helpers::ensureExt(implode(DS, $controller), 'php'); |
| 184 | 184 | |
| 185 | - if (! file_exists($path)) { |
|
| 185 | + if (!file_exists($path)) { |
|
| 186 | 186 | throw LoadException::controllerNotFound(str_replace('Controller', '', $con), $path); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | if (class_exists($class_namespaced, false)) { |
| 194 | 194 | return Injector::make($class_namespaced); |
| 195 | 195 | } |
| 196 | - if (! class_exists($con, false)) { |
|
| 196 | + if (!class_exists($con, false)) { |
|
| 197 | 197 | throw LoadException::controllerDontExist(str_replace('Controller', '', $con), $path); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | protected static function verifyPreferApp(array $options, string $name): bool |
| 223 | 223 | { |
| 224 | 224 | // Tout element sans restriction passe |
| 225 | - if (! $options['preferApp']) { |
|
| 225 | + if (!$options['preferApp']) { |
|
| 226 | 226 | return true; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $controller = $routes->getDefaultController(); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - if (! $fullName && is_string($controller)) { |
|
| 174 | + if (!$fullName && is_string($controller)) { |
|
| 175 | 175 | $controller = str_replace($routes->getDefaultNamespace(), '', $controller); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | require_once $routes_file; |
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | - if (empty($routes) || ! ($routes instanceof RouteCollection)) { |
|
| 275 | + if (empty($routes) || !($routes instanceof RouteCollection)) { |
|
| 276 | 276 | $routes = Services::routes(); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -282,14 +282,14 @@ discard block |
||
| 282 | 282 | $routeMiddlewares = (array) $this->dispatchRoutes($routes); |
| 283 | 283 | |
| 284 | 284 | // The bootstrapping in a middleware |
| 285 | - $this->middleware->append(function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
| 285 | + $this->middleware->append(function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
| 286 | 286 | $returned = $this->startController($request, $response); |
| 287 | 287 | |
| 288 | 288 | // Closure controller has run in startController(). |
| 289 | - if (! is_callable($this->controller)) { |
|
| 289 | + if (!is_callable($this->controller)) { |
|
| 290 | 290 | $controller = $this->createController($request, $response); |
| 291 | 291 | |
| 292 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
| 292 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
| 293 | 293 | throw PageNotFoundException::methodNotFound($this->method); |
| 294 | 294 | } |
| 295 | 295 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | $this->gatherOutput($this->middleware->handle($this->request)); |
| 329 | 329 | |
| 330 | - if (! $returnResponse) { |
|
| 330 | + if (!$returnResponse) { |
|
| 331 | 331 | $this->sendResponse(); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -375,14 +375,14 @@ discard block |
||
| 375 | 375 | return; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - if (is_cli() && ! on_test()) { |
|
| 378 | + if (is_cli() && !on_test()) { |
|
| 379 | 379 | // @codeCoverageIgnoreStart |
| 380 | 380 | // $this->request = Services::clirequest($this->config); |
| 381 | 381 | // @codeCoverageIgnoreEnd |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'; |
| 385 | - if (! is_numeric($version)) { |
|
| 385 | + if (!is_numeric($version)) { |
|
| 386 | 386 | $version = substr($version, strpos($version, '/') + 1); |
| 387 | 387 | } |
| 388 | 388 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | // Supposons le succès jusqu'à preuve du contraire. |
| 402 | 402 | $this->response = Services::response()->withStatus(200); |
| 403 | 403 | |
| 404 | - if (! is_cli() || on_test()) { |
|
| 404 | + if (!is_cli() || on_test()) { |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion()); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | { |
| 438 | 438 | if ($cachedResponse = Services::cache()->read($this->generateCacheName())) { |
| 439 | 439 | $cachedResponse = unserialize($cachedResponse); |
| 440 | - if (! is_array($cachedResponse) || ! isset($cachedResponse['output']) || ! isset($cachedResponse['headers'])) { |
|
| 440 | + if (!is_array($cachedResponse) || !isset($cachedResponse['output']) || !isset($cachedResponse['headers'])) { |
|
| 441 | 441 | throw new FrameworkException('Error unserializing page cache'); |
| 442 | 442 | } |
| 443 | 443 | |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | */ |
| 567 | 567 | protected function determinePath(): string |
| 568 | 568 | { |
| 569 | - if (! empty($this->path)) { |
|
| 569 | + if (!empty($this->path)) { |
|
| 570 | 570 | return $this->path; |
| 571 | 571 | } |
| 572 | 572 | |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | // Essayez de charger automatiquement la classe |
| 621 | - if (! class_exists($this->controller, true) || $this->method[0] === '_') { |
|
| 621 | + if (!class_exists($this->controller, true) || $this->method[0] === '_') { |
|
| 622 | 622 | throw PageNotFoundException::controllerNotFound($this->controller, $this->method); |
| 623 | 623 | } |
| 624 | 624 | |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | // Affiche l'erreur 404 |
| 707 | 707 | $this->response = $this->response->withStatus($e->getCode()); |
| 708 | 708 | |
| 709 | - if (! on_test()) { |
|
| 709 | + if (!on_test()) { |
|
| 710 | 710 | // @codeCoverageIgnoreStart |
| 711 | 711 | if (ob_get_level() > 0) { |
| 712 | 712 | ob_end_flush(); |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | ob_end_flush(); // @codeCoverageIgnore |
| 719 | 719 | } |
| 720 | 720 | |
| 721 | - throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : ''); |
|
| 721 | + throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : ''); |
|
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | /** |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | public function storePreviousURL($uri) |
| 774 | 774 | { |
| 775 | 775 | // Ignorer les requêtes CLI |
| 776 | - if (is_cli() && ! on_test()) { |
|
| 776 | + if (is_cli() && !on_test()) { |
|
| 777 | 777 | return; // @codeCoverageIgnore |
| 778 | 778 | } |
| 779 | 779 | |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | $this->middleware->prepend($this->spoofRequestMethod()); |
| 838 | 838 | |
| 839 | 839 | $middlewaresFile = CONFIG_PATH . 'middlewares.php'; |
| 840 | - if (file_exists($middlewaresFile) && ! in_array($middlewaresFile, get_included_files(), true)) { |
|
| 840 | + if (file_exists($middlewaresFile) && !in_array($middlewaresFile, get_included_files(), true)) { |
|
| 841 | 841 | $middleware = require $middlewaresFile; |
| 842 | 842 | if (is_callable($middleware)) { |
| 843 | 843 | $middlewareQueue = $middleware($this->middleware, $this->request); |
@@ -854,11 +854,11 @@ discard block |
||
| 854 | 854 | */ |
| 855 | 855 | private function spoofRequestMethod(): callable |
| 856 | 856 | { |
| 857 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
| 857 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
| 858 | 858 | $post = $request->getParsedBody(); |
| 859 | 859 | |
| 860 | 860 | // Ne fonctionne qu'avec les formulaires POST |
| 861 | - if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) { |
|
| 861 | + if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) { |
|
| 862 | 862 | // Accepte seulement PUT, PATCH, DELETE |
| 863 | 863 | if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) { |
| 864 | 864 | $request = $request->withMethod($post['_method']); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if (! count($data)) { |
|
| 89 | + if (!count($data)) { |
|
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -118,18 +118,18 @@ discard block |
||
| 118 | 118 | public function parse(): ?array |
| 119 | 119 | { |
| 120 | 120 | // Nous ne voulons pas imposer la présence d'un fichier .env, ils devraient être facultatifs. |
| 121 | - if (! is_file($this->path)) { |
|
| 121 | + if (!is_file($this->path)) { |
|
| 122 | 122 | return null; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // Assurez-vous que le fichier est lisible |
| 126 | - if (! is_readable($this->path)) { |
|
| 126 | + if (!is_readable($this->path)) { |
|
| 127 | 127 | throw new InvalidArgumentException("The .env file is not readable: {$this->path}"); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $vars = []; |
| 131 | 131 | |
| 132 | - $lines = file($this->path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
| 132 | + $lines = file($this->path, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); |
|
| 133 | 133 | |
| 134 | 134 | foreach ($lines as $line) { |
| 135 | 135 | // C'est un commentaire? |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | protected function setVariable(string $name, string $value = '') |
| 156 | 156 | { |
| 157 | - if (! getenv($name, true)) { |
|
| 157 | + if (!getenv($name, true)) { |
|
| 158 | 158 | putenv("{$name}={$value}"); |
| 159 | 159 | } |
| 160 | 160 | if (empty($_ENV[$name])) { |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | protected function sanitizeValue(string $value): string |
| 205 | 205 | { |
| 206 | - if (! $value) { |
|
| 206 | + if (!$value) { |
|
| 207 | 207 | return $value; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | $value = preg_replace_callback( |
| 261 | 261 | '/\${([a-zA-Z0-9_]+)}/', |
| 262 | - static function ($matchedPatterns) use ($loader) { |
|
| 262 | + static function($matchedPatterns) use ($loader) { |
|
| 263 | 263 | $nestedVariable = $loader->getVariable($matchedPatterns[1]); |
| 264 | 264 | |
| 265 | 265 | if (null === $nestedVariable) { |
@@ -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 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | return $this->respondOk($response); |
| 109 | 109 | } catch (Throwable $ex) { |
| 110 | - if (! on_dev()) { |
|
| 110 | + if (!on_dev()) { |
|
| 111 | 111 | $url = explode('?', $this->request->getRequestTarget())[0]; |
| 112 | 112 | |
| 113 | 113 | return $this->respondBadRequest($this->_translate('badUsed', [$url])); |
@@ -156,18 +156,18 @@ discard block |
||
| 156 | 156 | final protected function respondFail(?string $message = "Une erreur s'est produite", ?int $status = StatusCode::INTERNAL_ERROR, int|string|null $code = null, array $errors = []) |
| 157 | 157 | { |
| 158 | 158 | $message = $message ?: "Une erreur s'est produite"; |
| 159 | - $code = ! empty($code) ? $code : $status; |
|
| 159 | + $code = !empty($code) ? $code : $status; |
|
| 160 | 160 | |
| 161 | 161 | $response = [ |
| 162 | 162 | $this->config->field['message'] ?? 'message' => $message, |
| 163 | 163 | ]; |
| 164 | - if (! empty($this->config->field['status'])) { |
|
| 164 | + if (!empty($this->config->field['status'])) { |
|
| 165 | 165 | $response[$this->config->field['status']] = false; |
| 166 | 166 | } |
| 167 | - if (! empty($this->config->field['code'])) { |
|
| 167 | + if (!empty($this->config->field['code'])) { |
|
| 168 | 168 | $response[$this->config->field['code']] = $code; |
| 169 | 169 | } |
| 170 | - if (! empty($errors)) { |
|
| 170 | + if (!empty($errors)) { |
|
| 171 | 171 | $response[$this->config->field['errors'] ?? 'errors'] = $errors; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | final protected function respondSuccess(?string $message = 'Resultat', $result = null, ?int $status = StatusCode::OK) |
| 189 | 189 | { |
| 190 | 190 | $message = $message ?: 'Resultat'; |
| 191 | - $status = ! empty($status) ? $status : StatusCode::OK; |
|
| 191 | + $status = !empty($status) ? $status : StatusCode::OK; |
|
| 192 | 192 | |
| 193 | 193 | $response = [ |
| 194 | 194 | $this->config->field['message'] ?? 'message' => $message, |
| 195 | 195 | ]; |
| 196 | - if (! empty($this->config->field['status'])) { |
|
| 196 | + if (!empty($this->config->field['status'])) { |
|
| 197 | 197 | $response[$this->config->field['status']] = true; |
| 198 | 198 | } |
| 199 | 199 | if (is_array($result)) { |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | final protected function allowedMethods(string ...$methods): self |
| 307 | 307 | { |
| 308 | - if (! empty($methods)) { |
|
| 308 | + if (!empty($methods)) { |
|
| 309 | 309 | $this->config->allowed_methods = array_map(static fn ($str) => strtoupper($str), $methods); |
| 310 | 310 | } |
| 311 | 311 | |
@@ -403,13 +403,13 @@ discard block |
||
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | // Si la méthode de format existe, appelle et renvoie la sortie dans ce format |
| 406 | - if (! empty($mime)) { |
|
| 406 | + if (!empty($mime)) { |
|
| 407 | 407 | $output = Formatter::type($mime)->format($data); |
| 408 | 408 | |
| 409 | 409 | // Définit l'en-tête du format |
| 410 | 410 | // Ensuite, vérifiez si le client a demandé un rappel, et si la sortie contient ce rappel : |
| 411 | 411 | $callback = $this->request->getQuery('callback'); |
| 412 | - if (! empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) { |
|
| 412 | + if (!empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) { |
|
| 413 | 413 | $this->response = $this->response->withType($this->mimes['jsonp']); |
| 414 | 414 | } else { |
| 415 | 415 | $this->response = $this->response->withType($mime === $this->mimes['array'] ? $this->mimes['json'] : $mime); |
@@ -465,22 +465,22 @@ discard block |
||
| 465 | 465 | private function checkProcess(): bool|ResponseInterface |
| 466 | 466 | { |
| 467 | 467 | // Verifie si la requete est en ajax |
| 468 | - if (! $this->request->is('ajax') && $this->config->ajax_only) { |
|
| 468 | + if (!$this->request->is('ajax') && $this->config->ajax_only) { |
|
| 469 | 469 | return $this->respondNotAcceptable($this->_translate('ajaxOnly')); |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // Verifie si la requete est en https |
| 473 | - if (! $this->request->is('https') && $this->config->force_https) { |
|
| 473 | + if (!$this->request->is('https') && $this->config->force_https) { |
|
| 474 | 474 | return $this->respondForbidden($this->_translate('unsupported')); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | // Verifie si la methode utilisee pour la requete est autorisee |
| 478 | - if (! in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) { |
|
| 478 | + if (!in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) { |
|
| 479 | 479 | return $this->respondNotAcceptable($this->_translate('unknownMethod')); |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | // Verifie que l'ip qui emet la requete n'est pas dans la blacklist |
| 483 | - if (! empty($this->config->ip_blacklis)) { |
|
| 483 | + if (!empty($this->config->ip_blacklis)) { |
|
| 484 | 484 | $this->config->ip_blacklist = implode(',', $this->config->ip_blacklist); |
| 485 | 485 | |
| 486 | 486 | // Correspond à une adresse IP dans une liste noire, par ex. 127.0.0.0, 0.0.0.0 |
@@ -493,20 +493,20 @@ discard block |
||
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | // Verifie que l'ip qui emet la requete est dans la whitelist |
| 496 | - if (! empty($this->config->ip_whitelist)) { |
|
| 496 | + if (!empty($this->config->ip_whitelist)) { |
|
| 497 | 497 | $whitelist = $this->config->ip_whitelist; |
| 498 | 498 | array_push($whitelist, '127.0.0.1', '0.0.0.0'); |
| 499 | 499 | |
| 500 | 500 | // coupez les espaces de début et de fin des ip |
| 501 | 501 | $whitelist = array_map('trim', $whitelist); |
| 502 | 502 | |
| 503 | - if (! in_array($this->request->clientIp(), $whitelist, true)) { |
|
| 503 | + if (!in_array($this->request->clientIp(), $whitelist, true)) { |
|
| 504 | 504 | return $this->respondUnauthorized($this->_translate('ipUnauthorized')); |
| 505 | 505 | } |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | // Verifie l'authentification du client |
| 509 | - if (false !== $this->config->auth && ! $this->request->is('options')) { |
|
| 509 | + if (false !== $this->config->auth && !$this->request->is('options')) { |
|
| 510 | 510 | if ('bearer' === strtolower($this->config->auth)) { |
| 511 | 511 | $token = $this->getBearerToken(); |
| 512 | 512 | if (empty($token)) { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | // ================================= FONCTIONS D'ACCESSIBILITE ================================= // |
| 24 | 24 | |
| 25 | -if (! function_exists('env')) { |
|
| 25 | +if (!function_exists('env')) { |
|
| 26 | 26 | /** |
| 27 | 27 | * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation |
| 28 | 28 | * pour les variables d'environnement non prises en charge ou incohérentes |
@@ -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('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(string|array $name, array $options = [], ?ConnectionInterface &$conn = null) |
|
| 69 | + function model(string|array $name, array $options = [], ?ConnectionInterface&$conn = null) |
|
| 70 | 70 | { |
| 71 | 71 | return Load::model($name, $options, $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 | * |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | function config(string $config, $value = null, bool $force_set = false) |
| 125 | 125 | { |
| 126 | - if (! empty($value) || (empty($value) && true === $force_set)) { |
|
| 126 | + if (!empty($value) || (empty($value) && true === $force_set)) { |
|
| 127 | 127 | Config::set($config, $value); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== // |
| 135 | 135 | |
| 136 | -if (! function_exists('esc')) { |
|
| 136 | +if (!function_exists('esc')) { |
|
| 137 | 137 | /** |
| 138 | 138 | * Effectue un simple échappement automatique des données pour des raisons de sécurité. |
| 139 | 139 | * Pourrait envisager de rendre cela plus complexe à une date ultérieure. |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | -if (! function_exists('h')) { |
|
| 163 | +if (!function_exists('h')) { |
|
| 164 | 164 | /** |
| 165 | 165 | * Méthode pratique pour htmlspecialchars. |
| 166 | 166 | * |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | -if (! function_exists('purify')) { |
|
| 182 | +if (!function_exists('purify')) { |
|
| 183 | 183 | /** |
| 184 | 184 | * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier. |
| 185 | 185 | * Utilisez facilement plusieurs configurations de purificateur. |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | -if (! function_exists('remove_invisible_characters')) { |
|
| 200 | +if (!function_exists('remove_invisible_characters')) { |
|
| 201 | 201 | /** |
| 202 | 202 | * Supprimer les caractères invisibles |
| 203 | 203 | * |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | -if (! function_exists('stringify_attributes')) { |
|
| 213 | +if (!function_exists('stringify_attributes')) { |
|
| 214 | 214 | /** |
| 215 | 215 | * Chaîner les attributs à utiliser dans les balises HTML. |
| 216 | 216 | * |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= // |
| 226 | 226 | |
| 227 | -if (! function_exists('on_dev')) { |
|
| 227 | +if (!function_exists('on_dev')) { |
|
| 228 | 228 | /** |
| 229 | 229 | * Testez pour voir si nous sommes dans un environnement de développement. |
| 230 | 230 | */ |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | -if (! function_exists('on_prod')) { |
|
| 243 | +if (!function_exists('on_prod')) { |
|
| 244 | 244 | /** |
| 245 | 245 | * Testez pour voir si nous sommes dans un environnement de production. |
| 246 | 246 | */ |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | -if (! function_exists('on_test')) { |
|
| 259 | +if (!function_exists('on_test')) { |
|
| 260 | 260 | /** |
| 261 | 261 | * Testez pour voir si nous sommes dans un environnement de test |
| 262 | 262 | */ |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | -if (! function_exists('is_cli')) { |
|
| 271 | +if (!function_exists('is_cli')) { |
|
| 272 | 272 | /** |
| 273 | 273 | * Testez pour voir si une demande a été faite à partir de la ligne de commande. |
| 274 | 274 | */ |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | -if (! function_exists('is_php')) { |
|
| 281 | +if (!function_exists('is_php')) { |
|
| 282 | 282 | /** |
| 283 | 283 | * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie. |
| 284 | 284 | */ |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | -if (! function_exists('is_windows')) { |
|
| 291 | +if (!function_exists('is_windows')) { |
|
| 292 | 292 | /** |
| 293 | 293 | * Déterminez si l'environnement actuel est basé sur Windows. |
| 294 | 294 | */ |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | -if (! function_exists('is_https')) { |
|
| 301 | +if (!function_exists('is_https')) { |
|
| 302 | 302 | /** |
| 303 | 303 | * Determines if the application is accessed via an encrypted * (HTTPS) connection. |
| 304 | 304 | */ |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | -if (! function_exists('is_localfile')) { |
|
| 311 | +if (!function_exists('is_localfile')) { |
|
| 312 | 312 | /** |
| 313 | 313 | * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non |
| 314 | 314 | */ |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | return true; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - return ! preg_match('#^(https?://)#i', $name); |
|
| 321 | + return !preg_match('#^(https?://)#i', $name); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | -if (! function_exists('is_online')) { |
|
| 325 | +if (!function_exists('is_online')) { |
|
| 326 | 326 | /** |
| 327 | 327 | * Tester si l'application s'exécute en local ou en ligne. |
| 328 | 328 | */ |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | -if (! function_exists('is_connected')) { |
|
| 335 | +if (!function_exists('is_connected')) { |
|
| 336 | 336 | /** |
| 337 | 337 | * Verifie si l'utilisateur a une connexion internet active. |
| 338 | 338 | */ |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | -if (! function_exists('is_ajax_request')) { |
|
| 345 | +if (!function_exists('is_ajax_request')) { |
|
| 346 | 346 | /** |
| 347 | 347 | * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH. |
| 348 | 348 | */ |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | -if (! function_exists('redirection')) { |
|
| 355 | +if (!function_exists('redirection')) { |
|
| 356 | 356 | /** |
| 357 | 357 | * Redirige l'utilisateur |
| 358 | 358 | */ |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | -if (! function_exists('redirect')) { |
|
| 369 | +if (!function_exists('redirect')) { |
|
| 370 | 370 | /** |
| 371 | 371 | * Méthode pratique qui fonctionne avec la $request globale actuelle et |
| 372 | 372 | * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | { |
| 381 | 381 | $redirection = Services::redirection(); |
| 382 | 382 | |
| 383 | - if (! empty($uri)) { |
|
| 383 | + if (!empty($uri)) { |
|
| 384 | 384 | return $redirection->route($uri); |
| 385 | 385 | } |
| 386 | 386 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | -if (! function_exists('link_to')) { |
|
| 391 | +if (!function_exists('link_to')) { |
|
| 392 | 392 | /** |
| 393 | 393 | * Étant donné une chaîne de contrôleur/méthode et tous les paramètres, |
| 394 | 394 | * tentera de créer l'URL relative à la route correspondante. |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | -if (! function_exists('clean_path')) { |
|
| 407 | +if (!function_exists('clean_path')) { |
|
| 408 | 408 | /** |
| 409 | 409 | * Une méthode pratique pour nettoyer les chemins pour |
| 410 | 410 | * une sortie plus belle. Utile pour les exceptions |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | // ================================= FONCTIONS DE DEBOGAGE ================================= // |
| 437 | 437 | |
| 438 | -if (! function_exists('dd')) { |
|
| 438 | +if (!function_exists('dd')) { |
|
| 439 | 439 | /** |
| 440 | 440 | * Prints a Kint debug report and exits. |
| 441 | 441 | * |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | -if (! function_exists('dump')) { |
|
| 457 | +if (!function_exists('dump')) { |
|
| 458 | 458 | /** |
| 459 | 459 | * Prints a Kint debug report and exits. |
| 460 | 460 | * |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | -if (! function_exists('deprecationWarning')) { |
|
| 474 | +if (!function_exists('deprecationWarning')) { |
|
| 475 | 475 | /** |
| 476 | 476 | * Méthode d'assistance pour générer des avertissements d'obsolescence |
| 477 | 477 | * |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | -if (! function_exists('logger')) { |
|
| 490 | +if (!function_exists('logger')) { |
|
| 491 | 491 | /** |
| 492 | 492 | * A convenience/compatibility method for logging events through |
| 493 | 493 | * the Log system. |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | { |
| 511 | 511 | $logger = Services::logger(); |
| 512 | 512 | |
| 513 | - if (! empty($level) && ! empty($message)) { |
|
| 513 | + if (!empty($level) && !empty($message)) { |
|
| 514 | 514 | return $logger->log($level, $message, $context); |
| 515 | 515 | } |
| 516 | 516 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | -if (! function_exists('cache')) { |
|
| 521 | +if (!function_exists('cache')) { |
|
| 522 | 522 | /** |
| 523 | 523 | * Une méthode pratique qui donne accès au cache |
| 524 | 524 | * objet. Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | -if (! function_exists('pr')) { |
|
| 551 | +if (!function_exists('pr')) { |
|
| 552 | 552 | /** |
| 553 | 553 | * print_r() convenience function. |
| 554 | 554 | * |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | -if (! function_exists('pj')) { |
|
| 573 | +if (!function_exists('pj')) { |
|
| 574 | 574 | /** |
| 575 | 575 | * json pretty print convenience function. |
| 576 | 576 | * |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | } |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | -if (! function_exists('trigger_warning')) { |
|
| 594 | +if (!function_exists('trigger_warning')) { |
|
| 595 | 595 | /** |
| 596 | 596 | * Déclenche un E_USER_WARNING. |
| 597 | 597 | */ |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | -if (! function_exists('vd')) { |
|
| 604 | +if (!function_exists('vd')) { |
|
| 605 | 605 | /** |
| 606 | 606 | * Shortcut to ref, HTML mode |
| 607 | 607 | * |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | -if (! function_exists('vdt')) { |
|
| 616 | +if (!function_exists('vdt')) { |
|
| 617 | 617 | /** |
| 618 | 618 | * Shortcut to ref, plain text mode |
| 619 | 619 | * |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | |
| 628 | 628 | // ================================= FONCTIONS DIVERSES ================================= // |
| 629 | 629 | |
| 630 | -if (! function_exists('force_https')) { |
|
| 630 | +if (!function_exists('force_https')) { |
|
| 631 | 631 | /** |
| 632 | 632 | * Utilisé pour forcer l'accès à une page via HTTPS. |
| 633 | 633 | * Utilise une redirection standard, plus définira l'en-tête HSTS |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | -if (! function_exists('getTypeName')) { |
|
| 688 | +if (!function_exists('getTypeName')) { |
|
| 689 | 689 | /** |
| 690 | 690 | * Renvoie la classe d'objets ou le type var de ce n'est pas un objet |
| 691 | 691 | * |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | -if (! function_exists('ip_address')) { |
|
| 702 | +if (!function_exists('ip_address')) { |
|
| 703 | 703 | /** |
| 704 | 704 | * Renvoie l'adresse IP de l'utilisateur actuel |
| 705 | 705 | */ |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | } |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | -if (! function_exists('is_really_writable')) { |
|
| 712 | +if (!function_exists('is_really_writable')) { |
|
| 713 | 713 | /** |
| 714 | 714 | * Tests d'inscriptibilité des fichiers |
| 715 | 715 | */ |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | } |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | -if (! function_exists('lang')) { |
|
| 723 | +if (!function_exists('lang')) { |
|
| 724 | 724 | /** |
| 725 | 725 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
| 726 | 726 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | -if (! function_exists('namespaceSplit')) { |
|
| 739 | +if (!function_exists('namespaceSplit')) { |
|
| 740 | 740 | /** |
| 741 | 741 | * Séparez l'espace de noms du nom de classe. |
| 742 | 742 | * |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | } |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | -if (! function_exists('view_exist')) { |
|
| 760 | +if (!function_exists('view_exist')) { |
|
| 761 | 761 | /** |
| 762 | 762 | * Verifie si un fichier de vue existe. Utile pour limiter les failles include |
| 763 | 763 | */ |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | } |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | -if (! function_exists('view')) { |
|
| 774 | +if (!function_exists('view')) { |
|
| 775 | 775 | /** |
| 776 | 776 | * Charge une vue |
| 777 | 777 | * |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | } |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | -if (! function_exists('flash')) { |
|
| 790 | +if (!function_exists('flash')) { |
|
| 791 | 791 | /** |
| 792 | 792 | * Fournisseur d'acces rapide a la classe PHP Flash |
| 793 | 793 | * |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | }*/ |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | -if (! function_exists('geo_ip')) { |
|
| 822 | +if (!function_exists('geo_ip')) { |
|
| 823 | 823 | /** |
| 824 | 824 | * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip |
| 825 | 825 | */ |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | -if (! function_exists('to_stream')) { |
|
| 832 | +if (!function_exists('to_stream')) { |
|
| 833 | 833 | /** |
| 834 | 834 | * Créez un nouveau flux basé sur le type d'entrée. |
| 835 | 835 | * |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | -if (! function_exists('value')) { |
|
| 855 | +if (!function_exists('value')) { |
|
| 856 | 856 | /** |
| 857 | 857 | * Renvoie la valeur par défaut de la valeur donnée. |
| 858 | 858 | * |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | -if (! function_exists('with')) { |
|
| 869 | +if (!function_exists('with')) { |
|
| 870 | 870 | /** |
| 871 | 871 | * Renvoie la valeur donnée, éventuellement transmise via le rappel donné. |
| 872 | 872 | * |