Passed
Pull Request — master (#16)
by Carlos C
02:51
created

StampingAlert   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 64
ccs 25
cts 25
cp 1
rs 10
c 2
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A id() 0 3 1
A errorCode() 0 3 1
A __construct() 0 3 1
A uuid() 0 3 1
A workProcessId() 0 3 1
A message() 0 3 1
A get() 0 3 1
A certificatePac() 0 3 1
A date() 0 3 1
A rfc() 0 3 1
A extraInfo() 0 3 1
A values() 0 3 1
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 16
    public function __construct(stdClass $raw)
15
    {
16 16
        $this->data = $raw;
17 16
    }
18
19 11
    private function get(string $keyword): string
20
    {
21 11
        return strval($this->data->{$keyword} ?? '');
22
    }
23
24 4
    public function id(): string
25
    {
26 4
        return $this->get('IdIncidencia');
27
    }
28
29 3
    public function uuid(): string
30
    {
31 3
        return $this->get('Uuid');
32
    }
33
34 10
    public function errorCode(): string
35
    {
36 10
        return $this->get('CodigoError');
37
    }
38
39 3
    public function workProcessId(): string
40
    {
41 3
        return $this->get('WorkProcessId');
42
    }
43
44 3
    public function message(): string
45
    {
46 3
        return $this->get('MensajeIncidencia');
47
    }
48
49 2
    public function extraInfo(): string
50
    {
51 2
        return $this->get('ExtraInfo');
52
    }
53
54 3
    public function rfc(): string
55
    {
56 3
        return $this->get('RfcEmisor');
57
    }
58
59 3
    public function certificatePac(): string
60
    {
61 3
        return $this->get('NoCertificadoPac');
62
    }
63
64 3
    public function date(): string
65
    {
66 3
        return $this->get('FechaRegistro');
67
    }
68
69
    /** @return array<mixed> */
70 2
    public function values(): array
71
    {
72 2
        return (array) $this->data;
73
    }
74
}
75