Passed
Push — master ( 496bfe...1835bd )
by Carlos C
01:07 queued 11s
created

StampingResult::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\Finkok\Services\Stamping;
6
7
use PhpCfdi\Finkok\Services\AbstractResult;
8
use stdClass;
9
10
class StampingResult extends AbstractResult
11
{
12
    /** @var StampingAlerts */
13
    private $alerts;
14
15 9
    public function __construct(string $container, stdClass $data)
16
    {
17 9
        parent::__construct($data, $container);
18 9
        $alerts = $this->findInDescendent($data, $container, 'Incidencias', 'Incidencia');
19 9
        $this->alerts = new StampingAlerts(is_array($alerts) ? $alerts : []);
20 9
    }
21
22 2
    public function xml(): string
23
    {
24 2
        return $this->get('xml');
25
    }
26
27 2
    public function uuid(): string
28
    {
29 2
        return $this->get('UUID');
30
    }
31
32 2
    public function faultString(): string
33
    {
34 2
        return $this->get('faultstring');
35
    }
36
37 2
    public function faultCode(): string
38
    {
39 2
        return $this->get('faultcode');
40
    }
41
42 2
    public function date(): string
43
    {
44 2
        return $this->get('Fecha');
45
    }
46
47 2
    public function statusCode(): string
48
    {
49 2
        return $this->get('CodEstatus');
50
    }
51
52 2
    public function seal(): string
53
    {
54 2
        return $this->get('SatSeal');
55
    }
56
57 2
    public function certificateSat(): string
58
    {
59 2
        return $this->get('NoCertificadoSAT');
60
    }
61
62 6
    public function alerts(): StampingAlerts
63
    {
64 6
        return $this->alerts;
65
    }
66
67 1
    public function hasAlerts(): bool
68
    {
69 1
        return ($this->alerts->count() > 0);
70
    }
71
}
72