Skip to content

Commit

Permalink
- improved error handling for getUniverseRegions()
Browse files Browse the repository at this point in the history
- improved error handling for `getUniverseRegionData()`
- improved error handling for `getUniverseConstellations()`
- improved error handling for `getUniverseConstellationData()`
- improved error handling for `getUniverseSystems()`
- improved error handling for `getUniverseStarData()`
- improved error handling for `getUniversePlanetData()`
- improved error handling for `getUniverseStargateData()`
  • Loading branch information
exodus4d committed Jun 22, 2018
1 parent d409a6b commit f7bfa31
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app/ESI.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public function getUniverseRegions() : array {
$regionData = [];
$response = $this->request($url, 'GET');

if( !empty($response) ){
if( !$response->error && !empty($response) ){
$regionData = array_unique( array_map('intval', $response) );
}

Expand All @@ -336,7 +336,7 @@ public function getUniverseRegionData(int $regionId) : array {
$regionData = [];
$response = $this->request($url, 'GET');

if( !empty($response) ){
if( !$response->error && !empty($response) ){
$regionData = (new namespace\Mapper\Region($response))->getData();
}

Expand All @@ -351,7 +351,7 @@ public function getUniverseConstellations() : array{
$constellationData = [];
$response = $this->request($url, 'GET');

if( !empty($response) ){
if( !$response->error && !empty($response) ){
$constellationData = array_unique( array_map('intval', $response) );
}

Expand All @@ -367,7 +367,7 @@ public function getUniverseConstellationData(int $constellationId) : array {
$constellationData = [];
$response = $this->request($url, 'GET');

if( !empty($response) ){
if( !$response->error && !empty($response) ){
$constellationData = (new namespace\Mapper\Constellation($response))->getData();
}

Expand All @@ -382,7 +382,7 @@ public function getUniverseSystems() : array{
$systemData = [];
$response = $this->request($url, 'GET');

if( !empty($response) ){
if( !$response->error && !empty($response) ){
$systemData = array_unique( array_map('intval', $response) );
}

Expand Down Expand Up @@ -414,7 +414,7 @@ public function getUniverseStarData(int $starId) : array {
$starData = [];
$response = $this->request($url, 'GET');

if( !empty($response) ){
if( !$response->error && !empty($response) ){
$starData = (new namespace\Mapper\Universe\Star($response))->getData();
if( !empty($starData) ){
$starData['id'] = $starId;
Expand All @@ -433,7 +433,7 @@ public function getUniversePlanetData(int $planetId) : array {
$planetData = [];
$response = $this->request($url, 'GET');

if( !empty($response) ){
if( !$response->error && !empty($response) ){
$planetData = (new namespace\Mapper\Universe\Planet($response))->getData();
}

Expand All @@ -449,7 +449,7 @@ public function getUniverseStargateData(int $stargateId) : array {
$stargateData = [];
$response = $this->request($url, 'GET');

if( !empty($response) ){
if( !$response->error && !empty($response) ){
$stargateData = (new namespace\Mapper\Universe\Stargate($response))->getData();
}

Expand Down

0 comments on commit f7bfa31

Please sign in to comment.