@@ 7-47 (lines=41) @@ | ||
4 | ||
5 | use Pageon\Html\Meta\MetaItem; |
|
6 | ||
7 | final class ItemPropMeta implements MetaItem |
|
8 | { |
|
9 | /** |
|
10 | * @var string |
|
11 | */ |
|
12 | private $name; |
|
13 | ||
14 | /** |
|
15 | * @var string |
|
16 | */ |
|
17 | private $content; |
|
18 | ||
19 | /** |
|
20 | * @param string $name |
|
21 | * @param string $content |
|
22 | * |
|
23 | * @return MetaItem |
|
24 | */ |
|
25 | public static function create(string $name, string $content) : MetaItem { |
|
26 | return new self($name, $content); |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return string |
|
31 | */ |
|
32 | public function render() : string { |
|
33 | return "<meta itemprop=\"{$this->name}\" content=\"{$this->content}\">"; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * NamedMeta constructor. |
|
38 | * |
|
39 | * @param string $name |
|
40 | * @param string $content |
|
41 | */ |
|
42 | public function __construct(string $name, string $content) { |
|
43 | $this->name = $name; |
|
44 | $this->content = htmlentities($content); |
|
45 | } |
|
46 | ||
47 | } |
|
48 |
@@ 7-47 (lines=41) @@ | ||
4 | ||
5 | use Pageon\Html\Meta\MetaItem; |
|
6 | ||
7 | final class NameMeta implements MetaItem |
|
8 | { |
|
9 | /** |
|
10 | * @var string |
|
11 | */ |
|
12 | private $name; |
|
13 | ||
14 | /** |
|
15 | * @var string |
|
16 | */ |
|
17 | private $content; |
|
18 | ||
19 | /** |
|
20 | * @param string $name |
|
21 | * @param string $content |
|
22 | * |
|
23 | * @return MetaItem |
|
24 | */ |
|
25 | public static function create(string $name, string $content) : MetaItem { |
|
26 | return new self($name, $content); |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return string |
|
31 | */ |
|
32 | public function render() : string { |
|
33 | return "<meta name=\"{$this->name}\" content=\"{$this->content}\">"; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * NamedMeta constructor. |
|
38 | * |
|
39 | * @param string $name |
|
40 | * @param string $content |
|
41 | */ |
|
42 | public function __construct(string $name, string $content) { |
|
43 | $this->name = $name; |
|
44 | $this->content = htmlentities($content); |
|
45 | } |
|
46 | ||
47 | } |
|
48 |
@@ 7-47 (lines=41) @@ | ||
4 | ||
5 | use Pageon\Html\Meta\MetaItem; |
|
6 | ||
7 | final class PropertyMeta implements MetaItem |
|
8 | { |
|
9 | /** |
|
10 | * @var string |
|
11 | */ |
|
12 | private $name; |
|
13 | ||
14 | /** |
|
15 | * @var string |
|
16 | */ |
|
17 | private $content; |
|
18 | ||
19 | /** |
|
20 | * @param string $property |
|
21 | * @param string $content |
|
22 | * |
|
23 | * @return MetaItem |
|
24 | */ |
|
25 | public static function create(string $property, string $content) : MetaItem { |
|
26 | return new self($property, $content); |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return string |
|
31 | */ |
|
32 | public function render() : string { |
|
33 | return "<meta property=\"{$this->name}\" content=\"{$this->content}\">"; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * NamedMeta constructor. |
|
38 | * |
|
39 | * @param string $name |
|
40 | * @param string $content |
|
41 | */ |
|
42 | public function __construct(string $name, string $content) { |
|
43 | $this->name = $name; |
|
44 | $this->content = htmlentities($content); |
|
45 | } |
|
46 | ||
47 | } |
|
48 |