protected function setFromMixedSource($ip)
    {
        if (is_int($ip) || is_string($ip)) {
            if (is_int($ip)) {
                /*
                 * Convert int to dotted IP string
                 */
                $ip = long2ip($ip);
            }

            /*
             * We might have been given a string, or we may have converted to string. Attempt to make it an int.
             */
            if (is_string($ip)) {
                $ip = ip2long($ip);
            }
        } else {
            $ip = false;
        }

        /*
         * If given an improper data type, we set the $ip to false.
         * Also, the conversion through ip2long() could result in it becoming false.
         * Either way, we want to bail out.
         */
        if ($ip === false) {
            throw new \Exception(__METHOD__.' requires valid IPV4 address string in dot-notation (aaa.bbb.ccc.ddd).');
        }

        $this->set($ip);
    }
protected function setFromMixedSource($ip)
    {
        if (is_int($ip) || is_string($ip)) {
            if (is_int($ip)) {
                /*
                 * Convert int to dotted IP string
                 */
                $ip = long2ip($ip);
            }

            /*
             * We might have been given a string, or we may have converted to string. Attempt to make it an int.
             */
            if (is_string($ip)) {
                $ip = ip2long($ip);
            }
        } else {
            $ip = false;
        }

        /*
         * If given an improper data type, we set the $ip to false.
         * Also, the conversion through ip2long() could result in it becoming false.
         * Either way, we want to bail out.
         */
        if ($ip === false) {
            throw new \Exception(__METHOD__.' requires valid IPV4 address string in dot-notation (aaa.bbb.ccc.ddd).');
        }

        $this->set($ip);
    }
protected function setFromMixedSource ( $ ip ) { if ( is_int ( $ ip ) || is_string ( $ ip ) ) { if ( is_int ( $ ip ) ) { /*
                 * Convert int to dotted IP string
                 */ $ ip = long2ip ( $ ip ) ; } /*
             * We might have been given a string, or we may have converted to string. Attempt to make it an int.
             */ if ( is_string ( $ ip ) ) { $ ip = ip2long ( $ ip ) ; } } else { $ ip = false ; } /*
         * If given an improper data type, we set the $ip to false.
         * Also, the conversion through ip2long() could result in it becoming false.
         * Either way, we want to bail out.
         */ if ( $ ip === false ) { throw new \ Exception ( __METHOD__ . ' requires valid IPV4 address string in dot-notation (aaa.bbb.ccc.ddd).' ) ; } $ this -> set ( $ ip ) ; }
Format and validate for given string or integer formatted IPV4 network address.

@param string|int $ip The IP address (in dot-notation-string format or integer) to be represented by the instance

@throws Exception
Format and validate for given string or integer formatted IPV4 network address .