Skip to content

Commit 75d71dc

Browse files
committed
Updating buildFromArray()
1 parent 3edd1e7 commit 75d71dc

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/API/Type.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,19 @@ public function castToExchange($value, $type)
8585

8686
public static function buildFromArray($array)
8787
{
88+
if (!is_array($array)) {
89+
return $array;
90+
}
91+
8892
if (!self::arrayIsAssoc($array)) {
93+
foreach ($array as $key => $value) {
94+
$array[$key] = self::buildFromArray($value);
95+
}
96+
8997
return $array;
9098
}
9199

92-
$object = new self();
100+
$object = new static();
93101
foreach ($array as $key => $value) {
94102
if (is_array($value)) {
95103
$value = self::buildFromArray($value);

0 commit comments

Comments
 (0)