Skip to content

Commit 1fe9d17

Browse files
committed
refactor: rename concurrency parameter to requestConcurrency
1 parent 5c9a4b8 commit 1fe9d17

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/WebPush.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class WebPush
3131
protected ?array $notifications = null;
3232

3333
/**
34-
* @var array Default options: TTL, urgency, topic, batchSize, concurrency
34+
* @var array Default options: TTL, urgency, topic, batchSize, requestConcurrency
3535
*/
3636
protected array $defaultOptions;
3737

@@ -54,7 +54,7 @@ class WebPush
5454
* WebPush constructor.
5555
*
5656
* @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
5858
* @param int|null $timeout Timeout of POST request
5959
*
6060
* @throws \ErrorException
@@ -181,9 +181,9 @@ public function flush(?int $batchSize = null): \Generator
181181
*
182182
* @param callable(MessageSentReport): void $callback Callback for each notification
183183
* @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).
185185
*/
186-
public function flushPooled($callback, ?int $batchSize = null, ?int $concurrency = null): void
186+
public function flushPooled($callback, ?int $batchSize = null, ?int $requestConcurrency = null): void
187187
{
188188
if (empty($this->notifications)) {
189189
return;
@@ -193,8 +193,8 @@ public function flushPooled($callback, ?int $batchSize = null, ?int $concurrency
193193
$batchSize = $this->defaultOptions['batchSize'];
194194
}
195195

196-
if (null === $concurrency) {
197-
$concurrency = $this->defaultOptions['concurrency'];
196+
if (null === $requestConcurrency) {
197+
$requestConcurrency = $this->defaultOptions['requestConcurrency'];
198198
}
199199

200200
$batches = array_chunk($this->notifications, $batchSize);
@@ -203,7 +203,7 @@ public function flushPooled($callback, ?int $batchSize = null, ?int $concurrency
203203
foreach ($batches as $batch) {
204204
$batch = $this->prepare($batch);
205205
$pool = new Pool($this->client, $batch, [
206-
'concurrency' => $concurrency,
206+
'requestConcurrency' => $requestConcurrency,
207207
'fulfilled' => function (ResponseInterface $response, int $index) use ($callback, $batch) {
208208
/** @var \Psr\Http\Message\RequestInterface $request **/
209209
$request = $batch[$index];
@@ -368,15 +368,15 @@ public function getDefaultOptions(): array
368368
}
369369

370370
/**
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'
372372
*/
373373
public function setDefaultOptions(array $defaultOptions): WebPush
374374
{
375375
$this->defaultOptions['TTL'] = $defaultOptions['TTL'] ?? 2419200;
376376
$this->defaultOptions['urgency'] = $defaultOptions['urgency'] ?? null;
377377
$this->defaultOptions['topic'] = $defaultOptions['topic'] ?? null;
378378
$this->defaultOptions['batchSize'] = $defaultOptions['batchSize'] ?? 1000;
379-
$this->defaultOptions['concurrency'] = $defaultOptions['concurrency'] ?? 100;
379+
$this->defaultOptions['requestConcurrency'] = $defaultOptions['requestConcurrency'] ?? 100;
380380

381381

382382
return $this;

0 commit comments

Comments
 (0)