| @@ 33-47 (lines=15) @@ | ||
| 30 | $this->startYear = $startYear; |
|
| 31 | } |
|
| 32 | ||
| 33 | public function __invoke() |
|
| 34 | { |
|
| 35 | $years = $this->client->request( |
|
| 36 | 'GET', |
|
| 37 | 'https://api.github.com/repos/tech-conferences/conference-data/contents/conferences' |
|
| 38 | ); |
|
| 39 | ||
| 40 | $years = json_decode($years->getBody()->getContents(), true); |
|
| 41 | foreach ($years as $year) { |
|
| 42 | if ($year['name'] < $this->startYear) { |
|
| 43 | continue; |
|
| 44 | } |
|
| 45 | ($this->yearParser)($year['url']); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| @@ 28-39 (lines=12) @@ | ||
| 25 | $this->parser = $parser; |
|
| 26 | } |
|
| 27 | ||
| 28 | public function __invoke(string $url) |
|
| 29 | { |
|
| 30 | $categories = $this->client->request('GET', $url); |
|
| 31 | ||
| 32 | $categories = json_decode($categories->getBody()->getContents(), true); |
|
| 33 | foreach ($categories as $category) { |
|
| 34 | ($this->parser)( |
|
| 35 | str_replace('.json', '', $category['name']), |
|
| 36 | $category['git_url'] |
|
| 37 | ); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||