| Conditions | 7 |
| Paths | 6 |
| Total Lines | 22 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public static function el($tag, $attributes = [], $body = '', $noCloseTag = false) { |
||
| 23 | $html = "<{$tag}"; |
||
| 24 | if (!empty($attributes) && is_array($attributes)) { |
||
| 25 | foreach ($attributes as $key => $value) { |
||
| 26 | $html .= " {$key} = '"; |
||
| 27 | if (!is_array($value)) { |
||
| 28 | $html .= addcslashes($value, "'"); |
||
| 29 | } else { |
||
| 30 | $html .= json_encode($value); |
||
| 31 | } |
||
| 32 | $html .= "'"; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | if ($noCloseTag === null) { |
||
| 36 | $html .= ' />'; |
||
| 37 | } elseif ($noCloseTag === false) { |
||
| 38 | $html .= ">{$body}</{$tag}>"; |
||
| 39 | } else { |
||
| 40 | $html .= ">{$body}"; |
||
| 41 | } |
||
| 42 | return $html; |
||
| 43 | } |
||
| 44 | |||
| 46 |