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; } }
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; }
/** * @dataProvider expressionProvider */ public function testGetExpression($expr, $expected) { $expr = Factory::getExpression($expr); $this->assertInstanceOf($expected, $expr); }