SettingParser::getTag()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
5
namespace Xervice\Atomic\Communication\Twig\Extension;
6
7
8
use Twig_Token;
9
use Xervice\Atomic\Communication\Twig\Extension\Node\XerviceAtomicSettingNode;
10
11
class SettingParser extends \Twig_TokenParser
12
{
13 1
    public function parse(Twig_Token $token)
14
    {
15 1
        $parser = $this->parser;
16 1
        $stream = $parser->getStream();
17
18 1
        $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
19 1
        $stream->expect(Twig_Token::OPERATOR_TYPE, '=');
20 1
        $value = $parser->getExpressionParser()->parseExpression();
21 1
        $stream->expect(Twig_Token::BLOCK_END_TYPE);
22
23 1
        return new XerviceAtomicSettingNode($name, $value, $token->getLine(), $this->getTag());
24
    }
25
26
    /**
27
     * @return string
28
     */
29 1
    public function getTag()
30
    {
31 1
        return 'setting';
32
    }
33
34
}