Example #1
0
 public function match($value)
 {
     try {
         $address = \IpUtils\Factory::getAddress($value);
         return $this->_subnet->matches($address);
     } catch (\Exception $e) {
         unset($e);
         return false;
     }
 }
Example #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;
     }
 }
Example #3
0
 /**
  * @dataProvider       invalidAddressProvider
  * @expectedException  UnexpectedValueException
  */
 public function testGetInvalidAddress($address)
 {
     Factory::getAddress($address);
 }
Example #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;
     }
 }