Skip to content
Open
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
21 changes: 18 additions & 3 deletions src/Hypermedia/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ public function hasLink(ResponseInterface $response, $id)
return false;
}

return property_exists($this->getLinks($response), $id) ? true : false;
$links = $this->getLinks($links);
if (empty($links)) {
return false;
}

return property_exists($links, $id) ? true : false;
}

/**
Expand Down Expand Up @@ -127,7 +132,12 @@ public function hasEmbed(ResponseInterface $response, $id)
return false;
}

return property_exists($this->getEmbeds($response), $id) ? true : false;
$embeds = $this->getEmbeds($response);
if (empty($embeds)) {
return false;
}

return property_exists($embeds, $id) ? true : false;
}

/**
Expand Down Expand Up @@ -215,7 +225,12 @@ public function getCurie(ResponseInterface $response, $name)
*/
protected function responseHasProperty(ResponseInterface $response, $id)
{
return property_exists($this->parseJsonBody($response), $id);
$body = $this->parseJsonBody($response);
if (empty($body)) {
return false;
}

return property_exists($body, $id);
}

/**
Expand Down