PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.7
Booking for Appointments and Events Calendar – Amelia v2.4.7
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / moneyphp / money / resources / generate-money-factory.php
ameliabooking / vendor / moneyphp / money / resources Last commit date
currency.php 6 years ago generate-money-factory.php 7 years ago
generate-money-factory.php
62 lines
1 <?php
2
3 require __DIR__.'/../vendor/autoload.php';
4
5 use Money\Currencies;
6
7 $buffer = <<<PHP
8 <?php
9
10 namespace Money;
11
12 /**
13 * This is a generated file. Do not edit it manually!
14 *
15 PHPDOC
16 */
17 trait MoneyFactory
18 {
19 /**
20 * Convenience factory method for a Money object.
21 *
22 * <code>
23 * \$fiveDollar = Money::USD(500);
24 * </code>
25 *
26 * @param string \$method
27 * @param array \$arguments
28 *
29 * @return Money
30 *
31 * @throws \InvalidArgumentException If amount is not integer(ish)
32 */
33 public static function __callStatic(\$method, \$arguments)
34 {
35 return new Money(\$arguments[0], new Currency(\$method));
36 }
37 }
38
39 PHP;
40
41 $methodBuffer = '';
42
43 $currencies = new Currencies\AggregateCurrencies([
44 new Currencies\ISOCurrencies(),
45 new Currencies\BitcoinCurrencies(),
46 ]);
47
48 $currencies = iterator_to_array($currencies);
49
50 usort($currencies, function (\Money\Currency $a, \Money\Currency $b) {
51 return strcmp($a->getCode(), $b->getCode());
52 });
53
54 /** @var \Money\Currency[] $currencies */
55 foreach ($currencies as $currency) {
56 $methodBuffer .= sprintf(" * @method static Money %s(string|int \$amount)\n", $currency->getCode());
57 }
58
59 $buffer = str_replace('PHPDOC', rtrim($methodBuffer), $buffer);
60
61 file_put_contents(__DIR__.'/../src/MoneyFactory.php', $buffer);
62