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

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