Code Duplication    Length = 16-18 lines in 2 locations

src/Validators/Pix/AddressingAccountValidator.php 1 location

@@ 76-91 (lines=16) @@
73
     * @return void
74
     * @throws InvalidArgumentException
75
     */
76
    private function validateType()
77
    {
78
        $type = $this->addressingAccount->type;
79
        if (empty($type) || !is_string($type)) {
80
            throw new \InvalidArgumentException('type account should be a string');
81
        }
82
83
        $typeList = [
84
            'CHECKING',
85
            'SAVINGS',
86
            'SALARY',
87
        ];
88
        if (!in_array($this->addressingAccount->type, $typeList)) {
89
            throw new \InvalidArgumentException('this account type is not valid');
90
        }
91
    }
92
}
93

src/Validators/Pix/AddressingKeyValidator.php 1 location

@@ 37-54 (lines=18) @@
34
     * @return void
35
     * @throws InvalidArgumentException
36
     */
37
    private function validateType()
38
    {
39
        $type = $this->addressingKey->type;
40
        if (empty($type) || !is_string($type)) {
41
            throw new \InvalidArgumentException('type should be a string');
42
        }
43
44
        $typeList = [
45
            'CPF',
46
            'CNPJ',
47
            'EMAIL',
48
            'PHONE',
49
            'EVP',
50
        ];
51
        if (!in_array($this->addressingKey->type, $typeList)) {
52
            throw new \InvalidArgumentException('this key type is not valid');
53
        }
54
    }
55
56
    /**
57
     * This validates a key value