GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

BancontactPayment   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 33.33 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 12
loc 36
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A toArray() 12 12 2

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 CMPayments\PaymentSdk\Entities;
4
5
use Money\Money;
6
7
/**
8
 * Class BancontactPayment
9
 * @package CMPayments\PaymentSdk\Entities
10
 * @author Jory Geerts <[email protected]>
11
 */
12
class BancontactPayment extends Payment
13
{
14
    /**
15
     * @var \DateTime
16
     */
17
    private $dueDate;
18
19
    /**
20
     * CreditCardPayment constructor.
21
     *
22
     * @param Money $money
23
     * @param array $issuers
0 ignored issues
show
Bug introduced by
There is no parameter named $issuers. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
24
     * @param string $purchaseId
25
     * @param \DateTime $expiryDate
26
     */
27 1
    public function __construct(Money $money, $purchaseId, \DateTime $expiryDate = null)
28
    {
29 1
        parent::__construct($money, 'Bancontact', $purchaseId);
30
31 1
        $this->dueDate = $expiryDate;
32 1
    }
33
34
    /** @inheritdoc */
35 1 View Code Duplication
    public function toArray()
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...
36
    {
37 1
        $array = parent::toArray();
38 1
        $array['capture'] = true;
39
40 1
        if ($this->dueDate) {
41 1
            $array['due_date'] = $this->dueDate->format(DATE_RFC3339);
42 1
        }
43
44 1
        $array['payment_details']['issuers'] = ['BCMC'];
45 1
        return $array;
46
    }
47
}
48