@@ -29,71 +29,51 @@ class HaystackBuilder
29
29
30
30
/**
31
31
* The name of the haystack.
32
- *
33
- * @var string|null
34
32
*/
35
33
protected ?string $ name = null ;
36
34
37
35
/**
38
36
* The jobs to be added to the Haystack.
39
- *
40
- * @var Collection
41
37
*/
42
38
protected Collection $ jobs ;
43
39
44
40
/**
45
41
* Global connection
46
- *
47
- * @var string|null
48
42
*/
49
43
public ?string $ globalConnection = null ;
50
44
51
45
/**
52
46
* Global queue
53
- *
54
- * @var string|null
55
47
*/
56
48
public ?string $ globalQueue = null ;
57
49
58
50
/**
59
51
* Global delay
60
- *
61
- * @var int
62
52
*/
63
53
public int $ globalDelayInSeconds = 0 ;
64
54
65
55
/**
66
56
* Callbacks that will be run at various events
67
- *
68
- * @var CallbackCollection
69
57
*/
70
58
protected CallbackCollection $ callbacks ;
71
59
72
60
/**
73
61
* Middleware that will be applied to every job
74
- *
75
- * @var MiddlewareCollection
76
62
*/
77
63
protected MiddlewareCollection $ middleware ;
78
64
79
65
/**
80
66
* Other Haystack Options
81
- *
82
- * @var HaystackOptions
83
67
*/
84
68
protected HaystackOptions $ options ;
85
69
86
70
/**
87
71
* Array of pending data objects containing the initial data.
88
- *
89
- * @var Collection
90
72
*/
91
73
protected Collection $ initialData ;
92
74
93
75
/**
94
76
* Closure to execute before saving
95
- *
96
- * @var Closure|null
97
77
*/
98
78
protected ?Closure $ beforeSave = null ;
99
79
@@ -112,7 +92,6 @@ public function __construct()
112
92
/**
113
93
* Specify a name for the haystack.
114
94
*
115
- * @param string $name
116
95
* @return $this
117
96
*/
118
97
public function withName (string $ name ): static
@@ -125,7 +104,6 @@ public function withName(string $name): static
125
104
/**
126
105
* Provide a closure that will run when the haystack is complete.
127
106
*
128
- * @param Closure|callable $closure
129
107
* @return $this
130
108
*
131
109
* @throws PhpVersionNotSupportedException
@@ -140,7 +118,6 @@ public function then(Closure|callable $closure): static
140
118
/**
141
119
* Provide a closure that will run when the haystack fails.
142
120
*
143
- * @param Closure|callable $closure
144
121
* @return $this
145
122
*
146
123
* @throws PhpVersionNotSupportedException
@@ -155,7 +132,6 @@ public function catch(Closure|callable $closure): static
155
132
/**
156
133
* Provide a closure that will run when the haystack finishes.
157
134
*
158
- * @param Closure|callable $closure
159
135
* @return $this
160
136
*
161
137
* @throws PhpVersionNotSupportedException
@@ -170,7 +146,6 @@ public function finally(Closure|callable $closure): static
170
146
/**
171
147
* Provide a closure that will run when the haystack is paused.
172
148
*
173
- * @param Closure|callable $closure
174
149
* @return $this
175
150
*
176
151
* @throws PhpVersionNotSupportedException
@@ -185,10 +160,6 @@ public function paused(Closure|callable $closure): static
185
160
/**
186
161
* Add a job to the haystack.
187
162
*
188
- * @param StackableJob $job
189
- * @param int $delayInSeconds
190
- * @param string|null $queue
191
- * @param string|null $connection
192
163
* @return $this
193
164
*/
194
165
public function addJob (StackableJob $ job , int $ delayInSeconds = 0 , string $ queue = null , string $ connection = null ): static
@@ -203,8 +174,6 @@ public function addJob(StackableJob $job, int $delayInSeconds = 0, string $queue
203
174
/**
204
175
* Add a job when a condition is true.
205
176
*
206
- * @param bool $condition
207
- * @param ...$arguments
208
177
* @return $this
209
178
*/
210
179
public function addJobWhen (bool $ condition , ...$ arguments ): static
@@ -215,8 +184,6 @@ public function addJobWhen(bool $condition, ...$arguments): static
215
184
/**
216
185
* Add a job when a condition is false.
217
186
*
218
- * @param bool $condition
219
- * @param ...$arguments
220
187
* @return $this
221
188
*/
222
189
public function addJobUnless (bool $ condition , ...$ arguments ): static
@@ -227,10 +194,6 @@ public function addJobUnless(bool $condition, ...$arguments): static
227
194
/**
228
195
* Add multiple jobs to the haystack at a time.
229
196
*
230
- * @param Collection|array $jobs
231
- * @param int $delayInSeconds
232
- * @param string|null $queue
233
- * @param string|null $connection
234
197
* @return $this
235
198
*/
236
199
public function addJobs (Collection |array $ jobs , int $ delayInSeconds = 0 , string $ queue = null , string $ connection = null ): static
@@ -251,8 +214,6 @@ public function addJobs(Collection|array $jobs, int $delayInSeconds = 0, string
251
214
/**
252
215
* Add jobs when a condition is true.
253
216
*
254
- * @param bool $condition
255
- * @param ...$arguments
256
217
* @return $this
257
218
*/
258
219
public function addJobsWhen (bool $ condition , ...$ arguments ): static
@@ -263,8 +224,6 @@ public function addJobsWhen(bool $condition, ...$arguments): static
263
224
/**
264
225
* Add jobs when a condition is false.
265
226
*
266
- * @param bool $condition
267
- * @param ...$arguments
268
227
* @return $this
269
228
*/
270
229
public function addJobsUnless (bool $ condition , ...$ arguments ): static
@@ -277,10 +236,6 @@ public function addJobsUnless(bool $condition, ...$arguments): static
277
236
*
278
237
* @alias addJob()
279
238
*
280
- * @param StackableJob $job
281
- * @param int $delayInSeconds
282
- * @param string|null $queue
283
- * @param string|null $connection
284
239
* @return $this
285
240
*/
286
241
public function addBale (StackableJob $ job , int $ delayInSeconds = 0 , string $ queue = null , string $ connection = null ): static
@@ -293,10 +248,6 @@ public function addBale(StackableJob $job, int $delayInSeconds = 0, string $queu
293
248
*
294
249
* @alias addJobs()
295
250
*
296
- * @param Collection|array $jobs
297
- * @param int $delayInSeconds
298
- * @param string|null $queue
299
- * @param string|null $connection
300
251
* @return $this
301
252
*/
302
253
public function addBales (Collection |array $ jobs , int $ delayInSeconds = 0 , string $ queue = null , string $ connection = null ): static
@@ -307,7 +258,6 @@ public function addBales(Collection|array $jobs, int $delayInSeconds = 0, string
307
258
/**
308
259
* Set a global delay on the jobs.
309
260
*
310
- * @param int $seconds
311
261
* @return $this
312
262
*/
313
263
public function withDelay (int $ seconds ): static
@@ -320,7 +270,6 @@ public function withDelay(int $seconds): static
320
270
/**
321
271
* Set a global queue for the jobs.
322
272
*
323
- * @param string $queue
324
273
* @return $this
325
274
*/
326
275
public function onQueue (string $ queue ): static
@@ -333,7 +282,6 @@ public function onQueue(string $queue): static
333
282
/**
334
283
* Set a global connection for the jobs.
335
284
*
336
- * @param string $connection
337
285
* @return $this
338
286
*/
339
287
public function onConnection (string $ connection ): static
@@ -346,7 +294,6 @@ public function onConnection(string $connection): static
346
294
/**
347
295
* Add some middleware to be merged in with every job
348
296
*
349
- * @param Closure|callable|array $value
350
297
* @return $this
351
298
*
352
299
* @throws PhpVersionNotSupportedException
@@ -361,9 +308,6 @@ public function addMiddleware(Closure|callable|array $value): static
361
308
/**
362
309
* Provide data before the haystack is created.
363
310
*
364
- * @param string $key
365
- * @param mixed $value
366
- * @param string|null $cast
367
311
* @return $this
368
312
*/
369
313
public function withData (string $ key , mixed $ value , string $ cast = null ): static
@@ -378,8 +322,6 @@ public function withData(string $key, mixed $value, string $cast = null): static
378
322
/**
379
323
* Store a model to be shared across all haystack jobs.
380
324
*
381
- * @param Model $model
382
- * @param string|null $key
383
325
* @return $this
384
326
*
385
327
* @throws HaystackModelExists
@@ -399,8 +341,6 @@ public function withModel(Model $model, string $key = null): static
399
341
400
342
/**
401
343
* Create the Haystack
402
- *
403
- * @return Haystack
404
344
*/
405
345
public function create (): Haystack
406
346
{
@@ -409,8 +349,6 @@ public function create(): Haystack
409
349
410
350
/**
411
351
* Dispatch the Haystack.
412
- *
413
- * @return Haystack
414
352
*/
415
353
public function dispatch (): Haystack
416
354
{
@@ -423,9 +361,6 @@ public function dispatch(): Haystack
423
361
424
362
/**
425
363
* Map the jobs to be ready for inserting.
426
- *
427
- * @param Haystack $haystack
428
- * @return array
429
364
*/
430
365
protected function prepareJobsForInsert (Haystack $ haystack ): array
431
366
{
@@ -457,9 +392,6 @@ protected function prepareJobsForInsert(Haystack $haystack): array
457
392
458
393
/**
459
394
* Map the initial data to be ready for inserting.
460
- *
461
- * @param Haystack $haystack
462
- * @return array
463
395
*/
464
396
protected function prepareDataForInsert (Haystack $ haystack ): array
465
397
{
@@ -477,8 +409,6 @@ protected function prepareDataForInsert(Haystack $haystack): array
477
409
478
410
/**
479
411
* Create the haystack.
480
- *
481
- * @return Haystack
482
412
*/
483
413
protected function createHaystack (): Haystack
484
414
{
@@ -533,8 +463,6 @@ public function allowFailures(): static
533
463
534
464
/**
535
465
* Get all the jobs in the builder.
536
- *
537
- * @return Collection
538
466
*/
539
467
public function getJobs (): Collection
540
468
{
@@ -543,8 +471,6 @@ public function getJobs(): Collection
543
471
544
472
/**
545
473
* Retrieve the callbacks
546
- *
547
- * @return CallbackCollection
548
474
*/
549
475
public function getCallbacks (): CallbackCollection
550
476
{
@@ -553,8 +479,6 @@ public function getCallbacks(): CallbackCollection
553
479
554
480
/**
555
481
* Get the time for the "withDelay".
556
- *
557
- * @return int
558
482
*/
559
483
public function getGlobalDelayInSeconds (): int
560
484
{
@@ -563,8 +487,6 @@ public function getGlobalDelayInSeconds(): int
563
487
564
488
/**
565
489
* Get the global queue
566
- *
567
- * @return string|null
568
490
*/
569
491
public function getGlobalQueue (): ?string
570
492
{
@@ -573,8 +495,6 @@ public function getGlobalQueue(): ?string
573
495
574
496
/**
575
497
* Get the global connection.
576
- *
577
- * @return string|null
578
498
*/
579
499
public function getGlobalConnection (): ?string
580
500
{
@@ -583,8 +503,6 @@ public function getGlobalConnection(): ?string
583
503
584
504
/**
585
505
* Get the closure for the global middleware.
586
- *
587
- * @return MiddlewareCollection
588
506
*/
589
507
public function getMiddleware (): MiddlewareCollection
590
508
{
@@ -594,7 +512,6 @@ public function getMiddleware(): MiddlewareCollection
594
512
/**
595
513
* Specify a closure to run before saving the Haystack
596
514
*
597
- * @param Closure $closure
598
515
* @return $this
599
516
*/
600
517
public function beforeSave (Closure $ closure ): static
@@ -607,8 +524,6 @@ public function beforeSave(Closure $closure): static
607
524
/**
608
525
* Set an option on the Haystack Options.
609
526
*
610
- * @param string $option
611
- * @param mixed $value
612
527
* @return $this
613
528
*/
614
529
public function setOption (string $ option , mixed $ value ): static
0 commit comments