@@ -31,7 +31,7 @@ class WebPush
31
31
protected ?array $ notifications = null ;
32
32
33
33
/**
34
- * @var array Default options: TTL, urgency, topic, batchSize, concurrency
34
+ * @var array Default options: TTL, urgency, topic, batchSize, requestConcurrency
35
35
*/
36
36
protected array $ defaultOptions ;
37
37
@@ -54,7 +54,7 @@ class WebPush
54
54
* WebPush constructor.
55
55
*
56
56
* @param array $auth Some servers need authentication
57
- * @param array $defaultOptions TTL, urgency, topic, batchSize, concurrency
57
+ * @param array $defaultOptions TTL, urgency, topic, batchSize, requestConcurrency
58
58
* @param int|null $timeout Timeout of POST request
59
59
*
60
60
* @throws \ErrorException
@@ -181,9 +181,9 @@ public function flush(?int $batchSize = null): \Generator
181
181
*
182
182
* @param callable(MessageSentReport): void $callback Callback for each notification
183
183
* @param null|int $batchSize Defaults the value defined in defaultOptions during instantiation (which defaults to 1000).
184
- * @param null|int $concurrency Defaults the value defined in defaultOptions during instantiation (which defaults to 100).
184
+ * @param null|int $requestConcurrency Defaults the value defined in defaultOptions during instantiation (which defaults to 100).
185
185
*/
186
- public function flushPooled ($ callback , ?int $ batchSize = null , ?int $ concurrency = null ): void
186
+ public function flushPooled ($ callback , ?int $ batchSize = null , ?int $ requestConcurrency = null ): void
187
187
{
188
188
if (empty ($ this ->notifications )) {
189
189
return ;
@@ -193,8 +193,8 @@ public function flushPooled($callback, ?int $batchSize = null, ?int $concurrency
193
193
$ batchSize = $ this ->defaultOptions ['batchSize ' ];
194
194
}
195
195
196
- if (null === $ concurrency ) {
197
- $ concurrency = $ this ->defaultOptions ['concurrency ' ];
196
+ if (null === $ requestConcurrency ) {
197
+ $ requestConcurrency = $ this ->defaultOptions ['requestConcurrency ' ];
198
198
}
199
199
200
200
$ batches = array_chunk ($ this ->notifications , $ batchSize );
@@ -203,7 +203,7 @@ public function flushPooled($callback, ?int $batchSize = null, ?int $concurrency
203
203
foreach ($ batches as $ batch ) {
204
204
$ batch = $ this ->prepare ($ batch );
205
205
$ pool = new Pool ($ this ->client , $ batch , [
206
- 'concurrency ' => $ concurrency ,
206
+ 'requestConcurrency ' => $ requestConcurrency ,
207
207
'fulfilled ' => function (ResponseInterface $ response , int $ index ) use ($ callback , $ batch ) {
208
208
/** @var \Psr\Http\Message\RequestInterface $request **/
209
209
$ request = $ batch [$ index ];
@@ -368,15 +368,15 @@ public function getDefaultOptions(): array
368
368
}
369
369
370
370
/**
371
- * @param array $defaultOptions Keys 'TTL' (Time To Live, defaults 4 weeks), 'urgency', 'topic', 'batchSize', 'concurrency '
371
+ * @param array $defaultOptions Keys 'TTL' (Time To Live, defaults 4 weeks), 'urgency', 'topic', 'batchSize', 'requestConcurrency '
372
372
*/
373
373
public function setDefaultOptions (array $ defaultOptions ): WebPush
374
374
{
375
375
$ this ->defaultOptions ['TTL ' ] = $ defaultOptions ['TTL ' ] ?? 2419200 ;
376
376
$ this ->defaultOptions ['urgency ' ] = $ defaultOptions ['urgency ' ] ?? null ;
377
377
$ this ->defaultOptions ['topic ' ] = $ defaultOptions ['topic ' ] ?? null ;
378
378
$ this ->defaultOptions ['batchSize ' ] = $ defaultOptions ['batchSize ' ] ?? 1000 ;
379
- $ this ->defaultOptions ['concurrency ' ] = $ defaultOptions ['concurrency ' ] ?? 100 ;
379
+ $ this ->defaultOptions ['requestConcurrency ' ] = $ defaultOptions ['requestConcurrency ' ] ?? 100 ;
380
380
381
381
382
382
return $ this ;
0 commit comments