Hostnet\Bundle\WebpackBundle\Twig\Token\WebpackTokenParser::parse PHP Method

parse() public method

{@inheritDoc}
public parse ( Twig_Token $token )
$token Twig_Token
    public function parse(\Twig_Token $token)
    {
        $stream = $this->parser->getStream();
        $lineno = $stream->getCurrent()->getLine();
        // Export type: "js" or "css"
        $export_type = $stream->expect(\Twig_Token::NAME_TYPE)->getValue();
        if (!in_array($export_type, ['js', 'css', 'inline'])) {
            // This exception will include the template filename by itself.
            throw new \Twig_Error_Syntax(sprintf('Expected export type "inline", "js" or "css", got "%s" at line %d.', $export_type, $lineno));
        }
        if ($export_type === "inline") {
            return $this->parseInline($stream, $lineno);
        }
        return $this->parseType($stream, $lineno, $export_type);
    }