VisitorOpenedAnAccount::with()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 5
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CardGame\Account;
4
5
use Stratadox\CardGame\Visiting\VisitorId;
6
7
final class VisitorOpenedAnAccount implements AccountEvent
8
{
9
    private $playerId;
10
    private $visitorId;
11
12
    private function __construct(AccountId $forPlayer, VisitorId $fromVisitor)
13
    {
14
        $this->playerId = $forPlayer;
15
        $this->visitorId = $fromVisitor;
16
    }
17
18
    public static function with(
19
        AccountId $id,
20
        VisitorId $visitorId
21
    ): AccountEvent {
22
        return new self($id, $visitorId);
23
    }
24
25
    public function aggregateId(): AccountId
26
    {
27
        return $this->playerId;
28
    }
29
30
    public function forVisitor(): VisitorId
31
    {
32
        return $this->visitorId;
33
    }
34
}
35