示例#1
0
文件: IPCIDR.php 项目: skosm/LaraShop
 public function match($value)
 {
     try {
         $address = \IpUtils\Factory::getAddress($value);
         return $this->_subnet->matches($address);
     } catch (\Exception $e) {
         unset($e);
         return false;
     }
 }
示例#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;
     }
 }
示例#3
0
 /**
  * @dataProvider       invalidAddressProvider
  * @expectedException  UnexpectedValueException
  */
 public function testGetInvalidAddress($address)
 {
     Factory::getAddress($address);
 }
示例#4
0
文件: Host.php 项目: webignition/url
 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;
     }
 }