NotOperand::consumeTokens()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 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