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

GetSignedContractsResult::contract()   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
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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 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