Symfony\Component\Templating\PhpEngine::__construct PHP Метод

__construct() публичный Метод

Constructor.
public __construct ( Symfony\Component\Templating\TemplateNameParserInterface $parser, Symfony\Component\Templating\Loader\LoaderInterface $loader, array $helpers = [] )
$parser Symfony\Component\Templating\TemplateNameParserInterface A TemplateNameParserInterface instance
$loader Symfony\Component\Templating\Loader\LoaderInterface A loader instance
$helpers array An array of helper instances
    public function __construct(TemplateNameParserInterface $parser, LoaderInterface $loader, array $helpers = array())
    {
        $this->parser  = $parser;
        $this->loader  = $loader;
        $this->parents = array();
        $this->stack   = array();
        $this->charset = 'UTF-8';
        $this->cache   = array();
        $this->globals = array();

        $this->setHelpers($helpers);

        $this->initializeEscapers();
        foreach ($this->escapers as $context => $escaper) {
            $this->setEscaper($context, $escaper);
        }
    }

Usage Example

Пример #1
0
    /**
     * Constructor.
     *
     * @param TemplateNameParserInterface $parser    A TemplateNameParserInterface instance
     * @param ContainerInterface          $container The DI container
     * @param LoaderInterface             $loader    A loader instance
     * @param GlobalVariables             $globals   A GlobalVariables instance
     */
    public function __construct(TemplateNameParserInterface $parser, ContainerInterface $container, LoaderInterface $loader, GlobalVariables $globals)
    {
        $this->container = $container;

        parent::__construct($parser, $loader);
        $this->addGlobal('app', $globals);
    }
All Usage Examples Of Symfony\Component\Templating\PhpEngine::__construct