NotOperator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A evaluate() 0 8 2
1
<?php
2
/**
3
 * @author Aleksandar Panic
4
 * @license http://www.apache.org/licenses/LICENSE-2.0
5
 * @since 1.0.0
6
 **/
7
8
namespace ArekX\ArrayExpression\Operators;
9
10
use ArekX\ArrayExpression\Interfaces\ValueParser;
11
12
/**
13
 * Class NotOperator
14
 * Operator for handling NOT function
15
 *
16
 * @package ArekX\ArrayExpression\Operators
17
 */
18
class NotOperator extends BaseGroupOperator
19
{
20
    /**
21
     * Evaluates one value.
22
     *
23
     * @param ValueParser $value Value to be evaluated
24
     * @return mixed Evaluation result
25
     */
26 4
    public function evaluate(ValueParser $value)
27
    {
28 4
        if (empty($this->operators[1])) {
29 4
            $this->assertIsExpression($this->config[1]);
30 4
            $this->operators[1] = $this->parser->parse($this->config[1]);
31
        }
32
33 4
        return !$this->operators[1]->evaluate($value);
34
    }
35
}