Symfony\Bundle\AsseticBundle\Twig\AsseticTokenParser::parse PHP Méthode

parse() public méthode

public parse ( Twig_Token $token )
$token Twig_Token
    public function parse(\Twig_Token $token)
    {
        if ($this->templateNameParser && is_array($this->enabledBundles)) {
            // check the bundle
            $templateRef = null;
            try {
                $templateRef = $this->templateNameParser->parse($this->parser->getStream()->getSourceContext()->getName());
            } catch (\RuntimeException $e) {
                // this happens when the filename isn't a Bundle:* url
                // and it contains ".."
            } catch (\InvalidArgumentException $e) {
                // this happens when the filename isn't a Bundle:* url
                // but an absolute path instead
            }
            $bundle = $templateRef instanceof TemplateReference ? $templateRef->get('bundle') : null;
            if ($bundle && !in_array($bundle, $this->enabledBundles)) {
                throw new InvalidBundleException($bundle, "the {% {$this->getTag()} %} tag", $templateRef->getLogicalName(), $this->enabledBundles);
            }
        }
        return parent::parse($token);
    }