| Total Complexity | 4 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | final class Node |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Contains node name. |
||
| 23 | * |
||
| 24 | * @var string tag |
||
| 25 | */ |
||
| 26 | private $tag; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Contains content of node. |
||
| 30 | * |
||
| 31 | * @var string |
||
| 32 | */ |
||
| 33 | private $content; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Create a new instance of Node. |
||
| 37 | * |
||
| 38 | * @param string $tag |
||
| 39 | * @param string $content |
||
| 40 | */ |
||
| 41 | 5 | public function __construct(string $tag, string $content) |
|
| 42 | { |
||
| 43 | 5 | $this->tag = $tag; |
|
| 44 | 5 | $this->content = $this->cleanContent($content); |
|
| 45 | 5 | } |
|
| 46 | |||
| 47 | /** |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | 5 | public function getTag(): string |
|
| 51 | { |
||
| 52 | 5 | return $this->tag; |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return string |
||
| 57 | */ |
||
| 58 | 5 | public function getContent(): string |
|
| 59 | { |
||
| 60 | 5 | return $this->content; |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Cleans the given content removing spaces. |
||
| 65 | * |
||
| 66 | * @param string $content |
||
| 67 | * |
||
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | 5 | private function cleanContent(string $content): string |
|
| 73 | } |
||
| 74 | } |
||
| 75 |