/** * @{inheritdoc} */ public function parse(TokenStream $stream, Token $token) { if ($stream->nextIf($this->name) && $stream->expect('(')) { $out = sprintf("\$this->getDirective('%s')->call(%s)", $this->name, $stream->test('(') ? 'array' . $this->parser->parseExpression() : ''); if ($this->escape) { $out = sprintf("\$this->escape(%s)", $out); } return sprintf("echo(%s)", $out); } }
/** * @{inheritdoc} */ public function parse(TokenStream $stream, Token $token) { if ($stream->nextIf(['trans', 'transchoice']) && $stream->expect('(')) { $out = 'echo ' . ($token->test('trans') ? '__' : '_c'); while (!$stream->test(T_CLOSE_TAG)) { $out .= $this->parser->parseExpression(); } return $out; } }
/** * @{inheritdoc} */ public function parse(TokenStream $stream, Token $token) { if ($stream->nextIf('raw') && $stream->expect('(')) { $out = 'echo'; while (!$stream->test(T_CLOSE_TAG)) { $out .= $this->parser->parseExpression(); } return $out; } }
/** * @{inheritdoc} */ public function parse(TokenStream $stream, Token $token) { $control = in_array($token->getType(), $this->control); if ($control || in_array($token->getType(), $this->controlEnd)) { $out = ''; while (!$stream->test(T_CLOSE_TAG)) { $out .= $this->parser->parseExpression(); } if ($control) { $out .= ':'; } return $out; } }