CompletePurchaseResponseTrait::isPending()   B
last analyzed

Complexity

Conditions 5
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 11
loc 11
ccs 0
cts 7
cp 0
rs 8.8571
cc 5
eloc 6
nc 3
nop 0
crap 30
1
<?php
2
3
namespace ByTIC\Omnipay\Twispay\Message\Traits;
4
5
use ByTIC\Omnipay\Common\Message\Traits\GatewayNotificationResponseTrait;
6
7
/**
8
 * Trait CompletePurchaseResponseTrait
9
 * @package ByTIC\Omnipay\Twispay\Message\Traits
10
 */
11
trait CompletePurchaseResponseTrait
12
{
13
    use GatewayNotificationResponseTrait;
14
15
    /**
16
     * @inheritdoc
17
     */
18 View Code Duplication
    public function isSuccessful()
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...
19
    {
20
        if ($this->hasNotificationDataItem('status')
21
            && $this->getNotificationDataItem('status') == 'complete-ok'
22
        ) {
23
            return true;
24
        }
25
        if ($this->hasNotificationDataItem('transactionStatus')
26
            && $this->getNotificationDataItem('transactionStatus') == 'complete-ok'
27
        ) {
28
            return true;
29
        }
30
        return parent::isSuccessful();
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36 View Code Duplication
    public function isPending()
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...
37
    {
38
        if ($this->hasNotificationDataItem('status') && $this->getNotificationDataItem('status') == 'in-progress') {
39
            return true;
40
        }
41
        if ($this->hasNotificationDataItem('transactionStatus')
42
            && $this->getNotificationDataItem('transactionStatus') == 'in-progress'
43
        ) {
44
            return true;
45
        }
46
        return parent::isPending();
47
    }
48
}
49