Resolves template.

@param string $template The name of template

@throws \UnexpectedValueException If non-standart template name specified

@return string The path to template
321115
public function resolve($template)
    {
        if (! isset($this->templates[$template])) {
            throw new UnexpectedValueException(sprintf(
                'Unexpected template name "%s" provided.',
                is_string($template) ? $template : gettype($template)
            ));
        }

        return $this->templates[$template];
    }
306533
def resolve_template(template):
    ""
    if isinstance(template, (list, tuple)):
        return loader.select_template(template)
    elif isinstance(template, basestring):
        try:
            return loader.get_template(template)
        except TemplateDoesNotExist:
            return None
    else:
        return template
19093
protected function extensions(string $template): string
	{
		// Replace first occurance of extends tag with an empty string
		// and append the template with a view tag

		if(preg_match('/^{%\s*extends:(.*?)\s*%}/i', $template, $matches) > 0)
		{
			$replacement = '<?php $__view__ = $__viewfactory__->create(' . $matches[1] . '); $__renderer__ = $__view__->getRenderer(); ?>';

			$template = preg_replace('/^{%\s*extends:(.*?)\s*%}/i', $replacement, $template, 1);

			$template .= '<?php echo $__view__->render(); ?>';
		}

		return $template;
	}
1178944
public function parse($template)
    {
        $tree = $this->syntax->read($template);

        $compiler = new Compiler();
        $compiler->compile(new ClosureNode($tree));

        return $compiler->getSource();
    }
276190
protected function load($template){
		$template = get_stylesheet_directory()."/templates/admin/{$template}.php";
		/**
		 * wpametu_admin_screen_template
		 *
		 * @param string $template
		 * @param string $class_name
		 * @return string
		 */
		$template = apply_filters('wpametu_admin_screen_template', $template, get_called_class());
		if( file_exists($template) ){
			include $template;
		}
	}
74209
public function exists($template)
    {
        if (DIRECTORY_SEPARATOR === '\\' && strpos($template, '\\') !== false) {
            $template = str_replace('\\', '/', $template);
        }

        if (strpos($template, '/') === false) {
            $template = dirname(end($this->_context->templates)) . '/' . $template;
        }

        $template = $template[0] === '@' ? $this->alias->resolve($template) : $template;

        if (isset($this->_files[$template])) {
            return true;
        }

        foreach ($this->_engines as $extension => $_) {
            if (is_file($file = $template . $extension)) {
                if (PHP_EOL !== "\n") {
                    $realPath = strtr(realpath($file), '\\', '/');
                    if ($file !== $realPath) {
                        trigger_error("File name ($realPath) case mismatch for $file", E_USER_ERROR);
                    }
                }
                $this->_files[$template] = [$file, $extension];
                return $file;
            }
        }

        return false;
    }
561381
public function resolveErrorTemplate()
    {
        $this->buildTemplateIndex();

        $template = (array_key_exists(self::ERROR_TEMPLATE, $this->templateIndex)) ?
            $this->templateIndex[self::ERROR_TEMPLATE] :
            false;

        return($template);
    }
746146
protected function compiled($template)
    {
        $template = ltrim($template, '/');
        if (strrchr($template, '.') == $this->extension)
            $template = substr($template, 0, -strlen($this->extension));
        $file = $this->dir . DIRECTORY_SEPARATOR . $template . $this->extension;
        if (!is_file($file))
            throw new \RuntimeException("template not found:$file!");

        $modified = filemtime($file);
        $compiled = $this->temp . DIRECTORY_SEPARATOR . $template . ".{$modified}.php";
        if (!$this->debug && is_file($compiled) && filemtime($compiled) >= $modified)
            return $compiled;

        $content = self::compile(file_get_contents($file), $this->left, $this->right);
        self::writeFile($compiled, $content, $this->temp);

        return $compiled;
    }
878121
private function getRenderer(string $template): string
    {
        if (is_readable($template) === false) {
            throw new View\Exception('Could not open file "' . basename($template) . '"');
        }

        $suffix = strtolower(pathinfo($template, PATHINFO_EXTENSION));

        if (isset($this->renderer[$suffix]) === false) {
            throw new View\Exception('No template engine registered for file extension "' . $suffix . '"');
        }

        return $this->renderer[$suffix];
    }
950820
public function resolve(string $template, array $variables = null) 
    {
        return [
            $this->resolvePath($template), 
            $this->resolveEnv($template, $variables)
        ];
    }
826863
protected function replaceValues($template)
    {
        $template = str_replace( '##NAMESPACE##', Config::get('generators.namespace'), $template );
        $template = str_replace( '##FLOW_CLASS##', $this->flowClass, $template );
        $template = str_replace( '##FLOW_VARIABLE##', $this->flowVariable, $template );
        $template = str_replace( '##FLOW_STEP_CLASS##', $this->stepClass, $template );
        $template = str_replace( '##FLOW_STEP_VARIABLE##', $this->stepVariable, $template );
        $template = str_replace( '##FLOW_STEP_BREADCRUMB##', $this->stepBreadcrumb, $template );

        return $template;
    }
1202640
public function getLayoutFromTemplate($template)
	{
	    $content = file_get_contents($this->getTemplateFile($template));
	    
	    return $this->getEngineInstance()->getLayout($content);
	}
349883
protected function getTemplate(string $template) : string
    {
        if (isset($this->templates[$template])) {
            return $this->templates[$template];
        }

        $file = $this->basePath . $template;

        if (file_exists($file)) {
            $this->templates[$template] = file_get_contents($file);
        }

        if (!isset($this->templates[$template]) || !$this->templates[$template]) {
            unset($this->templates[$template]);
            throw new FileSystemException("Template $template not found");
        }

        return $this->templates[$template];
    }
548751
public function setTemplate(string $template): self
    {
        $this->template = $template;
        $this->logger->debug("Template file set to loader.", ["template" => $this->template]);
        return $this;
    }
617834
public function resolveNotFoundTemplate()
    {
        $this->buildTemplateIndex();

        $template = (array_key_exists(self::NOTFOUND_TEMPLATE, $this->templateIndex)) ?
            $this->templateIndex[self::NOTFOUND_TEMPLATE] :
            false;

        return($template);
    }
1342526
public function wrap($template)
	{
		$this->template = Template\Loader::load($template);
		$groundTemplate = Template\Loader::load('templates.layout.ground');

		return $groundTemplate;
	}
673695
public function resolver($name = null)
    {
        if (null === $this->__templateResolver) {
            $this->setResolver(new TemplatePathStack());
        }

        if (null !== $name) {
        	$viewPath = $this->__templateResolver->resolve($name, $this);
        	//echo $viewPath. "<br>";
            return $this->__templateResolver->resolve($name, $this);
        }

        return $this->__templateResolver;
    }