@@ -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 |
@@ -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); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | throw LoadException::libraryNotFound($lib); |
81 | 81 | } |
82 | 82 | |
83 | - if (true !== $file_syst && ! class_exists($lib)) { |
|
83 | + if (true !== $file_syst && !class_exists($lib)) { |
|
84 | 84 | throw LoadException::libraryDontExist($lib); |
85 | 85 | } |
86 | 86 | |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public static function model(string $model, ?ConnectionInterface $connection = null) |
100 | 100 | { |
101 | - if (! class_exists($model) && ! Text::endsWith($model, 'Model')) { |
|
101 | + if (!class_exists($model) && !Text::endsWith($model, 'Model')) { |
|
102 | 102 | $model .= 'Model'; |
103 | 103 | } |
104 | 104 | |
105 | - if (! class_exists($model)) { |
|
105 | + if (!class_exists($model)) { |
|
106 | 106 | $model = str_replace(APP_NAMESPACE . '\\Models\\', '', $model); |
107 | 107 | $model = APP_NAMESPACE . '\\Models\\' . $model; |
108 | 108 | } |
109 | 109 | |
110 | - if (! class_exists($model)) { |
|
110 | + if (!class_exists($model)) { |
|
111 | 111 | throw LoadException::modelNotFound($model); |
112 | 112 | } |
113 | 113 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $controller = explode('/', $controller); |
126 | 126 | |
127 | 127 | $con = ucfirst(end($controller)); |
128 | - $con = (! preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
128 | + $con = (!preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
129 | 129 | $controller[count($controller) - 1] = $con; |
130 | 130 | |
131 | 131 | foreach ($controller as $key => &$value) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | $path = CONTROLLER_PATH . Helpers::ensureExt(implode(DS, $controller), 'php'); |
138 | 138 | |
139 | - if (! file_exists($path)) { |
|
139 | + if (!file_exists($path)) { |
|
140 | 140 | throw LoadException::controllerNotFound(str_replace('Controller', '', $con), $path); |
141 | 141 | } |
142 | 142 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if (class_exists($class_namespaced, false)) { |
148 | 148 | return Injector::make($class_namespaced); |
149 | 149 | } |
150 | - if (! class_exists($con, false)) { |
|
150 | + if (!class_exists($con, false)) { |
|
151 | 151 | throw LoadException::controllerDontExist(str_replace('Controller', '', $con), $path); |
152 | 152 | } |
153 | 153 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | protected static function verifyPreferApp(array $options, string $name): bool |
177 | 177 | { |
178 | 178 | // Tout element sans restriction passe |
179 | - if (! $options['preferApp']) { |
|
179 | + if (!$options['preferApp']) { |
|
180 | 180 | return true; |
181 | 181 | } |
182 | 182 |
@@ -429,7 +429,7 @@ |
||
429 | 429 | */ |
430 | 430 | protected function idValue(array|object $data) |
431 | 431 | { |
432 | - if (is_object($data) && isset($data->{$this->primaryKey})) { |
|
432 | + if (is_object($data) && isset($data->{$this->primaryKey})) { |
|
433 | 433 | return $data->{$this->primaryKey}; |
434 | 434 | } |
435 | 435 |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // S'assurer qu'on a une bonne connxion a la base de donnees |
243 | - if (! $this->db instanceof ConnectionInterface) { |
|
243 | + if (!$this->db instanceof ConnectionInterface) { |
|
244 | 244 | $this->db = Database::connect($this->group); |
245 | 245 | } |
246 | 246 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function create(array|object|null $data = null, bool $returnID = true) |
274 | 274 | { |
275 | - if (! empty($this->tempData['data'])) { |
|
275 | + if (!empty($this->tempData['data'])) { |
|
276 | 276 | if (empty($data)) { |
277 | 277 | $data = $this->tempData['data']; |
278 | 278 | } else { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | { |
316 | 316 | $id = $id ?: $this->primaryKeyValue; |
317 | 317 | |
318 | - if (! empty($this->tempData['data'])) { |
|
318 | + if (!empty($this->tempData['data'])) { |
|
319 | 319 | if (empty($data)) { |
320 | 320 | $data = $this->tempData['data']; |
321 | 321 | } else { |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | return $data->{$this->primaryKey}; |
434 | 434 | } |
435 | 435 | |
436 | - if (is_array($data) && ! empty($data[$this->primaryKey])) { |
|
436 | + if (is_array($data) && !empty($data[$this->primaryKey])) { |
|
437 | 437 | return $data[$this->primaryKey]; |
438 | 438 | } |
439 | 439 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | */ |
447 | 447 | protected function shouldUpdate(array|object $data): bool |
448 | 448 | { |
449 | - return ! empty($this->idValue($data)); |
|
449 | + return !empty($this->idValue($data)); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | |
465 | 465 | // Convertissez toutes les instances de Date en $dateFormat approprié |
466 | 466 | if ($properties) { |
467 | - $properties = array_map(function ($value) { |
|
467 | + $properties = array_map(function($value) { |
|
468 | 468 | if ($value instanceof Date) { |
469 | 469 | return $this->timeToDate($value); |
470 | 470 | } |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $properties = $data->toArray(); |
493 | 493 | } else { |
494 | 494 | $mirror = new ReflectionClass($data); |
495 | - $props = $mirror->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED); |
|
495 | + $props = $mirror->getProperties(ReflectionProperty::IS_PUBLIC|ReflectionProperty::IS_PROTECTED); |
|
496 | 496 | |
497 | 497 | $properties = []; |
498 | 498 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | */ |
547 | 547 | protected function transformDataToArray(array|object|null $data, string $type): array |
548 | 548 | { |
549 | - if (! in_array($type, ['insert', 'update'], true)) { |
|
549 | + if (!in_array($type, ['insert', 'update'], true)) { |
|
550 | 550 | throw new InvalidArgumentException(sprintf('Invalid type "%s" used upon transforming data to array.', $type)); |
551 | 551 | } |
552 | 552 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | |
557 | 557 | // Si $data utilise une classe personnalisée avec des propriétés publiques ou protégées représentant |
558 | 558 | // les éléments de la collection, nous devons les saisir sous forme de tableau. |
559 | - if (is_object($data) && ! $data instanceof stdClass) { |
|
559 | + if (is_object($data) && !$data instanceof stdClass) { |
|
560 | 560 | $data = $this->objectToArray($data, $type === 'update', true); |
561 | 561 | } |
562 | 562 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | } |
568 | 568 | |
569 | 569 | // S'il est toujours vide ici, cela signifie que $data n'a pas changé ou est un objet vide |
570 | - if (! $this->allowEmptyInserts && empty($data)) { |
|
570 | + if (!$this->allowEmptyInserts && empty($data)) { |
|
571 | 571 | throw DataException::emptyDataset($type); |
572 | 572 | } |
573 | 573 |