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

TransactionStatusResponse   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 7
Bugs 0 Features 1
Metric Value
eloc 7
c 7
b 0
f 1
dl 0
loc 27
ccs 6
cts 9
cp 0.6667
rs 10
wmc 7

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isSuccessful() 0 6 4
A getTransactionReference() 0 3 1
A isCancelled() 0 3 2
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