NotOperand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 26
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 4 1
A consumeTokens() 0 5 1
A __toString() 0 4 1
1
<?php
2
3
4
namespace CondParse\Operand;
5
6
7
use CondParse\OperandInterface;
8
use CondParse\OperandStack;
9
10
class NotOperand extends AbstractOperand
11
{
12
    /** @var OperandInterface */
13
    private $containedOperand;
14
15
    /** @return bool */
16 2
    public function execute()
17
    {
18 2
        return ! $this->containedOperand->execute();
19
    }
20
21
    /**
22
     * @param OperandStack $operandStack
23
     * @return $this
24
     */
25 7
    public function consumeTokens(OperandStack $operandStack)
26
    {
27 7
        $this->containedOperand = $operandStack->pop();
28 7
        return $this;
29
    }
30
31 5
    public function __toString()
32
    {
33 5
        return sprintf('NOT(%s)', $this->containedOperand);
34
    }
35
}
36