JSTokenParser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

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

2 Methods

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