Exemple #1
0
 /**
  * @param IP ip
  * @throws \Exception
  */
 public function setNetmask(IP $ip)
 {
     if (!preg_match('/^1*0*$/', $ip->toBin())) {
         throw new \Exception('Invalid Netmask address format');
     }
     if (isset($this->ip) && $ip->getVersion() !== $this->ip->getVersion()) {
         throw new \Exception('Netmask version is not same as IP version');
     }
     $this->netmask = $ip;
 }