Example #1
0
 /**
  * @inheritdoc
  */
 protected function validate($value)
 {
     if (!Validator::cnpj()->validate($value)) {
         throw new \InvalidArgumentException("O CNPJ informado é inválido");
     }
     return true;
 }
Example #2
0
 public function setCompanyDocument($value)
 {
     if (!v::cnpj()->validate($value)) {
         throw new FieldRequiredException("CNPJ é uma informação obrigatória");
     }
     $cnpj = preg_replace('/\\D/', '', $value);
     $this->_companyDocument = $cnpj;
 }
 /**
  * Define o CNPJ da pessoa jurídica.
  * 
  * @param string $cnpj CNPJ da pessoa jurídica
  * @return \Umbrella\YaBoleto\PessoaJuridica
  */
 public function setCnpj($cnpj)
 {
     if (!Validator::cnpj()->validate($cnpj)) {
         throw new \InvalidArgumentException("O CNPJ informado é inválido");
     }
     $this->cnpj = $cnpj;
     return $this;
 }
Example #4
0
 public function setDocument($value)
 {
     $document = null;
     if (v::cnpj()->validate($value)) {
         $document = $this->setCNPJ($value);
     }
     if (v::cpf()->validate($value)) {
         $document = $this->setCPF($value);
     }
     if (is_null($document)) {
         throw new FieldRequiredException("Documento é uma informação obrigatória");
     }
 }