| Total Complexity | 4 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 9 | class Parser implements ParserInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @param array $matchInfos |
||
| 13 | * @return GameResult[] |
||
| 14 | */ |
||
| 15 | public function get(array $matchInfos): array |
||
| 16 | { |
||
| 17 | $resultGames = []; |
||
| 18 | foreach ($matchInfos as $matchInfo) { |
||
| 19 | $homeTeam = $matchInfo['home_team']; |
||
| 20 | $awayTeam = $matchInfo['away_team']; |
||
| 21 | |||
| 22 | $resultGames[] = new GameResult( |
||
| 23 | $homeTeam['country'], |
||
| 24 | $awayTeam['country'], |
||
| 25 | $this->getGoals($homeTeam), |
||
| 26 | $this->getGoals($awayTeam) |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | return $resultGames; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param array $team |
||
| 34 | * @return int |
||
| 35 | */ |
||
| 36 | private function getGoals(array $team): int |
||
| 43 | } |
||
| 44 | } |