1515
1616abstract class includeasset extends \Twig_Node
1717{
18- /** @var \Twig_Environment */
19- protected $ environment ;
20-
21- public function __construct (\Twig_Node_Expression $ expr , \phpbb \template \twig \environment $ environment , $ lineno , $ tag = null )
18+ public function __construct (\Twig_Node_Expression $ expr , $ lineno , $ tag = null )
2219 {
23- $ this ->environment = $ environment ;
24-
2520 parent ::__construct (array ('expr ' => $ expr ), array (), $ lineno , $ tag );
2621 }
22+
2723 /**
2824 * Compiles the node to PHP.
2925 *
@@ -33,20 +29,18 @@ public function compile(\Twig_Compiler $compiler)
3329 {
3430 $ compiler ->addDebugInfo ($ this );
3531
36- $ config = $ this ->environment ->get_phpbb_config ();
37-
3832 $ compiler
3933 ->write ("\$asset_file = " )
4034 ->subcompile ($ this ->getNode ('expr ' ))
4135 ->raw ("; \n" )
42- ->write ("\$asset = new \phpbb \\template \\asset( \$asset_file, \$this->getEnvironment() ->get_path_helper(), \$this->getEnvironment() ->get_filesystem()); \n" )
36+ ->write ("\$asset = new \phpbb \\template \\asset( \$asset_file, \$this->env ->get_path_helper(), \$this->env ->get_filesystem()); \n" )
4337 ->write ("if (substr( \$asset_file, 0, 2) !== './' && \$asset->is_relative()) { \n" )
4438 ->indent ()
4539 ->write ("\$asset_path = \$asset->get_path(); " )
46- ->write ("\$local_file = \$this->getEnvironment() ->get_phpbb_root_path() . \$asset_path; \n" )
40+ ->write ("\$local_file = \$this->env ->get_phpbb_root_path() . \$asset_path; \n" )
4741 ->write ("if (!file_exists( \$local_file)) { \n" )
4842 ->indent ()
49- ->write ("\$local_file = \$this->getEnvironment() ->findTemplate( \$asset_path); \n" )
43+ ->write ("\$local_file = \$this->env ->findTemplate( \$asset_path); \n" )
5044 ->write ("\$asset->set_path( \$local_file, true); \n" )
5145 ->outdent ()
5246 ->write ("} \n" )
@@ -55,10 +49,10 @@ public function compile(\Twig_Compiler $compiler)
5549 ->write ("\n" )
5650 ->write ("if ( \$asset->is_relative()) { \n" )
5751 ->indent ()
58- ->write ("\$asset->add_assets_version(' { $ config ['assets_version ' ]} ' ); \n" )
52+ ->write ("\$asset->add_assets_version( \$ this->env->get_phpbb_config() ['assets_version']); \n" )
5953 ->outdent ()
6054 ->write ("} \n" )
61- ->write ("\$this->getEnvironment() ->get_assets_bag()->add_ {$ this ->get_setters_name ()}( \$asset); " )
55+ ->write ("\$this->env ->get_assets_bag()->add_ {$ this ->get_setters_name ()}( \$asset); " )
6256 ;
6357 }
6458
0 commit comments