- Token name and options are now passed through parse() method
This commit is contained in:
1 parent
e9b2f0ece3
commit
b3a8e3aca2
29 files changed
+70
-59
No files matched your search
@@ -10,17 +10,15 @@ class JsonExtension implements Extension, FunctionExtension {
|
||||
|
||||
public int $flags = JSON_HEX_TAG | \JSON_HEX_QUOT | \JSON_THROW_ON_ERROR | \JSON_UNESCAPED_UNICODE;
|
||||
|
||||
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token)
|
||||
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string
|
||||
{
|
||||
$opt = $context->tokenOptions($token);
|
||||
|
||||
$flag = $this->flags;
|
||||
|
||||
if ( in_array('pretty', $opt) ) {
|
||||
if ( in_array('pretty', $options) ) {
|
||||
$flag |= \JSON_PRETTY_PRINT;
|
||||
}
|
||||
|
||||
if ( in_array('html', $opt) ) {
|
||||
if ( in_array('html', $options) ) {
|
||||
return "<?php echo htmlentities(json_encode($arguments, $flag), ENT_QUOTES, 'UTF-8') ?>";
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user