Пример #1
0
 public function setIp($ip)
 {
     $ip = trim($ip);
     if (is_string($ip) and $this->getNetwork() != null and Ip::isValidIp($ip, $this->getNetwork()->getIpv())) {
         if ($this->getNetwork()->getIpv() == 6) {
             $this->ip = (string) Ip::ipv6Expand($ip);
             return true;
         } elseif ($this->getNetwork()->getIpv() == 4) {
             $this->ip = $ip;
             return true;
         }
     }
     return false;
 }
Пример #2
0
 public function setIp($ip)
 {
     if (is_string($ip) and Ip::isValidIp($ip, $this->getIpv())) {
         $this->ip = $ip;
         if ($this->getIpv() == 6) {
             $this->ip = (string) Ip::ipv6Expand($this->ip);
         }
     }
 }