Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
2 / 3
CRAP
75.00% covered (warning)
75.00%
9 / 12
includephp
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
2 / 3
4.25
75.00% covered (warning)
75.00%
9 / 12
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 parse
0.00% covered (danger)
0.00%
0 / 1
2.15
66.67% covered (warning)
66.67%
6 / 9
 getTag
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\template\twig\tokenparser;
class includephp extends \Twig\TokenParser\AbstractTokenParser
{
    /** @var \phpbb\template\twig\environment */
    protected $environment;
    /**
    * Constructor
    *
    * @param \phpbb\template\twig\environment $environment
    */
    public function __construct(\phpbb\template\twig\environment $environment)
    {
        $this->environment = $environment;
    }
    /**
    * Parses a token and returns a node.
    *
    * @param \Twig\Token $token A Twig\Token instance
    *
    * @return \Twig\Node\Node A Twig\Node instance
    */
    public function parse(\Twig\Token $token)
    {
        $expr = $this->parser->getExpressionParser()->parseExpression();
        $stream = $this->parser->getStream();
        $ignoreMissing = false;
        if ($stream->test(\Twig\Token::NAME_TYPE, 'ignore'))
        {
            $stream->next();
            $stream->expect(\Twig\Token::NAME_TYPE, 'missing');
            $ignoreMissing = true;
        }
        $stream->expect(\Twig\Token::BLOCK_END_TYPE);
        return new \phpbb\template\twig\node\includephp($expr, $this->environment, $token->getLine(), $ignoreMissing, $this->getTag());
    }
    /**
    * Gets the tag name associated with this token parser.
    *
    * @return string The tag name
    */
    public function getTag()
    {
        return 'INCLUDEPHP';
    }
}