private function convert($input): Rates
    {
        $rates = new Rates();
        $rates->timestamp = time();
        $rates->date = $this->date;
        $rates->base = 'USD';
        $rates->rates = [];
        $this->url = $this->url;

        $data = json_decode($input, true);

        if (!empty($data)) {
            if (isset($data['success'])) {
                if ($data['success']) {
                    $rates->extra['cl_timestamp'] = $data['timestamp'] ?? null;
                    $newrates = [];
                    if (isset($data['quotes']) and is_array($data['quotes'])) {
                        foreach ($data['quotes'] as $key => $row) {
                            if ($key === "$rates->base$rates->base") {
                                $key = $rates->base;
                            } else {
                                $key = str_replace($rates->base, '', $key);
                            }
                            $newrates[$key] = round($row, 5);
                        }
                    }
                }
            }
            if (isset($data['error'])) {
                $rates->extra['cl_error'] = $data['error'] ?? null;
            }
        }
        else {
            $rates->error = "No data in response from Currency Layer.";
        }

        if (!empty($newrates)) {
            $rates->rates = $newrates;
        }

        return $rates;
    }