AbstractAggregateRoot   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getIdentity() 0 3 1
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