Search a view file in the current file system

@parame  string $path The file path to search
@return  string The path of the file found
189606
public function getTemplate($path)
    {
        if (file_exists($path)) {
            return $path;
        } elseif (false!==$path_rp = realpath($path)) {
            return $path_rp;
        } else {
            foreach ($this->getIncludePath() as $_path) {
                $_f = DirectoryHelper::slashDirname($_path).$path;
                if (file_exists($_f)) {
                    return $_f;
                }
            }
        }
        return null;
    }
491720
protected function findFileAt($path)
    {
        try {
            $files = $this->fromDirectory('')
                ->withPrefix($path)
                ->withDelimiter('')
                ->limit(1)
                ->get();
        } catch (ApiRequestFailedException $e) {
            return;
        }

        return $files->get(0);
    }
1039945
public function file($path)
    {
        return $this->files(dirname($path))->first(function ($file) use ($path) {
            return $file['path'] === $path;
        }, function () use ($path) {
            throw new FileNotFoundException("File [$path] not found!");
        });
    }
56536
protected function parseFile($path)
    {
        $content = $this->filesystem->readFile($path);

        return $this->parseContent($content, $path);
    }
632028
private function findFile($file) {
        $filePath = MODULES_DIR . DS . self::$currentRoute['module'] . DS . 'Views' . DS . $file . '.php';
        if (!file_exists($filePath)) {
            $filePath = BASE_DIR . DS . 'base' . DS . 'views' . DS . $file . '.php';
            if (!file_exists($filePath)) {
                throw new \Exception(_message(ExceptionMessages::VIEW_FILE_NOT_FOUND, $file));
            }
        }

        return $filePath;
    }
264905
public function read(string $path): string
    {
        $path = $this->normalizePath($path);
        $this->assertPresent($path);

        return $this->getAdapter()->read($path);
    }
47703
public static function detectByFilePath(string $path): string
    {
        $extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));

        return empty($extension) ? 'text/plain' : static::detectByFileExtension($extension);
    }
560456
protected function getLocalFilesystemPath($path)
	{
		if(!isset(static::$pointer_tree[$path]))
			static::$pointer_tree[$path] = tmpfile();
		
		if($metadata = stream_get_meta_data(static::$pointer_tree[$path]))
			return $metadata["uri"];
		
		return null;
	}
554953
protected function _findPath($path)
    {
        $path = $this->_unifyPath($path);
        $dirs = $this->_dirs;

        $file = null;

        foreach ($dirs as $dir) {
            if (is_readable(realpath($dir.DS.$path))) {
                $file = $dir.DS.$path;
                break;
            }
        }

        return $file;
    }
507601
public static function getFolder($path)
    {
        if (!is_dir($path)) return null;

        $path = rtrim($path, '/') . '/';

        $array = array('file' => array(), 'folder' => array());
        $dir_obj = opendir($path);

        while ($dir = readdir($dir_obj)) {
            if ($dir != '.' && $dir != '..') {
                $file = $path . $dir;
                if (is_dir($file)) {
                    $array['folder'][] = $dir;
                } elseif (is_file($file)) {
                    $array['file'][] = $dir;
                }

            }
        }
        closedir($dir_obj);
        return $array;

    }
206615
public static function get($path)
    {
        $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
        if (!isset(self::$fileTypes[$ext])) {
            return false;
        }
        return self::$fileTypes[$ext];
    }
145826
private function detectFromPath(string $path)
    {
        if (!$this->usePath) {
            return null;
        }

        $dirs = explode('/', ltrim($path, '/'), 2);
        $first = strtolower((string) array_shift($dirs));

        if (!empty($first) && in_array($first, $this->languages, true)) {
            return $first;
        }
    }
803270
protected function getExistsPath($path)
    {
        $fullPath = $this->concatPaths($path);

        if (!file_exists($fullPath)) {
            $fullPath = $this->getExistsPath(pathinfo($fullPath, PATHINFO_DIRNAME));
        }

        return $fullPath;
    }
907515
public static function getViewContent($path) {
        if ($path === false) {
            throw new \Exception('The view file is not specified. Probably the correct path to the file was not found. Make sure that all paths are specified correctly, the files exists and is available.');
        }

        ob_start();

        require($path);

        $result = ob_get_contents();

        ob_end_clean();

        return $result;
    }
205593
private function searchExtensions($path)
    {
        foreach ($this->fileExtensions as $ext) {
            if (file_exists($path . $ext)) {
                return $path . $ext;
            }
        }

        return false;
    }
617717
public function getFinder($path = '')
    {
        $finder = new Finder();
        $finder->in($this->applyPathPrefix($path));
        
        return $finder;
    }
402932
public static function get($path)
    {
        if (is_dir($path)) {
            return new filesystem\Directory($path);
        }
        return new filesystem\File($path);
    }