Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
MetadataElement | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
__toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
uniqueKey | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Hyde\Framework\Features\Metadata\Elements; |
6 | |
7 | use Hyde\Framework\Features\Metadata\MetadataElementContract; |
8 | |
9 | use function sprintf; |
10 | use function e; |
11 | |
12 | class MetadataElement implements MetadataElementContract |
13 | { |
14 | protected string $name; |
15 | protected string $content; |
16 | |
17 | public function __construct(string $name, string $content) |
18 | { |
19 | $this->name = $name; |
20 | $this->content = $content; |
21 | } |
22 | |
23 | public function __toString(): string |
24 | { |
25 | return sprintf('<meta name="%s" content="%s">', e($this->name), e($this->content)); |
26 | } |
27 | |
28 | public function uniqueKey(): string |
29 | { |
30 | return $this->name; |
31 | } |
32 | } |