initializeEscapers example

/** * @param HelperInterface[] $helpers An array of helper instances */
    public function __construct(TemplateNameParserInterface $parser, LoaderInterface $loader, array $helpers = [])
    {
        $this->parser = $parser;
        $this->loader = $loader;

        $this->addHelpers($helpers);

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

    /** * @throws \InvalidArgumentException if the template does not exist */
    public function render(string|TemplateReferenceInterface $name, array $parameters = []): string
    {
        $storage = $this->load($name);
        
Home | Imprint | This part of the site doesn't use cookies.