RedirectFlowResponse::getRedirectUrl()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Omnipay\GoCardless\Message;
4
5
use Omnipay\Common\Message\AbstractResponse;
6
use Omnipay\Common\Message\RedirectResponseInterface;
7
8
/**
9
 * GoCardless Redirect Flow Response
10
 */
11
class RedirectFlowResponse extends AbstractResponse implements RedirectResponseInterface
12
{
13
    public function isSuccessful()
14
    {
15
        return false;
16
    }
17
18
    public function isRedirect()
19
    {
20
        return !isset($this->data['error']) && isset($this->data['redirect_flows']);
21
    }
22
23
    public function getTransactionReference()
24
    {
25
        if ($this->isRedirect()) {
26
            return $this->data['redirect_flows']['id'];
27
        }
28
    }
29
30
    public function getMessage()
31
    {
32
        if (!$this->isRedirect()) {
33
            return $this->data['error']['message'];
34
        }
35
    }
36
37
    public function getRedirectUrl()
38
    {
39
        if ($this->isRedirect()) {
40
            return $this->data['redirect_flows']['redirect_url'];
41
        }
42
    }
43
44
    public function getRedirectMethod()
45
    {
46
        return 'GET';
47
    }
48
49
    public function getRedirectData()
50
    {
51
        return null;
52
    }
53
}
54