EqualRule::hasSolution()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace JClaveau\LogicalFilter\Rule;
3
4
/**
5
 * a = x
6
 */
7
class EqualRule extends AbstractAtomicRule
8
{
9
    /** @var string operator */
10
    const operator = '=';
11
12
    /** @var mixed $value */
13
    protected $value;
14
15
    /**
16
     * @param string $field The field to apply the rule on.
17
     * @param array  $value The value the field can equal to.
18
     */
19 185
    public function __construct( $field, $value )
20
    {
21 185
        $this->field = $field;
22 185
        $this->value = $value;
23 185
    }
24
25
    /**
26
     */
27 169
    public function getValue()
28
    {
29 169
        return $this->value;
30
    }
31
32
    /**
33
     * @return array
34
     */
35 165
    public function getValues()
36
    {
37 165
        return $this->getValue();
38
    }
39
40
    /**
41
     * By default, every atomic rule can have a solution by itself
42
     *
43
     * @return bool
44
     */
45 53
    public function hasSolution(array $contextual_options=[])
46
    {
47 53
        return true;
48
    }
49
50
    /**/
51
}
52