| Total Complexity | 4 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | abstract class AbstractElement extends AbstractHelper |
||
| 19 | { |
||
| 20 | |||
| 21 | |||
| 22 | abstract public function __invoke($tag, $content, array $attr = array()); |
||
| 23 | |||
| 24 | /** |
||
| 25 | * |
||
| 26 | * Returns any kind of complete HTML element with attributes and escaped content. |
||
| 27 | * |
||
| 28 | * @param string $tag The tag to generate. |
||
| 29 | * |
||
| 30 | * @param string $content The element content |
||
| 31 | * |
||
| 32 | * @param array $attr Attributes for the tag. |
||
| 33 | * |
||
| 34 | * @return string |
||
| 35 | * |
||
| 36 | */ |
||
| 37 | protected function escaped($tag, $content, array $attr = array()) |
||
| 38 | { |
||
| 39 | $attr = $this->escaper->attr($attr); |
||
| 40 | $out = $attr ? "<{$tag} $attr>" : "<{$tag}>"; |
||
| 41 | $out .= $this->escaper->html($content); |
||
| 42 | $out .= "</$tag>"; |
||
| 43 | return $out; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * |
||
| 48 | * Returns any kind of complete HTML element with attributes. |
||
| 49 | * |
||
| 50 | * @param string $tag The tag to generate. |
||
| 51 | * |
||
| 52 | * @param string $content The content of the element. |
||
| 53 | * |
||
| 54 | * @param array $attr Attributes for the tag. |
||
| 55 | * |
||
| 56 | * @return string |
||
| 57 | * |
||
| 58 | */ |
||
| 59 | public function raw($tag, $content, array $attr = array()) |
||
| 66 | } |
||
| 67 | } |
||
| 68 |