diff --git a/src/Responses/ItemPricing.php b/src/Responses/ItemPricing.php index 9564267..94cee43 100644 --- a/src/Responses/ItemPricing.php +++ b/src/Responses/ItemPricing.php @@ -28,15 +28,16 @@ private function decodeResponse($response) private function completeData($data) { - return [ - 'success' => $data['success'], - 'volume' => $data['volume'], + if (array_key_exists('lowest_price', $data)) { + $data['lowest_price_text'] = $data['lowest_price']; + $data['lowest_price'] = Mixins::toFloat($data['lowest_price']); + } - 'lowest_price' => Mixins::toFloat($data['lowest_price']), - 'lowest_price_text' => $data['lowest_price'], + if (array_key_exists('median_price', $data)) { + $data['median_price_text'] = $data['median_price']; + $data['median_price'] = Mixins::toFloat($data['median_price']); + } - 'median_price' => Mixins::toFloat($data['median_price']), - 'median_price_text' => $data['median_price'] - ]; + return $data; } } \ No newline at end of file