RecurringTransaction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 29
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 5 1
A __construct() 0 19 1
1
<?php
2
3
namespace Sebdesign\VivaPayments\Responses;
4
5
use Sebdesign\VivaPayments\Enums\TransactionStatus;
6
7
class RecurringTransaction
8
{
9 1
    public function __construct(
10
        public readonly ?string $Emv,
11
        public readonly float $Amount,
12
        public readonly TransactionStatus $StatusId,
13
        public readonly ?string $RedirectUrl,
14
        public readonly string $CurrencyCode,
15
        public readonly string $TransactionId,
16
        public readonly int $ReferenceNumber,
17
        public readonly string $AuthorizationId,
18
        public readonly string $RetrievalReferenceNumber,
19
        public readonly ?string $Loyalty,
20
        public readonly int $ThreeDSecureStatusId,
21
        public readonly int $ErrorCode,
22
        public readonly ?string $ErrorText,
23
        public readonly string $TimeStamp,
24
        public readonly ?string $CorrelationId,
25
        public readonly int $EventId,
26
        public readonly bool $Success,
27
    ) {
28
    }
29
30
    /** @phpstan-param  RecurringTransactionArray  $attributes */
31 3
    public static function create(array $attributes): self
32
    {
33 3
        return new self(...[
0 ignored issues
show
Bug introduced by
The call to Sebdesign\VivaPayments\R...nsaction::__construct() has too few arguments starting with Amount. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        return /** @scrutinizer ignore-call */ new self(...[

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
Bug introduced by
array($attributes, 'Stat...ttributes['StatusId'])) of type Sebdesign\VivaPayments\E...TransactionStatus|array is incompatible with the type null|string expected by parameter $Emv of Sebdesign\VivaPayments\R...nsaction::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

33
        return new self(/** @scrutinizer ignore-type */ ...[
Loading history...
34
            ...$attributes,
35 3
            'StatusId' => TransactionStatus::from($attributes['StatusId']),
36
        ]);
37
    }
38
}
39