@@ -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 |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | // @codeCoverageIgnoreStart |
114 | 114 | $this->colorize(lang('CLI.generator.usingBlitzNamespace'), 'yellow'); |
115 | 115 | |
116 | - if (! $this->confirm('Are you sure you want to continue?')) { |
|
116 | + if (!$this->confirm('Are you sure you want to continue?')) { |
|
117 | 117 | $this->eol()->colorize(lang('CLI.generator.cancelOperation'), 'yellow'); |
118 | 118 | |
119 | 119 | return; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | // Écraser des fichiers sans le savoir est une gêne sérieuse, nous allons donc vérifier si nous dupliquons des choses, |
129 | 129 | // si l'option "forcer" n'est pas fournie, nous renvoyons. |
130 | - if (! $this->option('force') && $isFile) { |
|
130 | + if (!$this->option('force') && $isFile) { |
|
131 | 131 | $this->io->error(lang('CLI.generator.fileExist', [clean_path($target)]), true); |
132 | 132 | |
133 | 133 | return; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | // Vérifie si le répertoire pour enregistrer le fichier existe. |
137 | 137 | $dir = dirname($target); |
138 | 138 | |
139 | - if (! is_dir($dir)) { |
|
139 | + if (!is_dir($dir)) { |
|
140 | 140 | mkdir($dir, 0755, true); |
141 | 141 | } |
142 | 142 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | // Construisez la classe en fonction des détails dont nous disposons. |
146 | 146 | // Nous obtiendrons le contenu de notre fichier à partir du modèle, |
147 | 147 | // puis nous effectuerons les remplacements nécessaires. |
148 | - if (! write_file($target, $content)) { |
|
148 | + if (!write_file($target, $content)) { |
|
149 | 149 | // @codeCoverageIgnoreStart |
150 | 150 | $this->io->error(lang('CLI.generator.fileError', [clean_path($target)]), true); |
151 | 151 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $class = $matches[1] . ucfirst($matches[2]); |
210 | 210 | } |
211 | 211 | |
212 | - if ($this->enabledSuffixing && $this->getOption('suffix') && ! strripos($class, $component)) { |
|
212 | + if ($this->enabledSuffixing && $this->getOption('suffix') && !strripos($class, $component)) { |
|
213 | 213 | $class .= ucfirst($component); |
214 | 214 | } |
215 | 215 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | $base = Services::autoloader()->getNamespace($namespace); |
282 | 282 | |
283 | - if (! $base = reset($base)) { |
|
283 | + if (!$base = reset($base)) { |
|
284 | 284 | $this->io->error(lang('CLI.namespaceNotDefined', [$namespace]), true); |
285 | 285 | |
286 | 286 | return ''; |
@@ -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 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | foreach ($contentTypes as $contentType) { |
62 | 62 | $type = $contentType; |
63 | 63 | |
64 | - if (! is_null($mimeType = $this->getMimeType($contentType))) { |
|
64 | + if (!is_null($mimeType = $this->getMimeType($contentType))) { |
|
65 | 65 | $type = $mimeType; |
66 | 66 | } |
67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $type = strtolower($type); |
71 | 71 | |
72 | - if ($this->matchesType($type, $accept) || $accept === strtok($type, '/').'/*') { |
|
72 | + if ($this->matchesType($type, $accept) || $accept === strtok($type, '/') . '/*') { |
|
73 | 73 | return $contentType; |
74 | 74 | } |
75 | 75 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $split = explode('/', $actual); |
117 | 117 | |
118 | - return isset($split[1]) && preg_match('#'.preg_quote($split[0], '#').'/.+\+'.preg_quote($split[1], '#').'#', $type); |
|
118 | + return isset($split[1]) && preg_match('#' . preg_quote($split[0], '#') . '/.+\+' . preg_quote($split[1], '#') . '#', $type); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | helper('assets'); |
71 | 71 | |
72 | - if (! empty($viewPathLocator)) { |
|
72 | + if (!empty($viewPathLocator)) { |
|
73 | 73 | if (is_string($viewPathLocator)) { |
74 | 74 | $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS; |
75 | 75 | } |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | |
224 | 224 | $file = str_replace('/', DS, rtrim($options['viewPath'] ?? $this->viewPath, '/\\') . DS . ltrim($view, '/\\')); |
225 | 225 | |
226 | - if (! is_file($file) && $this->locator instanceof Locator) { |
|
226 | + if (!is_file($file) && $this->locator instanceof Locator) { |
|
227 | 227 | $file = $this->locator->locateFile($view, 'Views', empty($ext) ? 'php' : $ext); |
228 | 228 | } |
229 | 229 | |
230 | 230 | // locateFile renverra une chaîne vide si le fichier est introuvable. |
231 | - if (! is_file($file)) { |
|
231 | + if (!is_file($file)) { |
|
232 | 232 | throw ViewException::invalidFile($view); |
233 | 233 | } |
234 | 234 |
@@ -72,12 +72,10 @@ |
||
72 | 72 | if (! empty($viewPathLocator)) { |
73 | 73 | if (is_string($viewPathLocator)) { |
74 | 74 | $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS; |
75 | - } |
|
76 | - else if ($viewPathLocator instanceof Locator) { |
|
75 | + } else if ($viewPathLocator instanceof Locator) { |
|
77 | 76 | $this->locator = $viewPathLocator; |
78 | 77 | } |
79 | - } |
|
80 | - else { |
|
78 | + } else { |
|
81 | 79 | $this->locator = Services::locator(); |
82 | 80 | } |
83 | 81 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | // Enregistrer les variables actuelles |
131 | 131 | $renderVars = $this->renderVars; |
132 | 132 | |
133 | - $output = (function (): string { |
|
133 | + $output = (function(): string { |
|
134 | 134 | extract($this->tempData); |
135 | 135 | ob_start(); |
136 | 136 | include $this->renderVars['file']; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $this->logPerformance($this->renderVars['start'], microtime(true), $this->renderVars['view']); |
158 | 158 | |
159 | - if (($this->debug && (! isset($options['debug']) || $options['debug'] === true))) { |
|
159 | + if (($this->debug && (!isset($options['debug']) || $options['debug'] === true))) { |
|
160 | 160 | // Nettoyer nos noms de chemins pour les rendre un peu plus propres |
161 | 161 | $this->renderVars['file'] = clean_path($this->renderVars['file']); |
162 | 162 | $this->renderVars['file'] = ++$this->viewsCount . ' ' . $this->renderVars['file']; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $saveData ??= $this->saveData; |
186 | 186 | $this->prepareTemplateData($saveData); |
187 | 187 | |
188 | - $output = (function (string $view): string { |
|
188 | + $output = (function(string $view): string { |
|
189 | 189 | extract($this->tempData); |
190 | 190 | ob_start(); |
191 | 191 | eval('?>' . $view); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $section = array_pop($this->sectionStack); |
314 | 314 | |
315 | 315 | // Assurez-vous qu'un tableau existe afin que nous puissions stocker plusieurs entrées pour cela. |
316 | - if (! array_key_exists($section, $this->sections)) { |
|
316 | + if (!array_key_exists($section, $this->sections)) { |
|
317 | 317 | $this->sections[$section] = []; |
318 | 318 | } |
319 | 319 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public function show(string $sectionName) |
351 | 351 | { |
352 | - if (! isset($this->sections[$sectionName])) { |
|
352 | + if (!isset($this->sections[$sectionName])) { |
|
353 | 353 | echo ''; |
354 | 354 | |
355 | 355 | return; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @param mixed $saveData |
420 | 420 | */ |
421 | - public function include(string $view, ?array $data = [], ?array $options = null, $saveData = true): string |
|
421 | + public function include(string $view, ?array $data = [], ?array $options = null, $saveData = true) : string |
|
422 | 422 | { |
423 | 423 | return $this->insert($view, $data, $options, $saveData); |
424 | 424 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | public function addLibCss(string ...$src): self |
430 | 430 | { |
431 | 431 | foreach ($src as $var) { |
432 | - if (! in_array($var, $this->_lib_styles, true)) { |
|
432 | + if (!in_array($var, $this->_lib_styles, true)) { |
|
433 | 433 | $this->_lib_styles[] = $var; |
434 | 434 | } |
435 | 435 | } |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | public function addCss(string ...$src): self |
444 | 444 | { |
445 | 445 | foreach ($src as $var) { |
446 | - if (! in_array($var, $this->_styles, true)) { |
|
446 | + if (!in_array($var, $this->_styles, true)) { |
|
447 | 447 | $this->_styles[] = $var; |
448 | 448 | } |
449 | 449 | } |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | ); |
473 | 473 | } |
474 | 474 | |
475 | - if (! empty($lib_styles)) { |
|
475 | + if (!empty($lib_styles)) { |
|
476 | 476 | lib_styles(array_unique($lib_styles)); |
477 | 477 | } |
478 | - if (! empty($styles)) { |
|
478 | + if (!empty($styles)) { |
|
479 | 479 | styles(array_unique($styles)); |
480 | 480 | } |
481 | 481 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | public function addLibJs(string ...$src): self |
489 | 489 | { |
490 | 490 | foreach ($src as $var) { |
491 | - if (! in_array($var, $this->_lib_scripts, true)) { |
|
491 | + if (!in_array($var, $this->_lib_scripts, true)) { |
|
492 | 492 | $this->_lib_scripts[] = $var; |
493 | 493 | } |
494 | 494 | } |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | public function addJs(string ...$src): self |
503 | 503 | { |
504 | 504 | foreach ($src as $var) { |
505 | - if (! in_array($var, $this->_scripts, true)) { |
|
505 | + if (!in_array($var, $this->_scripts, true)) { |
|
506 | 506 | $this->_scripts[] = $var; |
507 | 507 | } |
508 | 508 | } |
@@ -531,10 +531,10 @@ discard block |
||
531 | 531 | ); |
532 | 532 | } |
533 | 533 | |
534 | - if (! empty($lib_scripts)) { |
|
534 | + if (!empty($lib_scripts)) { |
|
535 | 535 | lib_scripts(array_unique($lib_scripts)); |
536 | 536 | } |
537 | - if (! empty($scripts)) { |
|
537 | + if (!empty($scripts)) { |
|
538 | 538 | scripts(array_unique($scripts)); |
539 | 539 | } |
540 | 540 |
@@ -276,8 +276,7 @@ |
||
276 | 276 | $this->sectionStack[] = $name; |
277 | 277 | |
278 | 278 | ob_start(); |
279 | - } |
|
280 | - else { |
|
279 | + } else { |
|
281 | 280 | $this->sections[$name] = [$content]; |
282 | 281 | } |
283 | 282 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this->renderVars['file'] = $this->getRenderedFile($options, $this->renderVars['view'], 'tpl'); |
62 | 62 | |
63 | 63 | $layout = $this->layout; |
64 | - if (! empty($layout)) { |
|
64 | + if (!empty($layout)) { |
|
65 | 65 | if (empty(pathinfo($layout, PATHINFO_EXTENSION))) { |
66 | 66 | $layout .= '.tpl'; |
67 | 67 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->engine->assign($this->data); |
72 | 72 | |
73 | 73 | // Doit-on mettre en cache? |
74 | - if (! empty($this->renderVars['options']['cache_name']) || ! empty($this->renderVars['options']['cache'])) { |
|
74 | + if (!empty($this->renderVars['options']['cache_name']) || !empty($this->renderVars['options']['cache'])) { |
|
75 | 75 | $this->enableCache(); |
76 | 76 | $this->engine->setCacheLifetime(60 * $this->renderVars['options']['cache'] ?? 60); |
77 | 77 | $this->engine->setCompileId($this->renderVars['options']['cache_name'] ?? null); |