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.

CreditCardPayment::toArray()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
dl 12
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 0
crap 2
1
<?php
2
3
namespace CMPayments\PaymentSdk\Entities;
4
5
use Money\Money;
6
7
/**
8
 * Class CreditCardPayment
9
 * @package CMPayments\PaymentSdk\Entities
10
 * @author Jory Geerts <[email protected]>
11
 */
12
class CreditCardPayment extends Payment
13
{
14
    /**
15
     * @var array
16
     */
17
    private $issuers;
18
    /**
19
     * @var \DateTime
20
     */
21
    private $dueDate;
22
23
    /**
24
     * CreditCardPayment constructor.
25
     *
26
     * @param Money $money
27
     * @param array $issuers
28
     * @param string $purchaseId
29
     * @param \DateTime $dueDate
30
     */
31 1
    public function __construct(Money $money, array $issuers, $purchaseId, \DateTime $dueDate = null)
32
    {
33 1
        parent::__construct($money, 'Creditcard', $purchaseId);
34
35 1
        $this->issuers = $issuers;
36 1
        $this->dueDate = $dueDate;
37 1
    }
38
39
    /** @inheritdoc */
40 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...
41
    {
42 1
        $array = parent::toArray();
43 1
        $array['capture'] = true;
44
45 1
        if ($this->dueDate) {
46 1
            $array['due_date'] = $this->dueDate->format(DATE_RFC3339);
47 1
        }
48
49 1
        $array['payment_details']['issuers'] = $this->issuers;
50 1
        return $array;
51
    }
52
}
53