Passed
Pull Request — master (#332)
by Mateusz
08:33
created

Page::getContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusCmsPlugin\Entity;
14
15
use Sylius\Component\Core\Model\ImageInterface;
16
use Sylius\Component\Resource\Model\TimestampableTrait;
17
use Sylius\Component\Resource\Model\ToggleableTrait;
18
use Sylius\Component\Resource\Model\TranslatableTrait;
19
use Sylius\Component\Resource\Model\TranslationInterface;
20
21
class Page implements PageInterface
22
{
23
    use ToggleableTrait;
24
    use ProductsAwareTrait;
25
    use SectionableTrait;
26
    use TimestampableTrait;
27
    use ChannelsAwareTrait;
28
    use TranslatableTrait {
29
        __construct as protected initializeTranslationsCollection;
30
    }
31
32
    /** @var int */
33
    protected $id;
34
35
    /** @var string */
36
    protected $code;
37
38
    /** @var \DateTimeImmutable|null */
39
    protected $publishAt;
40
41
    public function __construct()
42
    {
43
        $this->initializeProductsCollection();
44
        $this->initializeSectionsCollection();
45
        $this->initializeTranslationsCollection();
46
        $this->initializeChannelsCollection();
47
        $this->initializeChannelsCollection();
48
49
        $this->createdAt = new \DateTime();
50
    }
51
52
    public function getId(): ?int
53
    {
54
        return $this->id;
55
    }
56
57
    public function setId(?int $id): void
58
    {
59
        $this->id = $id;
60
    }
61
62
    public function getCode(): ?string
63
    {
64
        return $this->code;
65
    }
66
67
    public function setCode(?string $code): void
68
    {
69
        $this->code = $code;
70
    }
71
72
    public function getSlug(): ?string
73
    {
74
        return $this->getPageTranslation()->getSlug();
75
    }
76
77
    public function setSlug(?string $slug): void
78
    {
79
        $this->getPageTranslation()->setSlug($slug);
80
    }
81
82
    public function getMetaKeywords(): ?string
83
    {
84
        return $this->getPageTranslation()->getMetaKeywords();
85
    }
86
87
    public function setMetaKeywords(?string $metaKeywords): void
88
    {
89
        $this->getPageTranslation()->setMetaKeywords($metaKeywords);
90
    }
91
92
    public function getMetaDescription(): ?string
93
    {
94
        return $this->getPageTranslation()->getMetaDescription();
95
    }
96
97
    public function setMetaDescription(?string $metaDescription): void
98
    {
99
        $this->getPageTranslation()->setMetaDescription($metaDescription);
100
    }
101
102
    public function getContent(): ?string
103
    {
104
        return $this->getPageTranslation()->getContent();
105
    }
106
107
    public function setContent(?string $content): void
108
    {
109
        $this->getPageTranslation()->setContent($content);
110
    }
111
112
    public function getName(): ?string
113
    {
114
        return $this->getPageTranslation()->getName();
115
    }
116
117
    public function setName(?string $name): void
118
    {
119
        $this->getPageTranslation()->setName($name);
120
    }
121
122
    public function getNameWhenLinked(): ?string
123
    {
124
        return $this->getPageTranslation()->getNameWhenLinked();
125
    }
126
127
    public function setNameWhenLinked(?string $nameWhenLinked): void
128
    {
129
        $this->getPageTranslation()->setNameWhenLinked($nameWhenLinked);
130
    }
131
132
    public function getDescriptionWhenLinked(): ?string
133
    {
134
        return $this->getPageTranslation()->getDescriptionWhenLinked();
135
    }
136
137
    public function setDescriptionWhenLinked(?string $descriptionWhenLinked): void
138
    {
139
        $this->getPageTranslation()->setDescriptionWhenLinked($descriptionWhenLinked);
140
    }
141
142
    public function getBreadcrumb(): ?string
143
    {
144
        return $this->getPageTranslation()->getBreadcrumb();
145
    }
146
147
    public function setBreadcrumb(?string $breadcrumb): void
148
    {
149
        $this->getPageTranslation()->setBreadcrumb($breadcrumb);
150
    }
151
152
    public function getImage(): ?ImageInterface
153
    {
154
        return $this->getPageTranslation()->getImage();
155
    }
156
157
    public function setImage(?ImageInterface $image): void
158
    {
159
        $this->getPageTranslation()->setImage($image);
160
    }
161
162
    public function getTitle(): ?string
163
    {
164
        return $this->getPageTranslation()->getTitle();
165
    }
166
167
    public function setTitle(?string $title): void
168
    {
169
        $this->getPageTranslation()->setTitle($title);
170
    }
171
172
    /**
173
     * @return PageTranslationInterface|TranslationInterface|null
174
     */
175
    protected function getPageTranslation(): PageTranslationInterface
176
    {
177
        return $this->getTranslation();
178
    }
179
180
    protected function createTranslation(): PageTranslationInterface
181
    {
182
        return new PageTranslation();
183
    }
184
185
    public function getPublishAt(): ?\DateTimeImmutable
186
    {
187
        return $this->publishAt;
188
    }
189
190
    public function setPublishAt(?\DateTimeImmutable $publishAt): void
191
    {
192
        $this->publishAt = $publishAt;
193
    }
194
}
195