Total Complexity | 8 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
7 | class Style extends AbstractHtmlAttribute implements HtmlAttributeInterface |
||
8 | { |
||
9 | protected string $name = 'style'; |
||
10 | |||
11 | protected array $value = []; |
||
12 | |||
13 | /** |
||
14 | * @return $this |
||
15 | */ |
||
16 | public function set($style, $value): Style |
||
21 | } |
||
22 | |||
23 | public function get($style) |
||
24 | { |
||
25 | return $this->value[$style]; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @return $this |
||
30 | */ |
||
31 | public function remove($style): Style |
||
32 | { |
||
33 | unset($this->value[$style]); |
||
34 | |||
35 | return $this; |
||
36 | } |
||
37 | |||
38 | public function contains($style): bool |
||
39 | { |
||
40 | return isset($this->value[$style]); |
||
41 | } |
||
42 | |||
43 | public function parse(): string |
||
44 | { |
||
45 | $str = ''; |
||
46 | |||
47 | foreach ($this->value as $style => $value) { |
||
48 | $str .= "{$style}: {$value}; "; |
||
49 | } |
||
50 | |||
51 | return rtrim($str, ' '); |
||
52 | } |
||
53 | |||
54 | public function tokenize(string $styles): array |
||
66 | } |
||
67 | } |
||
68 |