Author: Nick Sagona, III (nick@popphp.org)
Inheritance: extends Validator
Example #1
0
 /**
  * Method to filter the ip addresses to confirm their validity
  *
  * @param  string|array $ips
  * @return array
  */
 protected function filterIps($ips)
 {
     $validIps = array();
     if (!is_array($ips)) {
         $ips = array($ips);
     }
     foreach ($ips as $ip) {
         $ip = trim($ip);
         if (Validator\Ipv4::factory()->evaluate($ip) || Validator\Ipv6::factory()->evaluate($ip)) {
             $validIps[] = $ip;
         }
     }
     return $validIps;
 }
Example #2
0
 public function testEvaluateFalse()
 {
     $v = new Ipv6(null, null, false);
     $this->assertFalse($v->evaluate('fe80::21a:4dff:fe50:11de'));
     $this->assertTrue($v->evaluate('123456'));
 }