Add templates folder

@param string $name
@param string $path
192876
public function addTemplatesFolder($name, $path)
    {
        if (is_dir($path)) {
            $this->templateEngine->addFolder($name, $path);
        }
    }
101181
public function addPath(string $path, string $namespace = null): void
    {
        $namespace = $namespace ?: FileViewFinder::DEFAULT_NAMESPACE;
        $this->finder->addPath($path, $namespace);
    }
141242
public function load_template($slug, $name = '', array $args = []){
        $base_path = $slug.'.php';
        $original_path = $slug.( !empty($name) ? '-'.$name : '' ).'.php';
        $found_path = '';
        foreach( [$original_path, $base_path] as $file ){
            foreach( [get_stylesheet_directory(), get_template_directory()] as $dir ){
                $path = $dir.'/'.ltrim($file, '\\');
                if( file_exists($path) ){
                    $found_path = $path;
                    break 2;
                }
            }
        }
        if( $found_path ){
            // Path found. Let's locate template.
            global $post, $posts, $wp_query;
            if( !empty($args) ){
                extract($args);
            }
            include $found_path;
        }
    }
1272962
public function add($name,$dir){
		if ($dir === false)
			$this->request->set_sort($name);
		else
			$this->request->set_sort($name,$dir);
	}
1075078
private function addHelper(string $name, string $path): void
    {
        $class = static::class;

        // create store of helpers for this class
        if (!isset(static::$helpers[$class])) {
            static::$helpers[$class] = [];
        }

        $helper = include $path;

        if (\is_callable($helper)) {
            static::$helpers[$class][$name] = $helper;
        } else {
            throw new CommonException("Helper `$name` not found in file `$path`");
        }
    }
1361924
public function createDirectory($name)
    {
        $newPath = $this->path.'/'.$name;
        mkdir($newPath);
        clearstatcache(true, $newPath);
    }
1125693
protected function convertTwigToPhp($path, $name)
    {
        $results = array();

        $dir = dirname($path);

        if (!file_exists($dir)) {
            mkdir($dir, 0755, true);
        }

        $templates = array();
        if ( $name === 'app' ) {
            $templates = $this->findFilesInFolder($dir . '/../../', 'twig');
        } else {
            $templates = $this->findFilesInFolder($dir . '/../views', 'twig');
        }

        $php  = "<?php\n";
        $twig = $this->getContainer()->get('twig');
        $twig->setLoader(new \Twig_Loader_String());
        foreach ($templates as $templateFileName) {
            $stream = $twig->tokenize(file_get_contents($templateFileName));
            $nodes = $twig->parse($stream);
            $template = $twig->compile($nodes);
            // remove first line
            $template = substr($template, strpos($template, "\n")+strlen("\n"));
            $php .= "/*\n * Resource: $name\n * File: $templateFileName\n */\n";
            $php .= $template;
            $results[$templateFileName]='Scanned';
        }

        if (!file_put_contents($path, $php)) {
            throw new \Exception('Cannot write intermediate PHP code for twig templates to twig.cache.php in: '.$path);
        }

        return $results;
    }
1272693
function addNameSpace($name, $path)
    {
        if (!is_dir($path))
        {
            throw new \Exception("$path is not real path.");
        }
        Swoole\Loader::addNameSpace($name, $path);
    }
590718
public function add_path(string $path)
    {
        $path = \trailingslashit($path);
        $this->paths[] = $path;
        $this->parse_files($path);
    }
146197
public function insert($name, array $data=null)
	{
		// Register the template file (to find the custom templates)
		if (!array_key_exists($name, TemplateLoader::getFiles()))
		{
			$objTheme = \LayoutModel::findById(Controller::getLayoutId($this->ptable, $this->pid))->getRelated('pid');
			
			TemplateLoader::addFile($name, $objTheme->templates);
		}
		
		/** @var \Template $tpl */
		if ($this instanceof \Template)
		{
			$tpl = new static($name);
		}
		elseif (TL_MODE == 'BE')
		{
			$tpl = new BackendTemplate($name);
		}
		else
		{
			$tpl = new FrontendTemplate($name);
		}
		if ($data !== null)
		{
			$tpl->setData($data);
		}
		
		echo $tpl->parse();
	}
340612
public function addAttachment($path, $name = null, $mime = true, $encoding = true)
    {
        $cid = static::generateId($this->client());
        $filename = basename($path);
        $this->_attachments[$path] = [
            'filename'    => $name ?: $filename,
            'disposition' => 'attachment',
            'mime'        => $mime,
            'headers'     => ['Content-ID: ' . $cid]
        ];
        return $cid;
    }
1361850
protected function createRoutes(string $name): void
    {
        $apiFile = base_path($this->moduleName().'/'.$name.'/Routes/api.php');
        if (! $this->files->exists($apiFile)) {
            $this->files->put($apiFile, $this->files->get(__DIR__.'/stubs/routes/api.stub'));
        }

        $webFile = base_path($this->moduleName().'/'.$name.'/Routes/web.php');
        if (! $this->files->exists($webFile)) {
            $this->files->put($webFile, $this->files->get(__DIR__.'/stubs/routes/web.stub'));
        }
    }
1045220
public function addTemplate($name, $filename)
    {
        if (!is_string($name) || !is_string($filename) || empty($name) || empty($filename)) {
            throw new \InvalidArgumentException('Template name and filename must be a not empty string');
        }

        $this->templateMap[$name] = $filename;
    }
1023927
public function addScript($name, $path)
    {
        if (isset($this->scripts->$name)) {
            $this->scripts->$name[] = $path;
        } else {
            $this->scripts->$name = [$path];
        }

        return $this;
    }
381105
protected function setServicesFile($path, $template, array $vars) {
    $this->addServicesFile()
      ->path($path)
      ->template($template)
      ->vars($vars);
  }
473086
public function addTemplatePath($namespace, $path)
    {
        if (!is_string($namespace) || !is_string($path) || empty($namespace) || empty($path)) {
            throw new \InvalidArgumentException('Template namespace and path must be a not empty string');
        }

        $this->paths[$namespace] = $this->normalizePath($path);
    }
109300
public function define($name, $path)
    {
        $name = $this->normalizeName($name);

        if (strpos($path, "%$name%") !== false) {
            throw new \InvalidArgumentException('Paths cannot reference themselves.');
        }

        $this->paths[$name] = $path;
    }