$record */ public function __construct(array $record) { $this->confidence = $record['confidence'] ?? null; $this->isAnonymous = $record['is_anonymous'] ?? false; $this->isAnonymousVpn = $record['is_anonymous_vpn'] ?? false; $this->isHostingProvider = $record['is_hosting_provider'] ?? false; $this->isPublicProxy = $record['is_public_proxy'] ?? false; $this->isResidentialProxy = $record['is_residential_proxy'] ?? false; $this->isTorExitNode = $record['is_tor_exit_node'] ?? false; $this->networkLastSeen = $record['network_last_seen'] ?? null; $this->providerName = $record['provider_name'] ?? null; $this->residential = new AnonymizerFeed($record['residential'] ?? []); } /** * @return array */ public function jsonSerialize(): array { $js = []; if ($this->confidence !== null) { $js['confidence'] = $this->confidence; } if ($this->isAnonymous !== false) { $js['is_anonymous'] = $this->isAnonymous; } if ($this->isAnonymousVpn !== false) { $js['is_anonymous_vpn'] = $this->isAnonymousVpn; } if ($this->isHostingProvider !== false) { $js['is_hosting_provider'] = $this->isHostingProvider; } if ($this->isPublicProxy !== false) { $js['is_public_proxy'] = $this->isPublicProxy; } if ($this->isResidentialProxy !== false) { $js['is_residential_proxy'] = $this->isResidentialProxy; } if ($this->isTorExitNode !== false) { $js['is_tor_exit_node'] = $this->isTorExitNode; } if ($this->networkLastSeen !== null) { $js['network_last_seen'] = $this->networkLastSeen; } if ($this->providerName !== null) { $js['provider_name'] = $this->providerName; } $residential = $this->residential->jsonSerialize(); if (!empty($residential)) { $js['residential'] = $residential; } return $js; } }