. */ namespace SP\Repositories\Track; use SP\Core\Exceptions\InvalidArgumentException; use SP\Http\Address; /** * Class TrackRequest * * @package SP\Repositories\Track */ final class TrackRequest { /** * @var int */ public $time; /** * @var string */ public $source; /** * @var int */ public $userId; /** * @var string */ protected $ipv6; /** * @var string */ protected $ipv4; /** * @param string $address * * @throws InvalidArgumentException */ public function setTrackIp($address) { $binary = Address::toBinary($address); $length = strlen($binary); if ($length === 4) { $this->ipv4 = $binary; } else { $this->ipv6 = $binary; } } /** * @return string */ public function getIpv6() { return $this->ipv6; } /** * @return string */ public function getIpv4() { return $this->ipv4; } }