TwigTokenParserSwitch
extends AbstractTokenParser
in package
Adds ability use elegant switch instead of ungainly if statements
{% switch type %} {% case 'foo' %} {{ my_data.foo }} {% case 'bar' %} {{ my_data.bar }} {% default %} {{ my_data.default }} {% endswitch %}
Table of Contents
Methods
- decideIfEnd() : bool
- Decide if current token marks end of swtich block.
- decideIfFork() : bool
- Decide if current token marks switch logic.
- getTag() : string
- {@inheritdoc}
- parse() : TwigNodeSwitch
Methods
decideIfEnd()
Decide if current token marks end of swtich block.
public
decideIfEnd(Token $token) : bool
Parameters
- $token : Token
Return values
booldecideIfFork()
Decide if current token marks switch logic.
public
decideIfFork(Token $token) : bool
Parameters
- $token : Token
Return values
boolgetTag()
{@inheritdoc}
public
getTag() : string
Return values
stringparse()
public
parse(Token $token) : TwigNodeSwitch
Parameters
- $token : Token