CommandWithMetadata   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 33
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getCommand() 0 4 1
A getMetadata() 0 4 1
A getAggregateId() 0 4 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
}