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

        $data = json_decode($input, true);

        if (!empty($data)) {
            if (!empty($data['rates'])) {
                $rates->extra['fixer_date'] = $data['date'] ?? null;
                foreach ($data['rates'] as $key => $row) {
                    $rates->rates[$key] = $row;
                }
                //add 1:1 conversion rate from base for testing
                $rates->rates[$data['base']] = 1;
            }
        }
        else {
            $rates->error = "No data in response from Fixer.io";
        }

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

        $data = json_decode($input, true);

        if (!empty($data)) {
            if (!empty($data['rates'])) {
                $rates->extra['fixer_date'] = $data['date'] ?? null;
                foreach ($data['rates'] as $key => $row) {
                    $rates->rates[$key] = $row;
                }
                //add 1:1 conversion rate from base for testing
                $rates->rates[$data['base']] = 1;
            }
        }
        else {
            $rates->error = "No data in response from Fixer.io";
        }

        return $rates;
    }
private function convert ( $ input ) : Rates { $ rates = new Rates ( ) ; $ rates -> timestamp = time ( ) ; $ rates -> date = $ this -> date ; $ rates -> base = 'EUR' ; $ rates -> rates = [ ] ; $ rates -> url = $ this -> url ; $ data = json_decode ( $ input , true ) ; if ( ! empty ( $ data ) ) { if ( ! empty ( $ data [ 'rates' ] ) ) { $ rates -> extra [ 'fixer_date' ] = $ data [ 'date' ] ?? null ; foreach ( $ data [ 'rates' ] as $ key => $ row ) { $ rates -> rates [ $ key ] = $ row ; } //add 1:1 conversion rate from base for testing $ rates -> rates [ $ data [ 'base' ] ] = 1 ; } } else { $ rates -> error = "No data in response from Fixer.io" ; } return $ rates ; }
Convert data from fixer.io to standardized format.

@param string $input
@return Rates
Convert data from fixer . io to standardized format .