| Conditions | 6 |
| Paths | 10 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public static function scripts($context, $return = false) |
||
| 27 | { |
||
| 28 | if ($context instanceof Tpl) { |
||
| 29 | $scripts = $context->getScripts(); |
||
| 30 | } else { |
||
| 31 | $scripts = $context; |
||
| 32 | } |
||
| 33 | |||
| 34 | if (empty($scripts) || !is_array($scripts)) { |
||
| 35 | return; |
||
| 36 | } |
||
| 37 | |||
| 38 | $data = []; |
||
| 39 | |||
| 40 | foreach ($scripts as $script) { |
||
| 41 | $data[] = sprintf('<script src="%s"></script>', $script); |
||
| 42 | } |
||
| 43 | |||
| 44 | if ($return) { |
||
| 45 | return $data; |
||
| 46 | } else { |
||
| 47 | echo implode("\n", $data); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 76 |