Total Complexity | 3 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
15 | class AnnotationsTokenParser extends \Twig_TokenParser |
||
16 | { |
||
17 | /** |
||
18 | * Parses a token and returns a node. |
||
19 | * |
||
20 | * @param Twig_Token $token A Twig_Token instance |
||
21 | * |
||
22 | * @return AnnotationsNode A Twig_NodeInterface instance |
||
23 | */ |
||
24 | public function parse(Twig_Token $token) |
||
25 | { |
||
26 | $stream = $this->parser->getStream(); |
||
27 | |||
28 | $stream->expect(Twig_Token::BLOCK_END_TYPE); |
||
29 | $body = $this->parser->subparse(array($this, 'decideEndAnnotations')); |
||
30 | $stream->expect('endannotations'); |
||
31 | $stream->expect(Twig_Token::BLOCK_END_TYPE); |
||
32 | |||
33 | return new AnnotationsNode(array('body' => $body)); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Gets the tag name associated with this token parser. |
||
38 | * |
||
39 | * @return string The tag name |
||
40 | */ |
||
41 | public function getTag() |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Decide end annotations |
||
48 | * |
||
49 | * @param string $token |
||
50 | * @return mixed |
||
51 | */ |
||
52 | public function decideEndAnnotations($token) |
||
55 | } |
||
56 | } |
||
57 |