@@ -2,40 +2,40 @@ |
||
2 | 2 | |
3 | 3 | $ignoreErrors = []; |
4 | 4 | $ignoreErrors[] = [ |
5 | - 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<cronExpression\\>, string given\\.$#', |
|
6 | - 'identifier' => 'argument.type', |
|
7 | - 'count' => 1, |
|
8 | - 'path' => __DIR__ . '/src/Commands/Lister.php', |
|
5 | + 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<cronExpression\\>, string given\\.$#', |
|
6 | + 'identifier' => 'argument.type', |
|
7 | + 'count' => 1, |
|
8 | + 'path' => __DIR__ . '/src/Commands/Lister.php', |
|
9 | 9 | ]; |
10 | 10 | $ignoreErrors[] = [ |
11 | - 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<scheduler\\>, string given\\.$#', |
|
12 | - 'identifier' => 'argument.type', |
|
13 | - 'count' => 1, |
|
14 | - 'path' => __DIR__ . '/src/Commands/Lister.php', |
|
11 | + 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<scheduler\\>, string given\\.$#', |
|
12 | + 'identifier' => 'argument.type', |
|
13 | + 'count' => 1, |
|
14 | + 'path' => __DIR__ . '/src/Commands/Lister.php', |
|
15 | 15 | ]; |
16 | 16 | $ignoreErrors[] = [ |
17 | - 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<scheduler\\>, string given\\.$#', |
|
18 | - 'identifier' => 'argument.type', |
|
19 | - 'count' => 1, |
|
20 | - 'path' => __DIR__ . '/src/Commands/Run.php', |
|
17 | + 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<scheduler\\>, string given\\.$#', |
|
18 | + 'identifier' => 'argument.type', |
|
19 | + 'count' => 1, |
|
20 | + 'path' => __DIR__ . '/src/Commands/Run.php', |
|
21 | 21 | ]; |
22 | 22 | $ignoreErrors[] = [ |
23 | - 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<cronExpression\\>, string given\\.$#', |
|
24 | - 'identifier' => 'argument.type', |
|
25 | - 'count' => 1, |
|
26 | - 'path' => __DIR__ . '/src/Task.php', |
|
23 | + 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<cronExpression\\>, string given\\.$#', |
|
24 | + 'identifier' => 'argument.type', |
|
25 | + 'count' => 1, |
|
26 | + 'path' => __DIR__ . '/src/Task.php', |
|
27 | 27 | ]; |
28 | 28 | $ignoreErrors[] = [ |
29 | - 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<httpclient\\>, string given\\.$#', |
|
30 | - 'identifier' => 'argument.type', |
|
31 | - 'count' => 1, |
|
32 | - 'path' => __DIR__ . '/src/Task.php', |
|
29 | + 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<httpclient\\>, string given\\.$#', |
|
30 | + 'identifier' => 'argument.type', |
|
31 | + 'count' => 1, |
|
32 | + 'path' => __DIR__ . '/src/Task.php', |
|
33 | 33 | ]; |
34 | 34 | $ignoreErrors[] = [ |
35 | - 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<scheduler\\>, string given\\.$#', |
|
36 | - 'identifier' => 'argument.type', |
|
37 | - 'count' => 1, |
|
38 | - 'path' => __DIR__ . '/src/TaskRunner.php', |
|
35 | + 'message' => '#^Parameter \\#1 \\$name of function service expects class\\-string\\<scheduler\\>, string given\\.$#', |
|
36 | + 'identifier' => 'argument.type', |
|
37 | + 'count' => 1, |
|
38 | + 'path' => __DIR__ . '/src/TaskRunner.php', |
|
39 | 39 | ]; |
40 | 40 | |
41 | 41 | return ['parameters' => ['ignoreErrors' => $ignoreErrors]]; |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | $ignoreErrors = []; |
4 | 4 | $ignoreErrors[] = [ |
@@ -42,4 +42,4 @@ |
||
42 | 42 | $reporters->add('coverage', $coverage); |
43 | 43 | }); |
44 | 44 | |
45 | -require_once realpath(rtrim(getcwd(), '\\/ ')).DIRECTORY_SEPARATOR.'spec'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
45 | +require_once realpath(rtrim(getcwd(), '\\/ ')) . DIRECTORY_SEPARATOR . 'spec' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
@@ -99,7 +99,7 @@ |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // Si nous ne le faisons pas correspondre, recommencez les itérations |
102 | - if (! $satisfied) { |
|
102 | + if (!$satisfied) { |
|
103 | 103 | $next = $this->increment($next, $position); |
104 | 104 | |
105 | 105 | continue 2; |
@@ -33,7 +33,7 @@ |
||
33 | 33 | public function run() |
34 | 34 | { |
35 | 35 | $method = 'run' . ucfirst($this->type); |
36 | - if (! method_exists($this, $method)) { |
|
36 | + if (!method_exists($this, $method)) { |
|
37 | 37 | throw TasksException::invalidTaskType($this->type); |
38 | 38 | } |
39 | 39 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * Enregistrez toutes les tâches dans cette méthode pour l'application. |
39 | 39 | * Appelé par TaskRunner. |
40 | 40 | */ |
41 | - 'init' => function (Scheduler $schedule) { |
|
41 | + 'init' => function(Scheduler $schedule) { |
|
42 | 42 | $schedule->command('foo:bar')->daily(); |
43 | 43 | |
44 | 44 | $schedule->shell('cp foo bar')->daily('11:00 pm'); |
@@ -144,7 +144,7 @@ |
||
144 | 144 | if (str_contains($time, '/')) { |
145 | 145 | $period = substr($time, strpos($time, '/') + 1) ?: ''; |
146 | 146 | |
147 | - if ($period === '' || ! ctype_digit($period)) { |
|
147 | + if ($period === '' || !ctype_digit($period)) { |
|
148 | 148 | throw TasksException::invalidCronExpression($this->currentExpression); |
149 | 149 | } |
150 | 150 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | protected string $timezone; |
29 | 29 | |
30 | - /** |
|
30 | + /** |
|
31 | 31 | * Le fuseau horaire global à utiliser. |
32 | 32 | */ |
33 | 33 | private string $globalTimezone; |
@@ -51,24 +51,24 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function __construct(?string $timezone = null) |
53 | 53 | { |
54 | - if (null === $globalTimezone = config('tasks.timezone')) { |
|
55 | - $globalTimezone = config('app.timezone'); |
|
56 | - } |
|
54 | + if (null === $globalTimezone = config('tasks.timezone')) { |
|
55 | + $globalTimezone = config('app.timezone'); |
|
56 | + } |
|
57 | 57 | |
58 | - $this->globalTimezone = $globalTimezone; |
|
58 | + $this->globalTimezone = $globalTimezone; |
|
59 | 59 | |
60 | 60 | $this->setTimezone($timezone); |
61 | 61 | } |
62 | 62 | |
63 | - /** |
|
64 | - * Définit le fuseau horaire global pour toutes les tâches de construction. |
|
65 | - */ |
|
66 | - public function setTimezone(?string $timezone = null): self |
|
67 | - { |
|
68 | - $this->timezone = $timezone ?? $this->globalTimezone; |
|
63 | + /** |
|
64 | + * Définit le fuseau horaire global pour toutes les tâches de construction. |
|
65 | + */ |
|
66 | + public function setTimezone(?string $timezone = null): self |
|
67 | + { |
|
68 | + $this->timezone = $timezone ?? $this->globalTimezone; |
|
69 | 69 | |
70 | - return $this; |
|
71 | - } |
|
70 | + return $this; |
|
71 | + } |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Vérifie si l'expression cron doit être exécutée. Permet d'utiliser un fuseau horaire personnalisé pour une tâche spécifique |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | |
59 | 59 | foreach ($tasks as $task) { |
60 | 60 | // Si des tâches spécifiques ont été choisies, sauter l'exécution des tâches restantes. |
61 | - if (! empty($this->only) && ! in_array($task->name, $this->only, true)) { |
|
61 | + if (!empty($this->only) && !in_array($task->name, $this->only, true)) { |
|
62 | 62 | continue; |
63 | 63 | } |
64 | 64 | |
65 | - if (! $task->shouldRun($this->testTime) && empty($this->only)) { |
|
65 | + if (!$task->shouldRun($this->testTime) && empty($this->only)) { |
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | - if (! is_cli()) { |
|
133 | + if (!is_cli()) { |
|
134 | 134 | return; |
135 | 135 | } |
136 | 136 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | protected array $environments = []; |
58 | 58 | |
59 | - /** |
|
59 | + /** |
|
60 | 60 | * Timezone dans lequel la tâche doit être traitée. |
61 | 61 | */ |
62 | 62 | protected ?string $timezone = null; |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected array $attributes = []; |
70 | 70 | |
71 | - protected ContainerInterface $container; |
|
71 | + protected ContainerInterface $container; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @param string $type Type de l'action en cours. |
75 | - * @param mixed $action Le contenu actuel qu'on souhaite executer. |
|
75 | + * @param mixed $action Le contenu actuel qu'on souhaite executer. |
|
76 | 76 | * |
77 | 77 | * @throws TasksException |
78 | 78 | */ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | throw TasksException::invalidTaskType($type); |
83 | 83 | } |
84 | 84 | |
85 | - $this->container = service('container'); |
|
85 | + $this->container = service('container'); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -158,18 +158,18 @@ discard block |
||
158 | 158 | return $this; |
159 | 159 | } |
160 | 160 | |
161 | - /** |
|
162 | - * Définit le fuseau horaire pour l'exécution de la tâche. |
|
163 | - * |
|
164 | - * @param string $timezone L'identifiant du fuseau horaire à utiliser pour la tâche. |
|
165 | - * Il doit s'agir d'une chaîne de caractères PHP valide (par exemple, 'America/New_York', 'Europe/Paris'). |
|
166 | - */ |
|
167 | - public function timezone(string $timezone): self |
|
168 | - { |
|
169 | - $this->timezone = $timezone; |
|
170 | - |
|
171 | - return $this; |
|
172 | - } |
|
161 | + /** |
|
162 | + * Définit le fuseau horaire pour l'exécution de la tâche. |
|
163 | + * |
|
164 | + * @param string $timezone L'identifiant du fuseau horaire à utiliser pour la tâche. |
|
165 | + * Il doit s'agir d'une chaîne de caractères PHP valide (par exemple, 'America/New_York', 'Europe/Paris'). |
|
166 | + */ |
|
167 | + public function timezone(string $timezone): self |
|
168 | + { |
|
169 | + $this->timezone = $timezone; |
|
170 | + |
|
171 | + return $this; |
|
172 | + } |
|
173 | 173 | |
174 | 174 | /** |
175 | 175 | * Renvoie la date à laquelle cette tâche a été exécutée pour la dernière fois. |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function __construct(protected string $type, protected mixed $action, protected array $parameters = []) |
80 | 80 | { |
81 | - if (! in_array($type, $this->types, true)) { |
|
81 | + if (!in_array($type, $this->types, true)) { |
|
82 | 82 | throw TasksException::invalidTaskType($type); |
83 | 83 | } |
84 | 84 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public function run() |
122 | 122 | { |
123 | 123 | $method = 'run' . ucfirst($this->type); |
124 | - if (! method_exists($this, $method)) { |
|
124 | + if (!method_exists($this, $method)) { |
|
125 | 125 | throw TasksException::invalidTaskType($this->type); |
126 | 126 | } |
127 | 127 | |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | $cron = service('cronExpression')->setTimezone($this->timezone); |
137 | 137 | |
138 | 138 | // Autoriser le réglage des heures pendant les tests |
139 | - if (! empty($testTime)) { |
|
139 | + if (!empty($testTime)) { |
|
140 | 140 | $cron->testTime($testTime); |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Sommes-nous limités aux environnements? |
144 | - if (! empty($this->environments) && ! $this->runsInEnvironment(environment())) { |
|
144 | + if (!empty($this->environments) && !$this->runsInEnvironment(environment())) { |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | protected function runEvent(): bool |
250 | 250 | { |
251 | - return ! (false === service('event')->emit($this->getAction())); |
|
251 | + return !(false === service('event')->emit($this->getAction())); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | class Scheduler |
20 | 20 | { |
21 | - const SUNDAY = 0; |
|
21 | + const SUNDAY = 0; |
|
22 | 22 | |
23 | 23 | const MONDAY = 1; |
24 | 24 |