RelayResponseTrait::getTransactionReference()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 2
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace ByTIC\Omnipay\PlatiOnline\Message\Traits;
4
5
use SimpleXMLElement;
6
7
/**
8
 * Trait RelayResponseTrait
9
 * @package ByTIC\Omnipay\PlatiOnline\Message\Traits
10
 */
11
trait RelayResponseTrait
12
{
13
    /**
14
     * @inheritDoc
15
     * @noinspection PhpMissingReturnTypeInspection
16
     */
17
    public function isSuccessful()
18
    {
19
        return $this->getCode() == '2';
20
    }
21
22
    /**
23
     * @inheritDoc
24
     * @noinspection PhpMissingReturnTypeInspection
25
     */
26
    public function isPending()
27
    {
28
        return $this->getCode() == '13';
29
    }
30
31
    /**
32
     * @inheritDoc
33
     * @noinspection PhpMissingReturnTypeInspection
34
     */
35
    public function getMessage()
36
    {
37
        return
38
            'CODE: ' . $this->getNotification()->x_response_reason_code
39
            . ' ' . $this->getNotification()->x_response_reason_text;
40
    }
41
42
    /**
43
     * @inheritDoc
44
     * @noinspection PhpMissingReturnTypeInspection
45
     */
46
    public function getCode()
47
    {
48
        return (string)$this->getNotification()->x_response_code;
49
    }
50
51
    /**
52
     * @inheritDoc
53
     * @noinspection PhpMissingReturnTypeInspection
54
     */
55
    public function getTransactionReference()
56
    {
57
        return (string)$this->getNotification()->x_trans_id;
58
    }
59
60
    /**
61
     * @inheritDoc
62
     * @noinspection PhpMissingReturnTypeInspection
63
     */
64
    public function getTransactionId()
65
    {
66
        return (string)$this->getNotification()->f_order_number;
67
    }
68
69
    /**
70
     * @return SimpleXMLElement
71
     */
72
    protected function getNotification()
73
    {
74
        return $this->getDataProperty('notification');
0 ignored issues
show
Bug introduced by
It seems like getDataProperty() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

74
        return $this->/** @scrutinizer ignore-call */ getDataProperty('notification');
Loading history...
75
    }
76
}
77