Passed
Push — master ( c52187...71f110 )
by Sébastien
02:19
created

CreatePaymentOrder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 16
dl 0
loc 24
ccs 1
cts 1
cp 1
crap 1
rs 10

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
namespace Sebdesign\VivaPayments\Requests;
4
5
class CreatePaymentOrder
6
{
7 2
    public function __construct(
8
        /** @var int<30,max> */
9
        public int $amount,
10
        public ?string $customerTrns = null,
11
        public ?Customer $customer = null,
12
        /** @var int<0,432000> */
13
        public int $paymentTimeOut = 1800,
14
        public bool $preauth = false,
15
        public bool $allowRecurring = false,
16
        /** @var int<0,36> */
17
        public int $maxInstallments = 0,
18
        public bool $paymentNotification = false,
19
        /** @var int<0,max> */
20
        public int $tipAmount = 0,
21
        public bool $disableExactAmount = false,
22
        public bool $disableCash = false,
23
        public bool $disableWallet = false,
24
        public string $sourceCode = 'Default',
25
        public ?string $merchantTrns = null,
26
        /** @var string[]|null */
27
        public ?array $tags = null,
28
        /** @var string[]|null */
29
        public ?array $cardTokens = null,
30
    ) {
31
    }
32
}
33