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.

XmlRpcPayloadParser   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 13
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 59
ccs 21
cts 28
cp 0.75
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C parse() 0 56 13
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Tools\Services\XmlRpc;
4
5
use DateTimeImmutable;
6
7
final class XmlRpcPayloadParser
8
{
9 11
    public static function parse(array $xml)
10
    {
11 11
        if (isset($xml['string'])) {
12 3
            return $xml['string'];
13
        }
14
15 9
        if (isset($xml['base64'])) {
16 1
            return base64_decode($xml['base64'], true);
17
        }
18
19 8
        if (isset($xml['i4'])) {
20 1
            return (int)$xml['i4'];
21
        }
22
23 7
        if (isset($xml['int'])) {
24 3
            return (int)$xml['int'];
25
        }
26
27 6
        if (isset($xml['double'])) {
28 1
            return (float)$xml['double'];
29
        }
30
31 5
        if (isset($xml['boolean'])) {
32 2
            return (bool)$xml['boolean'];
33
        }
34
35 3
        if (isset($xml['dateTime.iso8601'])) {
36 1
            return new DateTimeImmutable($xml['dateTime.iso8601']);
37
        }
38
39 2
        if (isset($xml['array'])) {
40
            $array = [];
41
42
            if (key($xml['array']['data']['value']) === 'struct') {
43
                $xml['array']['data']['value'] = [$xml['array']['data']['value']];
44
            }
45
46
            foreach ($xml['array']['data']['value'] as $item) {
47
                $array[] = self::parse($item);
48
            }
49
50
            return $array;
51
        }
52
53 2
        if (isset($xml['struct'])) {
54 2
            $struct = [];
55
56 2
            foreach ($xml['struct']['member'] as $member) {
57 2
                $struct[$member['name']] = self::parse($member['value']);
58
            }
59
60 2
            return $struct;
61
        }
62
63
        return $xml;
64
    }
65
}
66