Code Duplication    Length = 9-10 lines in 2 locations

src/Validators/BankAccountValidator.php 1 location

@@ 68-76 (lines=9) @@
65
    /**
66
     * This validates a cpf_cnpj
67
     */
68
    private function validateDocument()
69
    {
70
        $document = $this->bank_account->document;
71
        if (is_null($document) || !is_string($document)) {
72
            throw new \InvalidArgumentException('document should be a string');
73
        }
74
        $documentValidator = new CpfCnpjValidator($document);
75
        $documentValidator->validate();
76
    }
77
78
    /**
79
     * This validates a given name

src/Validators/Card/CardValidator.php 1 location

@@ 52-61 (lines=10) @@
49
     * @return void
50
     * @throws InvalidArgumentException
51
     */
52
    private function validateDocumentNumber()
53
    {
54
        $documentNumber = $this->card->documentNumber;
55
        if (empty($documentNumber) || !is_string($documentNumber) || !is_numeric($documentNumber)) {
56
            throw new \InvalidArgumentException('document number should be a numeric string');
57
        }
58
59
        $documentValidator = new CpfCnpjValidator($documentNumber);
60
        $documentValidator->validate();
61
    }
62
63
    /**
64
     * This validates a card name