Completed
Pull Request — master (#13)
by Carlos C
01:54
created

GetSignedContractsResult   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
dl 0
loc 45
ccs 16
cts 18
cp 0.8889
rs 10
c 1
b 0
f 0
wmc 8

5 Methods

Rating   Name   Duplication   Size   Complexity  
A error() 0 3 1
A contract() 0 3 1
A __construct() 0 10 4
A privacy() 0 3 1
A success() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\Finkok\Services\Manifest;
6
7
use PhpCfdi\Finkok\Services\AbstractResult;
8
use stdClass;
9
10
class GetSignedContractsResult extends AbstractResult
11
{
12
    /** @var bool */
13
    private $success;
14
15
    /** @var string */
16
    private $contract;
17
18
    /** @var string */
19
    private $privacy;
20
21
    /** @var string */
22
    private $error;
23
24 2
    public function __construct(stdClass $data, bool $isBase64)
25
    {
26 2
        parent::__construct($data, 'get_documentsResult');
27 2
        $this->success = boolval($this->get('success'));
28 2
        $this->contract = strval($this->get('contract'));
29 2
        $this->privacy = strval($this->get('privacy'));
30 2
        $this->error = strval($this->get('error'));
31 2
        if ($isBase64) {
32
            $this->contract = base64_decode($this->contract) ?: '';
33
            $this->privacy = base64_decode($this->privacy) ?: '';
34
        }
35 2
    }
36
37 1
    public function success(): bool
38
    {
39 1
        return $this->success;
40
    }
41
42 2
    public function contract(): string
43
    {
44 2
        return $this->contract;
45
    }
46
47 1
    public function privacy(): string
48
    {
49 1
        return $this->privacy;
50
    }
51
52 1
    public function error(): string
53
    {
54 1
        return $this->error;
55
    }
56
}
57