XlsDrawingTokenParser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 10 1
A getTag() 0 4 1
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