JSTokenParser::getTag()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types = 1);
2
3
namespace Fousky\JSBlockBundle\Twig\TokenParser;
4
5
use Fousky\JSBlockBundle\Twig\Node\JSNode;
6
use Twig\Token;
7
use Twig\TokenParser\AbstractTokenParser;
8
9
class JSTokenParser extends AbstractTokenParser
10
{
11
    public function parse(Token $token)
12
    {
13
        $stream = $this->parser->getStream();
14
        $value = $this->parser->getExpressionParser()->parseExpression();
15
        $stream->expect(Token::BLOCK_END_TYPE);
16
17
        return new JSNode($value, $token->getLine(), $this->getTag());
18
    }
19
20
    public function getTag(): string
21
    {
22
        return 'jsblock';
23
    }
24
}
25