Passed
Push — master ( 39dd2f...8ee4e9 )
by Rafal
03:50
created

Parser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 14 2
1
<?php declare(strict_types=1);
2
3
4
namespace App\GameApi\Business\WorldCupSfgIo\Client;
5
6
7
use App\GameApi\Persistence\DataProvider\GameResult;
8
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
           $resultGames[] = new GameResult(
22
               $homeTeam['country'],
23
               $awayTeam['country'],
24
               (int)$homeTeam['goals'],
25
               (int)$awayTeam['goals']
26
           );
27
        }
28
        return $resultGames;
29
    }
30
}