Get HTTP response of either original image file or
template applied file.

@param  string $template
@param  string $filename
@return Illuminate\Http\Response
164773
public function getResponse($template, $filename)
    {
        switch (strtolower($template)) {
            case 'original':
                return $this->getOriginal($filename);

            case 'download':
                return $this->getDownload($filename);

            default:
                return $this->getImage($template, $filename);
        }
    }
1163340
public function copy($template, $newName = null)
    {
        $response = $this->request(self::REQUEST_POST, 'templates/'.$template.'/copy', [
            'name' => $newName
        ]);

        return $response->response;
    }
872588
protected function createFile(string $fileName, string $className, string $template)
    {
        $directory = dirname($fileName);
        if (!file_exists($directory . '/.')) {
            mkdir($directory, 0755, true);
        }

        file_put_contents(
                $fileName,
                str_replace(
                        ['{NAMESPACE}', '{CLASS}'],
                        [$this->namespaceOf($className),
                         $this->nonQualifiedClassNameOf($className)
                        ],
                        $this->resourceLoader->load($this->pathForTemplate($template))
                )
        );
    }
1061933
protected function getTemplateContent($filename)
    {
        $filepath = $this->getTemplateFilePath($filename);

        if (!$filepath) {
            return null;
        }

        $contents = file_get_contents($filepath);

        if (!$contents) {
            return null;
        }

        return $contents;
    }
478486
public function load($name)
    {
        if (!isset($this->templates[$name])) {
            $this->templates[$name] = $this->loadFile($name);
        }

        return $this->templates[$name];
    }
770967
protected function loadFile($name)
    {
        $fileName = $this->getFileName($name);

        if ($this->shouldCheckPath() && !file_exists($fileName)) {
            throw new Mustache_Exception_UnknownTemplateException($name);
        }

        return file_get_contents($fileName);
    }
242483
public function render($template)
    {
        $this->setTemplate($template);
        extract($this->data);
        ob_start();
        require $this->templatePath;

        return ob_get_clean();
    }
766412
protected function load($filename, $data = array(), $return = false)
    {
        $template = $this->createSubTemplate();

        try {
            return $template->renderTemplate($filename, $data, $return);
        } catch (\Exception $exception) {
            if (!empty($this->log))
            {
                $this->log->error("Failed to render template " . $filename, $exception);
            }
            return '';
        }
    }
977605
public function template($template = null)
    {
        if (is_null($template)) {
            return $this->template;
        } else {
            $this->template = $template;
        }
    }
842289
public function getView($filename, $data = null)
    {
        // $data = ($data === null) ? $this->_data : $data;
        return $this->getTemplateFile($this->getTemplateFolder().$filename, $data);
    }
383038
public function create(Template $Template)
    {
        $response = $this->mailjet->post(Resources::$Template,
            ['body' => $Template->format()]);
        if (!$response->success()) {
            $this->throwError("TemplateManager:create() failed", $response);
        }

        return $response->getData();
    }
941196
public static function getTemplate($template, $format = 'html5')
	{
		$templates = static::getTemplates($template, $format = 'html5');

		return isset($templates[0]) ? $templates[0] : null;
	}
163778
public function getTemplateFilePath($templateName)
    {
        $templateList = array_merge(
            [ $this ],
            $this->getParentList()
        );

        /** @var TemplateDefinition $templateDefinition */
        foreach ($templateList as $templateDefinition) {
            $templateFilePath = sprintf(
                '%s%s/%s',
                THELIA_TEMPLATE_DIR,
                $templateDefinition->getPath(),
                $templateName
            );

            if (file_exists($templateFilePath)) {
                return $templateFilePath;
            }
        }

        throw new TemplateException("Template file not found: $templateName");
    }
589228
public function getTemplateFile($template) {
		$templateFileClass = $this->_templateFileClass;		

		$dwooTemplateFile = new $templateFileClass($template);
		
		if (!($dwooTemplateFile instanceof Dwoo_ITemplate)) {
			throw new Dwoo_Exception("Custom templateFile class must be a subclass of Dwoo_ITemplate");
		}

		foreach ($this->_templateFileSettings as $method => $value) {
			if (method_exists($dwooTemplateFile, 'set' . $method)) {
				call_user_func(array($dwooTemplateFile, 'set' . $method), $value);
			}
		}
		
		return $dwooTemplateFile;
	}
1257139
protected function getOutTemplate($template = 'default') {
		// check for current locale
		if ($this->locale != '') {
			$templatefile = $this->templatespath.'/'.$this->locale.'/'.$this->outtemplateprefix.$template.'.htm';
			
			if (file_exists($templatefile)) {
				return $this->locale.'/'.$this->outtemplateprefix.$template;
			}
		}
		
		// if not found, check for default locale
		if ($this->deflocale != '') {
			$templatefile = $this->templatespath.'/'.$this->deflocale.'/'.$this->outtemplateprefix.$template.'.htm';
			
			if (file_exists($templatefile)) {
				return $this->deflocale.'/'.$this->outtemplateprefix.$template;
			}
		}
		
		// if not found then check in root
		$templatefile = $this->templatespath.'/'.$this->outtemplateprefix.$template.'.htm';
			
		if (file_exists($templatefile)) {
			return $this->outtemplateprefix.$template;
		}
		
		// out template not found
		return null;
	}
1260235
protected function getTemplateName($fileName)
    {
        $pathFn = function ($dir) use ($fileName) {
            return static::$widgetTemplateDir . '/' . $dir . '/' . $fileName;
        };

        $pathToCheckFn = function ($path) {
            return APP_DIR . '/templates/' . $path . '.mustache';
        };

        $path = $pathFn($this->className);
        $pathToCheck = $pathToCheckFn($path);

        // If doesn't exists just take it by default from current APP
        if (!file_exists($pathToCheck)) {

            $path = $pathFn(static::$widgetTemplateDirDefault);
            $pathToCheck = $pathToCheckFn($path);

            // If doesn't exists take it by default from Knob-base
            if (!file_exists($pathToCheck)) {
                $path = '../../vendor/chemaclass/knob-base/src/templates/' . $path;
            }
        }

        return $path;
    }
602179
protected function getFluidTemplateObject($filename)
    {
        $view = GeneralUtility::makeInstance(StandaloneView::class);
        $view->setLayoutRootPaths(['EXT:backend/Resources/Private/Layouts']);
        if (\Gilbertsoft\Warranty\Utility\Adapter::isCompatVersion('8.7')) {
            $view->setPartialRootPaths(['EXT:backend/Resources/Private/Partials/ToolbarItems']);
            $view->assignMultiple([
                    'iconSize'  => 'default',
                ]);
        } else {
            $view->setPartialRootPaths(['EXT:gswarranty/Resources/Private/Partials/ToolbarItems']);
            $view->assignMultiple([
                    'iconSize'  => 'small',
                ]);
        }
        $view->setTemplateRootPaths(['EXT:gswarranty/Resources/Private/Templates/ToolbarItems']);
        $view->setTemplate($filename);

        return $view;
    }