Documentation

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
bool

decideIfFork()

Decide if current token marks switch logic.

public decideIfFork(Token $token) : bool
Parameters
$token : Token
Return values
bool

        
On this page

Search results