- Added a new Picea extension

This commit is contained in:
Dave M. 2022-11-24 19:56:20 +00:00
parent 2845badd40
commit b3936aa6e1
1 changed files with 33 additions and 0 deletions

33
src/Picea/Extension.php Normal file
View File

@ -0,0 +1,33 @@
<?php
namespace Taxus\Picea;
use Picea\Compiler\Context;
use Taxus\Taxus;
class Extension implements \Picea\Extension\Extension
{
protected Taxus $taxus;
public function __construct(Context $context, Taxus $taxus)
{
$this->register($context);
$this->taxus = $taxus;
}
public function register(Context $context) : void
{
$context->pushFunction("taxus", [ $this, 'taxus' ]);
}
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
return "";
}
public function taxus(string $name, ...$arguments) : bool
{
return $this->taxus->granted($name, ...$arguments);
}
}