CompletePurchaseResponseTrait   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 36
Duplicated Lines 69.44 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 10
c 1
b 0
f 1
dl 25
loc 36
ccs 0
cts 15
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B isSuccessful() 13 13 5
B isPending() 11 11 5

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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