src/Middleware/AuthenticationMiddleware.php
protected function getRedirectUrl($target, ServerRequestInterface $request)
    {
        $param = $this->getConfig('queryParam');
        if ($param === null) {
            return $target;
        }

        $uri = $request->getUri();
        if (property_exists($uri, 'base')) {
            $uri = $uri->withPath($uri->base . $uri->getPath());
        }
        $query = urlencode($param) . '=' . urlencode($uri);

        $url = parse_url($target);
        if (isset($url['query']) && strlen($url['query'])) {
            $url['query'] .= '&' . $query;
        } else {
            $url['query'] = $query;
        }
        $fragment = isset($url['fragment']) ? '#' . $url['fragment'] : '';

        return $url['path'] . '?' . $url['query'] . $fragment;
    }
protected function getRedirectUrl($target, ServerRequestInterface $request)
    {
        $param = $this->getConfig('queryParam');
        if ($param === null) {
            return $target;
        }

        $uri = $request->getUri();
        if (property_exists($uri, 'base')) {
            $uri = $uri->withPath($uri->base . $uri->getPath());
        }
        $query = urlencode($param) . '=' . urlencode($uri);

        $url = parse_url($target);
        if (isset($url['query']) && strlen($url['query'])) {
            $url['query'] .= '&' . $query;
        } else {
            $url['query'] = $query;
        }
        $fragment = isset($url['fragment']) ? '#' . $url['fragment'] : '';

        return $url['path'] . '?' . $url['query'] . $fragment;
    }
protected function getRedirectUrl ( $ target , ServerRequestInterface $ request ) { $ param = $ this -> getConfig ( 'queryParam' ) ; if ( $ param === null ) { return $ target ; } $ uri = $ request -> getUri ( ) ; if ( property_exists ( $ uri , 'base' ) ) { $ uri = $ uri -> withPath ( $ uri -> base . $ uri -> getPath ( ) ) ; } $ query = urlencode ( $ param ) . '=' . urlencode ( $ uri ) ; $ url = parse_url ( $ target ) ; if ( isset ( $ url [ 'query' ] ) && strlen ( $ url [ 'query' ] ) ) { $ url [ 'query' ] .= '&' . $ query ; } else { $ url [ 'query' ] = $ query ; } $ fragment = isset ( $ url [ 'fragment' ] ) ? '#' . $ url [ 'fragment' ] : '' ; return $ url [ 'path' ] . '?' . $ url [ 'query' ] . $ fragment ; }
Returns redirect URL.

@param string $target Redirect target.
@param \Psr\Http\Message\ServerRequestInterface $request Request instance.
@return string
Returns redirect URL .