GetSignedContractsResult   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A error() 0 3 1
A contract() 0 3 1
A privacy() 0 3 1
A success() 0 3 1
A __construct() 0 10 4
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