Completed
Push — master ( 56b74c...17974d )
by Ilias
02:06
created

Operand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 4
dl 0
loc 26
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldExecuteFor() 0 4 1
A executeFor() 0 9 1
1
<?php
2
3
4
namespace CondParse\ParseStrategy;
5
6
7
use CondParse\TokenParserParameter;
8
9
class Operand implements ParseStrategyInterface
10
{
11
12
    /**
13
     * @param TokenParserParameter $parserParameter
14
     * @return bool
15
     */
16 16
    public function shouldExecuteFor(TokenParserParameter $parserParameter)
17
    {
18 16
        return $parserParameter->getTokenMap()->isOperand($parserParameter->getLexerToken());
19
    }
20
21
    /**
22
     * @param TokenParserParameter $parserParameter
23
     * @return void
24
     */
25 11
    public function executeFor(TokenParserParameter $parserParameter)
26
    {
27 11
        $parserParameter->getOperandStack()->push(
28
            $parserParameter
29 11
                ->getTokenMap()
30 11
                ->buildOperand($parserParameter->getLexerToken())
31 11
                ->consumeTokens($parserParameter->getOperandStack())
32 11
        );
33 11
    }
34
}
35