Newer
Older
<?php
namespace QUI\ERP\Currency;
use QUI;
/**
* Interface CurrencyInterface
*
* Interface for all currencies.
*/
interface CurrencyInterface
{
/**
* Get title of the type of this currency.
*
* @param QUI\Locale|null $Locale
* @return string
*/
public static function getCurrencyTypeTitle(null|QUI\Locale $Locale = null): string;
/**
* Get internal identifier of the currency type.
*
* @return string
*/
public static function getCurrencyType(): string;
/**
* If the currency type has extra settings, use this form to set them.
*
* @return string|null
*/
public static function getExtraSettingsFormHtml(): ?string;
/**
* Currency constructor.
*
* @param array $data
* @param QUI\Locale|null $Locale - Locale for the currency
*/
public function __construct(array $data, null|QUI\Locale $Locale = null);
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* Set the locale for the currency
*
* @param QUI\Locale $Locale
*/
public function setLocale(QUI\Locale $Locale);
/**
* Return the currency code
*
* @return string
*/
public function getCode(): string;
/**
* Return the currency text
*
* @return string
*/
public function getText(): string;
/**
* Return the currency text
*
* @return string
*/
public function getSign(): string;
/**
* @return int
*/
public function getPrecision(): int;
/**
* Return the currency data
*
* @return array
*/
public function toArray(): array;
/**
* Return the float amount for the currency
* example for the most currencies -> 0.11223 = 0.11
*
* @param float|string $amount
* @param null|QUI\Locale $Locale -optional
* @return float
*/
public function amount($amount, null|QUI\Locale $Locale = null): float;
/**
* Format an amount
*
* @param float|string $amount
* @param null|QUI\Locale $Locale - optional, locale object
* @return string
*/
public function format($amount, null|QUI\Locale $Locale = null): string;
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**
* updates the currency itself?
*
* @return boolean
*/
public function autoupdate(): bool;
/**
* Convert the amount to the wanted currency
*
* @param float|string $amount
* @param string|Currency $Currency
* @return float
*
* @throws QUI\Exception
*/
public function convert($amount, $Currency);
/**
*
* @param float|string $amount
* @param string|Currency $Currency
* @return string
*
* @throws QUI\Exception
*/
public function convertFormat($amount, $Currency): string;
/**
* Return the exchange rate to the EUR
*
* @param boolean|string|Currency $Currency - optional, default = false -> return own exchange rate
* @return float|boolean
*/
public function getExchangeRate($Currency = false);
/**
* Set the exchange rate
* if you want to save it to the currency, use ->update()
*
* @param float|integer $rate
*/
public function setExchangeRate($rate);
/**
* Get all custom data.
*
* @return array
*/
public function getCustomData(): array;
/**
* Set specific custom data entry.
*
* @param string $key
* @param $value
* @return mixed
*/
public function setCustomDataEntry(string $key, $value);
/**
* Get specific custom data entry.
*
* @param string $key
* @return mixed
*/
public function getCustomDataEntry(string $key);
}