Cake\Localized\Validation\RuValidation::address1 PHP Method

address1() public static method

Checks an adress (street) for Russia.
public static address1 ( string $check ) : boolean
$check string The value to check.
return boolean Success.
    public static function address1($check)
    {
        $pattern = '/^[a-zA-Z\\p{Cyrillic} \\.]+,/u';
        return (bool) preg_match($pattern, $check);
    }

Usage Example

Beispiel #1
0
 /**
  * test address method of RuValidation
  *
  * @return void
  */
 public function testAddress()
 {
     $this->assertTrue(RuValidation::address1('Московский пр., д. 100'));
     $this->assertTrue(RuValidation::address1('Moskovskiy ave., bld. 100'));
     $this->assertFalse(RuValidation::address1('I would not tell'));
 }