@@ -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); |
@@ -98,7 +98,7 @@ |
||
98 | 98 | return $this->withFile($filepath, ['download' => true, 'name' => $filename]); |
99 | 99 | } |
100 | 100 | |
101 | - if (! empty($data)) { |
|
101 | + if (!empty($data)) { |
|
102 | 102 | return $this->withStringBody($data) |
103 | 103 | ->withType(pathinfo($filename, PATHINFO_EXTENSION)) |
104 | 104 | ->withDownload($filename); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * Chemin source |
18 | 18 | */ |
19 | - protected string $sourcePath = __DIR__ .'/../'; |
|
19 | + protected string $sourcePath = __DIR__ . '/../'; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Chemin cible pour le replacement |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | |
69 | 69 | $directory = dirname($path); |
70 | 70 | |
71 | - if (! is_dir($directory)) { |
|
71 | + if (!is_dir($directory)) { |
|
72 | 72 | mkdir($directory, 0777, true); |
73 | 73 | } |
74 | 74 | |
75 | 75 | if (file_exists($path)) { |
76 | 76 | $overwrite = (bool) $this->option('f'); |
77 | 77 | |
78 | - if (! $overwrite && ! $this->confirm("File '{$cleanPath}' already exists in destination. Overwrite?")) { |
|
78 | + if (!$overwrite && !$this->confirm("File '{$cleanPath}' already exists in destination. Overwrite?")) { |
|
79 | 79 | $this->error("Skipped {$cleanPath}. If you wish to overwrite, please use the '-f' option or reply 'y' to the prompt."); |
80 | 80 | |
81 | 81 | return; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | final protected function success(string $message, bool $badge = true, string $label = 'SUCCESS'): self |
308 | 308 | { |
309 | - if (! $badge) { |
|
309 | + if (!$badge) { |
|
310 | 310 | $this->writer->okBold($label); |
311 | 311 | } else { |
312 | 312 | $this->writer->boldWhiteBgGreen(" {$label} "); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | final protected function warning(string $message, bool $badge = true, string $label = 'WARNING'): self |
322 | 322 | { |
323 | - if (! $badge) { |
|
323 | + if (!$badge) { |
|
324 | 324 | $this->writer->warnBold($label); |
325 | 325 | } else { |
326 | 326 | $this->writer->boldWhiteBgYellow(" {$label} "); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | final protected function info(string $message, bool $badge = true, string $label = 'INFO'): self |
336 | 336 | { |
337 | - if (! $badge) { |
|
337 | + if (!$badge) { |
|
338 | 338 | $this->writer->infoBold($label); |
339 | 339 | } else { |
340 | 340 | $this->writer->boldWhiteBgCyan(" {$label} "); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | final protected function error(string $message, bool $badge = true, string $label = 'ERROR'): self |
350 | 350 | { |
351 | - if (! $badge) { |
|
351 | + if (!$badge) { |
|
352 | 352 | $this->writer->errorBold($label); |
353 | 353 | } else { |
354 | 354 | $this->writer->boldWhiteBgRed(" {$label} "); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | */ |
454 | 454 | final protected function json($data): self |
455 | 455 | { |
456 | - $this->write(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), true); |
|
456 | + $this->write(json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES), true); |
|
457 | 457 | |
458 | 458 | return $this; |
459 | 459 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class DatabaseCollector extends BaseCollector |
23 | 23 | { |
24 | - /** |
|
24 | + /** |
|
25 | 25 | * {@inheritDoc} |
26 | 26 | */ |
27 | 27 | protected $hasTimeline = true; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | |
67 | - /** |
|
67 | + /** |
|
68 | 68 | * La méthode statique utilisée lors des événements pour collecter des données. |
69 | 69 | */ |
70 | 70 | public static function collect(Event $event) |
@@ -78,141 +78,141 @@ discard block |
||
78 | 78 | // Fournit la valeur par défaut au cas où elle n'est pas définie |
79 | 79 | $max = $config->max_queries ?: 100; |
80 | 80 | |
81 | - if (count(static::$queries) < $max) { |
|
81 | + if (count(static::$queries) < $max) { |
|
82 | 82 | static::$queries[] = (object) $result->details(); |
83 | - } |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * {@inheritDoc} |
|
88 | - */ |
|
89 | - protected function formatTimelineData(): array |
|
90 | - { |
|
91 | - $data = []; |
|
92 | - |
|
93 | - foreach ($this->connections as $alias => $connection) { |
|
94 | - $data[] = [ |
|
95 | - 'name' => 'Connecting to Database: "' . $connection->getDatabase() . '". Config: "' . $alias . '"', |
|
96 | - 'component' => 'Database', |
|
97 | - 'start' => $connection->getConnectStart(), |
|
98 | - 'duration' => $connection->getConnectDuration(), |
|
99 | - ]; |
|
100 | - } |
|
101 | - |
|
102 | - foreach (static::$queries as $query) { |
|
103 | - $data[] = [ |
|
104 | - 'name' => 'Query', |
|
105 | - 'component' => 'Database', |
|
106 | - 'query' => $query->sql, |
|
107 | - 'start' => $query->start, |
|
108 | - 'duration' => $query->duration |
|
109 | - ]; |
|
110 | - } |
|
111 | - |
|
112 | - return $data; |
|
113 | - } |
|
83 | + } |
|
84 | + } |
|
114 | 85 | |
115 | 86 | /** |
116 | - * {@inheritDoc} |
|
117 | - */ |
|
118 | - public function display(): array |
|
119 | - { |
|
120 | - // Mots clés que nous voulons mettre en gras |
|
121 | - $highlight = [ |
|
122 | - 'SELECT', |
|
123 | - 'DISTINCT', |
|
124 | - 'FROM', |
|
125 | - 'WHERE', |
|
126 | - 'AND', |
|
127 | - 'INNER JOIN', |
|
128 | - 'LEFT JOIN', |
|
129 | - 'RIGHT JOIN', |
|
130 | - 'JOIN', |
|
131 | - 'ORDER BY', |
|
132 | - 'ASC', |
|
133 | - 'DESC', |
|
134 | - 'GROUP BY', |
|
135 | - 'LIMIT', |
|
136 | - 'INSERT', |
|
137 | - 'INTO', |
|
138 | - 'VALUES', |
|
139 | - 'UPDATE', |
|
140 | - 'OR ', |
|
141 | - 'HAVING', |
|
142 | - 'OFFSET', |
|
143 | - 'NOT IN', |
|
144 | - 'IN', |
|
145 | - 'NOT LIKE', |
|
146 | - 'LIKE', |
|
147 | - 'COUNT', |
|
148 | - 'MAX', |
|
149 | - 'MIN', |
|
150 | - 'ON', |
|
151 | - 'AS', |
|
152 | - 'AVG', |
|
153 | - 'SUM', |
|
154 | - 'UPPER', |
|
155 | - 'LOWER', |
|
156 | - '(', |
|
157 | - ')', |
|
158 | - ]; |
|
159 | - |
|
160 | - $data = [ |
|
161 | - 'queries' => [], |
|
162 | - ]; |
|
87 | + * {@inheritDoc} |
|
88 | + */ |
|
89 | + protected function formatTimelineData(): array |
|
90 | + { |
|
91 | + $data = []; |
|
92 | + |
|
93 | + foreach ($this->connections as $alias => $connection) { |
|
94 | + $data[] = [ |
|
95 | + 'name' => 'Connecting to Database: "' . $connection->getDatabase() . '". Config: "' . $alias . '"', |
|
96 | + 'component' => 'Database', |
|
97 | + 'start' => $connection->getConnectStart(), |
|
98 | + 'duration' => $connection->getConnectDuration(), |
|
99 | + ]; |
|
100 | + } |
|
101 | + |
|
102 | + foreach (static::$queries as $query) { |
|
103 | + $data[] = [ |
|
104 | + 'name' => 'Query', |
|
105 | + 'component' => 'Database', |
|
106 | + 'query' => $query->sql, |
|
107 | + 'start' => $query->start, |
|
108 | + 'duration' => $query->duration |
|
109 | + ]; |
|
110 | + } |
|
111 | + |
|
112 | + return $data; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * {@inheritDoc} |
|
117 | + */ |
|
118 | + public function display(): array |
|
119 | + { |
|
120 | + // Mots clés que nous voulons mettre en gras |
|
121 | + $highlight = [ |
|
122 | + 'SELECT', |
|
123 | + 'DISTINCT', |
|
124 | + 'FROM', |
|
125 | + 'WHERE', |
|
126 | + 'AND', |
|
127 | + 'INNER JOIN', |
|
128 | + 'LEFT JOIN', |
|
129 | + 'RIGHT JOIN', |
|
130 | + 'JOIN', |
|
131 | + 'ORDER BY', |
|
132 | + 'ASC', |
|
133 | + 'DESC', |
|
134 | + 'GROUP BY', |
|
135 | + 'LIMIT', |
|
136 | + 'INSERT', |
|
137 | + 'INTO', |
|
138 | + 'VALUES', |
|
139 | + 'UPDATE', |
|
140 | + 'OR ', |
|
141 | + 'HAVING', |
|
142 | + 'OFFSET', |
|
143 | + 'NOT IN', |
|
144 | + 'IN', |
|
145 | + 'NOT LIKE', |
|
146 | + 'LIKE', |
|
147 | + 'COUNT', |
|
148 | + 'MAX', |
|
149 | + 'MIN', |
|
150 | + 'ON', |
|
151 | + 'AS', |
|
152 | + 'AVG', |
|
153 | + 'SUM', |
|
154 | + 'UPPER', |
|
155 | + 'LOWER', |
|
156 | + '(', |
|
157 | + ')', |
|
158 | + ]; |
|
159 | + |
|
160 | + $data = [ |
|
161 | + 'queries' => [], |
|
162 | + ]; |
|
163 | 163 | |
164 | 164 | |
165 | - foreach (static::$queries as $query) { |
|
166 | - $sql = $query->sql; |
|
165 | + foreach (static::$queries as $query) { |
|
166 | + $sql = $query->sql; |
|
167 | 167 | |
168 | - foreach ($highlight as $term) { |
|
169 | - $sql = str_replace($term, "<strong>{$term}</strong>", $sql); |
|
170 | - } |
|
168 | + foreach ($highlight as $term) { |
|
169 | + $sql = str_replace($term, "<strong>{$term}</strong>", $sql); |
|
170 | + } |
|
171 | 171 | |
172 | - $data['queries'][] = [ |
|
172 | + $data['queries'][] = [ |
|
173 | 173 | 'duration' => (number_format($query->duration, 5) * 1000) . ' ms', |
174 | 174 | 'sql' => $sql, |
175 | 175 | 'affected_rows' => $query->affected_rows |
176 | - ]; |
|
177 | - } |
|
176 | + ]; |
|
177 | + } |
|
178 | 178 | |
179 | - return $data; |
|
180 | - } |
|
181 | - |
|
182 | - /** |
|
183 | - * {@inheritDoc} |
|
184 | - */ |
|
185 | - public function getBadgeValue(): int |
|
186 | - { |
|
187 | - return count(static::$queries); |
|
188 | - } |
|
189 | - |
|
190 | - /** |
|
191 | - * {@inheritDoc} |
|
192 | - * |
|
193 | - * @return string Le nombre de requêtes (entre parenthèses) ou une chaîne vide. |
|
194 | - */ |
|
195 | - public function getTitleDetails(): string |
|
196 | - { |
|
197 | - return '(' . count(static::$queries) . ' Queries across ' . ($countConnection = count($this->connections)) . ' Connection' . |
|
198 | - ($countConnection > 1 ? 's' : '') . ')'; |
|
199 | - } |
|
200 | - |
|
201 | - /** |
|
202 | - * {@inheritDoc} |
|
203 | - */ |
|
204 | - public function isEmpty(): bool |
|
205 | - { |
|
206 | - return empty(static::$queries); |
|
207 | - } |
|
208 | - |
|
209 | - /** |
|
210 | - * {@inheritDoc} |
|
211 | - */ |
|
212 | - public function icon(): string |
|
213 | - { |
|
214 | - return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADMSURBVEhLY6A3YExLSwsA4nIycQDIDIhRWEBqamo/UNF/SjDQjF6ocZgAKPkRiFeEhoYyQ4WIBiA9QAuWAPEHqBAmgLqgHcolGQD1V4DMgHIxwbCxYD+QBqcKINseKo6eWrBioPrtQBq/BcgY5ht0cUIYbBg2AJKkRxCNWkDQgtFUNJwtABr+F6igE8olGQD114HMgHIxAVDyAhA/AlpSA8RYUwoeXAPVex5qHCbIyMgwBCkAuQJIY00huDBUz/mUlBQDqHGjgBjAwAAACexpph6oHSQAAAAASUVORK5CYII='; |
|
215 | - } |
|
179 | + return $data; |
|
180 | + } |
|
181 | + |
|
182 | + /** |
|
183 | + * {@inheritDoc} |
|
184 | + */ |
|
185 | + public function getBadgeValue(): int |
|
186 | + { |
|
187 | + return count(static::$queries); |
|
188 | + } |
|
189 | + |
|
190 | + /** |
|
191 | + * {@inheritDoc} |
|
192 | + * |
|
193 | + * @return string Le nombre de requêtes (entre parenthèses) ou une chaîne vide. |
|
194 | + */ |
|
195 | + public function getTitleDetails(): string |
|
196 | + { |
|
197 | + return '(' . count(static::$queries) . ' Queries across ' . ($countConnection = count($this->connections)) . ' Connection' . |
|
198 | + ($countConnection > 1 ? 's' : '') . ')'; |
|
199 | + } |
|
200 | + |
|
201 | + /** |
|
202 | + * {@inheritDoc} |
|
203 | + */ |
|
204 | + public function isEmpty(): bool |
|
205 | + { |
|
206 | + return empty(static::$queries); |
|
207 | + } |
|
208 | + |
|
209 | + /** |
|
210 | + * {@inheritDoc} |
|
211 | + */ |
|
212 | + public function icon(): string |
|
213 | + { |
|
214 | + return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADMSURBVEhLY6A3YExLSwsA4nIycQDIDIhRWEBqamo/UNF/SjDQjF6ocZgAKPkRiFeEhoYyQ4WIBiA9QAuWAPEHqBAmgLqgHcolGQD1V4DMgHIxwbCxYD+QBqcKINseKo6eWrBioPrtQBq/BcgY5ht0cUIYbBg2AJKkRxCNWkDQgtFUNJwtABr+F6igE8olGQD114HMgHIxAVDyAhA/AlpSA8RYUwoeXAPVex5qHCbIyMgwBCkAuQJIY00huDBUz/mUlBQDqHGjgBjAwAAACexpph6oHSQAAAAASUVORK5CYII='; |
|
215 | + } |
|
216 | 216 | |
217 | 217 | /** |
218 | 218 | * Obtient les connexions à partir de la configuration de la base de données |
@@ -118,7 +118,7 @@ |
||
118 | 118 | public function display(): array |
119 | 119 | { |
120 | 120 | // Mots clés que nous voulons mettre en gras |
121 | - $highlight = [ |
|
121 | + $highlight = [ |
|
122 | 122 | 'SELECT', |
123 | 123 | 'DISTINCT', |
124 | 124 | 'FROM', |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | helper('assets'); |
72 | 72 | |
73 | - if (! empty($viewPathLocator)) { |
|
73 | + if (!empty($viewPathLocator)) { |
|
74 | 74 | if (is_string($viewPathLocator)) { |
75 | 75 | $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS; |
76 | 76 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $options = (array) $options; |
224 | 224 | |
225 | 225 | $viewPath = $options['viewPath'] ?? $this->viewPath; |
226 | - if (! empty($viewPath)) { |
|
226 | + if (!empty($viewPath)) { |
|
227 | 227 | $file = str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')); |
228 | 228 | } |
229 | 229 | else { |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | |
233 | 233 | $file = Helpers::ensureExt($file, $ext); |
234 | 234 | |
235 | - if (! is_file($file) && $this->locator instanceof Locator) { |
|
235 | + if (!is_file($file) && $this->locator instanceof Locator) { |
|
236 | 236 | $file = $this->locator->locateFile($view, 'Views', empty($ext) ? 'php' : $ext); |
237 | 237 | } |
238 | 238 | |
239 | 239 | // locateFile renverra une chaîne vide si le fichier est introuvable. |
240 | - if (! is_file($file)) { |
|
240 | + if (!is_file($file)) { |
|
241 | 241 | throw ViewException::invalidFile($view); |
242 | 242 | } |
243 | 243 |
@@ -73,12 +73,10 @@ discard block |
||
73 | 73 | if (! empty($viewPathLocator)) { |
74 | 74 | if (is_string($viewPathLocator)) { |
75 | 75 | $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS; |
76 | - } |
|
77 | - else if ($viewPathLocator instanceof Locator) { |
|
76 | + } else if ($viewPathLocator instanceof Locator) { |
|
78 | 77 | $this->locator = $viewPathLocator; |
79 | 78 | } |
80 | - } |
|
81 | - else { |
|
79 | + } else { |
|
82 | 80 | $this->locator = Services::locator(); |
83 | 81 | } |
84 | 82 | } |
@@ -225,8 +223,7 @@ discard block |
||
225 | 223 | $viewPath = $options['viewPath'] ?? $this->viewPath; |
226 | 224 | if (! empty($viewPath)) { |
227 | 225 | $file = str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')); |
228 | - } |
|
229 | - else { |
|
226 | + } else { |
|
230 | 227 | $file = $view; |
231 | 228 | } |
232 | 229 |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | $group = on_test() ? 'test' : (on_prod() ? 'production' : 'development'); |
58 | 58 | } |
59 | 59 | |
60 | - if (! isset($config[$group])) { |
|
60 | + if (!isset($config[$group])) { |
|
61 | 61 | $group = 'default'; |
62 | 62 | } |
63 | 63 | |
64 | - if (is_string($group) && ! isset($config[$group]) && strpos($group, 'custom-') !== 0) { |
|
64 | + if (is_string($group) && !isset($config[$group]) && strpos($group, 'custom-') !== 0) { |
|
65 | 65 | throw new InvalidArgumentException($group . ' is not a valid database connection group.'); |
66 | 66 | } |
67 | 67 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $config = $config[$group]; |
73 | 73 | |
74 | - if (str_contains($config['driver'], 'sqlite') && $config['database'] !== ':memory:' && ! str_contains($config['database'], DS)) { |
|
74 | + if (str_contains($config['driver'], 'sqlite') && $config['database'] !== ':memory:' && !str_contains($config['database'], DS)) { |
|
75 | 75 | $config['database'] = APP_STORAGE_PATH . $config['database']; |
76 | 76 | } |
77 | 77 |
@@ -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, $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 |
@@ -477,7 +477,7 @@ |
||
477 | 477 | $name = array_shift($arguments); |
478 | 478 | |
479 | 479 | if (empty(static::$instances[$name])) { |
480 | - if (! empty($arguments)) { |
|
480 | + if (!empty($arguments)) { |
|
481 | 481 | static::$instances[$name] = static::factory($name, $arguments); |
482 | 482 | } else { |
483 | 483 | static::$instances[$name] = static::injector()->get($name); |