@@ -96,7 +96,7 @@ |
||
96 | 96 | */ |
97 | 97 | public function fullUrl(): string |
98 | 98 | { |
99 | - if (! empty($query = $this->getEnv('QUERY_STRING'))) { |
|
99 | + if (!empty($query = $this->getEnv('QUERY_STRING'))) { |
|
100 | 100 | return $this->url() . '?' . $query; |
101 | 101 | } |
102 | 102 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $route = Services::routes()->reverseRoute($route, ...$params); |
52 | 52 | |
53 | - if (! $route) { |
|
53 | + if (!$route) { |
|
54 | 54 | throw HttpException::invalidRedirectRoute($route); |
55 | 55 | } |
56 | 56 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $errors = [$errors]; |
82 | 82 | } |
83 | 83 | |
84 | - if (! empty($errors)) { |
|
84 | + if (!empty($errors)) { |
|
85 | 85 | $session = Services::session(); |
86 | 86 | $_errors = $session->getFlashdata('errors') ?? []; |
87 | 87 | $session->setFlashdata( |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | return $this->db->table($table); |
233 | 233 | } |
234 | 234 | |
235 | - if (empty($builderTable) && ! empty($this->table)) { |
|
235 | + if (empty($builderTable) && !empty($this->table)) { |
|
236 | 236 | $this->builder = $this->builder->table($this->table); |
237 | 237 | } |
238 | 238 | |
@@ -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 |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | private function buildDsn(): string |
424 | 424 | { |
425 | - if (! empty($this->dsn)) { |
|
425 | + if (!empty($this->dsn)) { |
|
426 | 426 | return $this->dsn; |
427 | 427 | } |
428 | 428 | |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | static::PROTOCOL_SMTP => "smtp://{$this->username}:{$this->password}@{$this->host}:{$this->port}", |
431 | 431 | static::PROTOCOL_SENDMAIL => 'sendmail://default', |
432 | 432 | static::PROTOCOL_MAIL => 'sendmail://default', |
433 | - static::PROTOCOL_POSTMARK => "postmark+smtp://{$this->username}@default", // username joue le role de ID |
|
434 | - static::PROTOCOL_SENDGRID => "sendgrid+smtp://apikey:{$this->username}@default", // username joue le role de API_KEY |
|
433 | + static::PROTOCOL_POSTMARK => "postmark+smtp://{$this->username}@default", // username joue le role de ID |
|
434 | + static::PROTOCOL_SENDGRID => "sendgrid+smtp://apikey:{$this->username}@default", // username joue le role de API_KEY |
|
435 | 435 | default => "{$this->protocol}+smtp://{$this->username}:{$this->password}@default", |
436 | 436 | }; |
437 | 437 | } |
@@ -159,10 +159,10 @@ |
||
159 | 159 | public function setEncryption(?string $encryption): self |
160 | 160 | { |
161 | 161 | if ($encryption === static::ENCRYPTION_NONE) { |
162 | - $encryption = null; |
|
163 | - } |
|
162 | + $encryption = null; |
|
163 | + } |
|
164 | 164 | |
165 | - if (in_array($encryption, [null, static::ENCRYPTION_SSL, static::ENCRYPTION_TLS], true)) { |
|
165 | + if (in_array($encryption, [null, static::ENCRYPTION_SSL, static::ENCRYPTION_TLS], true)) { |
|
166 | 166 | $this->encryption = $encryption; |
167 | 167 | } |
168 | 168 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function __construct(bool $debug = false) |
33 | 33 | { |
34 | 34 | $this->mailer = new Mailer(); |
35 | - $this->mailer->Debugoutput = function ($str, $level) { |
|
35 | + $this->mailer->Debugoutput = function($str, $level) { |
|
36 | 36 | Services::logger()->info('[Mail][' . $level . ']: ' . $str); |
37 | 37 | }; |
38 | 38 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function init(array $config): self |
46 | 46 | { |
47 | - if (! empty($config['username']) && ! empty($config['password'])) { |
|
47 | + if (!empty($config['username']) && !empty($config['password'])) { |
|
48 | 48 | $this->mailer->SMTPAuth = true; |
49 | 49 | } |
50 | 50 |
@@ -164,9 +164,9 @@ |
||
164 | 164 | */ |
165 | 165 | public function setEncryption(?string $encryption): self |
166 | 166 | { |
167 | - if ($encryption === static::ENCRYPTION_NONE) { |
|
168 | - $encryption = null; |
|
169 | - } |
|
167 | + if ($encryption === static::ENCRYPTION_NONE) { |
|
168 | + $encryption = null; |
|
169 | + } |
|
170 | 170 | |
171 | 171 | if (in_array($encryption, [null, static::ENCRYPTION_SSL, static::ENCRYPTION_TLS], true)) { |
172 | 172 | $this->mailer->SMTPSecure = $encryption; |
@@ -40,11 +40,11 @@ |
||
40 | 40 | if (empty($dependency['class']) || empty($dependency['package'])) { |
41 | 41 | throw new InvalidArgumentException('Invalid dependencies property'); |
42 | 42 | } |
43 | - if (! is_string($dependency['class']) || ! is_string($dependency['package'])) { |
|
43 | + if (!is_string($dependency['class']) || !is_string($dependency['package'])) { |
|
44 | 44 | throw new InvalidArgumentException('Invalid dependencies property'); |
45 | 45 | } |
46 | 46 | |
47 | - if (! class_exists($dependency['class'])) { |
|
47 | + if (!class_exists($dependency['class'])) { |
|
48 | 48 | throw new RuntimeException(lang('Mail.dependancyNotFound', [$dependency['class'], static::class, $dependency['package']])); |
49 | 49 | } |
50 | 50 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | protected function factory(): AbstractAdapter |
113 | 113 | { |
114 | - if (! empty($this->adapter)) { |
|
114 | + if (!empty($this->adapter)) { |
|
115 | 115 | return $this->adapter; |
116 | 116 | } |
117 | 117 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $handler = static::$validHandlers[$handler]; |
126 | 126 | } |
127 | 127 | |
128 | - if (! class_exists($handler)) { |
|
128 | + if (!class_exists($handler)) { |
|
129 | 129 | throw new InvalidArgumentException(lang('Mail.invalidHandler', [$handler])); |
130 | 130 | } |
131 | 131 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $debug = on_dev(); |
135 | 135 | } |
136 | 136 | |
137 | - if (! is_subclass_of($handler, AbstractAdapter::class)) { |
|
137 | + if (!is_subclass_of($handler, AbstractAdapter::class)) { |
|
138 | 138 | throw new InvalidArgumentException(lang('Mail.handlerMustExtendClass', [$handler, AbstractAdapter::class])); |
139 | 139 | } |
140 | 140 | |
@@ -342,13 +342,13 @@ discard block |
||
342 | 342 | // N'est-il pas namespaced ? on cherche le dossier en fonction du parametre "view_base" |
343 | 343 | if (strpos($view, '\\') === false) { |
344 | 344 | $path = $this->config['view_dir'] ?? ''; |
345 | - if (! empty($path)) { |
|
345 | + if (!empty($path)) { |
|
346 | 346 | $path .= '/'; |
347 | 347 | } |
348 | 348 | } |
349 | 349 | |
350 | 350 | $view = view($path . $view, $data); |
351 | - if (! empty($this->config['template'])) { |
|
351 | + if (!empty($this->config['template'])) { |
|
352 | 352 | $view->setLayout($this->config['template']); |
353 | 353 | } |
354 | 354 |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function send(Mail $mail): bool |
174 | 174 | { |
175 | 175 | foreach ($this->bcc() as $key => $value) { |
176 | - if (empty($value) || ! is_string($value)) { |
|
176 | + if (empty($value) || !is_string($value)) { |
|
177 | 177 | continue; |
178 | 178 | } |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | foreach ($this->cc() as $key => $value) { |
188 | - if (empty($value) || ! is_string($value)) { |
|
188 | + if (empty($value) || !is_string($value)) { |
|
189 | 189 | continue; |
190 | 190 | } |
191 | 191 | |
@@ -198,12 +198,12 @@ discard block |
||
198 | 198 | |
199 | 199 | $content = $this->content(); |
200 | 200 | |
201 | - if (! empty($content['view'])) { |
|
201 | + if (!empty($content['view'])) { |
|
202 | 202 | $mail->view($content['view'], $this->data()); |
203 | - } elseif (! empty($content['html'])) { |
|
203 | + } elseif (!empty($content['html'])) { |
|
204 | 204 | $mail->html($content['html']); |
205 | 205 | } |
206 | - if (! empty($content['text'])) { |
|
206 | + if (!empty($content['text'])) { |
|
207 | 207 | $mail->text($content['text']); |
208 | 208 | } |
209 | 209 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $mail->priority($this->priority()); |
213 | 213 | |
214 | 214 | foreach ($this->replyTo() as $key => $value) { |
215 | - if (empty($value) || ! is_string($value)) { |
|
215 | + if (empty($value) || !is_string($value)) { |
|
216 | 216 | continue; |
217 | 217 | } |
218 | 218 |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | // Toujours là ? Ensuite, nous pouvons essayer de faire correspondre l'URI avec |
168 | 168 | // Contrôleurs/répertoires, mais l'application peut ne pas |
169 | 169 | // vouloir ceci, comme dans le cas des API. |
170 | - if (! $this->collection->shouldAutoRoute()) { |
|
170 | + if (!$this->collection->shouldAutoRoute()) { |
|
171 | 171 | $verb = strtolower($this->collection->getHTTPVerb()); |
172 | 172 | |
173 | 173 | throw new PageNotFoundException("Impossible de trouver une route pour '{$verb}: {$uri}'."); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function controllerName() |
197 | 197 | { |
198 | - if (! is_string($this->controller)) { |
|
198 | + if (!is_string($this->controller)) { |
|
199 | 199 | return $this->controller; |
200 | 200 | } |
201 | 201 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | return [ |
237 | 237 | $routeArray[0], // Controller |
238 | - $routeArray[1] ?? 'index', // Method |
|
238 | + $routeArray[1] ?? 'index', // Method |
|
239 | 239 | ]; |
240 | 240 | } |
241 | 241 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | // Cette route est-elle censée rediriger vers une autre ? |
360 | 360 | if ($this->collection->isRedirect($routeKey)) { |
361 | 361 | // remplacement des groupes de routes correspondants par des références : post/([0-9]+) -> post/$1 |
362 | - $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function () { |
|
362 | + $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function() { |
|
363 | 363 | static $i = 1; |
364 | 364 | |
365 | 365 | return '$' . $i++; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | ); |
380 | 380 | |
381 | 381 | if ($this->collection->shouldUseSupportedLocalesOnly() |
382 | - && ! in_array($matched['locale'], config('App')->supportedLocales, true)) { |
|
382 | + && !in_array($matched['locale'], config('App')->supportedLocales, true)) { |
|
383 | 383 | // Lancer une exception pour empêcher l'autorouteur, |
384 | 384 | // si activé, essayer de trouver une route |
385 | 385 | throw PageNotFoundException::localeNotSupported($matched['locale']); |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // Utilisons-nous Closures ? Si tel est le cas, nous devons collecter les paramètres dans un tableau |
393 | 393 | // afin qu'ils puissent être transmis ultérieurement à la méthode du contrôleur. |
394 | - if (! is_string($handler) && is_callable($handler)) { |
|
394 | + if (!is_string($handler) && is_callable($handler)) { |
|
395 | 395 | $this->controller = $handler; |
396 | 396 | |
397 | 397 | // Supprime la chaîne d'origine du tableau matches |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | // $this->method contient déjà le nom de la méthode par défaut, |
491 | 491 | // donc ne l'écrasez pas avec le vide. |
492 | - if (! empty($method)) { |
|
492 | + if (!empty($method)) { |
|
493 | 493 | $this->setMethod($method); |
494 | 494 | } |
495 | 495 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $this->method = $this->collection->getDefaultMethod(); |
513 | 513 | } |
514 | 514 | |
515 | - if (! is_file(CONTROLLER_PATH . $this->directory . $this->makeController($class) . '.php')) { |
|
515 | + if (!is_file(CONTROLLER_PATH . $this->directory . $this->makeController($class) . '.php')) { |
|
516 | 516 | return; |
517 | 517 | } |
518 | 518 |