Conditions | 2 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | 3 | protected function yieldItemsByCursor(Closure $callback): Generator |
|
26 | { |
||
27 | 3 | $request = clone $this->source->request(); |
|
28 | |||
29 | 2 | yield from $generator = $callback($this->source->pullResponse()); |
|
30 | |||
31 | 2 | yield from $this->retry(function () use ($callback, $request, $generator) { |
|
32 | 2 | while ($cursor = $this->toPage($generator->getReturn(), onlyNumerics: false)) { |
|
|
|||
33 | 2 | $this->respectRateLimits(); |
|
34 | |||
35 | 2 | $uri = $this->uriForPage($request->getUri(), (string) $cursor); |
|
36 | 2 | $response = $this->client->send($request->withUri($uri)); |
|
37 | |||
38 | 2 | yield from $generator = $callback($response); |
|
39 | } |
||
43 |