XlsDrawingTokenParser::getTag()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace MewesK\TwigExcelBundle\Twig\TokenParser;
4
5
use MewesK\TwigExcelBundle\Twig\Node\XlsDrawingNode;
6
use Twig_Token;
7
8
/**
9
 * Class XlsDrawingTokenParser
10
 *
11
 * @package MewesK\TwigExcelBundle\Twig\TokenParser
12
 */
13
class XlsDrawingTokenParser extends AbstractTokenParser
14
{
15
    /**
16
     * @param Twig_Token $token
17
     *
18
     * @return XlsDrawingNode
19
     * @throws \Twig_Error_Syntax
20
     */
21
    public function parse(Twig_Token $token)
22
    {
23
        // parse attributes
24
        $path = $this->parser->getExpressionParser()->parseExpression();
25
        $properties = $this->parseProperties($token);
26
        $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
27
28
        // return node
29
        return new XlsDrawingNode($path, $properties, $token->getLine(), $this->getTag());
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function getTag()
36
    {
37
        return 'xlsdrawing';
38
    }
39
}
40