Changes   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A added() 0 3 1
A __construct() 0 8 1
A altered() 0 3 1
A wereMade() 0 6 1
A removed() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Stratadox\EntityState;
5
6
/**
7
 * Changes.
8
 *
9
 * @author Stratadox
10
 */
11
final class Changes implements TellsWhatChanged
12
{
13
    private $added;
14
    private $altered;
15
    private $removed;
16
17
    private function __construct(
18
        ListsEntityStates $added,
19
        ListsEntityStates $altered,
20
        ListsEntityStates $removed
21
    ) {
22
        $this->added = $added;
23
        $this->altered = $altered;
24
        $this->removed = $removed;
25
    }
26
27
    /**
28
     * Produces a container of changed state.
29
     *
30
     * @param ListsEntityStates $added   The added entities.
31
     * @param ListsEntityStates $altered The altered entities.
32
     * @param ListsEntityStates $removed The removed entities.
33
     * @return TellsWhatChanged          The container with changes.
34
     */
35
    public static function wereMade(
36
        ListsEntityStates $added,
37
        ListsEntityStates $altered,
38
        ListsEntityStates $removed
39
    ): TellsWhatChanged {
40
        return new self($added, $altered, $removed);
41
    }
42
43
    /** @inheritdoc */
44
    public function added(): ListsEntityStates
45
    {
46
        return $this->added;
47
    }
48
49
    /** @inheritdoc */
50
    public function altered(): ListsEntityStates
51
    {
52
        return $this->altered;
53
    }
54
55
    /** @inheritdoc */
56
    public function removed(): ListsEntityStates
57
    {
58
        return $this->removed;
59
    }
60
}
61