1 | <?php |
||
9 | class Html { |
||
10 | |||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $tag = ''; |
||
15 | |||
16 | /** |
||
17 | * @var null|string |
||
18 | */ |
||
19 | protected $content = null; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $attributes = []; |
||
25 | |||
26 | |||
27 | /** |
||
28 | * @return string |
||
29 | */ |
||
30 | public function __toString() { |
||
33 | |||
34 | |||
35 | /** |
||
36 | * @param string $className |
||
37 | * @return $this |
||
38 | */ |
||
39 | public function addClass($className) { |
||
50 | |||
51 | |||
52 | /** |
||
53 | * @param array $attributes |
||
54 | * @return string |
||
55 | */ |
||
56 | public static function renderAttributes(array $attributes = []) { |
||
63 | |||
64 | |||
65 | /** |
||
66 | * |
||
67 | * @param string $tag |
||
68 | * @param array $attributes |
||
69 | * @param string|null $content |
||
70 | * @return string |
||
71 | */ |
||
72 | public static function tag($tag, array $attributes = [], $content = null) { |
||
83 | |||
84 | |||
85 | /** |
||
86 | * @return array |
||
87 | */ |
||
88 | public function getAttributes() { |
||
91 | |||
92 | |||
93 | /** |
||
94 | * @param array $attributes |
||
95 | * @return $this |
||
96 | */ |
||
97 | public function setAttributes(array $attributes) { |
||
103 | |||
104 | |||
105 | /** |
||
106 | * Add multiple attributes |
||
107 | * |
||
108 | * @param array $attributes |
||
109 | * @return $this |
||
110 | */ |
||
111 | public function addAttributes(array $attributes) { |
||
115 | |||
116 | |||
117 | /** |
||
118 | * @param string $name |
||
119 | * @param string $value |
||
120 | * @return $this |
||
121 | */ |
||
122 | public function setAttribute($name, $value) { |
||
126 | |||
127 | |||
128 | /** |
||
129 | * @param string $name |
||
130 | * @return $this |
||
131 | */ |
||
132 | public function removeAttribute($name) { |
||
136 | |||
137 | |||
138 | /** |
||
139 | * @param string $name Attribute name |
||
140 | * @return string|null |
||
141 | */ |
||
142 | public function getAttribute($name) { |
||
145 | |||
146 | |||
147 | /** |
||
148 | * @return string |
||
149 | */ |
||
150 | public function render() { |
||
153 | |||
154 | |||
155 | /** |
||
156 | * @return null|string |
||
157 | */ |
||
158 | public function getContent() { |
||
161 | |||
162 | |||
163 | /** |
||
164 | * @return string |
||
165 | */ |
||
166 | public function getTag() { |
||
169 | |||
170 | |||
171 | /** |
||
172 | * @param string $tag |
||
173 | * @return $this |
||
174 | */ |
||
175 | public function setTag($tag) { |
||
182 | |||
183 | } |