| @@ 8-33 (lines=26) @@ | ||
| 5 | use Pageon\Html\Meta\Meta; |
|
| 6 | use Pageon\Html\Meta\SocialMeta; |
|
| 7 | ||
| 8 | final class GooglePlusMeta implements SocialMeta |
|
| 9 | { |
|
| 10 | private $meta; |
|
| 11 | ||
| 12 | public function __construct(Meta $meta, string $type = 'article') { |
|
| 13 | $this->meta = $meta; |
|
| 14 | } |
|
| 15 | ||
| 16 | public function title(string $title) : SocialMeta { |
|
| 17 | $this->meta->itemprop('name', $title); |
|
| 18 | ||
| 19 | return $this; |
|
| 20 | } |
|
| 21 | ||
| 22 | public function description(string $description) : SocialMeta { |
|
| 23 | $this->meta->itemprop('description', $description); |
|
| 24 | ||
| 25 | return $this; |
|
| 26 | } |
|
| 27 | ||
| 28 | public function image(string $image) : SocialMeta { |
|
| 29 | $this->meta->itemprop('image', $image); |
|
| 30 | ||
| 31 | return $this; |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||
| @@ 8-35 (lines=28) @@ | ||
| 5 | use Pageon\Html\Meta\Meta; |
|
| 6 | use Pageon\Html\Meta\SocialMeta; |
|
| 7 | ||
| 8 | final class OpenGraphMeta implements SocialMeta |
|
| 9 | { |
|
| 10 | private $meta; |
|
| 11 | ||
| 12 | public function __construct(Meta $meta, string $type = 'article') { |
|
| 13 | $this->meta = $meta; |
|
| 14 | ||
| 15 | $this->meta->property('og:type', $type); |
|
| 16 | } |
|
| 17 | ||
| 18 | public function title(string $title) : SocialMeta { |
|
| 19 | $this->meta->property('og:title', $title); |
|
| 20 | ||
| 21 | return $this; |
|
| 22 | } |
|
| 23 | ||
| 24 | public function description(string $description) : SocialMeta { |
|
| 25 | $this->meta->property('og:description', $description); |
|
| 26 | ||
| 27 | return $this; |
|
| 28 | } |
|
| 29 | ||
| 30 | public function image(string $image) : SocialMeta { |
|
| 31 | $this->meta->property('og:image', $image); |
|
| 32 | ||
| 33 | return $this; |
|
| 34 | } |
|
| 35 | } |
|
| 36 | ||