src/Charcoal/Object/UserData.php
public function setIp($ip)
    {
        if ($ip === null) {
            $this->ip = null;
            return $this;
        }

        if (is_string($ip)) {
            $ip = ip2long($ip);
        } elseif (is_numeric($ip)) {
            $ip = intval($ip);
        } else {
            $ip = 0;
        }

        $this->ip = $ip;

        return $this;
    }
public function setIp($ip)
    {
        if ($ip === null) {
            $this->ip = null;
            return $this;
        }

        if (is_string($ip)) {
            $ip = ip2long($ip);
        } elseif (is_numeric($ip)) {
            $ip = intval($ip);
        } else {
            $ip = 0;
        }

        $this->ip = $ip;

        return $this;
    }
Set the client IP address.

@param  integer|null $ip The remote IP at object creation.
@return UserDataInterface Chainable