GetSignedContractsResult::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 8
nc 2
nop 2
dl 0
loc 10
ccs 9
cts 9
cp 1
crap 4
rs 10
c 1
b 0
f 0
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 5
    public function __construct(stdClass $data, bool $isBase64)
25
    {
26 5
        parent::__construct($data, 'get_documentsResult');
27 5
        $this->success = boolval($this->get('success'));
28 5
        $this->contract = $this->get('contract');
29 5
        $this->privacy = $this->get('privacy');
30 5
        $this->error = $this->get('error');
31 5
        if ($isBase64) {
32 1
            $this->contract = base64_decode($this->contract) ?: '';
33 1
            $this->privacy = base64_decode($this->privacy) ?: '';
34
        }
35
    }
36
37 4
    public function success(): bool
38
    {
39 4
        return $this->success;
40
    }
41
42 4
    public function contract(): string
43
    {
44 4
        return $this->contract;
45
    }
46
47 3
    public function privacy(): string
48
    {
49 3
        return $this->privacy;
50
    }
51
52 3
    public function error(): string
53
    {
54 3
        return $this->error;
55
    }
56
}
57