Sh3ll
OdayForums


Server : Apache
System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64
User : tradze ( 1001)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /home/tradze/public_html/vendor/moneyphp/money/resources/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/tradze/public_html/vendor/moneyphp/money/resources/generate-money-factory.php
<?php

require __DIR__.'/../vendor/autoload.php';

use Money\Currencies;

$buffer = <<<PHP
<?php

namespace Money;

/**
 * This is a generated file. Do not edit it manually!
 *
PHPDOC
 */
trait MoneyFactory
{
    /**
     * Convenience factory method for a Money object.
     *
     * <code>
     * \$fiveDollar = Money::USD(500);
     * </code>
     *
     * @param string \$method
     * @param array  \$arguments
     *
     * @return Money
     *
     * @throws \InvalidArgumentException If amount is not integer(ish)
     */
    public static function __callStatic(\$method, \$arguments)
    {
        return new Money(\$arguments[0], new Currency(\$method));
    }
}

PHP;

$methodBuffer = '';

$currencies = new Currencies\AggregateCurrencies([
    new Currencies\ISOCurrencies(),
    new Currencies\BitcoinCurrencies(),
]);

$currencies = iterator_to_array($currencies);

usort($currencies, function (\Money\Currency $a, \Money\Currency $b) {
    return strcmp($a->getCode(), $b->getCode());
});

/** @var \Money\Currency[] $currencies */
foreach ($currencies as $currency) {
    $methodBuffer .= sprintf(" * @method static Money %s(string|int \$amount)\n", $currency->getCode());
}

$buffer = str_replace('PHPDOC', rtrim($methodBuffer), $buffer);

file_put_contents(__DIR__.'/../src/MoneyFactory.php', $buffer);

ZeroDay Forums Mini