public function redirectOrRespond()
    {
        if ($this->isRedirect()) {
            $redirectResponse = $this->omnipayResponse->getRedirectResponse();
            if ($redirectResponse instanceof \Symfony\Component\HttpFoundation\RedirectResponse) {
                $this->targetUrl = $redirectResponse->getTargetUrl();

                return Controller::curr()->redirect($this->targetUrl);
            } else {
                return new HTTPResponse((string)$redirectResponse->getContent(), 200);
            }
        }

        if ($this->httpResponse) {
            return $this->httpResponse;
        }

        if ($this->targetUrl) {
            return Controller::curr()->redirect($this->targetUrl);
        }

        // return some default HTTP responses
        return $this->isError()
            ? new HTTPResponse("NOK", 500)
            : new HTTPResponse("OK", 200);
    }
public function redirectOrRespond()
    {
        if ($this->isRedirect()) {
            $redirectResponse = $this->omnipayResponse->getRedirectResponse();
            if ($redirectResponse instanceof \Symfony\Component\HttpFoundation\RedirectResponse) {
                $this->targetUrl = $redirectResponse->getTargetUrl();

                return Controller::curr()->redirect($this->targetUrl);
            } else {
                return new HTTPResponse((string)$redirectResponse->getContent(), 200);
            }
        }

        if ($this->httpResponse) {
            return $this->httpResponse;
        }

        if ($this->targetUrl) {
            return Controller::curr()->redirect($this->targetUrl);
        }

        // return some default HTTP responses
        return $this->isError()
            ? new HTTPResponse("NOK", 500)
            : new HTTPResponse("OK", 200);
    }
public function redirectOrRespond ( ) { if ( $ this -> isRedirect ( ) ) { $ redirectResponse = $ this -> omnipayResponse -> getRedirectResponse ( ) ; if ( $ redirectResponse instanceof \ Symfony \ Component \ HttpFoundation \ RedirectResponse ) { $ this -> targetUrl = $ redirectResponse -> getTargetUrl ( ) ; return Controller :: curr ( ) -> redirect ( $ this -> targetUrl ) ; } else { return new HTTPResponse ( ( string ) $ redirectResponse -> getContent ( ) , 200 ) ; } } if ( $ this -> httpResponse ) { return $ this -> httpResponse ; } if ( $ this -> targetUrl ) { return Controller :: curr ( ) -> redirect ( $ this -> targetUrl ) ; } // return some default HTTP responses return $ this -> isError ( ) ? new HTTPResponse ( "NOK" , 500 ) : new HTTPResponse ( "OK" , 200 ) ; }
Create a redirect or a response.
This should be called when the application is ready to redirect!

If the response is a redirect, the redirect takes precedence.
Next, the HTTP response will be returned (if set) and lastly
a redirect response to the  @see getTargetUrl.

If none of these parameters are given, this method will return null

@return HTTPResponse
Create a redirect or a response . This should be called when the application is ready to redirect!