Passed
Pull Request — master (#17)
by Joppe
03:41
created

Seo::getOgDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JoppeDc\SyliusBetterSeoPlugin\Entity;
6
7
use Sylius\Component\Resource\Model\ResourceInterface;
8
use Sylius\Component\Resource\Model\TranslatableInterface;
9
use Sylius\Component\Resource\Model\TranslatableTrait;
10
use Sylius\Component\Resource\Model\TranslationInterface;
11
12
class Seo implements TranslatableInterface, ResourceInterface
13
{
14
    use TranslatableTrait {
15
        __construct as private initializeTranslationsCollection;
16
        getTranslation as private doGetTranslation;
17
    }
18
19
    /**
20
     * @var int|null
21
     */
22
    protected $id;
23
24
    public function __construct()
25
    {
26
        $this->initializeTranslationsCollection();
27
    }
28
29
    public function __toString()
30
    {
31
        return (string) $this->getId();
32
    }
33
34
    public function getPageTitle(): ?string
35
    {
36
        return $this->getTranslation()->getPageTitle();
37
    }
38
39
    public function setPageTitle(?string $pageTitle): void
40
    {
41
        $this->getTranslation()->setPageTitle($pageTitle);
42
    }
43
44
    public function getOgTitle(): ?string
45
    {
46
        return $this->getTranslation()->getOgTitle();
47
    }
48
49
    public function setOgTitle(?string $ogTitle): void
50
    {
51
        $this->getTranslation()->setOgTitle($ogTitle);
52
    }
53
54
    public function getOgDescription(): ?string
55
    {
56
        return $this->getTranslation()->getOgDescription();
57
    }
58
59
    public function setOgDescription(?string $ogDescription): void
60
    {
61
        $this->getTranslation()->setOgDescription($ogDescription);
62
    }
63
64
    public function getTwitterTitle(): ?string
65
    {
66
        return $this->getTranslation()->getTwitterTitle();
67
    }
68
69
    public function setTwitterTitle(?string $twitterTitle): void
70
    {
71
        $this->getTranslation()->setTwitterTitle($twitterTitle);
72
    }
73
74
    public function getTwitterDescription(): ?string
75
    {
76
        return $this->getTranslation()->getTwitterDescription();
77
    }
78
79
    public function setTwitterDescription(?string $twitterDescription): void
80
    {
81
        $this->getTranslation()->setTwitterDescription($twitterDescription);
82
    }
83
84
    public function getTwitterSite(): ?string
85
    {
86
        return $this->getTranslation()->getTwitterSite();
87
    }
88
89
    public function setTwitterSite(?string $twitterSite): void
90
    {
91
        $this->getTranslation()->setTwitterSite($twitterSite);
92
    }
93
94
    public function getExtraTags(): ?string
95
    {
96
        return $this->getTranslation()->getExtraTags();
97
    }
98
99
    public function setExtraTags(?string $extraTags): void
100
    {
101
        $this->getTranslation()->setExtraTags($extraTags);
102
    }
103
104
    public function getId()
105
    {
106
        return $this->id;
107
    }
108
109
    public function setId(?int $id): void
110
    {
111
        $this->id = $id;
112
    }
113
114
    public function getImage(): ?SeoImage
115
    {
116
        return $this->getTranslation()->getImage();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getTranslation()->getImage() returns the type JoppeDc\SyliusBetterSeoP...ntity\SeoImageInterface which includes types incompatible with the type-hinted return JoppeDc\SyliusBetterSeoPlugin\Entity\SeoImage|null.
Loading history...
117
    }
118
119
    /**
120
     * @return SeoTranslation
121
     */
122
    public function getTranslation(?string $locale = null): TranslationInterface
123
    {
124
        /** @var SeoTranslation $translation */
125
        $translation = $this->doGetTranslation($locale);
126
127
        return $translation;
128
    }
129
130
    protected function createTranslation(): SeoTranslation
131
    {
132
        return new SeoTranslation();
133
    }
134
}
135