public function get()
    {
        if ($this->date) {
            $result = $this->historical($this->date, $this->base, $this->targets);
        } else {
            $result = $this->latest($this->base, $this->targets);
        }

        // Ensure the result object is valid.
        if (!$result instanceof ResultContract) {
            throw new UnexpectedValueException('Invalid result type');
        }

        // Perform conversion if requested.
        if ($this->amount !== 1) {
            $converted = $result->rates;

            foreach ($converted as $key => $value) {
                $converted[$key] = round($this->amount * $value, 2);
            }

            // Attach converted values to results.
            $result->setConverted($converted);
        }

        return $result;
    }
public function get()
    {
        if ($this->date) {
            $result = $this->historical($this->date, $this->base, $this->targets);
        } else {
            $result = $this->latest($this->base, $this->targets);
        }

        // Ensure the result object is valid.
        if (!$result instanceof ResultContract) {
            throw new UnexpectedValueException('Invalid result type');
        }

        // Perform conversion if requested.
        if ($this->amount !== 1) {
            $converted = $result->rates;

            foreach ($converted as $key => $value) {
                $converted[$key] = round($this->amount * $value, 2);
            }

            // Attach converted values to results.
            $result->setConverted($converted);
        }

        return $result;
    }
public function get ( ) { if ( $ this -> date ) { $ result = $ this -> historical ( $ this -> date , $ this -> base , $ this -> targets ) ; } else { $ result = $ this -> latest ( $ this -> base , $ this -> targets ) ; } // Ensure the result object is valid. if ( ! $ result instanceof ResultContract ) { throw new UnexpectedValueException ( 'Invalid result type' ) ; } // Perform conversion if requested. if ( $ this -> amount !== 1 ) { $ converted = $ result -> rates ; foreach ( $ converted as $ key => $ value ) { $ converted [ $ key ] = round ( $ this -> amount * $ value , 2 ) ; } // Attach converted values to results. $ result -> setConverted ( $ converted ) ; } return $ result ; }
Query the API.

@return \Ultraleet\CurrencyRates\Contracts\Result
Query the API .