Completed
Push — master ( fe8dc9...ddccce )
by Andrey
02:35
created

UpdateElement::setSourceValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/form-comparator
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\FormComparator\Comparator\Diff;
7
8
use Nnx\FormComparator\Comparator\AbstractDiff;
9
use Nnx\FormComparator\Comparator\DiffBuilder;
10
use Zend\Form\ElementInterface;
11
12
/**
13
 * Class UpdateElement
14
 *
15
 * @package Nnx\FormComparator\Comparator\Diff
16
 */
17
class UpdateElement extends AbstractDiff
18
{
19
    /**
20
     * Старое значение
21
     *
22
     * @var mixed
23
     */
24
    private $sourceValue;
25
26
    /**
27
     * Новое значение
28
     *
29
     * @var mixed
30
     */
31
    private $targetValue;
32
33
    /**
34
     * Элемент который сравнивают
35
     *
36
     * @var ElementInterface
37
     */
38
    private $sourceElement;
39
40
    /**
41
     * Элемент с которым сравнивают
42
     *
43
     * @var ElementInterface
44
     */
45
    private $targetElement;
46
47
    /**
48
     * UpdateElement constructor.
49
     *
50
     * @param DiffBuilder $diffBuilder
51
     */
52
    public function __construct(DiffBuilder $diffBuilder)
53
    {
54
        $this->sourceValue = $diffBuilder->getSourceValue();
55
        $this->targetValue = $diffBuilder->getTargetValue();
56
        $this->sourceElement = $diffBuilder->getSourceElement();
57
        $this->targetElement = $diffBuilder->getTargetElement();
58
59
        parent::__construct($diffBuilder);
60
    }
61
62
    /**
63
     * Элемент который сравнивают
64
     *
65
     * @return ElementInterface
66
     */
67
    public function getSourceElement()
68
    {
69
        return $this->sourceElement;
70
    }
71
72
    /**
73
     * Элемент с которым сравнивают
74
     *
75
     * @return ElementInterface
76
     */
77
    public function getTargetElement()
78
    {
79
        return $this->targetElement;
80
    }
81
82
83
    /**
84
     * @return mixed
85
     */
86
    public function getSourceValue()
87
    {
88
        return $this->sourceValue;
89
    }
90
91
    /**
92
     * @param mixed $sourceValue
93
     *
94
     * @return $this
95
     */
96
    public function setSourceValue($sourceValue)
97
    {
98
        $this->sourceValue = $sourceValue;
99
100
        return $this;
101
    }
102
103
    /**
104
     * @return mixed
105
     */
106
    public function getTargetValue()
107
    {
108
        return $this->targetValue;
109
    }
110
111
    /**
112
     * @param mixed $targetValue
113
     *
114
     * @return $this
115
     */
116
    public function setTargetValue($targetValue)
117
    {
118
        $this->targetValue = $targetValue;
119
120
        return $this;
121
    }
122
}
123