@@ -177,36 +177,36 @@ |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
180 | - * Recupère ou modifie le titre de la page |
|
180 | + * Recupère ou modifie le titre de la page |
|
181 | 181 | * |
182 | - * @return string|self |
|
183 | - */ |
|
184 | - public function title(?string $title = null) |
|
185 | - { |
|
186 | - if (empty($title)) { |
|
187 | - return $this->getData()['title'] ?? ''; |
|
188 | - } |
|
182 | + * @return string|self |
|
183 | + */ |
|
184 | + public function title(?string $title = null) |
|
185 | + { |
|
186 | + if (empty($title)) { |
|
187 | + return $this->getData()['title'] ?? ''; |
|
188 | + } |
|
189 | 189 | |
190 | 190 | return $this->setVar('title', $title); |
191 | 191 | } |
192 | 192 | |
193 | - /** |
|
194 | - * Recupère ou modifie les elements de balises "meta" |
|
195 | - * |
|
196 | - * @return string|self |
|
197 | - */ |
|
198 | - public function meta(string $key, ?string $value = null) |
|
199 | - { |
|
193 | + /** |
|
194 | + * Recupère ou modifie les elements de balises "meta" |
|
195 | + * |
|
196 | + * @return string|self |
|
197 | + */ |
|
198 | + public function meta(string $key, ?string $value = null) |
|
199 | + { |
|
200 | 200 | $meta = $this->getData()['meta'] ?? []; |
201 | 201 | |
202 | - if (empty($value)) { |
|
203 | - return $meta[$key] ?? ''; |
|
204 | - } |
|
202 | + if (empty($value)) { |
|
203 | + return $meta[$key] ?? ''; |
|
204 | + } |
|
205 | 205 | |
206 | - $meta[$key] = esc($value); |
|
206 | + $meta[$key] = esc($value); |
|
207 | 207 | |
208 | 208 | return $this->setVar('meta', $meta); |
209 | - } |
|
209 | + } |
|
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Construit la sortie en fonction d'un nom de fichier et de tout données déjà définies. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $file = $this->viewPath . $view; |
98 | 98 | |
99 | - if (! is_file($file)) { |
|
99 | + if (!is_file($file)) { |
|
100 | 100 | $fileOrig = $file; |
101 | 101 | $file = $this->loader->locateFile($view, 'Views'); |
102 | 102 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function setData(array $data = [], ?string $context = null): self |
173 | 173 | { |
174 | - if (! empty($context)) { |
|
174 | + if (!empty($context)) { |
|
175 | 175 | foreach ($data as $key => &$value) { |
176 | 176 | if (is_array($value)) { |
177 | 177 | foreach ($value as &$obj) { |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | foreach ($matches as $match) { |
280 | 280 | // Loop over each piece of $data, replacing |
281 | 281 | // its contents so that we know what to replace in parse() |
282 | - $str = ''; // holds the new contents for this tag pair. |
|
282 | + $str = ''; // holds the new contents for this tag pair. |
|
283 | 283 | |
284 | 284 | foreach ($data as $row) { |
285 | 285 | // Objects that have a `toArray()` method should be |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | if (is_array($val)) { |
302 | 302 | $pair = $this->parsePair($key, $val, $match[1]); |
303 | 303 | |
304 | - if (! empty($pair)) { |
|
304 | + if (!empty($pair)) { |
|
305 | 305 | $pairs[array_keys($pair)[0]] = true; |
306 | 306 | |
307 | 307 | $temp = array_merge($temp, $pair); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | // Now replace our placeholders with the new content. |
323 | 323 | foreach ($temp as $pattern => $content) { |
324 | - $out = $this->replaceSingle($pattern, $content, $out, ! isset($pairs[$pattern])); |
|
324 | + $out = $this->replaceSingle($pattern, $content, $out, !isset($pairs[$pattern])); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | $str .= $out; |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | $content = (string) $content; |
492 | 492 | |
493 | 493 | // Replace the content in the template |
494 | - return preg_replace_callback($pattern, function ($matches) use ($content, $escape) { |
|
494 | + return preg_replace_callback($pattern, function($matches) use ($content, $escape) { |
|
495 | 495 | // Check for {! !} syntax to not escape this one. |
496 | 496 | if (strpos($matches[0], '{!') === 0 && substr($matches[0], -2) === '!}') { |
497 | 497 | $escape = false; |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | |
511 | 511 | // Our regex earlier will leave all chained values on a single line |
512 | 512 | // so we need to break them apart so we can apply them all. |
513 | - $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : []; |
|
513 | + $filters = !empty($matches[1]) ? explode('|', $matches[1]) : []; |
|
514 | 514 | |
515 | 515 | if ($escape && empty($filters) && ($context = $this->shouldAddEscaping($orig))) { |
516 | 516 | $filters[] = "esc({$context})"; |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $escape = false; |
547 | 547 | } |
548 | 548 | // If no `esc` filter is found, then we'll need to add one. |
549 | - elseif (! preg_match('/\s+esc/', $key)) { |
|
549 | + elseif (!preg_match('/\s+esc/', $key)) { |
|
550 | 550 | $escape = 'html'; |
551 | 551 | } |
552 | 552 | |
@@ -565,10 +565,10 @@ discard block |
||
565 | 565 | preg_match('/\([\w<>=\/\\\,:.\-\s\+]+\)/', $filter, $param); |
566 | 566 | |
567 | 567 | // Remove the () and spaces to we have just the parameter left |
568 | - $param = ! empty($param) ? trim($param[0], '() ') : null; |
|
568 | + $param = !empty($param) ? trim($param[0], '() ') : null; |
|
569 | 569 | |
570 | 570 | // Params can be separated by commas to allow multiple parameters for the filter |
571 | - if (! empty($param)) { |
|
571 | + if (!empty($param)) { |
|
572 | 572 | $param = explode(',', $param); |
573 | 573 | |
574 | 574 | // Clean it up |
@@ -580,10 +580,10 @@ discard block |
||
580 | 580 | } |
581 | 581 | |
582 | 582 | // Get our filter name |
583 | - $filter = ! empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter); |
|
583 | + $filter = !empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter); |
|
584 | 584 | |
585 | 585 | $this->config['filters'] ??= []; |
586 | - if (! array_key_exists($filter, $this->config['filters'])) { |
|
586 | + if (!array_key_exists($filter, $this->config['filters'])) { |
|
587 | 587 | continue; |
588 | 588 | } |
589 | 589 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * $matches[1] = all parameters string in opening tag |
623 | 623 | * $matches[2] = content between the tags to send to the plugin. |
624 | 624 | */ |
625 | - if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) { |
|
625 | + if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) { |
|
626 | 626 | continue; |
627 | 627 | } |
628 | 628 |
@@ -54,11 +54,11 @@ |
||
54 | 54 | |
55 | 55 | parent::initAnnotation($properties); |
56 | 56 | |
57 | - if ($this->min !== null && ! is_int($this->min) && ! is_float($this->min)) { |
|
57 | + if ($this->min !== null && !is_int($this->min) && !is_float($this->min)) { |
|
58 | 58 | throw new AnnotationException('RangeAnnotation requires a numeric (float or int) min property'); |
59 | 59 | } |
60 | 60 | |
61 | - if ($this->max !== null && ! is_int($this->max) && ! is_float($this->max)) { |
|
61 | + if ($this->max !== null && !is_int($this->max) && !is_float($this->max)) { |
|
62 | 62 | throw new AnnotationException('RangeAnnotation requires a numeric (float or int) max property'); |
63 | 63 | } |
64 | 64 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function getValue() |
35 | 35 | { |
36 | - if (! empty($this->value)) { |
|
36 | + if (!empty($this->value)) { |
|
37 | 37 | return $this->value; |
38 | 38 | } |
39 | 39 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | if (isset($properties[1])) { |
61 | 61 | $this->method = (array) $properties[0]; |
62 | 62 | |
63 | - if (! is_string($properties[1])) { |
|
63 | + if (!is_string($properties[1])) { |
|
64 | 64 | throw new AnnotationException('RequestMappingAnnotation requires a string as path property'); |
65 | 65 | } |
66 | 66 | |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | if ($this->method === ['*']) { |
86 | 86 | $this->method = null; |
87 | 87 | } |
88 | - if (! empty($this->method)) { |
|
88 | + if (!empty($this->method)) { |
|
89 | 89 | $this->method = array_map('strtoupper', $this->method); |
90 | 90 | |
91 | 91 | foreach ($this->method as $method) { |
92 | - if (! in_array($method, self::VALID_METHODS, true)) { |
|
92 | + if (!in_array($method, self::VALID_METHODS, true)) { |
|
93 | 93 | throw new AnnotationException('`' . $method . '` is not a valid method for RequestMappingAnnotation'); |
94 | 94 | } |
95 | 95 | } |
@@ -33,8 +33,8 @@ |
||
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Vérifie, instancie et renvoie la seule instance de la classe appelée. |
36 | - * |
|
37 | - * @return static |
|
36 | + * |
|
37 | + * @return static |
|
38 | 38 | */ |
39 | 39 | public static function instance() |
40 | 40 | { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function instance() |
40 | 40 | { |
41 | - if (! (static::$_instance instanceof static)) { |
|
41 | + if (!(static::$_instance instanceof static)) { |
|
42 | 42 | $params = func_get_args(); |
43 | 43 | static::$_instance = new static(...$params); |
44 | 44 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | protected function __construct() |
53 | 53 | { |
54 | 54 | $cacheDir = rtrim(sys_get_temp_dir(), '/\\') . DIRECTORY_SEPARATOR . 'blitz-php' . DIRECTORY_SEPARATOR . 'annotations'; |
55 | - if (! is_dir($cacheDir)) { |
|
55 | + if (!is_dir($cacheDir)) { |
|
56 | 56 | mkdir($cacheDir, 0777, true); |
57 | 57 | } |
58 | 58 | Annotations::$config['cache'] = new AnnotationCache($cacheDir); |
@@ -84,14 +84,14 @@ |
||
84 | 84 | $command = is_string($command) ? $command : 'command:name'; |
85 | 85 | $type = is_string($type) ? $type : 'basic'; |
86 | 86 | |
87 | - if (! in_array($type, ['basic', 'generator'], true)) { |
|
87 | + if (!in_array($type, ['basic', 'generator'], true)) { |
|
88 | 88 | // @codeCoverageIgnoreStart |
89 | 89 | $type = $this->choice(lang('CLI.generator.commandType'), ['basic', 'generator'], 'basic'); |
90 | 90 | $this->eol(); |
91 | 91 | // @codeCoverageIgnoreEnd |
92 | 92 | } |
93 | 93 | |
94 | - if (! is_string($group)) { |
|
94 | + if (!is_string($group)) { |
|
95 | 95 | $group = $type === 'generator' ? 'Generators' : 'BlitzPHP'; |
96 | 96 | } |
97 | 97 |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | foreach (Filesystem::allFiles($path) as $file) { |
140 | 140 | $name = str_replace([$path, '.' . $file->getExtension(), DS], ['', '', '\\'], $file->getPathname()); |
141 | 141 | |
142 | - if (! Str::contains($name, 'Generators' . DS . 'Views')) { |
|
142 | + if (!Str::contains($name, 'Generators' . DS . 'Views')) { |
|
143 | 143 | $this->addCommand('\BlitzPHP\Cli\Commands\\' . $name); |
144 | 144 | } |
145 | 145 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | private function addCommand(string $commandName) |
164 | 164 | { |
165 | - if (! class_exists($commandName)) { |
|
165 | + if (!class_exists($commandName)) { |
|
166 | 166 | throw new CLIException("La classe `{$commandName}` n'existe pas"); |
167 | 167 | } |
168 | 168 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | $instance = new $commandName($this, Services::logger()); |
173 | 173 | |
174 | - if (! ($instance instanceof Command)) { |
|
174 | + if (!($instance instanceof Command)) { |
|
175 | 175 | throw CLIException::invalidCommand($commandName); |
176 | 176 | } |
177 | 177 | |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | $value = (array) $value; |
194 | 194 | |
195 | 195 | $description = $value[0]; |
196 | - if (! is_string($description)) { |
|
196 | + if (!is_string($description)) { |
|
197 | 197 | continue; |
198 | 198 | } |
199 | 199 | |
200 | 200 | $default = $value[1] ?? null; |
201 | 201 | $filter = $value[2] ?? null; |
202 | - if ($filter !== null && ! is_callable($filter)) { |
|
202 | + if ($filter !== null && !is_callable($filter)) { |
|
203 | 203 | $filter = null; |
204 | 204 | } |
205 | 205 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $value = (array) $value; |
212 | 212 | |
213 | 213 | $description = $value[0]; |
214 | - if (! is_string($description)) { |
|
214 | + if (!is_string($description)) { |
|
215 | 215 | continue; |
216 | 216 | } |
217 | 217 | |
@@ -222,14 +222,14 @@ discard block |
||
222 | 222 | |
223 | 223 | $console = $this; |
224 | 224 | |
225 | - $command->action(function () use ($instance, $command, $console) { |
|
226 | - if (! $console->suppress) { |
|
225 | + $command->action(function() use ($instance, $command, $console) { |
|
226 | + if (!$console->suppress) { |
|
227 | 227 | $console->start($instance->service); |
228 | 228 | } |
229 | 229 | |
230 | 230 | $result = $instance->execute($command->values(false)); |
231 | 231 | |
232 | - if (! $console->suppress) { |
|
232 | + if (!$console->suppress) { |
|
233 | 233 | $console->end(); |
234 | 234 | } |
235 | 235 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | // @codeCoverageIgnoreStart |
95 | 95 | $this->colorize(lang('CLI.generator.usingCINamespace'), 'yellow'); |
96 | 96 | |
97 | - if (! $this->confirm('Are you sure you want to continue?')) { |
|
97 | + if (!$this->confirm('Are you sure you want to continue?')) { |
|
98 | 98 | $this->eol(); |
99 | 99 | $this->colorize(lang('CLI.generator.cancelOperation'), 'yellow'); |
100 | 100 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | // Écraser des fichiers sans le savoir est une gêne sérieuse, nous allons donc vérifier si nous dupliquons des choses, |
122 | 122 | // si l'option "forcer" n'est pas fournie, nous renvoyons. |
123 | - if (! $this->getOption('force') && $isFile) { |
|
123 | + if (!$this->getOption('force') && $isFile) { |
|
124 | 124 | $this->io->error(lang('CLI.generator.fileExist', [clean_path($path)]), true); |
125 | 125 | |
126 | 126 | return; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | // Vérifie si le répertoire pour enregistrer le fichier existe. |
130 | 130 | $dir = dirname($path); |
131 | 131 | |
132 | - if (! is_dir($dir)) { |
|
132 | + if (!is_dir($dir)) { |
|
133 | 133 | mkdir($dir, 0755, true); |
134 | 134 | } |
135 | 135 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | // Construisez la classe en fonction des détails dont nous disposons. |
139 | 139 | // Nous obtiendrons le contenu de notre fichier à partir du modèle, |
140 | 140 | // puis nous effectuerons les remplacements nécessaires. |
141 | - if (! write_file($path, $this->buildContent($class))) { |
|
141 | + if (!write_file($path, $this->buildContent($class))) { |
|
142 | 142 | // @codeCoverageIgnoreStart |
143 | 143 | $this->io->error(lang('CLI.generator.fileError', [clean_path($path)]), true); |
144 | 144 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $class = $matches[1] . ucfirst($matches[2]); |
203 | 203 | } |
204 | 204 | |
205 | - if ($this->enabledSuffixing && $this->getOption('suffix') && ! strripos($class, $component)) { |
|
205 | + if ($this->enabledSuffixing && $this->getOption('suffix') && !strripos($class, $component)) { |
|
206 | 206 | $class .= ucfirst($component); |
207 | 207 | } |
208 | 208 |