Skip to content

Commit

Permalink
Updated Resolver code formatting. Closes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
toonvandenbos committed Apr 4, 2019
1 parent f895773 commit 0de6490
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Value/Resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ public function get($resource, $attribute, $layouts)
protected function extractValueFromResource($resource, $attribute)
{
$value = data_get($resource, str_replace('->', '.', $attribute)) ?? [];

if (is_string($value)) $value = json_decode($value) ?? [];
if (!is_array($value)) return []; // Fail silently in case data is invalid

// Fail silently in case data is invalid
if (!is_array($value)) return [];

return array_map(function($item) {
return is_array($item) ? (object) $item : $item;
Expand Down

0 comments on commit 0de6490

Please sign in to comment.