WSAuthorizeResponse::getValidUntil()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Omnipay\Komerci\Message;
4
5
use Omnipay\Common\Message\AbstractResponse;
6
use Omnipay\Common\Message\RequestInterface;
7
8
/**
9
 * Komerci Authorize Response
10
 */
11
class WSAuthorizeResponse extends AbstractResponse
12
{
13
14 5 View Code Duplication
    public function __construct(RequestInterface $request, $data)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
    {
16 5
        $this->request = $request;
17
18 5
        foreach ($data->children() as $childName => $childValue) {
19 5
            $this->data[strtoupper($childName)] = (string) $childValue;
20 5
        }
21 5
    }
22
23 5
    public function isSuccessful()
24
    {
25 5
        return ($this->getCode() == '0') && ($this->getTransactionReference() != '') && ($this->getConfCodRet() == '0');
26
    }
27
28 5
    public function getCode()
29
    {
30 5
        $code = isset($this->data['CODRET']) ? $this->data['CODRET'] : '99';
31 5
        if ($code == '0') {
32 4
            $code = $this->getConfCodRet();
33 4
        }
34 5
        return $code;
35
    }
36
37 5
    public function getMessage()
38
    {
39 5
        if ($this->getConfCodRet()) {
40 1
            return $this->getConfMsgRet();
41
        }
42 4
        return isset($this->data['MSGRET']) ? $this->data['MSGRET'] : '';
43
    }
44
45 4
    public function getTransactionReference()
46
    {
47 4
        return isset($this->data['NUMCV']) ? $this->data['NUMCV'] : '';
48
    }
49
50 1
    public function getNumAutor()
51
    {
52 1
        return isset($this->data['NUMAUTOR']) ? $this->data['NUMAUTOR'] : '';
53
    }
54
55 1
    public function getNumPedido()
56
    {
57 1
        return isset($this->data['NUMPEDIDO']) ? $this->data['NUMPEDIDO'] : '';
58
    }
59
60 1
    public function getNumSqn()
61
    {
62 1
        return isset($this->data['NUMSQN']) ? $this->data['NUMSQN'] : '';
63
    }
64
65 1
    public function getNumAutent()
66
    {
67 1
        return isset($this->data['NUMAUTENT']) ? $this->data['NUMAUTENT'] : '';
68
    }
69
70 1
    public function getOrigemBin()
71
    {
72 1
        return isset($this->data['ORIGEM_BIN']) ? $this->data['ORIGEM_BIN'] : '';
73
    }
74
75 5
    public function getConfCodRet()
76
    {
77 5
        return isset($this->data['CONFCODRET']) ? $this->data['CONFCODRET'] : '';
78
    }
79
80 1
    public function getConfMsgRet()
81
    {
82 1
        return isset($this->data['CONFMSGRET']) ? $this->data['CONFMSGRET'] : '';
83
    }
84
85 1
    public function getValidUntil()
86
    {
87 1
        return isset($this->data['DATA_EXPI']) ? substr($this->data['DATA_EXPI'], 0, 4) . '-' . substr($this->data['DATA_EXPI'], 4, 2) . '-' . substr($this->data['DATA_EXPI'], 6) : '';
88
    }
89
90
}
91