Passed
Pull Request — master (#11)
by Carlos C
01:36
created

StampingAlert::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\Finkok\Services\Stamping;
6
7
use stdClass;
8
9
class StampingAlert
10
{
11
    /** @var stdClass */
12
    private $data;
13
14 12
    public function __construct(stdClass $raw)
15
    {
16 12
        $this->data = $raw;
17 12
    }
18
19 9
    private function get(string $keyword): string
20
    {
21 9
        return strval($this->data->{$keyword} ?? '');
22
    }
23
24 2
    public function id(): string
25
    {
26 2
        return $this->get('IdIncidencia');
27
    }
28
29 1
    public function uuid(): string
30
    {
31 1
        return $this->get('Uuid');
32
    }
33
34 8
    public function errorCode(): string
35
    {
36 8
        return $this->get('CodigoError');
37
    }
38
39 1
    public function workProcessId(): string
40
    {
41 1
        return $this->get('WorkProcessId');
42
    }
43
44 1
    public function message(): string
45
    {
46 1
        return $this->get('MensajeIncidencia');
47
    }
48
49 1
    public function rfc(): string
50
    {
51 1
        return $this->get('RfcEmisor');
52
    }
53
54 1
    public function certificatePac(): string
55
    {
56 1
        return $this->get('NoCertificadoPac');
57
    }
58
59 1
    public function date(): string
60
    {
61 1
        return $this->get('FechaRegistro');
62
    }
63
64 2
    public function values(): array
65
    {
66 2
        return (array) $this->data;
67
    }
68
}
69