private function applyExtensions(TemplateEngineInterface $engine)
    {
        foreach (static::$extensions as $className => $extension) {
            $ext = $this->getExtension($className, $extension);
            if ($ext->appliesTo($engine)) {
                $ext->update($engine);
            }
        }
        return $engine;
    }