public static function defineMoneyMarshaller() { self::$moneyMarshaller = newinstance(TypeMarshaller::class, [], ['marshal' => function ($money, $marshalling = null) { $amount = $money->amount(); return sprintf('%.2f %s', is_object($amount) ? $amount->doubleValue() : $amount, $money->currency()->name()); }, 'unmarshal' => function (\lang\Type $t, $input, $marshalling = null) { sscanf($input, '%f %s', $amount, $currency); return $t->newInstance($amount, \util\Currency::getInstance($currency)); }]); }
public function get_instance_nonexistant() { Currency::getInstance('@@not-a-currency@@'); }