Total Complexity | 6 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 87.5% |
Changes | 0 |
1 | <?php |
||
18 | class ChangeText implements ContentHandlerInterface |
||
19 | { |
||
20 | /** @var string */ |
||
21 | private $text = ''; |
||
22 | |||
23 | /** |
||
24 | * @param string $qName |
||
25 | * @param array $attributes |
||
26 | */ |
||
27 | 35 | public function startElement(string $qName, array $attributes = []): void |
|
28 | { |
||
29 | 35 | $this->text .= '<' . $qName; |
|
30 | |||
31 | 35 | foreach ($attributes as $attr => $value) { |
|
32 | 31 | $this->text .= \sprintf(' %s="%s"', $attr, $value); |
|
33 | } |
||
34 | |||
35 | 35 | $this->text .= '>'; |
|
36 | 35 | } |
|
37 | |||
38 | /** |
||
39 | * @param string $qName |
||
40 | */ |
||
41 | 35 | public function endElement(string $qName): void |
|
44 | 35 | } |
|
45 | |||
46 | /** |
||
47 | * @param string $chars |
||
48 | */ |
||
49 | 28 | public function characters(string $chars): void |
|
50 | { |
||
51 | 28 | $this->text .= $chars; |
|
52 | 28 | } |
|
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | 33 | public function getText(): string |
|
58 | { |
||
59 | 33 | return $this->text; |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return string |
||
64 | */ |
||
65 | public function __toString(): string |
||
68 | } |
||
69 | } |
||
70 |