Files
picea/src/ControlStructure/IfToken.php
T

26 lines
645 B
PHP

<?php
namespace Picea\ControlStructure;
class IfToken implements ControlStructure {
public array $token = [ "if", "else", "elseif", "endif" ];
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string {
switch($token) {
case "if":
return "<?php if ($arguments): ?>";
case "else":
return "<?php else: ?>";
case "elseif":
return "<?php elseif ($arguments): ?>";
case "endif":
return "<?php endif ?>";
}
}
}