@param string $path

@return Slice|mixed
@throws Exceptions\PermissionDenied
@throws \Deimos\Helper\Exceptions\ExceptionEmpty
556796
public function get($path)
    {
        $data = explode(':', $path, 2);
        $file = $this->filePath($data[0]);

        if (!$file)
        {
            throw new Exceptions\PermissionDenied($data[0]);
        }

        $slice = $this->slice($file);

        if (!empty($data[1]))
        {
            return $slice->getData($data[1]);
        }

        return $slice;
    }
1275111
public static function removeDotSegments($path)
    {
        static $noopPaths = ['' => true, '/' => true, '*' => true];
        static $ignoreSegments = ['.' => true, '..' => true];

        if (array_key_exists($path, $noopPaths)) {
            return $path;
        }

        $results = [];
        $segments = explode('/', $path);
        foreach ($segments as $segment) {
            if ($segment === '..') {
                array_pop($results);
            } elseif (!array_key_exists($segment, $ignoreSegments)) {
                $results[] = $segment;
            }
        }

        $newPath = implode('/', $results);
        // add the leading slash if necessary
        if (strpos($path, '/') === 0 && strpos($newPath, '/') !== 0) {
            $newPath = '/' . $newPath;
        }

        // add the trailing slash if necessary
        if ($newPath !== '/' && array_key_exists(end($segments), $ignoreSegments)) {
            $newPath .= '/';
        }

        return $newPath;
    }
734375
public function getVisibility(string $path): string
    {
        $location = $this->applyBasePath($path);
        clearstatcache(false, $location);
        $permission = octdec(substr(sprintf('%o', fileperms($location)), -4));

        return $permission & 0044 ? self::VIS_PUB : self::VIS_PRI;
    }
227018
public function read( $path )
	{
		try {
			return $this->fs->get( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
1044418
public function route($path)
    {
        $route = $this->configureSlice()->atData($path);

        if (empty($route))
        {
            throw new Exceptions\NotFound('Route `' . $path . '` not found');
        }

        return $route;
    }
534181
public static function decodeFromFile($path)
    {
        if (!is_file($path)) {
            throw new \Exception("File does not exist: {$path}");
        }

        $string = file_get_contents($path);

        if ($string === false) {
            throw new \Exception("Failed to read the file: {$path}");
        }

        if (!$string) {
            return [];
        }

        $array = json_decode($string, true);

        static::checkLastError();

        return $array;
    }
736624
private function loadFile(string $path)
    {
        if (!file_exists($path)) {
            throw new Exception('Configuration file "' . $path . '" is not found');
        }

        if (!is_readable($path)) {
            throw new Exception('Configuration file "' . $path . '" is not readable');
        }

        // Include file
        $content = include $path;

        if (!\is_array($content)) {
            throw new Exception("Passed file \"$path\" is not array");
        }

        return $content;
    }
1255827
public static function check($path)
	{
		if (strpos($path, '..') !== false)
		{
			throw new FilesystemException(
				sprintf(
					'%s() - Use of relative paths not permitted',
					__METHOD__
				),
				20
			);
		}

		$path = static::clean($path);

		if ((JPATH_ROOT != '') && strpos($path, static::clean(JPATH_ROOT)) !== 0)
		{
			throw new FilesystemException(
				sprintf(
					'%1$s() - Snooping out of bounds @ %2$s',
					__METHOD__,
					$path
				),
				20
			);
		}

		return $path;
	}
636541
public function fromPath($path)
    {
        $schemeClass = $this->schemeClass('file');
        if ($this->isolator->defined('PHP_WINDOWS_VERSION_BUILD')) {
            $uri = $schemeClass::fromWindowsPath($path);
        } else {
            $uri = $schemeClass::fromUnixPath($path);
        }

        return $uri;
    }
1176848
protected function normalizePath($path) {
		$path = realpath(rtrim($path, DIRECTORY_SEPARATOR));
		
		if ($path === false || ! is_readable($path)) {
			require_once __DIR__ . '/Exceptions/InvalidPath.php';
			throw new InvalidPath('Directory "' . $path . '" does not exists or is unreadable');
		}
		
		return $path;
	}
1276391
public function remove($path)
    {
        $keys       = $this->explode($path);
        $parameters = &$this->parameters;

        while (count($keys) > 0) {
            if (count($keys) === 1) {
                if (is_array($parameters)) {
                    unset($parameters[array_shift($keys)]);
                } else {
                    return $this;
                }
            } else {
                $key = array_shift($keys);

                if (!isset($parameters[$key])) {
                    return $this;
                }
                $parameters = &$parameters[$key];
            }
        }
        return $this;
    }
1184481
public function path($path)
    {
        if ($path !== '/' . trim($path, '/') . '/') {
            throw new Exception('Invalid path "' . $path . '", use like this /foo/', 2);
        }

        $this->path = $path;

        return $this;
    }
1201498
protected function rights( $path )
    {
        if ( isset( $this->rightsCache[$path] ) )
        {
            return $this->rightsCache[$path];
        }

        $name = basename( $path );

        if ( isset( $name[0] ) && $name[0] == '.' )
        {
            return $this->rightsCache[$path] = (object) array(
                'read'   => false,
                'write'  => false,
                'delete' => false,
            );
        }

        if ( $this->permissions->isAllowed( 'uploads', 'manage' ) )
        {
            return $this->rightsCache[$path] = (object) array(
                'read'   => true,
                'write'  => true,
                'delete' => true,
            );
        }

        if ( empty( $path ) )
        {
            $res = 'uploads.*';
        }
        else
        {
            $res = 'uploads.' . trim( strtr( $path, array(
                '.' => '*',
                '/' => '.',
            ) ), '.' );
        }

        return $this->rightsCache[$path] = (object) array(
            'read'   => $this->permissions->isAllowed( $res, 'read' ),
            'write'  => $this->permissions->isAllowed( $res, 'write' ),
            'delete' => $this->permissions->isAllowed( $res, 'delete' ),
        );
    }
5297
private function parsePath($path)
    {
        $parts = array(
            'template' => null,
            'path' => null,
        );

        // strip out any query params
        if (preg_match('/^\/?(.*?)\/(.*)/', $path, $matches)) {
            $parts['template'] = $matches[1];
            $parts['path'] = $matches[2];
        }

        return $parts;
    }
658127
public function fromPath($path)
    {
        $mimetype = null;

        if (static::isSupported())
        {
            if (!is_file($path)) {
                throw new \RuntimeException('File not found at '.$path);
            }

            if (!is_readable($path)) {
                throw new \RuntimeException('File not readable at '.$path);
            }

            $mimetype = $this->_getMimetype(strtolower(pathinfo($path, PATHINFO_EXTENSION)));
        }

        return $mimetype;
    }
822107
public function parse($path)
    {
        $data = @parse_ini_file($path, true);

        if (!$data) {
            $error = error_get_last();

            // parse_ini_file() may return NULL but set no error if the file contains no parsable data
            if (!is_array($error)) {
                $error["message"] = "No parsable content in file.";
            }

            // if file contains no parsable data, no error is set, resulting in any previous error
            // persisting in error_get_last(). in php 7 this can be addressed with error_clear_last()
            if (function_exists("error_clear_last")) {
                error_clear_last();
            }

            throw new ParseException($error);
        }

        return $this->expandDottedKey($data);
    }
1020187
public function delete($path)
    {
        $result = @ftp_delete($this->connection, $path);
        
        if ($result === false) {
            throw new Exception('Unable to get parent folder');
        }

        return $this;
    }