AbstractAggregateRoot::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/*
4
 * aggregate (https://github.com/phpgears/aggregate).
5
 * Aggregate base.
6
 *
7
 * @license MIT
8
 * @link https://github.com/phpgears/aggregate
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Gears\Aggregate;
15
16
use Gears\Identity\Identity;
17
18
/**
19
 * Abstract aggregate root class.
20
 */
21
abstract class AbstractAggregateRoot implements AggregateRoot
22
{
23
    use EventBehaviour;
24
25
    /**
26
     * @var Identity
27
     */
28
    private $identity;
29
30
    /**
31
     * AbstractAggregateRoot constructor.
32
     *
33
     * @param Identity $identity
34
     */
35
    final protected function __construct(Identity $identity)
36
    {
37
        $this->identity = $identity;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    final public function getIdentity(): Identity
44
    {
45
        return $this->identity;
46
    }
47
}
48