AcceptTheProposal   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 37
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A proposal() 0 3 1
A acceptingPlayer() 0 3 1
A __construct() 0 8 1
A correlationId() 0 3 1
A withId() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CardGame\Proposal;
4
5
use Stratadox\CardGame\Account\AccountId;
6
use Stratadox\CardGame\Command;
7
use Stratadox\CardGame\CorrelationId;
8
9
final class AcceptTheProposal implements Command
10
{
11
    private $proposalId;
12
    private $acceptingPlayer;
13
    private $correlationId;
14
15
    private function __construct(
16
        ProposalId $id,
17
        AccountId $acceptingPlayer,
18
        CorrelationId $correlationId
19
    ) {
20
        $this->proposalId = $id;
21
        $this->acceptingPlayer = $acceptingPlayer;
22
        $this->correlationId = $correlationId;
23
    }
24
25
    public static function withId(
26
        ProposalId $id,
27
        AccountId $acceptingPlayer,
28
        CorrelationId $correlationId
29
    ): self {
30
        return new self($id, $acceptingPlayer, $correlationId);
31
    }
32
33
    public function proposal(): ProposalId
34
    {
35
        return $this->proposalId;
36
    }
37
38
    public function acceptingPlayer(): AccountId
39
    {
40
        return $this->acceptingPlayer;
41
    }
42
43
    public function correlationId(): CorrelationId
44
    {
45
        return $this->correlationId;
46
    }
47
}
48