Пример #1
0
 public function match($value)
 {
     try {
         $address = \IpUtils\Factory::getAddress($this->_definition);
         $otherAddress = \IpUtils\Factory::getExpression($value);
         return $address->matches($otherAddress);
     } catch (\Exception $e) {
         unset($e);
         return false;
     }
 }
Пример #2
0
 public function validate()
 {
     try {
         $this->_subnet = \IpUtils\Factory::getExpression($this->_definition);
         // Check that we got a subnet expression and not something else
         if (!$this->_subnet instanceof \IpUtils\Expression\Subnet) {
             return false;
         }
     } catch (\Exception $e) {
         unset($e);
         return false;
     }
     return true;
 }
Пример #3
0
 /**
  * @dataProvider  expressionProvider
  */
 public function testGetExpression($expr, $expected)
 {
     $expr = Factory::getExpression($expr);
     $this->assertInstanceOf($expected, $expr);
 }