-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurrencyInterface.php
53 lines (46 loc) · 1.26 KB
/
CurrencyInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
declare(strict_types=1);
namespace SonsOfPHP\Contract\Money;
/**
* Currency Interface.
*
* @see https://en.wikipedia.org/wiki/ISO_4217
*
* @author Joshua Estes <joshua@sonsofphp.com>
*/
interface CurrencyInterface
{
/**
* Returns the Alphabetic Code of the currency.
*
* Defined by the ISO-4217 standard
*/
public function getCurrencyCode(): string;
/**
* The Currency's Numeric Code.
*
* Defined by the ISO-4217 standard
*
* @return int|null This may return null if the either does not have one or is unknown
*/
public function getNumericCode(): ?int;
/**
* The Currency's Minor Unit.
*
* Defined by the ISO-4217 standard
*
* “0” means that there is no minor unit for that currency, whereas “1”,
* “2” and “3” signify a ratio of 10:1, 100:1 and 1000:1 respectively.
*
* @return int|null This may return null if the either does not have one or is unknown
*/
public function getMinorUnit(): ?int;
/**
* Compare two currencies to see if they are the same.
*/
public function isEqualTo(self $currency): bool;
/**
* Able to pass in custom queries
*/
public function query(CurrencyQueryInterface $query);
}