CondParse::parseConditionString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
4
namespace CondParse;
5
6
7
class CondParse
8
{
9
    /** @var LexerInterface */
10
    private $lexer;
11
    /** @var ParserInterface */
12
    private $parser;
13
    /** @var TokenMap */
14
    private $tokenMap;
15
16
    /**
17
     * @param LexerInterface $lexer
18
     * @param ParserInterface $parser
19
     * @param TokenMap $tokenMap
20
     */
21 11
    public function __construct(LexerInterface $lexer, ParserInterface $parser, TokenMap $tokenMap)
22
    {
23 11
        $this->lexer = $lexer;
24 11
        $this->parser = $parser;
25 11
        $this->tokenMap = $tokenMap;
26 11
    }
27
28
    /**
29
     * @param string $conditionString
30
     * @return OperandInterface
31
     */
32 11
    public function parseConditionString($conditionString)
33
    {
34 11
        return $this->parser->parseTokenStream(
35 11
            $this->lexer->getTokenStream($conditionString, $this->tokenMap),
36 11
            $this->tokenMap
37 11
        );
38
    }
39
}
40