EventWithMetaData::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 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
}