Skip to content

Commit

Permalink
fixed bug on parsing key from url on character API
Browse files Browse the repository at this point in the history
  • Loading branch information
zmaglica committed Oct 14, 2019
1 parent 52fb412 commit eddcc2c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Model/Character.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,20 @@ public function getEpisodes($removeDuplicates = false)
}

/**
* This helper function will extract all URL ids by key. Key can be location, residence or episode
* @param $key
* @param $removeDuplicates
* @param string $key
* @param boolean $removeDuplicates
* @return array
*/
private function extractIdsFromResponseBasedOnKey($key, $removeDuplicates)
{
$ids = [];
$urls = [];
if ($this->info) {
$urls = array_column($this->data['results'], 'location');
$urls = array_column($this->data['results'], $key);
} elseif (isset($this->data[0])) {
$urls = array_column($this->data, 'location');
$urls = array_column($this->data, $key);
} else {
$urls[] = $this->data['location'];
$urls[] = $this->data[$key];
}
$urls = array_column($urls, 'url');
if ($removeDuplicates) {
Expand Down

0 comments on commit eddcc2c

Please sign in to comment.