public function toArray($depth = null) { $result = []; foreach ($this->data as $key => $value) { if ($value instanceof ArrayableInterface) { $result[$key] = $value->toArray($depth); } else { $result[$key] = $value; } } return $result; }