Ejemplo n.º 1
0
 public function match($value)
 {
     try {
         $address = \IpUtils\Factory::getAddress($value);
         return $this->_subnet->matches($address);
     } catch (\Exception $e) {
         unset($e);
         return false;
     }
 }
Ejemplo n.º 2
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;
     }
 }
Ejemplo n.º 3
0
 /**
  * @dataProvider  expressionProvider
  */
 public function testGetExpression($expr, $expected)
 {
     $expr = Factory::getExpression($expr);
     $this->assertInstanceOf($expected, $expr);
 }
Ejemplo n.º 4
0
 public function isPubliclyRoutable()
 {
     try {
         $ip = \IpUtils\Factory::getAddress($this->get());
         if ($ip->isPrivate()) {
             return false;
         }
         if ($ip->isLoopback()) {
             return false;
         }
         if ($ip instanceof IPv4 && $this->isIpv4InUnroutableRange($ip)) {
             return false;
         }
         return true;
     } catch (\UnexpectedValueException $unexpectedValueException) {
         return true;
     }
 }