Passed
Push — main ( b480f2...a8d709 )
by Carlos C
02:53 queued 12s
created

GetPendingResult::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
ccs 5
cts 6
cp 0.8333
crap 2.0185
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\Finkok\Services\Cancel;
6
7
use PhpCfdi\Finkok\Services\AbstractResult;
8
use stdClass;
9
10
class GetPendingResult extends AbstractResult
11
{
12
    /** @var string[] */
13
    private $uuids;
14
15 4
    public function __construct(stdClass $data)
16
    {
17 4
        parent::__construct($data, 'get_pendingResult');
18 4
        $items = $this->findInDescendent($data, 'get_pendingResult', 'uuids', 'string') ?? [];
19 4
        if (! is_array($items)) {
20
            $items = [];
21
        }
22 4
        $this->uuids = $items;
23
    }
24
25
    /** @return string[] */
26 3
    public function uuids(): array
27
    {
28 3
        return $this->uuids;
29
    }
30
31 3
    public function error(): string
32
    {
33 3
        return $this->get('error');
34
    }
35
}
36