29 lines
748 B
PHP
29 lines
748 B
PHP
<?php
|
|
|
|
namespace Picea\ControlStructure;
|
|
|
|
class EchoToken implements ControlStructure {
|
|
|
|
public array $token = [ "echo", "echo.raw" ];
|
|
|
|
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token) {
|
|
switch($token) {
|
|
case "echo":
|
|
return "<?php \\Picea\\ControlStructure\\EchoToken::echoSafe($arguments) ?>";
|
|
|
|
case "echo.raw":
|
|
return "<?php \\Picea\\ControlStructure\\EchoToken::echoRaw($arguments) ?>";
|
|
}
|
|
}
|
|
|
|
public static function echoRaw($arguments) : string
|
|
{
|
|
return "<?php echo $arguments ?>";
|
|
}
|
|
|
|
public static function echoSafe($arguments) : string
|
|
{
|
|
return "<?php echo $arguments ?>";
|
|
}
|
|
}
|