Skip to content

Commit

Permalink
Get rid of pointless null checks
Browse files Browse the repository at this point in the history
We ensure the values are not null in the constructor.
  • Loading branch information
oschwald committed Nov 14, 2024
1 parent 780a572 commit 4639bab
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions src/Model/AnonymousIp.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,12 @@ public function __construct(array $raw)
public function jsonSerialize(): ?array
{
$js = [];
if ($this->isAnonymous !== null) {
$js['is_anonymous'] = $this->isAnonymous;
}
if ($this->isAnonymousVpn !== null) {
$js['is_anonymous_vpn'] = $this->isAnonymousVpn;
}
if ($this->isHostingProvider !== null) {
$js['is_hosting_provider'] = $this->isHostingProvider;
}
if ($this->isPublicProxy !== null) {
$js['is_public_proxy'] = $this->isPublicProxy;
}
if ($this->isResidentialProxy !== null) {
$js['is_residential_proxy'] = $this->isResidentialProxy;
}
if ($this->isTorExitNode !== null) {
$js['is_tor_exit_node'] = $this->isTorExitNode;
}
$js['is_anonymous'] = $this->isAnonymous;
$js['is_anonymous_vpn'] = $this->isAnonymousVpn;
$js['is_hosting_provider'] = $this->isHostingProvider;
$js['is_public_proxy'] = $this->isPublicProxy;
$js['is_residential_proxy'] = $this->isResidentialProxy;
$js['is_tor_exit_node'] = $this->isTorExitNode;
$js['ip_address'] = $this->ipAddress;
$js['network'] = $this->network;

Expand Down

0 comments on commit 4639bab

Please sign in to comment.