- Some more documentation made / fixed

This commit is contained in:
mcndave committed 2022-12-22 14:35:26 +00:00
1 parent 46535c2734
commit 58f73d914b
9 files changed
+49 -41

No files matched your search

+7 -6
View File
@@ -4,7 +4,7 @@ namespace Picea\Extension;
use Picea\Compiler\Context;
class MoneyExtension implements Extension {
class MoneyExtension implements Extension, FunctionExtension {
public string $token = "money";
@@ -14,17 +14,18 @@ class MoneyExtension implements Extension {
public \NumberFormatter $formatter;
public function __construct(Context $context) {
$this->register($context);
public function __construct() {
$this->locale = explode('.', \Locale::getDefault())[0];
$this->formatter = new \NumberFormatter($this->locale, \NumberFormatter::CURRENCY);
}
public function register(Context $context) : void
public function exportFunctions(): array
{
$context->pushFunction("money", [ $this, 'money' ]);
return [
"money" => [ $this, 'money' ]
];
}
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token) {
return "<?php echo money($arguments) ?>";
}