PixEntries::validate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace WeDevBr\Bankly\Types\Pix;
4
5
use WeDevBr\Bankly\Types\Pix\AddressingAccount;
6
use WeDevBr\Bankly\Validators\Pix\AddressingAccountValidator;
7
use WeDevBr\Bankly\Validators\Pix\AddressingKeyValidator;
8
9
class PixEntries
10
{
11
    /** @var AddressingKey */
12
    public $addressingKey;
13
14
    /** @var AddressingAccount */
15
    public $account;
16
17
    /**
18
     * This validate and return an array
19
     * @return array
20
     */
21
    public function toArray(): array
22
    {
23
        $this->validate();
24
        return (array) $this;
25
    }
26
27
    /**
28
     * This function validate a Addressing Key
29
     */
30
    public function validate()
31
    {
32
        $addressingKeyValidator = new AddressingKeyValidator($this->addressingKey);
33
        $addressingKeyValidator->validate();
34
35
        $addressingAccountValidator = new AddressingAccountValidator($this->account);
36
        $addressingAccountValidator->validate();
37
    }
38
}
39