Total Complexity | 5 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class NextPageHandler extends AbstractHandler |
||
16 | { |
||
17 | /** |
||
18 | * Determine whether the handler can handle the APIs configuration |
||
19 | * |
||
20 | * @return bool |
||
21 | */ |
||
22 | 5 | public function matches(): bool |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * Handle the APIs configuration |
||
29 | * |
||
30 | * @return Traversable |
||
31 | */ |
||
32 | 2 | public function handle(): Traversable |
|
33 | { |
||
34 | 2 | yield from $this->retry(function (Outcome $outcome) { |
|
35 | try { |
||
36 | 2 | yield from $this->handleByNextPage(); |
|
37 | 1 | } catch (Throwable $e) { |
|
38 | 1 | $outcome->addFailedPage($this->config->nextPage); |
|
39 | 1 | throw $e; |
|
40 | } |
||
41 | 2 | }); |
|
42 | 1 | } |
|
43 | |||
44 | /** |
||
45 | * Handle APIs with next page |
||
46 | * |
||
47 | * @return Traversable |
||
48 | */ |
||
49 | 2 | protected function handleByNextPage(): Traversable |
|
60 | } |
||
61 | 1 | } |
|
63 |