picea/src/ControlStructure/DefaultToken.php

22 lines
493 B
PHP

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