Condition::getValueIdentifier()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright © 2018 Thomas Klein, All rights reserved.
4
 * See LICENSE bundled with this library for license details.
5
 */
6
declare(strict_types=1);
7
8
namespace LogicTree\Node;
9
10
/**
11
 * Class Condition
12
 */
13
final class Condition extends AbstractNode implements ConditionInterface
14
{
15
    /**
16
     * Operator code
17
     *
18
     * @var string
19
     */
20
    private $operator;
21
22
    /**
23
     * Key value identifier in the data source
24
     *
25
     * @var string
26
     */
27
    private $valueIdentifier;
28
29
    /**
30
     * Value to compare to the data source value
31
     *
32
     * @var mixed
33
     */
34
    private $valueCompare;
35
36
    /**
37
     * Condition constructor
38
     *
39
     * @param string $valueIdentifier
40
     * @param string $operator
41
     * @param mixed $valueCompare
42
     */
43
    public function __construct(
44
        string $valueIdentifier,
45
        string $operator,
46
        $valueCompare
47
    ) {
48
        $this->setValueIdentifier($valueIdentifier);
49
        $this->setOperator($operator);
50
        $this->setValueCompare($valueCompare);
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getOperator(): string
57
    {
58
        return $this->operator;
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function setOperator(string $operator): ConditionInterface
65
    {
66
        $this->operator = $operator;
67
68
        return $this;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function getValueIdentifier(): string
75
    {
76
        return $this->valueIdentifier;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function setValueIdentifier(string $identifier): ConditionInterface
83
    {
84
        $this->valueIdentifier = $identifier;
85
86
        return $this;
87
    }
88
89
    /**
90
     * {@inheritdoc}
91
     */
92
    public function getValueCompare()
93
    {
94
        return $this->valueCompare;
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function setValueCompare($value): ConditionInterface
101
    {
102
        $this->valueCompare = $value;
103
104
        return $this;
105
    }
106
}
107