当前位置: 首页>>代码示例>>PHP>>正文


PHP Validator::cpf方法代码示例

本文整理汇总了PHP中Respect\Validation\Validator::cpf方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::cpf方法的具体用法?PHP Validator::cpf怎么用?PHP Validator::cpf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Respect\Validation\Validator的用法示例。


在下文中一共展示了Validator::cpf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 /**
  * @inheritdoc
  */
 protected function validate($value)
 {
     if (!Validator::cpf()->validate($value)) {
         throw new \InvalidArgumentException("O CPF informado é inválido");
     }
     return true;
 }
开发者ID:victor-felix,项目名称:ya-boleto-php,代码行数:10,代码来源:Cpf.php

示例2: setCpf

 /**
  * 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;
 }
开发者ID:wfcreations,项目名称:ya-boleto-php,代码行数:14,代码来源:PessoaFisica.php

示例3: validatePostVars

 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;
 }
开发者ID:jokeronaldo,项目名称:crud-slim3,代码行数:11,代码来源:Usuario.php

示例4: setDocument

 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");
     }
 }
开发者ID:dindigital,项目名称:nfe-focus,代码行数:13,代码来源:Receiver.php

示例5: isValid

 /**
  * @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);
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:9,代码来源:SynchronizerUser.php


注:本文中的Respect\Validation\Validator::cpf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。