picea/src/ControlStructure/DefaultToken.php

22 lines
452 B
PHP

<?php
namespace Picea\ControlStructure;
class DefaultToken implements ControlStructure {
public string $token = "default";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
$output = "";
if ( $context->switchStack ) {
array_pop($context->switchStack);
}
else {
$output = "<?php ";
}
return ( $output ?? "" ) . "default: ?>";
}
}