RefundResponse   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 35
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A isSuccessful() 0 4 1
A getMessage() 0 4 1
A parseResponse() 0 10 2
1
<?php
2
/**
3
 * OKPAY driver for Omnipay PHP payment library.
4
 *
5
 * @link      https://github.com/hiqdev/omnipay-okpay
6
 * @package   omnipay-okpay
7
 * @license   MIT
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace Omnipay\OKPAY\Message;
12
13
use Omnipay\Common\Message\AbstractResponse;
14
use Omnipay\Common\Message\RequestInterface;
15
16
class RefundResponse extends AbstractResponse
17
{
18
    protected $redirectUrl;
19
    protected $message;
20
    protected $success;
21
22
    public function __construct(RequestInterface $request, $data)
23
    {
24
        $this->request = $request;
25
        $this->data = $data;
26
        $this->success = false;
27
        $this->parseResponse($data);
28
    }
29
30
    public function isSuccessful()
31
    {
32
        return $this->success;
33
    }
34
35
    public function getMessage()
36
    {
37
        return $this->message;
38
    }
39
40
    private function parseResponse($data)
41
    {
42
        if ($data->Status !== 'Completed') {
43
            $this->message = $data->Status;
44
            $this->success = false;
45
46
            return false;
47
        }
48
        $this->success = true;
49
    }
50
}
51