public function getUrl()
    {
        // Ensure in request cycle (even for override).
        if ($this->request === null) {
            return null;
        }

        // Ensure request has been matched
        if (!$this->request->attributes->get('_route')) {
            return null;
        }

        if ($this->override) {
            $this->resolveCurrentOverride();

            return (string) $this->override;
        }

        return $this->urlGenerator->generate(
            $this->request->attributes->get('_route'),
            $this->request->attributes->get('_route_params'),
            UrlGeneratorInterface::ABSOLUTE_URL
        );
    }
public function getUrl()
    {
        // Ensure in request cycle (even for override).
        if ($this->request === null) {
            return null;
        }

        // Ensure request has been matched
        if (!$this->request->attributes->get('_route')) {
            return null;
        }

        if ($this->override) {
            $this->resolveCurrentOverride();

            return (string) $this->override;
        }

        return $this->urlGenerator->generate(
            $this->request->attributes->get('_route'),
            $this->request->attributes->get('_route_params'),
            UrlGeneratorInterface::ABSOLUTE_URL
        );
    }
public function getUrl ( ) { // Ensure in request cycle (even for override). if ( $ this -> request === null ) { return null ; } // Ensure request has been matched if ( ! $ this -> request -> attributes -> get ( '_route' ) ) { return null ; } if ( $ this -> override ) { $ this -> resolveCurrentOverride ( ) ; return ( string ) $ this -> override ; } return $ this -> urlGenerator -> generate ( $ this -> request -> attributes -> get ( '_route' ) , $ this -> request -> attributes -> get ( '_route_params' ) , UrlGeneratorInterface :: ABSOLUTE_URL ) ; }
Returns the canonical url for the current request,
or null if called outside of the request cycle.

@return string|null
Returns the canonical url for the current request or null if called outside of the request cycle .