Skip to content

Commit

Permalink
Updating buildFromArray()
Browse files Browse the repository at this point in the history
  • Loading branch information
Garethp committed Jul 22, 2015
1 parent 3edd1e7 commit 75d71dc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/API/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,19 @@ public function castToExchange($value, $type)

public static function buildFromArray($array)
{
if (!is_array($array)) {
return $array;
}

if (!self::arrayIsAssoc($array)) {
foreach ($array as $key => $value) {
$array[$key] = self::buildFromArray($value);
}

return $array;
}

$object = new self();
$object = new static();
foreach ($array as $key => $value) {
if (is_array($value)) {
$value = self::buildFromArray($value);
Expand Down

0 comments on commit 75d71dc

Please sign in to comment.