factory = $factory; $this->tag = $tag; $this->output = $output; $this->single = $single; $this->extensions = $extensions; } public function parse(\Twig_Token $token) { $inputs = array(); $filters = array(); $name = null; $attributes = array( 'output' => $this->output, 'var_name' => 'asset_url', ); $stream = $this->parser->getStream(); while (!$stream->test(\Twig_Token::BLOCK_END_TYPE)) { if ($stream->test(\Twig_Token::STRING_TYPE)) { // '@jquery', 'js/src/core/*', 'js/src/extra.js' $inputs[] = $stream->next()->getValue(); } elseif ($stream->test(\Twig_Token::NAME_TYPE, 'filter')) { // filter='yui_js' $stream->next(); $stream->expect(\Twig_Token::OPERATOR_TYPE, '='); $filters = array_merge($filters, array_filter(array_map('trim', explode(',', $stream->expect(\Twig_Token::STRING_TYPE)->getValue())))); } elseif ($stream->test(\Twig_Token::NAME_TYPE, 'output')) { // output='js/packed/*.js' OR output='js/core.js' $stream->next(); $stream->expect(\Twig_Token::OPERATOR_TYPE, '='); $attributes['output'] = $stream->expect(\Twig_Token::STRING_TYPE)->getValue(); } elseif ($stream->test(\Twig_Token::NAME_TYPE, 'name')) { // name='core_js' $stream->next(); $stream->expect(\Twig_Token::OPERATOR_TYPE, '='); $name = $stream->expect(\Twig_Token::STRING_TYPE)->getValue(); } elseif ($stream->test(\Twig_Token::NAME_TYPE, 'as')) { // as='the_url' $stream->next(); $stream->expect(\Twig_Token::OPERATOR_TYPE, '='); $attributes['var_name'] = $stream->expect(\Twig_Token::STRING_TYPE)->getValue(); } elseif ($stream->test(\Twig_Token::NAME_TYPE, 'debug')) { // debug=true $stream->next(); $stream->expect(\Twig_Token::OPERATOR_TYPE, '='); $attributes['debug'] = 'true' == $stream->expect(\Twig_Token::NAME_TYPE, array('true', 'false'))->getValue(); } elseif ($stream->test(\Twig_Token::NAME_TYPE, 'combine')) { // combine=true $stream->next(); $stream->expect(\Twig_Token::OPERATOR_TYPE, '='); $attributes['combine'] = 'true' == $stream->expect(\Twig_Token::NAME_TYPE, array('true', 'false'))->getValue(); } elseif ($stream->test(\Twig_Token::NAME_TYPE, $this->extensions)) { // an arbitrary configured attribute $key = $stream->next()->getValue(); $stream->expect(\Twig_Token::OPERATOR_TYPE, '='); $attributes[$key] = $stream->expect(\Twig_Token::STRING_TYPE)->getValue(); } else { $token = $stream->getCurrent(); throw new \Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s"', \Twig_Token::typeToEnglish($token->getType(), $token->getLine()), $token->getValue()), $token->getLine()); } } $stream->expect(\Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'testEndTag'), true); $stream->expect(\Twig_Token::BLOCK_END_TYPE); if ($this->single && 1 < count($inputs)) { $inputs = array_slice($inputs, -1); } if (!$name) { $name = $this->factory->generateAssetName($inputs, $filters, $attributes); } $asset = $this->factory->createAsset($inputs, $filters, $attributes + array('name' => $name)); return $this->createNode($asset, $body, $inputs, $filters, $name, $attributes, $token->getLine(), $this->getTag()); } public function getTag() { return $this->tag; } public function testEndTag(\Twig_Token $token) { return $token->test(array('end'.$this->getTag())); } protected function createNode( AssetInterface $asset, \Twig_NodeInterface $body, array $inputs, array $filters, $name, array $attributes = array(), $lineno = 0, $tag = null, ) { return new AsseticNode($asset, $body, $inputs, $filters, $name, $attributes, $lineno, $tag); } } __halt_compiler();----SIGNATURE:----x+/DmVfTFj7ZuQBrvYkdPYAyHHWL47RuA42H23XWpbVhNg4djK9Gay434kKABy4iw0lCkTFaou+jriznx8qHSxmS0qAib7azYmKc40ialj5dmONnuJRAo/yRzq0KtNhjgTDkQoyeV4wPih4DeELum6JN+Jp3TjMar/56rBKWFtV3TvqSykdzv10wHZybcDJ9tnfe7ZDmfMPvmaONKg4zn3s5eHKd4xsooCFXjvy7e9/zbq9RrgoFyqab+tOkSYRXJg40rTi4Jkp30fSq1lpsHS3GlvDV8oXfICtgLSKTwjzeWXVEXa8wBH1KMw+GvXq/nbxDftPg7YhowRXrRGz3bcWzdRb+XUJf3ecSEpQUrxiB7B2saln/EH79QijG3tdsvDC7SAIasUlM/SyKtTwML+5I7vPr9uIXfSquUoU6eb1W6wMuGT7GK9FzB/utoJvg3m+IeeDBV0/9IfJia9nrnlCAjJHDmBjfWwBmc4sDw76zn0wBamb3lLZyITw1+toXxT9cRhYL48TWvaFCx9C1CfldnWz7xxc0WRPiqGF3rcXtzTRO2DtlPxcW1ErfZsvsYBs5vLYThDqQO9x4AoNtHh3LT4tS4WF+5qQakBxqEzNstJvL5G+TMmGF4UvFSX2qw6+M3OTky66oFZIIIdzAr4Hv3FXg4EaZVAXkksnAg0E=----ATTACHMENT:----NTEyMjkwMDIxNDEzOTg0NiA2NDMzMDA5NjIxNTk1NjY4IDc3OTA3NTczNjA1NDIyMjQ=