EventWithMetaData   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
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 35
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getEvent() 0 4 1
A getMetaData() 0 4 1
A withSequenceAndIndex() 0 6 1
1
<?php
2
/******************************************************************************
3
 * Copyright (c) 2016 Constantin Galbenu <[email protected]>             *
4
 ******************************************************************************/
5
6
namespace Gica\Cqrs\Event;
7
8
class EventWithMetaData
9
{
10
11
    private $event;
12
    /**
13
     * @var MetaData
14
     */
15
    private $metaData;
16
17 35
    public function __construct(
18
        $event,
19
        MetaData $metaData
20
    )
21
    {
22 35
        $this->event = $event;
23 35
        $this->metaData = $metaData;
24 35
    }
25
26 28
    public function getEvent()
27
    {
28 28
        return $this->event;
29
    }
30
31 27
    public function getMetaData(): MetaData
32
    {
33 27
        return $this->metaData;
34
    }
35
36 4
    public function withSequenceAndIndex(int $sequence, int $index): self
37
    {
38 4
        $other = clone $this;
39 4
        $other->metaData = $other->metaData->withSequenceAndIndex($sequence, $index);
40 4
        return $other;
41
    }
42
}