Skip to content

Commit

Permalink
fix: array can be nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
YellowPhoenix18 committed Feb 22, 2021
1 parent a048153 commit d6cf248
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "syntaxphoenix/bgpview-php",
"version": "0.0.3",
"version": "0.0.4",
"type": "framework",
"autoload": {
"psr-4": {
Expand Down
18 changes: 9 additions & 9 deletions src/BGPView.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,47 @@ public function __construct(string $baseUrl, float $requestTimeout = 0.4, bool $
]);
}

public function getAsnDetails(int $asNumber): array
public function getAsnDetails(int $asNumber): ?array
{
return $this->getDataByApi('asn/' . $asNumber)['data'];
}

public function getAsnPrefixes(int $asNumber): array
public function getAsnPrefixes(int $asNumber): ?array
{
return $this->getDataByApi('asn/' . $asNumber . '/prefixes')['data'];
}

public function getAsnPeers(int $asNumber): array
public function getAsnPeers(int $asNumber): ?array
{
return $this->getDataByApi('asn/' . $asNumber . '/peers')['data'];
}

public function getAsnUpstreams(int $asNumber): array
public function getAsnUpstreams(int $asNumber): ?array
{
return $this->getDataByApi('asn/' . $asNumber . '/upstreams')['data'];
}

public function getAsnDownstreams(int $asNumber): array
public function getAsnDownstreams(int $asNumber): ?array
{
return $this->getDataByApi('asn/' . $asNumber . '/downstreams')['data'];
}

public function getPrefix(string $ipAddress, int $cidr): array
public function getPrefix(string $ipAddress, int $cidr): ?array
{
return $this->getDataByApi('prefix/' . $ipAddress . '/' . $cidr)['data'];
}

public function getIPDetails(string $ipAddress): array
public function getIPDetails(string $ipAddress): ?array
{
return $this->getDataByApi('ip/' . $ipAddress)['data'];
}

public function getIXDetails(int $ixId): array
public function getIXDetails(int $ixId): ?array
{
return $this->getDataByApi('ix/' . $ixId)['data'];
}

private function getDataByApi(string $urlPart): array
private function getDataByApi(string $urlPart): ?array
{
if ($this->caching) {
$response = $this->cache->load($urlPart);
Expand Down

0 comments on commit d6cf248

Please sign in to comment.