24
24
25
25
class CloudTasksQueue extends LaravelQueue implements QueueContract
26
26
{
27
- private Closure | array $ headers = [];
27
+ private Closure | array $ headers = [];
28
28
private static ?Closure $ handlerUrlCallback = null ;
29
29
30
30
public function __construct (public array $ config , public CloudTasksClient $ client , public $ dispatchAfterCommit = false )
@@ -160,7 +160,7 @@ private function taskName(string $queueName, array $payload): string
160
160
$ this ->config ['project ' ],
161
161
$ this ->config ['location ' ],
162
162
$ queueName ,
163
- $ displayName .'- ' .bin2hex (random_bytes (8 )),
163
+ $ displayName .'- ' .bin2hex (random_bytes (8 )),
164
164
);
165
165
}
166
166
@@ -180,8 +180,7 @@ private function enrichPayloadWithInternalData(
180
180
string $ queueName ,
181
181
string $ taskName ,
182
182
string $ connectionName ,
183
- ): array
184
- {
183
+ ): array {
185
184
$ payload ['internal ' ] = [
186
185
'attempts ' => $ payload ['internal ' ]['attempts ' ] ?? 0 ,
187
186
'queue ' => $ queueName ,
@@ -197,7 +196,7 @@ public function addPayloadToTask(array $payload, Task $task, mixed $job): Task
197
196
{
198
197
$ headers = value ($ this ->headers , $ payload ) ?: [];
199
198
200
- if (!empty ($ this ->config ['app_engine ' ])) {
199
+ if (!empty ($ this ->config ['app_engine ' ])) {
201
200
$ path = \Safe \parse_url (route ('cloud-tasks.handle-task ' ), PHP_URL_PATH );
202
201
203
202
$ appEngineRequest = new AppEngineHttpRequest ();
@@ -206,7 +205,7 @@ public function addPayloadToTask(array $payload, Task $task, mixed $job): Task
206
205
$ appEngineRequest ->setBody (json_encode ($ payload ));
207
206
$ appEngineRequest ->setHeaders ($ headers );
208
207
209
- if (!empty ($ service = $ this ->config ['app_engine_service ' ])) {
208
+ if (!empty ($ service = $ this ->config ['app_engine_service ' ])) {
210
209
$ routing = new AppEngineRouting ();
211
210
$ routing ->setService ($ service );
212
211
$ appEngineRequest ->setAppEngineRouting ($ routing );
@@ -264,14 +263,14 @@ public function getHandler(mixed $job): string
264
263
265
264
$ handler = rtrim ($ this ->config ['handler ' ], '/ ' );
266
265
267
- if (str_ends_with ($ handler , '/ ' .config ('cloud-tasks.uri ' ))) {
266
+ if (str_ends_with ($ handler , '/ ' .config ('cloud-tasks.uri ' ))) {
268
267
return $ handler ;
269
268
}
270
269
271
- return $ handler .'/ ' .config ('cloud-tasks.uri ' );
270
+ return $ handler .'/ ' .config ('cloud-tasks.uri ' );
272
271
}
273
272
274
- public function setTaskHeaders (Closure | array $ headers ): void
273
+ public function setTaskHeaders (Closure | array $ headers ): void
275
274
{
276
275
$ this ->headers = $ headers ;
277
276
}
0 commit comments