1 | <?php |
||
12 | class Tag implements Htmlable, HtmlAttributes |
||
13 | { |
||
14 | use HasAttributes; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $tag; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $contents; |
||
25 | |||
26 | /** |
||
27 | * @param string $tagName |
||
28 | * @param array $attributes |
||
29 | */ |
||
30 | 33 | public function __construct($tagName, $attributes = []) |
|
36 | |||
37 | /** |
||
38 | * @param string $tagName |
||
39 | * @param array $attributes |
||
40 | */ |
||
41 | 6 | public static function make($tagName, $attributes = []) |
|
45 | |||
46 | /** |
||
47 | * @return void |
||
48 | */ |
||
49 | 33 | private function openTag() |
|
55 | |||
56 | /** |
||
57 | * @return void |
||
58 | */ |
||
59 | 27 | private function closeTag() |
|
63 | |||
64 | /** |
||
65 | * @param String $contents |
||
66 | * @return void |
||
67 | */ |
||
68 | 21 | public function add($contents) |
|
74 | |||
75 | /** |
||
76 | * @return void |
||
77 | */ |
||
78 | 33 | public function render() |
|
94 | |||
95 | /** |
||
96 | * @return bool |
||
97 | */ |
||
98 | 33 | protected function isSelfClosingTag() |
|
106 | |||
107 | /** |
||
108 | * Returns the element html as a string |
||
109 | * @return string |
||
110 | */ |
||
111 | 33 | public function toHtml() |
|
120 | |||
121 | /** |
||
122 | * @return string |
||
123 | */ |
||
124 | public function __toString() |
||
128 | } |
||
129 |