Completed
Push — master ( 4b1e3c...30d3d2 )
by Jesse
02:57
created

AllCards   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A ofType() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CardGame\ReadModel\Match;
4
5
use Stratadox\CardGame\Deck\CardId;
6
7
class AllCards
8
{
9
    /** @var Card[] */
10
    private $cards;
11
12
    public function __construct(Card ...$cards)
13
    {
14
        foreach ($cards as $card) {
15
            $this->cards[$card->type()] = $card;
16
        }
17
    }
18
19
    // @todo remove in favour of... what? (match, player, realm, position)? :S
20
    public function ofType(CardId $card): Card
21
    {
22
        return $this->cards[$card->id()];
23
    }
24
}
25