Craft 3 Class Reference

Class craft\web\twig\tokenparsers\SwitchTokenParser

Inheritance
craft\web\twig\tokenparsers\SwitchTokenParser ยป Twig_TokenParser
Implements
Twig_TokenParserInterface
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/web/twig/tokenparsers/SwitchTokenParser.php

Class SwitchTokenParser that parses {% switch %} tags.

Based on the rejected Twig pull request: https://github.com/fabpot/Twig/pull/185

Protected Properties
Property Type Description Defined By
$parser Twig_Parser Twig_TokenParser
Public Methods
Method Description Defined By
decideIfEnd() craft\web\twig\tokenparsers\SwitchTokenParser
decideIfFork() craft\web\twig\tokenparsers\SwitchTokenParser
getTag() Gets the tag name associated with this token parser. craft\web\twig\tokenparsers\SwitchTokenParser
parse() Parses a token and returns a node. craft\web\twig\tokenparsers\SwitchTokenParser
setParser() Sets the parser associated with this token parser. Twig_TokenParser

Method Details

decideIfEnd() public method #

public boolean decideIfEnd ( Twig_Token $token )
$token Twig_Token

decideIfFork() public method #

public boolean decideIfFork ( Twig_Token $token )
$token Twig_Token

getTag() public method #

Gets the tag name associated with this token parser.

public string getTag ( )
return string The tag name

parse() public method #

Parses a token and returns a node.

public Twig_Node parse ( Twig_Token $token )
$token
return Twig_Node A Twig_Node instance
throws Twig_Error_Syntax