for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Braunstetter\AssetsPushBundle\Twig\TokenParser;
use Braunstetter\AssetsPushBundle\Twig\Nodes\CssNode;
use Twig\Node\Node;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
class CssTokenParser extends AbstractTokenParser
{
/**
* @inheritDoc
*/
public function parse(Token $token): Node|CssNode
$parser = $this->parser;
$stream = $parser->getStream();
$data = null;
// keep collecting strings until the block ends
while (!$stream->test(Token::BLOCK_END_TYPE)) {
$data = $stream->expect(Token::STRING_TYPE)->getValue();
}
$stream->expect(Token::BLOCK_END_TYPE);
return new CssNode($data, $token->getLine(), $this->getTag());
public function getTag(): string
return 'css';