Completed
Push — master ( 69d984...0eb511 )
by Claude
03:26
created

AbstractResponse::getCode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 4
cp 0.75
rs 9.4285
nc 2
cc 2
eloc 3
nop 0
crap 2.0625
1
<?php
2
3
namespace Omnipay\Payline\Message;
4
5
/**
6
 * AbstractResponse
7
 */
8
abstract class AbstractResponse extends \Omnipay\Common\Message\AbstractResponse
9
{
10 6
    public function isSuccessful()
11
    {
12 6
        return $this->getCode() === '00000';
13
    }
14
15 6
    public function getCode()
16
    {
17 6
        if (isset($this->data->result->code)) {
18 6
            return $this->data->result->code;
19
        }
20
    }
21
22 6
    public function getMessage()
23
    {
24 6
        if (isset($this->data->result->shortMessage)) {
25 6
            return $this->data->result->shortMessage;
26
        }
27
    }
28
29 6
    public function getLongMessage()
30
    {
31 6
        if (isset($this->data->result->longMessage)) {
32 6
            return $this->data->result->longMessage;
33
        }
34
    }
35
36 6
    public function getToken()
37
    {
38 6
        if (isset($this->data->token)) {
39 6
            return $this->data->token;
40
        }
41
    }
42
}
43