Conditions | 6 |
Paths | 8 |
Total Lines | 32 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | 1 | public function fetchMilestoneIssues(ChangelogConfig $changelogConfig): array |
|
22 | { |
||
23 | 1 | $labels = $changelogConfig->getLabels(); |
|
24 | 1 | $labels = count($labels) === 0 ? [''] : $labels; |
|
25 | |||
26 | 1 | $issues = []; |
|
27 | |||
28 | 1 | foreach ($labels as $label) { |
|
29 | 1 | $url = $changelogConfig->getMilestoneIssuesUrl($label); |
|
30 | |||
31 | 1 | while (true) { |
|
32 | 1 | $response = $this->issueClient->execute($url, $changelogConfig->getGitHubCredentials()); |
|
33 | |||
34 | 1 | $body = $response->getBody(); |
|
35 | |||
36 | 1 | foreach ($body['items'] as $item) { |
|
37 | 1 | $issues[] = $item; |
|
38 | } |
||
39 | |||
40 | 1 | $nextUrl = $response->getNextUrl(); |
|
41 | |||
42 | 1 | if ($nextUrl !== null) { |
|
43 | 1 | $url = $nextUrl; |
|
44 | |||
45 | 1 | continue; |
|
46 | } |
||
47 | |||
48 | 1 | break; |
|
49 | } |
||
50 | } |
||
51 | |||
52 | 1 | return $issues; |
|
53 | } |
||
55 |