Example #1
0
 /**
  * Checks SSN for Brazil
  *
  * @param string $check The value to check.
  * @return boolean
  * @access public
  */
 function ssn($check)
 {
     $check = str_replace(array(' ', '-', '.', '/'), '', $check);
     if (!ctype_digit($check)) {
         return false;
     }
     return BrValidation::cpf($check) || BrValidation::cnjp($check);
 }
Example #2
0
 /**
  * test the ssn method of BrValidation
  *
  * @return void
  * @access public
  */
 function testSsn()
 {
     // Testing CPF
     $this->assertFalse(BrValidation::ssn('22692173811'));
     $this->assertFalse(BrValidation::ssn('50549727322'));
     $this->assertFalse(BrValidation::ssn('869.283.422-11'));
     $this->assertFalse(BrValidation::ssn('843.701.734-22'));
     $this->assertTrue(BrValidation::ssn('22692173813'));
     $this->assertTrue(BrValidation::ssn('50549727302'));
     $this->assertTrue(BrValidation::ssn('869.283.422-00'));
     $this->assertTrue(BrValidation::ssn('843.701.734-34'));
     // Testing CNPJ
     $this->assertFalse(BrValidation::ssn('04295165000133'));
     $this->assertFalse(BrValidation::ssn('33530485000129'));
     $this->assertFalse(BrValidation::ssn('04295166000101'));
     $this->assertFalse(BrValidation::ssn('33530486000130'));
     $this->assertFalse(BrValidation::ssn('04.295.165/0001-33'));
     $this->assertFalse(BrValidation::ssn('33.530.485/0001-29'));
     $this->assertFalse(BrValidation::ssn('04.295.166/0001-01'));
     $this->assertFalse(BrValidation::ssn('33.530.486/0001-30'));
     $this->assertTrue(BrValidation::ssn('04295166000133'));
     $this->assertTrue(BrValidation::ssn('33530486000129'));
     $this->assertTrue(BrValidation::ssn('04.295.166/0001-33'));
     $this->assertTrue(BrValidation::ssn('33.530.486/0001-29'));
     // Testing invalid input
     $this->assertFalse(BrValidation::ssn('3712093712890371289073901287390812'));
     $this->assertFalse(BrValidation::ssn('33aaaa86000129'));
 }
Example #3
0
 /**
  * Checks SSN for Brazil
  *
  * @param string $check The value to check.
  * @return boolean
  */
 public static function ssn($check)
 {
     return BrValidation::cpf($check) || BrValidation::cnpj($check);
 }
Example #4
0
 /**
  * Checks SSN for Brazil.
  *
  * @param string $check The value to check.
  * @return bool Success.
  */
 public static function personId($check)
 {
     return BrValidation::cpf($check) || BrValidation::cnpj($check);
 }
Example #5
0
 function cnpj($cnpj)
 {
     return BrValidation::cnpj($cnpj['cnpj']);
 }
 /**
  * Valida CPF
  * 
  * @param  string $data O CPF
  * 
  * @return boolean
  */
 public function cpf($data)
 {
     return BrValidation::cpf(array_shift($data));
 }
Example #7
0
 /**
  * Checks SSN for Brazil
  *
  * @param string $check The value to check.
  * @return boolean
  * @access public
  */
 function ssn($check)
 {
     $check = preg_replace('/[^0-9]/', '', $check);
     return BrValidation::cpf($check) || BrValidation::cnjp($check);
 }