Cake\Localized\Validation\UaValidation::personId PHP Method

personId() public static method

Checks a country specific identification number.
public static personId ( string $check ) : boolean
$check string The value to check.
return boolean Success.
    public static function personId($check)
    {
        $pattern = '/^\\d{10}$/';
        return (bool) preg_match($pattern, $check);
    }

Usage Example

Example #1
0
 /**
  * test personId method of UaValidation
  *
  * @return void
  *
  * @covers UaValidation::personId
  */
 public function testPersonId()
 {
     $this->assertTrue(UaValidation::personId('1234567890'));
     $this->assertFalse(UaValidation::personId('12345678999'));
     $this->assertFalse(UaValidation::personId('112-233-445 96'));
 }