InMemoryPlayerBase::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CardGame\Infrastructure\Test;
4
5
use Stratadox\CardGame\Account\PlayerAccount;
6
use Stratadox\CardGame\Account\PlayerBase;
7
use Stratadox\CardGame\Account\AccountId;
8
use Stratadox\CardGame\ReadModel\Account\NoAccountForVisitor;
9
10
/**
11
 * In-memory repository for AccountOverviews; read models used for retrieving
12
 * information about accounts.
13
 */
14
final class InMemoryPlayerBase implements PlayerBase
15
{
16
    private $overviews;
17
18
    public function add(PlayerAccount $player): void
19
    {
20
        $this->overviews[(string) $player->id()] = $player;
21
    }
22
23
    public function withId(AccountId $id): PlayerAccount
24
    {
25
        return $this->overviews[(string) $id];
26
    }
27
}
28