Completed
Push — master ( 2fa681...c8ac20 )
by Constantin
03:18
created

CommandWithMetadata   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

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 5
    public function __construct(
21
        Command $command,
22
        $metadata
23
    )
24
    {
25 5
        $this->command = $command;
26 5
        $this->metadata = $metadata;
27 5
    }
28
29 5
    public function getCommand(): Command
30
    {
31 5
        return $this->command;
32
    }
33
34
    /**
35
     * @return mixed
36
     */
37 5
    public function getMetadata()
38
    {
39 5
        return $this->metadata;
40
    }
41
42 5
    public function getAggregateId()
43
    {
44 5
        return $this->getCommand()->getAggregateId();
45
    }
46
}