pathOriginatesFromVendor() should always be called prior to calling this method.

@param string $path

@return string
500481
private function getPackage($path)
    {
        $path = realpath($path) ?: $path;
        foreach (self::getVendors() as $vendorRoot) {
            if (0 === strpos($path, $vendorRoot)) {
                $relativePath = substr($path, \strlen($vendorRoot) + 1);
                $vendor = strstr($relativePath, \DIRECTORY_SEPARATOR, true);
                if (false === $vendor) {
                    throw new \RuntimeException(sprintf('Could not find directory separator "%s" in path "%s"', \DIRECTORY_SEPARATOR, $relativePath));
                }

                return rtrim($vendor.'/'.strstr(substr(
                    $relativePath,
                    \strlen($vendor) + 1
                ), \DIRECTORY_SEPARATOR, true), '/');
            }
        }

        throw new \RuntimeException(sprintf('No vendors found for path "%s"', $path));
    }
339680
protected function formatPath(string $path): string
    {
        if ('' === $path) {
            $base_path = $this->base_uri->getPath();
            return in_array($base_path, ['', '/'], true) ? $base_path : './';
        }

        if (false === ($colon_pos = strpos($path, ':'))) {
            return $path;
        }

        $slash_pos = strpos($path, '/');
        if (false === $slash_pos || $colon_pos < $slash_pos) {
            return "./$path";
        }

        return $path;
    }
243102
protected function urlFromRoute($path = '')
    {
        $url = $this->baseURL;
        $url[] = $path;
        if (!empty($this->page)) $url[] = '?page=' . $this->page;
        return implode('', $url);
    }
1061021
public function urlFor($path)
    {
        $root = $this->options['api_root'][$this->options['mode']];
        return rtrim($root, '/') . '/' . ltrim($path, '/');
    }
532977
protected function makeAbsolutePath($path)
    {
        $path = $this->serverUrlHelper->__invoke($this->basePathHelper->__invoke($path));
        return $path;
    }
658302
public function applyPathPrefix($path)
    {
        $path = ltrim($path, '/');
        if (strlen($path) === 0) {
            return rtrim($this->getPathPrefix(), '/');
        }

        return $this->getPathPrefix() . $path;
    }
1071699
private function getPath($path)
    {
        return $this->root .
            ltrim(
                preg_replace(
                    sprintf('|%s{2,}|', preg_quote(DIRECTORY_SEPARATOR)),
                    DIRECTORY_SEPARATOR,
                    $path
                ),
                DIRECTORY_SEPARATOR
            );
    }
634971
public function urlGenerator($path)
    {
        if ($this->getCloudFront() === true) {
            $url = $this->cdn_helper->parseUrl($this->getCloudFrontUrl());

            return $url['scheme'].'://'.$url['host'].'/'.$path;
        }

        $url = $this->cdn_helper->parseUrl($this->getUrl());

        $bucket = $this->getBucket();
        $bucket = (!empty($bucket)) ? $bucket.'.' : '';

        return $url['scheme'].'://'.$bucket.$url['host'].'/'.$path;
    }
262295
public function withPath($path)
    {
        if (!is_string($path)) {
            throw new \InvalidArgumentException('Invalid path provided; must be a string');
        }
        $path = $this->filterPath($path);

        $new = clone $this;
        $new->path = $path;

        return $new;
    }
308522
protected function getObject($path)
    {
        $location = $this->applyPathPrefix($path);

        return $this->container->getObject($location);
    }
1018486
public function normalizeDirectoryPath($path)
    {
        $path = $this->normalizePath($path);

        if (is_link($path)) {
            $path = realpath($path);
        }

        return $path;
    }
279738
private function normalizePath($path)
    {
        if (!is_string($path) && !method_exists($path, '__toString')) {
            throw new InvalidArgumentException('Uri path must be a string');
        }

        $path = $this->urlEncode($path);

        if (empty($path)) {
            return '';
        }

        if ($path[0] !== '/') {
            return $path;
        }

        // Ensure only one leading slash
        return '/' . ltrim($path, '/');
    }
1202267
protected function _relpath($path) {
		return $path == $this->root ? '' : substr($path, strlen($this->root)+1);
	}
664554
protected function path($path)
    {
        if (strpos($path, './') === 0) {
            return $this->dir . '/' . substr($path, 2);
        }

        if (strpos($path, '../') === 0) {
            return dirname($this->dir) . '/' . substr($path, 3);
        }

        return $path;
    }
720457
public function getUrl($path)
    {
        $path = $this->getPathFromUrl($path);
        $url = $this->storageUrl . $path;
        
        return $url;
    }
928176
protected function formatPath(string $path): string
    {
        $path = $this->filterPath($path)->withoutDotSegments();
        if ('' !== $this->base_uri->getAuthority() && '' !== $path->__toString()) {
            $path = $path->withLeadingSlash();
        }

        return (string) $path;
    }
859390
public function getAsInstance($path)
    {
        if (empty($path)) {
            return static::create([], $this->separator);
        }
        $value = $this->getAsArray($path);
        if (!is_array($value)) {
            throw new \InvalidArgumentException('You cannot return a Parameter instance on a non-array value.');
        }
        return static::create($this->getAsArray($path), $this->separator);
    }