- WIP on DiExtension

This commit is contained in:
Dave M. 2026-07-07 12:23:19 +00:00
parent 1f771b1932
commit 28210836cd

View File

@ -13,15 +13,15 @@ class DiExtension implements Extension, FunctionExtension {
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string
{
if ( $token === 'di:has' ) {
return "<?php echo \$picea->compiler->getExtensionFromToken('$token')->container->has($arguments) ?>";
}
if ( $token === 'di:get' ) {
return "<?php echo \$picea->compiler->getExtensionFromToken('$token')->container->get($arguments) ?>";
}
throw new \InvalidArgumentException("You must use has() or get() method.");
if ( $token === 'di:has' ) {
return "<?php echo \$picea->compiler->getExtensionFromToken('$token')->container->has($arguments) ?>";
}
throw new \InvalidArgumentException("You must use di:get/di:has tokens or di_get()/di_has() methods.");
}
public function exportFunctions(): array