Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public static function tag(string $name, ?string $value = null, array|string $properties = []): string |
||
22 | { |
||
23 | if (is_array($properties)) { |
||
|
|||
24 | $propertiesTransformed = []; |
||
25 | foreach ($properties as $key => $property) { |
||
26 | $propertiesTransformed[] = $key . '="' . $property . '"'; |
||
27 | } |
||
28 | $properties = implode(' ', $propertiesTransformed); |
||
29 | } |
||
30 | $tag = self::OPEN_TAG . $name . ' ' . $properties . self::END_TAG; |
||
31 | if ($value !== null) { |
||
32 | $tag .= $value . self::VALUE_OPEN_END_TAG . $name . self::END_TAG; |
||
33 | } |
||
34 | return $tag; |
||
35 | } |
||
37 | } |