checkTemplateDirectory

@return void
173400
protected function checkTemplateDirectory()
    {
        if (!$this->templateDir || !is_dir($this->templateDir)) {
            throw new \InvalidArgumentException(
                sprintf('Invalid template directory: %s', $this->templateDir)
            );
        }
    }
1219940
protected function _checkTemplateBlock($sTemplate, $sBlockName)
    {
        $sTplFile = Registry::getConfig()->getTemplatePath($sTemplate, false);
        if (!$sTplFile || !file_exists($sTplFile)) {
            // check if file is in admin theme
            $sTplFile = Registry::getConfig()->getTemplatePath($sTemplate, true);
            if (!$sTplFile || !file_exists($sTplFile)) {
                return false;
            }
        }

        $sFile = file_get_contents($sTplFile);
        $sBlockNameQuoted = preg_quote($sBlockName, '/');

        return (bool) preg_match('/\[\{\s*block\s+name\s*=\s*([\'"])' . $sBlockNameQuoted . '\1\s*\}\]/is', $sFile);
    }
580400
private function findTemplatesInDirectory($dir, $namespace = null, array $excludeDirs = [])
    {
        if (!is_dir($dir)) {
            return [];
        }

        $templates = [];
        foreach (Finder::create()->files()->followLinks()->in($dir)->exclude($excludeDirs) as $file) {
            $templates[] = (null !== $namespace ? '@'.$namespace.'/' : '').str_replace('\\', '/', $file->getRelativePathname());
        }

        return $templates;
    }
575816
public function setTemplatesDirectory($directory)
    {
        $this->templatesDirectory = rtrim($directory, DIRECTORY_SEPARATOR);
		$this->engine->setDirectory($this->getTemplatesDirectory());
    }
361516
public static function clearCompiledTemplates()
    {
        $twig = StaticContainer::get(Twig::class);
        $environment = $twig->getTwigEnvironment();
        $environment->clearTemplateCache();

        $cacheDirectory = $environment->getCache();
        if (!empty($cacheDirectory)
            && is_dir($cacheDirectory)
        ) {
            $environment->clearCacheFiles();
        }
    }
111972
public function getTemplateDir($key = null)
    {
        if ($key === null) {
            if (count($this->templateDirs) > 0) {
                return $this->templateDirs;
            }
            return null;
        }
        if (is_string($key) === 'string' || is_int($key)) {
            return isset($this->templateDirs[$key]) ? $this->templateDirs[$key] : null;
        }
        return null;
    }
810749
public function detectMainTemplate()
    {
        $name = (isset($this->mainxsl) && !empty($this->mainxsl)) ? $this->mainxsl : 'index';

        foreach ($this->getIncludePaths() as $path) {
            if (is_readable($path.DIRECTORY_SEPARATOR.$name.'.xsl')) {
                $this->xsl->includeXSL($path.DIRECTORY_SEPARATOR.$name.'.xsl', true);

                return $path.DIRECTORY_SEPARATOR.$name.'.xsl';
            }
        }
    }
37526
public function initializeTemplate($directory = null)
	{
		if (empty($directory)) {
			$directory = $this->config->resolvePath('views');
		}

		$this->template = new Template($directory);
	}
779745
public function find($template)
    {
        if (!$this->supports($template)) {
            return false;
        }

        foreach ($this->paths as $path) {
            $filePath = "{$path}/{$template}";

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

        return false;
    }
872455
public function initCustomTemplates()
    {
        $directory = MUNICIPIO_PATH . 'library/Controller/';

        foreach (@glob($directory . "*.php") as $file) {
            $class = '\Municipio\Controller\\' . basename($file, '.php');

            if (!class_exists($class)) {
                continue;
            }

            if (!method_exists($class, 'registerTemplate')) {
                continue;
            }

            $class::registerTemplate();
            unset($class);
        }
    }
1168678
private function publishTemplates()
    {
        if (!$this->fileSystem->isDirectory(getcwd().'/resources/crudmaker')) {
            $this->copyDirectory(__DIR__.'/../Templates/Lumen', getcwd().'/resources/crudmaker');
            $this->info("\n\nLumen templates files have been published");
        } else {
            $this->error('Lumen templates files has already been published');
        }
    }
1219816
public function tryTemplate($dir, $template, $view)
    {
        $dir = rtrim($dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'templates';

        if (is_readable($dir.DIRECTORY_SEPARATOR.$template) && is_file($dir.DIRECTORY_SEPARATOR.$template)) {
            if (isset($view)) {
                $view->setTemplatesDirectory($dir);
            }

            return $template;
        }
    }
425284
public function setTemplateDir($path = VIEW) {
		$old = $this->_sv_template_dir;
		$this->_sv_template_dir  = $path;

		return $old;
	}
782377
public function setCompileDirectory()
    {
        $compilePath = $this->getTemplatesDirectory() . DIRECTORY_SEPARATOR . $this->compileDirectoryName . DIRECTORY_SEPARATOR;

        if (!file_exists($compilePath))
        {
            static::mkdir($compilePath);
        }

        $this->compilePath = $compilePath;
    }
1026813
protected function _should_load_template() {
		return ( \is_tax() || \is_category() || \is_tag() )
			&& ! empty( $this->term )
			&& in_array( $this->taxonomy, $this->taxonomies );
	}
810536
private function setTemplateSource()
    {
        // not accurate, but better than null
        $this->srcFile = $this->file;
        $this->srcLine = $this->line;

        list($file,$line) = $this->findFileAndLine();

        if (NULL === $file) {
            return false;
        }

        // this is not accurate yet, hopefully will be overwritten later
        $this->srcFile = $file;
        $this->srcLine = $line;

        $lines = @file($file);
        if (!$lines) {
            return false;
        }

        $found_line=false;
        $found_file=false;

        // scan lines backwards looking for "from line" comments
        $end = min(count($lines), $line)-1;
        for($i=$end; $i >= 0; $i--) {
            if (preg_match('/tag "[^"]*" from line (\d+)/', $lines[$i], $m)) {
                $this->srcLine = intval($m[1]);
                $found_line=true;
                break;
            }
        }

        foreach(preg_grep('/Generated by PHPTAL from/',$lines) as $line) {
            if (preg_match('/Generated by PHPTAL from (.*) \(/', $line, $m)) {
                $this->srcFile = $m[1];
                $found_file=true;
                break;
            }
        }

        return $found_line && $found_file;
    }
633446
public function action_template_redirect() {
		add_filter( 'template_include', array( $this, 'filter_template_include' ), PHP_INT_MAX );

		foreach ( self::get_query_template_names() as $template => $conditional ) {

			// If a matching theme-compat file is found, further conditional checks won't occur in template-loader.php
			if ( $this->got_theme_compat ) {
				break;
			}

			$get_template = "get_{$template}_template";

			if ( function_exists( $conditional ) && function_exists( $get_template ) && call_user_func( $conditional ) ) {
				$filter = str_replace( '_', '', $template );
				add_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), PHP_INT_MAX );
				call_user_func( $get_template );
				remove_filter( "{$filter}_template_hierarchy", array( $this, 'filter_template_hierarchy' ), PHP_INT_MAX );
			}
		}

	}