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.

PaymentMethodNonceArray::toArray()   A
last analyzed

Complexity

Conditions 4
Paths 5

Size

Total Lines 23
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 23
rs 9.9
c 0
b 0
f 0
cc 4
nc 5
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitBag\SyliusBraintreePlugin\Reply\Api;
6
7
use BitBag\SyliusBraintreePlugin\Util\ArrayUtils;
8
use Braintree\PaymentMethodNonce;
9
10
final class PaymentMethodNonceArray
11
{
12
    public static function toArray(PaymentMethodNonce $object): array
13
    {
14
        if (null === $object) {
15
            return [];
16
        }
17
18
        $array = ArrayUtils::extractPropertiesToArray($object, [
19
            'nonce', 'consumed', 'default', 'type', 'threeDSecureInfo', 'details',
20
        ]);
21
22
        if (array_key_exists('threeDSecureInfo', $array)) {
23
            $array['threeDSecureInfo'] = ArrayUtils::extractPropertiesToArray($array['threeDSecureInfo'], [
24
                'enrolled', 'liabilityShiftPossible', 'liabilityShifted', 'status',
25
            ]);
26
        }
27
28
        if (array_key_exists('details', $array)) {
29
            $array['details'] = ArrayUtils::extractPropertiesToArray($array['details'], [
30
                'cardType', 'lastTwo', 'correlationId', 'email', 'payerInfo', 'username',
31
            ]);
32
        }
33
34
        return $array;
35
    }
36
}
37