24
24
25
25
class CloudTasksQueue extends LaravelQueue implements QueueContract
26
26
{
27
- private Closure | array $ headers = [];
27
+ private Closure | array $ headers = [];
28
28
29
29
public function __construct (public array $ config , public CloudTasksClient $ client , public $ dispatchAfterCommit = false )
30
30
{
@@ -152,7 +152,7 @@ private function taskName(string $queueName, array $payload): string
152
152
$ this ->config ['project ' ],
153
153
$ this ->config ['location ' ],
154
154
$ queueName ,
155
- $ displayName .'- ' .bin2hex (random_bytes (8 )),
155
+ $ displayName .'- ' .bin2hex (random_bytes (8 )),
156
156
);
157
157
}
158
158
@@ -172,8 +172,7 @@ private function enrichPayloadWithInternalData(
172
172
string $ queueName ,
173
173
string $ taskName ,
174
174
string $ connectionName ,
175
- ): array
176
- {
175
+ ): array {
177
176
$ payload ['internal ' ] = [
178
177
'attempts ' => $ payload ['internal ' ]['attempts ' ] ?? 0 ,
179
178
'queue ' => $ queueName ,
@@ -188,7 +187,7 @@ public function addPayloadToTask(array $payload, Task $task): Task
188
187
{
189
188
$ headers = value ($ this ->headers , $ payload ) ?: [];
190
189
191
- if (!empty ($ this ->config ['app_engine ' ])) {
190
+ if (!empty ($ this ->config ['app_engine ' ])) {
192
191
$ path = \Safe \parse_url (route ('cloud-tasks.handle-task ' ), PHP_URL_PATH );
193
192
194
193
$ appEngineRequest = new AppEngineHttpRequest ();
@@ -197,7 +196,7 @@ public function addPayloadToTask(array $payload, Task $task): Task
197
196
$ appEngineRequest ->setBody (json_encode ($ payload ));
198
197
$ appEngineRequest ->setHeaders ($ headers );
199
198
200
- if (!empty ($ service = $ this ->config ['app_engine_service ' ])) {
199
+ if (!empty ($ service = $ this ->config ['app_engine_service ' ])) {
201
200
$ routing = new AppEngineRouting ();
202
201
$ routing ->setService ($ service );
203
202
$ appEngineRequest ->setAppEngineRouting ($ routing );
@@ -250,14 +249,14 @@ public function getHandler(): string
250
249
251
250
$ handler = rtrim ($ this ->config ['handler ' ], '/ ' );
252
251
253
- if (str_ends_with ($ handler , '/ ' .config ('cloud-tasks.uri ' ))) {
252
+ if (str_ends_with ($ handler , '/ ' .config ('cloud-tasks.uri ' ))) {
254
253
return $ handler ;
255
254
}
256
255
257
- return $ handler .'/ ' .config ('cloud-tasks.uri ' );
256
+ return $ handler .'/ ' .config ('cloud-tasks.uri ' );
258
257
}
259
258
260
- public function setTaskHeaders (Closure | array $ headers ): void
259
+ public function setTaskHeaders (Closure | array $ headers ): void
261
260
{
262
261
$ this ->headers = $ headers ;
263
262
}
0 commit comments