Resolves a template name to a file in $templateDirs

@param $template
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];
    }
205077
function resolveTemplateFiles(name) {
    // Create paths for resolving
    var customFile = customDir + '/' + name + '.js',
        customTemplateDir = customDir + '/' + name + '/**/*',
        stdFile = stdDir + '/' + name + '.js',
        stdTemplateDir = stdDir + '/' + name + '/**/*';

    // Grab any and all files
    var customFiles = expandFiles(customFile).concat(expandFiles(customTemplateDir)),
        stdFiles = expandFiles(stdFile).concat(expandFiles(stdTemplateDir));

    // Generate a hash of files
    var fileMap = {};

    // Iterate over the customFiles
    customFiles.forEach(function (file) {
      // Extract the relative path of the file
      var relPath = path.relative(customDir, file);

      // Save the relative path
      fileMap[relPath] = file;
    });

    // Iterate over the stdFiles
    stdFiles.forEach(function (file) {
      // Extract the relative path of the file
      var relPath = path.relative(stdDir, file),
          overrideExists = fileMap[relPath];

      // If it does not exist, save it
      if (!overrideExists) {
        fileMap[relPath] = file;
      }
    });

    // Return the fileMap
    return fileMap;
  }
710083
protected function resolve()
	{
		$key = $this->templatesFile . '.' . $this->source;

		if (Lang::has($key)) {
			return Lang::get($key);
		}

		return $this->default();
	}
93055
public function setTemplateDir($templatesDirectory)
    {
        if ($templatesDirectory && !in_array($templatesDirectory, $this->_aTemplateDir)) {
            $this->_aTemplateDir[] = $templatesDirectory;
        }
    }
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;
    }
246997
public function registerTemplate($template)
    {
        $template = $this->normalizeTemplateDuringRegistration($template);

        $this->templates[$template['name']] = $template;

        $this->registerTemplateAliases($template, $template['aliases']);
    }
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");
    }
945157
private static function get_template_path( $template ) {
		$command_root  = Utils\phar_safe_path( dirname( __DIR__ ) );
		$template_path = "{$command_root}/templates/{$template}";

		if ( ! file_exists( $template_path ) ) {
			WP_CLI::error( "Couldn't find {$template}" );
		}

		return $template_path;
	}
970754
public function compile(Template $template)
    {
        // Otherwise, we look for a compile method
        $method = 'compile'.ucfirst($template->getName());
        if (!method_exists($this, $method)) {
            return null;
        }

        return $this->$method($template);
    }
1087824
public static function injectFile(TemplateInterface $template, TemplateTranslationInterface $translation): void
    {
        if ($template instanceof TemplateFileInterface && $translation instanceof TemplateFileInterface) {
            /** @var TemplateInterface $template */
            /** @var TemplateTranslationInterface $translation */
            static::injectValue($template, $translation, 'file');
        }
    }
1340896
protected function locateTemplate(FileLocatorInterface $locator, TemplateReference $template, array &$templates)
    {
        $templates[$template->getLogicalName()] = $locator->locate($template->getPath());
    }
137925
protected function solveTemplatePath($template) {
		foreach(array_reverse($this->templatePathSolvers) as $s) {
			if(($r = $s($this, $template)) && file_exists($r))
				return $r;
		}
	}
678833
private function scanFor($template)
    {
        $in = $this->dirs;
        $found = false;
        while (! $found && ! empty($in)) {
            $dir = array_shift($in);
            $found = $this->exists($dir, $template);
        }

        return $found;
    }
950820
public function resolve(string $template, array $variables = null) 
    {
        return [
            $this->resolvePath($template), 
            $this->resolveEnv($template, $variables)
        ];
    }
738706
public function resolve($template)
    {
        foreach ($this as $resolver) {
            $resource = $resolver->resolve($template);
            if (! is_null($resource)) {
                return $resource;
            }
        }
        return null;
    }
885826
public function getPossibleViewFilesFromTemplates($templates)
    {
        return call_user_func_array('array_merge', array_map(function ($template) {
            return array_map(function ($extension) use ($template) {
                return str_replace('.', '/', $template).'.'.$extension;
            }, $this->extensions);
        }, $templates));
    }
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];
    }