Completed
Push — master ( 0141b8...171c3a )
by Ivannis Suárez
04:55
created

DomainEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Domain\EventSourcing;
13
14
use Cubiche\Domain\EventPublisher\DomainEvent as BaseDomainEvent;
15
use Cubiche\Domain\Model\IdInterface;
16
17
/**
18
 * DomainEvent class.
19
 *
20
 * @author Ivannis Suárez Jerez <[email protected]>
21
 */
22
class DomainEvent extends BaseDomainEvent implements DomainEventInterface
23
{
24
    /**
25
     * EntityDomainEvent constructor.
26
     *
27
     * @param IdInterface $aggregateId
28
     */
29
    public function __construct(IdInterface $aggregateId)
30
    {
31
        parent::__construct();
32
33
        $this->setMetadata('aggregateId', $aggregateId);
0 ignored issues
show
Bug introduced by
The method setMetadata() does not seem to exist on object<Cubiche\Domain\EventSourcing\DomainEvent>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
        $this->setMetadata('eventId', DomainEventId::next());
0 ignored issues
show
Bug introduced by
The method setMetadata() does not seem to exist on object<Cubiche\Domain\EventSourcing\DomainEvent>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
        $this->setVersion(0);
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function eventId()
42
    {
43
        return $this->getMetadata('eventId');
0 ignored issues
show
Bug introduced by
The method getMetadata() does not seem to exist on object<Cubiche\Domain\EventSourcing\DomainEvent>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function aggregateId()
50
    {
51
        return $this->getMetadata('aggregateId');
0 ignored issues
show
Bug introduced by
The method getMetadata() does not seem to exist on object<Cubiche\Domain\EventSourcing\DomainEvent>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function version()
58
    {
59
        return $this->getMetadata('version');
0 ignored issues
show
Bug introduced by
The method getMetadata() does not seem to exist on object<Cubiche\Domain\EventSourcing\DomainEvent>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function setVersion($version)
66
    {
67
        $this->setMetadata('version', $version);
0 ignored issues
show
Bug introduced by
The method setMetadata() does not seem to exist on object<Cubiche\Domain\EventSourcing\DomainEvent>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
68
    }
69
}
70