@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | // Se rassurer que le dossier courant pointe sur le dossier du front controller |
19 | 19 | chdir(WEBROOT); |
20 | 20 | |
21 | -return function (array $paths, string $paths_config_file, bool $is_cli) { |
|
21 | +return function(array $paths, string $paths_config_file, bool $is_cli) { |
|
22 | 22 | // Le chemin d'accès vers le dossier de l'application |
23 | 23 | if (is_dir($paths['app'])) { |
24 | 24 | if (($_temp = realpath($paths['app'])) !== false) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | require_once __DIR__ . DS . 'kint.php'; |
95 | 95 | |
96 | - if (! $is_cli) { |
|
96 | + if (!$is_cli) { |
|
97 | 97 | $app->run(); |
98 | 98 | } |
99 | 99 | }; |
@@ -102,35 +102,35 @@ discard block |
||
102 | 102 | */ |
103 | 103 | defined('LAYOUT_PATH') || define('LAYOUT_PATH', VIEW_PATH . 'layouts' . DS); |
104 | 104 | |
105 | -if (! defined('SERVICE_PATH')) { |
|
105 | +if (!defined('SERVICE_PATH')) { |
|
106 | 106 | /** |
107 | 107 | * Services directory path |
108 | 108 | */ |
109 | 109 | define('SERVICE_PATH', APP_PATH . 'services' . DS); |
110 | 110 | } |
111 | 111 | |
112 | -if (! defined('DATABASE_PATH')) { |
|
112 | +if (!defined('DATABASE_PATH')) { |
|
113 | 113 | /** |
114 | 114 | * Database storage directory path |
115 | 115 | */ |
116 | 116 | define('DATABASE_PATH', STORAGE_PATH . 'database' . DS); |
117 | 117 | } |
118 | 118 | |
119 | -if (! defined('DB_SEED_PATH')) { |
|
119 | +if (!defined('DB_SEED_PATH')) { |
|
120 | 120 | /** |
121 | 121 | * Database seeds storage path |
122 | 122 | */ |
123 | 123 | define('DB_SEED_PATH', RESOURCE_PATH . 'database' . DS . 'seeds' . DS); |
124 | 124 | } |
125 | 125 | |
126 | -if (! defined('DB_DUMP_PATH')) { |
|
126 | +if (!defined('DB_DUMP_PATH')) { |
|
127 | 127 | /** |
128 | 128 | * Database backup storage path |
129 | 129 | */ |
130 | 130 | define('DB_DUMP_PATH', DATABASE_PATH . 'dump' . DS); |
131 | 131 | } |
132 | 132 | |
133 | -if (! defined('DB_CACHE_PATH')) { |
|
133 | +if (!defined('DB_CACHE_PATH')) { |
|
134 | 134 | /** |
135 | 135 | * Database cache directory path |
136 | 136 | */ |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | */ |
153 | 153 | defined('SECOND') || define('SECOND', 1); |
154 | 154 | defined('MINUTE') || define('MINUTE', 60); |
155 | -defined('HOUR') || define('HOUR', 3600); |
|
156 | -defined('DAY') || define('DAY', 86400); |
|
157 | -defined('WEEK') || define('WEEK', 604800); |
|
158 | -defined('MONTH') || define('MONTH', 2592000); |
|
159 | -defined('YEAR') || define('YEAR', 31536000); |
|
155 | +defined('HOUR') || define('HOUR', 3600); |
|
156 | +defined('DAY') || define('DAY', 86400); |
|
157 | +defined('WEEK') || define('WEEK', 604800); |
|
158 | +defined('MONTH') || define('MONTH', 2592000); |
|
159 | +defined('YEAR') || define('YEAR', 31536000); |
|
160 | 160 | defined('DECADE') || define('DECADE', 315360000); |
161 | 161 | |
162 | 162 | /** |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | * - BSD sysexits.h: http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits |
178 | 178 | * - Bash scripting: http://tldp.org/LDP/abs/html/exitcodes.html |
179 | 179 | */ |
180 | -defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // pas d'erreurs |
|
181 | -defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // erreur generique |
|
182 | -defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // erreur de configuration |
|
183 | -defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // fichier non trouvé |
|
184 | -defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // classe inconnue |
|
180 | +defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // pas d'erreurs |
|
181 | +defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // erreur generique |
|
182 | +defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // erreur de configuration |
|
183 | +defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // fichier non trouvé |
|
184 | +defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // classe inconnue |
|
185 | 185 | defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // membre de classe inconnu |
186 | -defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // saisie utilisateur invalide |
|
187 | -defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // erreur de base de données |
|
188 | -defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // code d'erreur attribué automatiquement le plus bas |
|
189 | -defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // code d'erreur attribué automatiquement le plus élevé |
|
186 | +defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // saisie utilisateur invalide |
|
187 | +defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // erreur de base de données |
|
188 | +defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // code d'erreur attribué automatiquement le plus bas |
|
189 | +defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // code d'erreur attribué automatiquement le plus élevé |
@@ -81,7 +81,7 @@ |
||
81 | 81 | */ |
82 | 82 | public function get() |
83 | 83 | { |
84 | - if (! $this->isValid()) { |
|
84 | + if (!$this->isValid()) { |
|
85 | 85 | throw new FileNotFoundException("Le fichier n'existe pas dans le chemin {$this->getPathname()}."); |
86 | 86 | } |
87 | 87 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function expectsJson(): bool |
33 | 33 | { |
34 | - return ($this->ajax() && ! $this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson(); |
|
34 | + return ($this->ajax() && !$this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson(); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $type = strtolower($type); |
69 | 69 | |
70 | - if ($this->matchesType($accept, $type) || $accept === strtok($type, '/').'/*') { |
|
70 | + if ($this->matchesType($accept, $type) || $accept === strtok($type, '/') . '/*') { |
|
71 | 71 | return true; |
72 | 72 | } |
73 | 73 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | foreach ($contentTypes as $contentType) { |
94 | 94 | $type = $contentType; |
95 | 95 | |
96 | - if (! is_null($mimeType = $this->getMimeType($contentType))) { |
|
96 | + if (!is_null($mimeType = $this->getMimeType($contentType))) { |
|
97 | 97 | $type = $mimeType; |
98 | 98 | } |
99 | 99 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | $type = strtolower($type); |
103 | 103 | |
104 | - if ($this->matchesType($type, $accept) || $accept === strtok($type, '/').'/*') { |
|
104 | + if ($this->matchesType($type, $accept) || $accept === strtok($type, '/') . '/*') { |
|
105 | 105 | return $contentType; |
106 | 106 | } |
107 | 107 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | $split = explode('/', $actual); |
149 | 149 | |
150 | - return isset($split[1]) && preg_match('#'.preg_quote($split[0], '#').'/.+\+'.preg_quote($split[1], '#').'#', $type); |
|
150 | + return isset($split[1]) && preg_match('#' . preg_quote($split[0], '#') . '/.+\+' . preg_quote($split[1], '#') . '#', $type); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $input = $this->all(); |
89 | 89 | |
90 | 90 | foreach ($keys as $value) { |
91 | - if (! Arr::has($input, $value)) { |
|
91 | + if (!Arr::has($input, $value)) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $keys = is_array($key) ? $key : func_get_args(); |
151 | 151 | |
152 | 152 | foreach ($keys as $value) { |
153 | - if (! $this->isEmptyString($value)) { |
|
153 | + if (!$this->isEmptyString($value)) { |
|
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | $keys = is_array($key) ? $key : func_get_args(); |
201 | 201 | |
202 | - return ! $this->has($keys); |
|
202 | + return !$this->has($keys); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $value = $this->input($key); |
229 | 229 | |
230 | - return ! is_bool($value) && ! is_array($value) && trim((string) $value) === ''; |
|
230 | + return !is_bool($value) && !is_array($value) && trim((string) $value) === ''; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | { |
248 | 248 | $input = array_replace_recursive($this->data(), $this->allFiles()); |
249 | 249 | |
250 | - if (! $keys) { |
|
250 | + if (!$keys) { |
|
251 | 251 | return $input; |
252 | 252 | } |
253 | 253 | |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | public function enum(string $key, $enumClass) |
340 | 340 | { |
341 | 341 | if ($this->isNotFilled($key) || |
342 | - ! function_exists('enum_exists') || |
|
343 | - ! enum_exists($enumClass) || |
|
344 | - ! method_exists($enumClass, 'tryFrom')) { |
|
342 | + !function_exists('enum_exists') || |
|
343 | + !enum_exists($enumClass) || |
|
344 | + !method_exists($enumClass, 'tryFrom')) { |
|
345 | 345 | return null; |
346 | 346 | } |
347 | 347 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | */ |
426 | 426 | public function hasCookie(string $key): bool |
427 | 427 | { |
428 | - return ! is_null($this->cookie($key)); |
|
428 | + return !is_null($this->cookie($key)); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | /** |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | */ |
456 | 456 | public function hasFile(string $key): bool |
457 | 457 | { |
458 | - if (! is_array($files = $this->file($key))) { |
|
458 | + if (!is_array($files = $this->file($key))) { |
|
459 | 459 | $files = [$files]; |
460 | 460 | } |
461 | 461 |
@@ -33,15 +33,15 @@ |
||
33 | 33 | public function hashName(?string $path = null): string |
34 | 34 | { |
35 | 35 | if ($path) { |
36 | - $path = rtrim($path, '/').'/'; |
|
36 | + $path = rtrim($path, '/') . '/'; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $hash = $this->hashName ?: $this->hashName = Text::random(40); |
40 | 40 | |
41 | 41 | if ($extension = $this->clientExtension()) { |
42 | - $extension = '.'.$extension; |
|
42 | + $extension = '.' . $extension; |
|
43 | 43 | } |
44 | 44 | |
45 | - return $path.$hash.$extension; |
|
45 | + return $path . $hash . $extension; |
|
46 | 46 | } |
47 | 47 | } |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function fullUrl(): string |
90 | 90 | { |
91 | - if (! empty($query = $this->getEnv('QUERY_STRING'))) { |
|
92 | - return $this->url().'?'.$query; |
|
91 | + if (!empty($query = $this->getEnv('QUERY_STRING'))) { |
|
92 | + return $this->url() . '?' . $query; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return $this->url(); |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | $question = '?'; |
104 | 104 | |
105 | 105 | return count($this->query()) > 0 |
106 | - ? $this->url().$question.Arr::query(array_merge($this->query(), $query)) |
|
107 | - : $this->fullUrl().$question.Arr::query($query); |
|
106 | + ? $this->url() . $question . Arr::query(array_merge($this->query(), $query)) |
|
107 | + : $this->fullUrl() . $question . Arr::query($query); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $query = Arr::except($this->query(), $keys); |
116 | 116 | |
117 | 117 | return count($query) > 0 |
118 | - ? $this->url().'?'.Arr::query($query) |
|
118 | + ? $this->url() . '?' . Arr::query($query) |
|
119 | 119 | : $this->url(); |
120 | 120 | } |
121 | 121 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public function hasSession(): bool |
268 | 268 | { |
269 | - return ! is_null($this->session); |
|
269 | + return !is_null($this->session); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | */ |
331 | 331 | public function __isset(string $key): bool |
332 | 332 | { |
333 | - return ! is_null($this->__get($key)); |
|
333 | + return !is_null($this->__get($key)); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -37,8 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | try { |
39 | 39 | return Validator::validate($this->all(), $rules, $messages); |
40 | - } |
|
41 | - catch (ValidationException $e) { |
|
40 | + } catch (ValidationException $e) { |
|
42 | 41 | return redirect()->back()->withInput(); |
43 | 42 | } |
44 | 43 | } |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | |
40 | 40 | // services système |
41 | 41 | $filename = SYST_PATH . 'Constants' . DS . 'providers.php'; |
42 | - if (! file_exists($filename)) { |
|
42 | + if (!file_exists($filename)) { |
|
43 | 43 | throw LoadException::providersDefinitionDontExist($filename); |
44 | 44 | } |
45 | - if (! in_array($filename, get_included_files(), true)) { |
|
45 | + if (!in_array($filename, get_included_files(), true)) { |
|
46 | 46 | $providers = array_merge($providers, require $filename); |
47 | 47 | } |
48 | 48 | |
49 | 49 | // services de l'application |
50 | 50 | $filename = CONFIG_PATH . 'providers.php'; |
51 | - if (file_exists($filename) && ! in_array($filename, get_included_files(), true)) { |
|
51 | + if (file_exists($filename) && !in_array($filename, get_included_files(), true)) { |
|
52 | 52 | $providers = array_merge($providers, require $filename); |
53 | 53 | } |
54 | 54 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return $models; |
98 | 98 | } |
99 | 99 | |
100 | - if (! self::isLoaded('models', $model)) { |
|
100 | + if (!self::isLoaded('models', $model)) { |
|
101 | 101 | self::loaded('models', $model, FileLocator::model($model, $options, $connection)); |
102 | 102 | } |
103 | 103 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | private static function isLoaded(string $module, $element): bool |
113 | 113 | { |
114 | - if (! isset(self::$loads[$module]) || ! is_array(self::$loads[$module])) { |
|
114 | + if (!isset(self::$loads[$module]) || !is_array(self::$loads[$module])) { |
|
115 | 115 | return false; |
116 | 116 | } |
117 | 117 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | throw LoadException::libraryNotFound($lib); |
80 | 80 | } |
81 | 81 | |
82 | - if (true !== $file_syst && ! class_exists($lib)) { |
|
82 | + if (true !== $file_syst && !class_exists($lib)) { |
|
83 | 83 | throw LoadException::libraryDontExist($lib); |
84 | 84 | } |
85 | 85 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | 'preferApp' => true, |
102 | 102 | ], $options); |
103 | 103 | |
104 | - if (! preg_match('#Model$#', $model)) { |
|
104 | + if (!preg_match('#Model$#', $model)) { |
|
105 | 105 | $model .= 'Model'; |
106 | 106 | } |
107 | 107 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $model = APP_NAMESPACE . '\\Models\\' . $model; |
113 | 113 | } |
114 | 114 | |
115 | - if (! class_exists($model)) { |
|
115 | + if (!class_exists($model)) { |
|
116 | 116 | throw LoadException::modelNotFound($model); |
117 | 117 | } |
118 | 118 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $controller = explode('/', $controller); |
131 | 131 | |
132 | 132 | $con = ucfirst(end($controller)); |
133 | - $con = (! preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
133 | + $con = (!preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
134 | 134 | $controller[count($controller) - 1] = $con; |
135 | 135 | |
136 | 136 | foreach ($controller as $key => &$value) { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | $path = CONTROLLER_PATH . Helpers::ensureExt(implode(DS, $controller), 'php'); |
143 | 143 | |
144 | - if (! file_exists($path)) { |
|
144 | + if (!file_exists($path)) { |
|
145 | 145 | throw LoadException::controllerNotFound(str_replace('Controller', '', $con), $path); |
146 | 146 | } |
147 | 147 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | if (class_exists($class_namespaced, false)) { |
153 | 153 | return Injector::make($class_namespaced); |
154 | 154 | } |
155 | - if (! class_exists($con, false)) { |
|
155 | + if (!class_exists($con, false)) { |
|
156 | 156 | throw LoadException::controllerDontExist(str_replace('Controller', '', $con), $path); |
157 | 157 | } |
158 | 158 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | protected static function verifyPreferApp(array $options, string $name): bool |
182 | 182 | { |
183 | 183 | // Tout element sans restriction passe |
184 | - if (! $options['preferApp']) { |
|
184 | + if (!$options['preferApp']) { |
|
185 | 185 | return true; |
186 | 186 | } |
187 | 187 |