$raw */ public function __construct(array $raw) { $this->autonomousSystemNumber = $raw['autonomous_system_number'] ?? null; $this->autonomousSystemOrganization = $raw['autonomous_system_organization'] ?? null; $this->isp = $raw['isp'] ?? null; $this->mobileCountryCode = $raw['mobile_country_code'] ?? null; $this->mobileNetworkCode = $raw['mobile_network_code'] ?? null; $this->organization = $raw['organization'] ?? null; $ipAddress = $raw['ip_address']; $this->ipAddress = $ipAddress; $this->network = Util::cidr($ipAddress, $raw['prefix_len']); } /** * @return array|null */ public function jsonSerialize(): ?array { $js = []; if ($this->autonomousSystemNumber !== null) { $js['autonomous_system_number'] = $this->autonomousSystemNumber; } if ($this->autonomousSystemOrganization !== null) { $js['autonomous_system_organization'] = $this->autonomousSystemOrganization; } if ($this->isp !== null) { $js['isp'] = $this->isp; } if ($this->mobileCountryCode !== null) { $js['mobile_country_code'] = $this->mobileCountryCode; } if ($this->mobileNetworkCode !== null) { $js['mobile_network_code'] = $this->mobileNetworkCode; } if ($this->organization !== null) { $js['organization'] = $this->organization; } $js['ip_address'] = $this->ipAddress; $js['network'] = $this->network; return $js; } }