Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * One Bitcoin equivalent in a given currency.
4 *
5 * @package    brianhenryie/bh-wp-bitcoin-gateway
6 */
7
8namespace BrianHenryIE\WP_Bitcoin_Gateway\API\Clients;
9
10use BrianHenryIE\WP_Bitcoin_Gateway\API\Model\Exceptions\BH_WP_Bitcoin_Gateway_Exception;
11use BrianHenryIE\WP_Bitcoin_Gateway\Brick\Money\Currency;
12use BrianHenryIE\WP_Bitcoin_Gateway\Brick\Money\Exception\UnknownCurrencyException;
13use BrianHenryIE\WP_Bitcoin_Gateway\Brick\Money\Money;
14use JsonException;
15
16interface Exchange_Rate_API_Interface {
17
18    /**
19     * Given a currency, e.g. USD, return the equivalent of 1 BTC in that currency, e.g. $10,000 USD.
20     *
21     * @param Currency $currency FIAT currency (presumably) e.g. USD.
22     *
23     * @return Money Value of one BTC in that currency.
24     *
25     * @throws BH_WP_Bitcoin_Gateway_Exception When the request fails.
26     * @throws UnknownCurrencyException Almost impossible – unless the Money library cannot use a Currency object it created.
27     * @throws JsonException If the API returns malformed JSON.
28     */
29    public function get_exchange_rate( Currency $currency ): Money;
30}