- WIP on DiExtension
This commit is contained in:
parent
1f771b1932
commit
28210836cd
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user