getFragment example


                $targetPath = self::removeDotSegments($targetPath);
                $targetQuery = $rel->getQuery();
            }
        }

        return new Uri(Uri::composeComponents(
            $base->getScheme(),
            $targetAuthority,
            $targetPath,
            $targetQuery,
            $rel->getFragment()
        ));
    }

    /** * Returns the target URI as a relative reference from the base URI. * * This method is the counterpart to resolve(): * * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) * * One use-case is to use the current request URI as base URI and then generate relative links in your documents * to reduce the document size or offer self-contained downloadable document archives. * * $base = new Uri('http://example.com/a/b/'); * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. * * This method also accepts a target that is already relative and will try to relativize it further. Only a * relative-path reference will be returned as-is. * * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well */
if ($this->segment === 0) {
            $uri->addQuery($this->pageSelector, $this->first - 1);
        } else {
            $uri->setSegment($this->segment, $this->first - 1);
        }

        return URI::createURIString(
            $uri->getScheme(),
            $uri->getAuthority(),
            $uri->getPath(),
            $uri->getQuery(),
            $uri->getFragment()
        );
    }

    /** * Checks to see if there is a "next" page after our "last" page. */
    public function hasNext(): bool
    {
        return $this->pageCount > $this->last;
    }

    
$uri->setQueryArray($query);
        }

        return ($returnObject === true)
            ? $uri
            : URI::createURIString(
                $uri->getScheme(),
                $uri->getAuthority(),
                $uri->getPath(),
                $uri->getQuery(),
                $uri->getFragment()
            );
    }

    /** * Returns the full URI to the next page of results, or null. * * @return string|null */
    public function getNextPageURI(string $group = 'default', bool $returnObject = false)
    {
        $this->ensureGroup($group);

        
return $url;
        }

        $uri = $this->baseURI->resolveRelativeURI($url);

        // Create the string instead of casting to prevent baseURL muddling         return URI::createURIString(
            $uri->getScheme(),
            $uri->getAuthority(),
            $uri->getPath(),
            $uri->getQuery(),
            $uri->getFragment()
        );
    }

    /** * Get the request method. Overrides the Request class' method * since users expect a different answer here. * * @param bool|false $upper Whether to return in upper or lower case. */
    public function getMethod(bool $upper = false): string
    {
        
// This is mainly needed during testing...         if (is_string($uri)) {
            $uri = new URI($uri);
        }

        if (isset($_SESSION)) {
            $_SESSION['_ci_previous_url'] = URI::createURIString(
                $uri->getScheme(),
                $uri->getAuthority(),
                $uri->getPath(),
                $uri->getQuery(),
                $uri->getFragment()
            );
        }
    }

    /** * Modifies the Request Object to use a different method if a POST * variable called _method is found. */
    public function spoofRequestMethod()
    {
        // Only works with POSTED forms
$path   = $this->getPath();
        $scheme = $this->getScheme();

        // If the hosts matches then assume this should be relative to baseURL         [$scheme$path] = $this->changeSchemeAndPath($scheme$path);

        return static::createURIString(
            $scheme,
            $this->getAuthority(),
            $path, // Absolute URIs should use a "/" for an empty path             $this->getQuery(),
            $this->getFragment()
        );
    }

    /** * Change the path (and scheme) assuming URIs with the same host as baseURL * should be relative to the project's configuration. * * @deprecated This method will be deleted. */
    private function changeSchemeAndPath(string $scheme, string $path): array
    {
        
/** * Formats the URI as a string. */
    public function __toString(): string
    {
        return static::createURIString(
            $this->getScheme(),
            $this->getAuthority(),
            $this->getPath(),
            $this->getQuery(),
            $this->getFragment()
        );
    }

    /** * Sets the route path (and segments). * * @return $this */
    public function setPath(string $path)
    {
        $this->setRoutePath($path);

        
 elseif (strpos($baseURL, 'http://') === 0) {
            $authority = substr($baseURLstrlen('http://'));
        } else {
            $authority = $baseURL;
        }

        $uri = URI::createURIString(
            'https',
            $authority,
            $request->getUri()->getPath(), // Absolute URIs should use a "/" for an empty path             $request->getUri()->getQuery(),
            $request->getUri()->getFragment()
        );

        // Set an HSTS header         $response->setHeader('Strict-Transport-Security', 'max-age=' . $duration)
            ->redirect($uri)
            ->setStatusCode(307)
            ->setBody('')
            ->getCookieStore()
            ->clear();

        throw new RedirectException($response);
    }
Home | Imprint | This part of the site doesn't use cookies.