public function match($value) { try { $address = \IpUtils\Factory::getAddress($value); return $this->_subnet->matches($address); } catch (\Exception $e) { unset($e); return false; } }
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; } }
/** * @dataProvider expressionProvider */ public function testGetExpression($expr, $expected) { $expr = Factory::getExpression($expr); $this->assertInstanceOf($expected, $expr); }
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; } }