@@ -31,7 +31,7 @@ |
||
| 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 | /** |
@@ -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); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $input = $this->all(); |
| 88 | 88 | |
| 89 | 89 | foreach ($keys as $value) { |
| 90 | - if (! Arr::has($input, $value)) { |
|
| 90 | + if (!Arr::has($input, $value)) { |
|
| 91 | 91 | return false; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $keys = is_array($key) ? $key : func_get_args(); |
| 150 | 150 | |
| 151 | 151 | foreach ($keys as $value) { |
| 152 | - if (! $this->isEmptyString($value)) { |
|
| 152 | + if (!$this->isEmptyString($value)) { |
|
| 153 | 153 | return false; |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | { |
| 199 | 199 | $keys = is_array($key) ? $key : func_get_args(); |
| 200 | 200 | |
| 201 | - return ! $this->has($keys); |
|
| 201 | + return !$this->has($keys); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | $value = $this->input($key); |
| 228 | 228 | |
| 229 | - return ! is_bool($value) && ! is_array($value) && trim((string) $value) === ''; |
|
| 229 | + return !is_bool($value) && !is_array($value) && trim((string) $value) === ''; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | { |
| 247 | 247 | $input = array_replace_recursive($this->data(), $this->allFiles()); |
| 248 | 248 | |
| 249 | - if (! $keys) { |
|
| 249 | + if (!$keys) { |
|
| 250 | 250 | return $input; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -341,9 +341,9 @@ discard block |
||
| 341 | 341 | public function enum(string $key, $enumClass) |
| 342 | 342 | { |
| 343 | 343 | if ($this->isNotFilled($key) |
| 344 | - || ! function_exists('enum_exists') |
|
| 345 | - || ! enum_exists($enumClass) |
|
| 346 | - || ! method_exists($enumClass, 'tryFrom')) { |
|
| 344 | + || !function_exists('enum_exists') |
|
| 345 | + || !enum_exists($enumClass) |
|
| 346 | + || !method_exists($enumClass, 'tryFrom')) { |
|
| 347 | 347 | return null; |
| 348 | 348 | } |
| 349 | 349 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | public function hasFile(string $key): bool |
| 459 | 459 | { |
| 460 | - if (! is_array($files = $this->file($key))) { |
|
| 460 | + if (!is_array($files = $this->file($key))) { |
|
| 461 | 461 | $files = [$files]; |
| 462 | 462 | } |
| 463 | 463 | |
@@ -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 | |
@@ -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 | } elseif ($viewPathLocator instanceof Locator) { |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $options = (array) $options; |
| 222 | 222 | |
| 223 | 223 | $viewPath = $options['viewPath'] ?? $this->viewPath; |
| 224 | - if (! empty($viewPath)) { |
|
| 224 | + if (!empty($viewPath)) { |
|
| 225 | 225 | $file = str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')); |
| 226 | 226 | } else { |
| 227 | 227 | $file = $view; |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | $file = Helpers::ensureExt($file, $ext); |
| 231 | 231 | |
| 232 | - if (! is_file($file) && $this->locator instanceof Locator) { |
|
| 232 | + if (!is_file($file) && $this->locator instanceof Locator) { |
|
| 233 | 233 | $file = $this->locator->locateFile($view, 'Views', empty($ext) ? 'php' : $ext); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // locateFile renverra une chaîne vide si le fichier est introuvable. |
| 237 | - if (! is_file($file)) { |
|
| 237 | + if (!is_file($file)) { |
|
| 238 | 238 | throw ViewException::invalidFile($view); |
| 239 | 239 | } |
| 240 | 240 | |
@@ -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 | } |
@@ -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 | |