@@ -8,29 +8,26 @@ public function __construct(){}
88 // abstract public function init();
99 // abstract public function draw();
1010 public function getCss () {
11- $ temp = [];
12- foreach ($ this ->requires as $ i )
13- $ temp = array_merge ( $ temp , $ i ->getCss () );
14- foreach ($ this ->dipendence as $ i )
15- if (!is_array ($ i ) && strpos ($ i , '.css ' ) !== FALSE )
16- array_push ($ temp ,$ i );
17- return $ temp ;
11+ return $ this ->getRequire ("getCss " ,".css " );
1812 }
1913 public function getJs () {
14+ return $ this ->getRequire ("getJs " ,".js " );
15+ }
16+ public function getJsVariables () {
2017 $ temp = [];
2118 foreach ($ this ->requires as $ i )
22- $ temp = array_merge ( $ temp , $ i ->getJs () );
19+ $ temp = array_merge ( $ temp , $ i ->getJsVariables () );
2320 foreach ($ this ->dipendence as $ i )
24- if (! is_array ($ i ) && strpos ( $ i , ' .js ' ) !== FALSE )
21+ if (is_array ($ i ))
2522 array_push ($ temp ,$ i );
2623 return $ temp ;
2724 }
28- public function getJsVariables ( ) {
25+ private function getRequire ( $ _function , $ _extenction ) {
2926 $ temp = [];
3027 foreach ($ this ->requires as $ i )
31- $ temp = array_merge ( $ temp , $ i ->getJsVariables () );
28+ $ temp = array_merge ( $ temp , $ i ->$ _function () );
3229 foreach ($ this ->dipendence as $ i )
33- if (is_array ($ i ))
30+ if (! is_array ($ i ) && strpos ( $ i , $ _extenction ) !== FALSE )
3431 array_push ($ temp ,$ i );
3532 return $ temp ;
3633 }
0 commit comments