src/Context/RawTqContext.php
public function locatePath($path = '')
    {
        // Obtain base URL when path is empty, or not starts from "//" or "http".
        if (empty($path) || strpos($path, '//') !== 0 && strpos($path, 'http') !== 0) {
            $path = rtrim($this->getMinkParameter('base_url'), '/') . '/' . ltrim($path, '/');
        }

        $url = parse_url($path);

        if (!isset($url['host'])) {
            throw new \InvalidArgumentException(sprintf('Incorrect URL: %s', func_get_arg(0)));
        }

        // When URL starts from "//" the "scheme" key will not exists.
        if (isset($url['scheme'])) {
            // Check scheme.
            if (!in_array($url['scheme'], ['http', 'https'])) {
                throw new \InvalidArgumentException(sprintf('%s is not valid scheme.', $url['scheme']));
            }

            $path = $url['scheme'] . ':';
        } else {
            // Process "//" at the start.
            $path = '';
        }

        $path .= '//';

        if (isset($url['user'], $url['pass'])) {
            // Encode special characters in username and password. Useful
            // when some item contain something like "@" symbol.
            foreach (['user' => ':', 'pass' => '@'] as $part => $suffix) {
                $path .= rawurlencode($url[$part]) . $suffix;
            }
        }

        $path .= $url['host'];

        // Append additional URL components.
        foreach (['port' => ':', 'path' => '', 'query' => '?', 'fragment' => '#'] as $part => $prefix) {
            if (isset($url[$part])) {
                $path .= $prefix . $url[$part];
            }
        }

        return $path;
    }
public function locatePath($path = '')
    {
        // Obtain base URL when path is empty, or not starts from "//" or "http".
        if (empty($path) || strpos($path, '//') !== 0 && strpos($path, 'http') !== 0) {
            $path = rtrim($this->getMinkParameter('base_url'), '/') . '/' . ltrim($path, '/');
        }

        $url = parse_url($path);

        if (!isset($url['host'])) {
            throw new \InvalidArgumentException(sprintf('Incorrect URL: %s', func_get_arg(0)));
        }

        // When URL starts from "//" the "scheme" key will not exists.
        if (isset($url['scheme'])) {
            // Check scheme.
            if (!in_array($url['scheme'], ['http', 'https'])) {
                throw new \InvalidArgumentException(sprintf('%s is not valid scheme.', $url['scheme']));
            }

            $path = $url['scheme'] . ':';
        } else {
            // Process "//" at the start.
            $path = '';
        }

        $path .= '//';

        if (isset($url['user'], $url['pass'])) {
            // Encode special characters in username and password. Useful
            // when some item contain something like "@" symbol.
            foreach (['user' => ':', 'pass' => '@'] as $part => $suffix) {
                $path .= rawurlencode($url[$part]) . $suffix;
            }
        }

        $path .= $url['host'];

        // Append additional URL components.
        foreach (['port' => ':', 'path' => '', 'query' => '?', 'fragment' => '#'] as $part => $prefix) {
            if (isset($url[$part])) {
                $path .= $prefix . $url[$part];
            }
        }

        return $path;
    }
{@inheritdoc}