CommandWithMetadata::getCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Copyright (c) 2017 Constantin Galbenu <[email protected]>
4
 */
5
6
namespace Gica\Cqrs\Command;
7
8
9
use Gica\Cqrs\Command;
10
11
class CommandWithMetadata
12
{
13
14
    /**
15
     * @var Command
16
     */
17
    private $command;
18
    private $metadata;
19
20 9
    public function __construct(
21
        Command $command,
22
        CommandMetadata $metadata = null
23
    )
24
    {
25 9
        $this->command = $command;
26 9
        $this->metadata = $metadata;
27 9
    }
28
29 9
    public function getCommand(): Command
30
    {
31 9
        return $this->command;
32
    }
33
34 9
    public function getMetadata():?CommandMetadata
35
    {
36 9
        return $this->metadata;
37
    }
38
39 9
    public function getAggregateId()
40
    {
41 9
        return $this->getCommand()->getAggregateId();
42
    }
43
}