/** * Store subnet properties * * @param string $address * @param string $mask * @param string $name * @throws \InvalidArgumentException if address or mask is invalid */ public function saveSubnet($address, $mask, $name) { try { $this->_validate($address, $mask); } catch (\UnexpectedValueException $e) { throw new \InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } // Convert empty string to NULL for correct sorting order if ($name == '') { $name = null; } if (!$this->_subnets->update(array('name' => $name), array('netid' => $address, 'mask' => $mask))) { $this->_subnets->insert(array('netid' => $address, 'mask' => $mask, 'name' => $name)); } }