Skip to content

Add StateProvCode property #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/IpDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ private function __construct(
private string $continentName,
private string $countryCode,
private string $countryName,
private string $stateProvCode,
private bool $isEuMember,
private string $stateProv,
private string $city,
Expand All @@ -29,6 +30,7 @@ private function __construct(
* ?continentName: string,
* ?countryCode: string,
* ?countryName: string,
* ?stateProvCode: string,
* ?isEuMember: bool,
* ?stateProv: string,
* ?city: string,
Expand All @@ -46,6 +48,7 @@ public static function new(array $data): self
$data['continentName'] ?? '',
$data['countryCode'] ?? '',
$data['countryName'] ?? '',
$data['stateProvCode'] ?? '',
$data['isEuMember'] ?? false,
$data['stateProv'] ?? '',
$data['city'] ?? '',
Expand Down Expand Up @@ -81,16 +84,21 @@ public function getCountryName(): string
return $this->countryName;
}

public function isEuMember(): bool
public function getStateProvCode(): string
{
return $this->isEuMember;
return $this->stateProvCode;
}

public function getStateProv(): string
{
return $this->stateProv;
}

public function isEuMember(): bool
{
return $this->isEuMember;
}

public function getCity(): string
{
return $this->city;
Expand Down
1 change: 1 addition & 0 deletions tests/DbIpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function testFullDetail(): void
self::assertEquals('US', $ipDetails->getCountryCode());
self::assertEquals('États-Unis', $ipDetails->getCountryName());
self::assertEquals('Caroline du Sud', $ipDetails->getStateProv());
self::assertEquals('SC', $ipDetails->getStateProvCode());
self::assertEquals('North Charleston', $ipDetails->getCity());
self::assertEquals('low', $ipDetails->getThreatLevel());
self::assertEquals('AT&T Services', $ipDetails->getIsp());
Expand Down