Passed
Push — master ( 13f7a8...03c847 )
by
unknown
03:03
created

PurchaseResponse   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 27
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isRedirect() 0 3 1
A isSuccessful() 0 3 1
A getRedirectData() 0 5 1
A getRedirectMethod() 0 3 1
A getRedirectUrl() 0 3 2
1
<?php
2
3
namespace Omnipay\SmartPay\Message;
4
5
use Omnipay\Common\Message\AbstractResponse;
6
use Omnipay\Common\Message\RedirectResponseInterface;
7
8
/**
9
 * Bank Muscat Redirect Response
10
 */
11
class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface {
12
    public function isSuccessful()
13
    {
14
        return false;
15
    }
16
17
    public function isRedirect()
18
    {
19
        return true;
20
    }
21
22
    public function getRedirectUrl()
23
    {
24
        return $this->getRedirectMethod() === 'POST' ? $this->data['endpoint'] : $this->data['url'];
25
    }
26
27
    public function getRedirectData()
28
    {
29
        return [
30
            'encRequest' => $this->data['enc_request'],
31
            'access_code' => $this->data['access_code']
32
        ];
33
    }
34
35
    public function getRedirectMethod()
36
    {
37
        return 'POST';
38
    }
39
}