Completed
Push — master ( ddccce...70f96e )
by Andrey
02:38
created

AbstractDiffElement   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 96
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getSourceForm() 0 4 1
A setSourceForm() 0 6 1
A getTargetForm() 0 4 1
A setTargetForm() 0 6 1
A getSourceLabel() 0 4 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\DiffElementBuilder;
10
use Zend\Form\FormInterface;
11
12
/**
13
 * Class AllowFormTrait
14
 *
15
 * @package Nnx\FormComparator\Comparator\Diff
16
 */
17
abstract class AbstractDiffElement extends AbstractDiff
18
{
19
    /**
20
     * Форма которую сравнивают
21
     *
22
     * @var FormInterface
23
     */
24
    private $sourceForm;
25
26
    /**
27
     * Форма с которой сравнивают
28
     *
29
     * @var FormInterface
30
     */
31
    private $targetForm;
32
33
34
    /**
35
     * Заголовок сравниваемого элемента
36
     *
37
     * @var string
38
     */
39
    private $sourceLabel;
40
41
    /**
42
     * DeleteElement constructor.
43
     *
44
     * @param DiffElementBuilder $diffBuilder
45
     */
46
    public function __construct(DiffElementBuilder $diffBuilder)
47
    {
48
        $this->sourceForm = $diffBuilder->getSourceForm();
49
        $this->targetForm = $diffBuilder->getTargetForm();
50
        $this->sourceLabel = $diffBuilder->getSourceLabel();
51
52
        parent::__construct($diffBuilder);
53
    }
54
55
    /**
56
     * Возвращает форму которую сравнивают
57
     *
58
     * @return FormInterface
59
     */
60
    public function getSourceForm()
61
    {
62
        return $this->sourceForm;
63
    }
64
65
    /**
66
     * Устанавливает форму которую сравнивают
67
     *
68
     * @param FormInterface $sourceForm
69
     *
70
     * @return $this
71
     */
72
    public function setSourceForm($sourceForm)
73
    {
74
        $this->sourceForm = $sourceForm;
75
76
        return $this;
77
    }
78
79
    /**
80
     * Возвращает форму  с которой сравнивают
81
     *
82
     * @return FormInterface
83
     */
84
    public function getTargetForm()
85
    {
86
        return $this->targetForm;
87
    }
88
89
    /**
90
     * Устанавливает форму  с которой сравнивают
91
     *
92
     * @param FormInterface $targetForm
93
     *
94
     * @return $this
95
     */
96
    public function setTargetForm($targetForm)
97
    {
98
        $this->targetForm = $targetForm;
99
100
        return $this;
101
    }
102
103
    /**
104
     * Заголовок сравниваемого элемента
105
     *
106
     * @return string
107
     */
108
    public function getSourceLabel()
109
    {
110
        return $this->sourceLabel;
111
    }
112
}
113