@@ -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]]; |
@@ -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. |
@@ -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 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return $this->daily($time); |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
71 | + /** |
|
72 | 72 | * S'exécute tous les jours à minuit, sauf si une chaîne d'heure est transmise (comme 04:08pm) |
73 | 73 | */ |
74 | 74 | public function daily(?string $time = null): self |
@@ -85,16 +85,16 @@ discard block |
||
85 | 85 | return $this; |
86 | 86 | } |
87 | 87 | |
88 | - /** |
|
88 | + /** |
|
89 | 89 | * S'execute entre une temps de debut et de fin |
90 | 90 | */ |
91 | 91 | public function between(string $startTime, string $endTime): self |
92 | 92 | { |
93 | - [$minStart, $hourStart] = array_map('intval', $this->parseTime($startTime)); |
|
94 | - [$minEnd, $hourEnd] = array_map('intval', $this->parseTime($endTime)); |
|
93 | + [$minStart, $hourStart] = array_map('intval', $this->parseTime($startTime)); |
|
94 | + [$minEnd, $hourEnd] = array_map('intval', $this->parseTime($endTime)); |
|
95 | 95 | |
96 | - $this->betweenHours($hourStart, $hourEnd); |
|
97 | - $this->betweenMinutes($minStart, $minEnd); |
|
96 | + $this->betweenHours($hourStart, $hourEnd); |
|
97 | + $this->betweenMinutes($minStart, $minEnd); |
|
98 | 98 | |
99 | 99 | return $this; |
100 | 100 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return $this; |
134 | 134 | } |
135 | 135 | |
136 | - /** |
|
136 | + /** |
|
137 | 137 | * S'exécute toutes les 2 heures |
138 | 138 | * |
139 | 139 | * @param int|string|null $minute |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return $this->everyHour(2, $minute); |
144 | 144 | } |
145 | 145 | |
146 | - /** |
|
146 | + /** |
|
147 | 147 | * S'exécute toutes les 3 heures |
148 | 148 | * |
149 | 149 | * @param int|string|null $minute |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | return $this->everyHour(3, $minute); |
154 | 154 | } |
155 | 155 | |
156 | - /** |
|
156 | + /** |
|
157 | 157 | * S'exécute toutes les 4 heures |
158 | 158 | * |
159 | 159 | * @param int|string|null $minute |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return $this->everyHour(4, $minute); |
164 | 164 | } |
165 | 165 | |
166 | - /** |
|
166 | + /** |
|
167 | 167 | * S'exécute toutes les 6 heures |
168 | 168 | * |
169 | 169 | * @param int|string|null $minute |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function everyOddHour($minute = null): self |
180 | 180 | { |
181 | - $this->expression['min'] = $minute ?? '0'; |
|
181 | + $this->expression['min'] = $minute ?? '0'; |
|
182 | 182 | $this->expression['hour'] = '1-23/2'; |
183 | 183 | |
184 | 184 | return $this; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function everyTenMinutes(): self |
261 | 261 | { |
262 | - return $this->everyMinute(10); |
|
262 | + return $this->everyMinute(10); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | return $this->monthlyOn(1, $time); |
385 | 385 | } |
386 | 386 | |
387 | - /** |
|
387 | + /** |
|
388 | 388 | * S'execute mensuellement à un jour et une heure donnés. |
389 | 389 | * |
390 | 390 | * @param int<1, 31> $dayOfMonth |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | { |
428 | 428 | $this->daily($time); |
429 | 429 | |
430 | - return $this->daysOfMonth(Date::now()->endOfMonth()->getDay()); |
|
430 | + return $this->daysOfMonth(Date::now()->endOfMonth()->getDay()); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | return $this->quarterlyOn(1, $time); |
477 | 477 | } |
478 | 478 | |
479 | - /** |
|
479 | + /** |
|
480 | 480 | * S'execute tous les trimestres à un jour et une heure donnés. |
481 | 481 | */ |
482 | 482 | public function quarterlyOn(int $dayOfQuarter = 1, ?string $time = null) |
483 | - { |
|
483 | + { |
|
484 | 484 | $min = $hour = 0; |
485 | 485 | |
486 | 486 | if (! empty($time)) { |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | return $this->yearlyOn(1, 1, $time); |
505 | 505 | } |
506 | 506 | |
507 | - /** |
|
507 | + /** |
|
508 | 508 | * S'execute chaque année à un mois, un jour et une heure donnés. |
509 | 509 | * |
510 | 510 | * @param int<1, 31> $dayOfMonth |
@@ -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 |