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