Code Duplication    Length = 7-11 lines in 4 locations

src/Validators/Pix/AddressingKeyValidator.php 2 locations

@@ 63-69 (lines=7) @@
60
     * @return void
61
     * @throws \InvalidArgumentException
62
     */
63
    private function validateValue()
64
    {
65
        $value = $this->addressingKey->value;
66
        if ($this->addressingKey->type !== 'EVP' && (empty($value) || !is_string($value))) {
67
            throw new \InvalidArgumentException('value should be a string');
68
        }
69
    }
70
71
    /**
72
     * This validates a key value
@@ 77-84 (lines=8) @@
74
     * @return void
75
     * @throws \InvalidArgumentException
76
     */
77
    private function validateEvpType()
78
    {
79
        $value = $this->addressingKey->value;
80
        if ($this->addressingKey->type === 'EVP' && !empty($value))
81
        {
82
            throw new \InvalidArgumentException('value must be empty for EVP type');
83
        }
84
    }
85
}
86

src/Validators/Pix/PixCashoutManualValidator.php 1 location

@@ 113-123 (lines=11) @@
110
     * @return void
111
     * @throws \InvalidArgumentException
112
     */
113
    private function validateInitializationType()
114
    {
115
        $initializationType = $this->pixCashoutManual->initializationType;
116
        if (empty($initializationType) || !is_string($initializationType)) {
117
            throw new \InvalidArgumentException('initialization type should be a string');
118
        }
119
120
        if ($this->pixCashoutManual->initializationType != 'Manual') {
121
            throw new \InvalidArgumentException('this initialization type is not valid');
122
        }
123
    }
124
}
125

src/Validators/Pix/PixCashoutStaticQrCodeValidator.php 1 location

@@ 114-124 (lines=11) @@
111
     * @return void
112
     * @throws \InvalidArgumentException
113
     */
114
    private function validateInitializationType()
115
    {
116
        $initializationType = $this->pixCashoutStaticQrCode->initializationType;
117
        if (empty($initializationType) || !is_string($initializationType)) {
118
            throw new \InvalidArgumentException('initialization type should be a string');
119
        }
120
121
        if ($this->pixCashoutStaticQrCode->initializationType != 'StaticQrCode') {
122
            throw new \InvalidArgumentException('this initialization type is not valid');
123
        }
124
    }
125
126
    /**
127
     * This validates the end to end id