Test Setup Failed
Push — master ( 647a95...23a558 )
by Jesse
02:13
created

CardTemplates::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CardGame\ReadModel\Match;
4
5
use Stratadox\CardGame\Deck\CardId;
6
7
class CardTemplates
8
{
9
    /** @var CardTemplate[] */
10
    private $cards;
11
12
    public function __construct(CardTemplate ...$cards)
13
    {
14
        foreach ($cards as $card) {
15
            $this->cards[$card->type()] = $card;
16
        }
17
    }
18
19
    public function ofType(CardId $card): CardTemplate
20
    {
21
        return $this->cards[$card->id()];
22
    }
23
}
24