Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Adds extra normalization steps to prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 26, 2016
1 parent 66deadd commit 942b8d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Preparable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ protected function prepare($data, array $params)
$key = $param['key'];
$property = $param['property'];

$array[$property] = isset($data->$key) && !is_null($data->$key) ? $data->$key : null;
if (is_array($data)) {
$array[$property] = isset($data[$key]) && !is_null($data[$key]) ? $data[$key] : null;
} else {
$array[$property] = isset($data->$key) && !is_null($data->$key) ? $data->$key : null;
}

if (isset($param['cast'])) {
switch ($param['cast']) {
Expand Down

0 comments on commit 942b8d0

Please sign in to comment.