Find a template path

@param array  $info      The path information
@return array
165526
public function find(array $info)
    {
        $locator = $this->getObject('manager')->getClassLoader()->getLocator('module');

        //Get the package
        $package = $info['package'];

        //Get the domain
        $domain = $info['domain'];

        //Switch basepath
        if(!$locator->getNamespace(ucfirst($package))) {
            $basepath = $locator->getNamespace('\\');
        } else {
            $basepath = $locator->getNamespace(ucfirst($package));
        }

        $basepath .= '/mod_'.strtolower($package);

        return array('mod_'.$package => $basepath);
    }
106618
protected function getTwigInfo($trace)
    {
        $file = $trace['object']->getTemplateName();

        if (isset($trace['line'])) {
            foreach ($trace['object']->getDebugInfo() as $codeLine => $templateLine) {
                if ($codeLine <= $trace['line']) {
                    return [$file, $templateLine];
                }
            }
        }

        return [$file, -1];
    }
210071
protected function unpack(array $info)
	{
		$return = [];
		foreach ($info as $key => $value)
		{
			if ($value instanceof AbstractDto)
			{
				$value = $value->raw();
			}
			$return[$key] = $value;
		}

		return $return;
	}
610491
public function templatePath($path = null)
    {
        deprecationWarning('ViewBuilder::templatePath() is deprecated. Use ViewBuilder::setTemplatePath() or ViewBuilder::getTemplatePath() instead.');
        if ($path !== null) {
            return $this->setTemplatePath($path);
        }

        return $this->getTemplatePath();
    }
68387
public function compile($info) {
        // resets the footer (eg: layouts)
        $property = $this->reflect->getProperty("footer");
        $property->setAccessible(true);
        $property->setValue($this->blade, []);

        $contents = $this->blade->compileString($info->contents);

        if(!is_null($this->cachePath)) {
            $this->files->put($this->getCompiledPath($info), $contents);
        }
    }
1171284
protected function getPathToTemplates($template = null)
    {
        $template = Helpers::getPathWithSlash($template ?: Config::getDefaultTemplateName());
        $basePath = base_path(Config::getTemplatesPath() . $template);
        $path = Helpers::getPathWithSlash($basePath);

        if (!$this->isFileExists($path)) {
            throw new Exception('Invalid template. Make sure the following path exists: "' . $path . '"');
        }

        return $path;
    }
170885
protected function getTemplateMatches($template, $path)
    {
        $template = '~^' . preg_replace('~\<(\d+)\>~', '(?<p_$1>.+?)', $template) . '$~i';
        if (!preg_match($template, $path, $m)) {
            return false;
        } else {
            $matches = [];
            foreach ($m as $key => $value) {
                if (substr($key, 0, 2) == 'p_') {
                    $matches[substr($key, 2)] = $value;
                }
            }
            return $matches;
        }
    }
401644
public function find(array $info)
    {
        //Qualify partial templates.
        if(dirname($info['url']) === '.')
        {
            if(empty($info['base'])) {
                throw new RuntimeException('Cannot qualify partial template path');
            }

            $relative_path = dirname($info['base']);
        }
        else $relative_path = dirname($info['url']);

        $file   = pathinfo($info['url'], PATHINFO_FILENAME);
        $format = pathinfo($info['url'], PATHINFO_EXTENSION);

        $base_paths = array(JPATH_ROOT);

        if (!empty($this->_override_paths)) {
            foreach ($this->_override_paths as $override_path) {
                array_unshift($base_paths, $override_path);
            }
        }

        foreach ($base_paths as $base_path)
        {
            $path = $base_path.'/'.str_replace(parse_url($relative_path, PHP_URL_SCHEME).'://', '', $relative_path);

            // Remove /view from the end of the override path
            if (in_array($base_path, KObjectConfig::unbox($this->_override_paths)) && substr($path, strrpos($path, '/')) === '/view') {
                $path = substr($path, 0, -5);
            }

            if(!$result = $this->realPath($path.'/'.$file.'.'.$format))
            {
                $pattern = $path.'/'.$file.'.'.$format.'.*';
                $results = glob($pattern);

                //Try to find the file
                if ($results)
                {
                    foreach($results as $file)
                    {
                        if($result = $this->realPath($file)) {
                            return $result;
                        }
                    }
                }
            }
        }

        return $result;
    }
397053
private function findTemplate($template)
    {
        $logicalName = (string) $template;

        if (isset($this->cache[$logicalName])) {
            return $this->cache[$logicalName];
        }

        $template = $this->templateNameParser->parse($template);
        $file = $this->templateLocator->locate($template);

        return $this->cache[$logicalName] = $file;
    }
502944
protected function parseLog($info)
    {
        $requestInfo = [
            'ip'     => $this->app['request']->ip(),
            'method' => $this->app['request']->method(),
            'host'   => $this->app['request']->host(),
            'uri'    => $this->app['request']->url(),
        ];

        if ($this->config['json']) {
            $info = $requestInfo + $info;
            return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\r\n";
        }

        array_unshift($info, "---------------------------------------------------------------\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}");
        unset($info['timestamp']);

        return implode("\r\n", $info) . "\r\n";
    }
422014
private function getPaths($plugin): array
    {
        if ($plugin === null || !Plugin::loaded($plugin)) {
            return App::path('Template');
        }

        return App::path('Template', $plugin);
    }
684778
public function findAllTemplates()
    {
        if (null !== $this->templates) {
            return $this->templates;
        }

        $templates = array();

        foreach ($this->paths as $dir) {
            $templates = array_merge($templates, $this->findTemplatesInFolder($dir));
        }

        return $this->templates = $templates;
    }
502877
protected function resolveTemplate($template)
    {
        if (!$this->pathCache[$template]) {

            foreach (array_reverse($this->templateDirs) as $dir) {
                $path = $dir . DIRECTORY_SEPARATOR . $template .'.'. $this->getFileExtension();
                if (is_readable($path)) {
                    $this->pathCache[$template] = $path;
                    break;
                }
            }

        }

        return $this->pathCache[$template];
    }
1164759
protected function parseCliLog($info)
    {
        if ($this->config['json']) {
            $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\r\n";
        } else {
            $now = $info['timestamp'];
            unset($info['timestamp']);

            $message = implode("\r\n", $info);

            $message = "[{$now}]" . $message . "\r\n";
        }

        return $message;
    }
866379
protected function findTemplateInPaths($template)
    {
        if (file_exists($template)) {
            return $template;
        }

        foreach ($this->paths as $path) {
            if (file_exists($realpath = $path . DIRECTORY_SEPARATOR . ltrim($template, DIRECTORY_SEPARATOR))) {
                return $realpath;
            }
        }

        return false;
    }
470751
protected function findTemplate($name)
    {
        try {
            return parent::findTemplate($name);
        } catch (\Twig_Error_Loader $e) {
            $namespace = self::MAIN_NAMESPACE;

            if (is_readable($name)) {
                return $name;
            }

            throw new \Twig_Error_Loader(sprintf(
                'Unable to find template "%s" (looked into: %s).',
                $name,
                implode(', ', $this->paths[$namespace])
            ));
        }
    }
280532
public function getTemplate($templatePath)
    {
        $absoluteTemplateFilePath = $this->getTemplateFilePath($templatePath);
        if (!$absoluteTemplateFilePath) {
            return;
        }
        extract($this->getArrayCopy());
        ob_start();
        include $absoluteTemplateFilePath;
        $content = ob_get_contents();
        ob_end_clean();
        return $content;
    }