SiteURI example

$query = $fragment = '';
        if (isset($parts['query'])) {
            $query = '?' . $parts['query'];
        }
        if (isset($parts['fragment'])) {
            $fragment = '#' . $parts['fragment'];
        }

        $relativePath = ($parts['path'] ?? '') . $query . $fragment;
        $host         = $this->getValidHost($parts['host']);

        return new SiteURI($this->appConfig, $relativePath$host$parts['scheme']);
    }

    /** * Detects the current URI path relative to baseURL based on the URIProtocol * Config setting. * * @param string $protocol URIProtocol * * @return string The route path * * @internal Used for testing purposes only. * @testTag */


    /** * Setup a Request object to use so that CodeIgniter * won't try to auto-populate some of the items. * * @param string $method HTTP verb */
    protected function setupRequest(string $method, ?string $path = null): IncomingRequest
    {
        $config = config(App::class);
        $uri    = new SiteURI($config);

        // $path may have a query in it         $path  = URI::removeDotSegments($path);
        $parts = explode('?', $path);
        $path  = $parts[0];
        $query = $parts[1] ?? '';

        $superglobals = Services::superglobals();
        $superglobals->setServer('QUERY_STRING', $query);

        $uri->setPath($path);
        
Home | Imprint | This part of the site doesn't use cookies.