Test Failed
Pull Request — master (#10)
by Kiet
03:33 queued 01:50
created

getTransactionReference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Omnipay\IcepayPayments\Message;
4
5
/**
6
 * The response after getting the transaction status at Icepay.
7
 */
8
class TransactionStatusResponse extends AbstractResponse
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13 2
    public function isSuccessful(): bool
14
    {
15 2
        return (isset($this->data['status']) && in_array($this->data['status'], [
16
            self::RESPONSE_STATUS_COMPLETED,
17 2
            self::RESPONSE_STATUS_SETTLED,
18 2
        ])) && (isset($this->data['statusCode']) && $this->data['statusCode'] === 200);
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 1
    public function isCancelled(): bool
25
    {
26 1
        return parent::isCancelled() || $this->data['statusCode'] === self::RESPONSE_STATUS_CANCELLED;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function getTransactionReference(): ?string
33
    {
34
        return $this->request->getTransactionReference();
35
    }
36
}
37