EqualRule   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 45
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getValue() 0 4 1
A getValues() 0 4 1
A hasSolution() 0 4 1
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