Response::getOrderNumber()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Omnipay\Moneris\Message;
4
5
use Omnipay\Common\Message\AbstractResponse;
6
7
class Response extends AbstractResponse
8
{
9 51
    public function isSuccessful()
10
    {
11
        if ((
0 ignored issues
show
introduced by
Consider adding parentheses for clarity. Current Interpretation: (IssetNode && (bool)$thi...ipt->ResponseCode <= 49, Probably Intended Meaning: IssetNode && (bool)$this...pt->ResponseCode <= 49)
Loading history...
12 51
                (isset($this->data->receipt->Complete) && (bool) $this->data->receipt->Complete === true) ||
13 51
                (isset($this->data->receipt->ResSuccess) && (bool) $this->data->receipt->ResSuccess === true)
14
            ) &&
15
            (
16 45
                isset($this->data->receipt->ResponseCode) && $this->data->receipt->ResponseCode != 'null' &&
17 51
                (int) $this->data->receipt->ResponseCode >= 0 && (int) $this->data->receipt->ResponseCode <= 49
18
            )
19
        ) {
20 24
            return true;
21
        }
22
23 27
        return false;
24
    }
25
26 3
    public function getCardReference()
27
    {
28 3
        return isset($this->data->receipt->DataKey) ? (string) $this->data->receipt->DataKey : null;
29
    }
30
31 6
    public function getCode()
32
    {
33 6
        return isset($this->data->receipt->ResponseCode) ? (string) $this->data->receipt->ResponseCode : null;
34
    }
35
36 3
    public function getAuthCode()
37
    {
38 3
        return isset($this->data->receipt->AuthCode) ? (string) $this->data->receipt->AuthCode : null;
39
    }
40
41 3
    public function getTransactionId()
42
    {
43 3
        return isset($this->data->receipt->TransID) ? (string) $this->data->receipt->TransID : null;
44
    }
45
46 6
    public function getTransactionReference()
47
    {
48 6
        return isset($this->data->receipt->ReferenceNum) ? (string) $this->data->receipt->ReferenceNum : null;
49
    }
50
51 6
    public function getMessage()
52
    {
53 6
        return isset($this->data->receipt->Message) ? (string) $this->data->receipt->Message : null;
54
    }
55
56 3
    public function getOrderNumber()
57
    {
58 3
        return isset($this->data->receipt->ReceiptId) ? (string) $this->data->receipt->ReceiptId : null;
59
    }
60
61 3
    public function getData()
62
    {
63 3
        $response = null;
0 ignored issues
show
Unused Code introduced by
The assignment to $response is dead and can be removed.
Loading history...
64
65
        try {
66 3
            $response = preg_replace('/\n/', '', ($this->data)->asXML());
67 3
        } catch (\Error $e) {
68 3
            $response = $this->data;
69
        }
70
71 3
        return $response;
72
    }
73
}
74