コード例 #1
0
ファイル: Cpf.php プロジェクト: victor-felix/ya-boleto-php
 /**
  * @inheritdoc
  */
 protected function validate($value)
 {
     if (!Validator::cpf()->validate($value)) {
         throw new \InvalidArgumentException("O CPF informado é inválido");
     }
     return true;
 }
コード例 #2
0
 /**
  * Define o CPF da pessoa física.
  * 
  * @param string $cpf CPF da pessoa física
  * @return \Umbrella\YaBoleto\PessoaFisica
  */
 public function setCpf($cpf)
 {
     if (!Validator::cpf()->validate($cpf)) {
         throw new \InvalidArgumentException("O CPF informado é inválido");
     }
     $this->cpf = $cpf;
     return $this;
 }
コード例 #3
0
ファイル: Usuario.php プロジェクト: jokeronaldo/crud-slim3
 public function validatePostVars($vars)
 {
     $validations = [v::stringType()->length(2)->validate($vars['nome']), v::stringType()->length(2)->validate($vars['sobrenome']), v::cpf()->validate($vars['cpf']), v::email()->validate($vars['email']), v::intVal()->validate($vars['clube']), v::intVal()->validate($vars['plano'])];
     if ($vars['nascimento']) {
         $validations[] = v::date()->validate($vars['nascimento']);
     }
     if ($vars['titular']) {
         $validations[] = v::intVal()->validate($vars['titular']);
     }
     return $validations;
 }
コード例 #4
0
ファイル: Receiver.php プロジェクト: dindigital/nfe-focus
 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");
     }
 }
コード例 #5
0
 /**
  * @return boolean
  * @param stdClass $user
  */
 public function isValid($user)
 {
     $userValidator = v::attribute('ID', v::numeric())->attribute('USUARIO', v::string()->notEmpty()->noWhitespace())->attribute('NOME', v::string()->notEmpty())->attribute('EMAIL', v::email())->attribute('CPF', v::cpf())->attribute('STATUS', v::numeric())->attribute('UNIDADES', v::arr());
     return $userValidator->validate($user);
 }