Code Duplication    Length = 41-44 lines in 2 locations

src/Types/Pix/PixCashoutManual.php 1 location

@@ 8-48 (lines=41) @@
5
use WeDevBr\Bankly\Contracts\Pix\PixCashoutInterface;
6
use WeDevBr\Bankly\Validators\Pix\PixCashoutManualValidator;
7
8
class PixCashoutManual implements PixCashoutInterface
9
{
10
    /** @var string */
11
    public $amount;
12
13
    /** @var string */
14
    public $description;
15
16
    /** @var \WeDevBr\Bankly\Types\Pix\BankAccount */
17
    public $sender;
18
19
    /** @var \WeDevBr\Bankly\Types\Pix\BankAccount */
20
    public $recipient;
21
22
    /**
23
     * [Manual, Key, StaticQrCode, DynamicQrCode]
24
     * @var string
25
     */
26
    public $initializationType = 'Manual';
27
28
    /**
29
     * This validate and return an array
30
     * @return array
31
     */
32
    public function toArray(): array
33
    {
34
        $this->validate();
35
        return json_decode(json_encode($this), true);
36
    }
37
38
    /**
39
     * This function validate the PixCashout type
40
     *
41
     * @return void
42
     */
43
    public function validate(): void
44
    {
45
        $pixCashout = new PixCashoutManualValidator($this);
46
        $pixCashout->validate();
47
    }
48
}
49

src/Types/Pix/PixCashoutStaticQrCode.php 1 location

@@ 8-51 (lines=44) @@
5
use WeDevBr\Bankly\Contracts\Pix\PixCashoutInterface;
6
use WeDevBr\Bankly\Validators\Pix\PixCashoutStaticQrCodeValidator;
7
8
class PixCashoutStaticQrCode implements PixCashoutInterface
9
{
10
    /** @var string */
11
    public $amount;
12
13
    /** @var string */
14
    public $description;
15
16
    /** @var \WeDevBr\Bankly\Types\Pix\BankAccount */
17
    public $sender;
18
19
    /** @var \WeDevBr\Bankly\Types\Pix\BankAccount */
20
    public $recipient;
21
22
    /**
23
     * [Manual, Key, StaticQrCode, DynamicQrCode]
24
     * @var string
25
     */
26
    public $initializationType = 'StaticQrCode';
27
28
    /** @var string */
29
    public $endToEndId;
30
31
    /**
32
     * This validate and return an array
33
     * @return array
34
     */
35
    public function toArray(): array
36
    {
37
        $this->validate();
38
        return json_decode(json_encode($this), true);
39
    }
40
41
    /**
42
     * This function validate the PixCashoutStaticQrCode type
43
     *
44
     * @return void
45
     */
46
    public function validate(): void
47
    {
48
        $pixCashout = new PixCashoutStaticQrCodeValidator($this);
49
        $pixCashout->validate();
50
    }
51
}
52