Passed
Pull Request — master (#360)
by Mateusz
08:07
created

Page::getPublishAt()   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
dl 0
loc 3
rs 10
c 0
b 0
f 0
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\Resource\Model\TimestampableTrait;
16
use Sylius\Component\Resource\Model\ToggleableTrait;
17
use Sylius\Component\Resource\Model\TranslatableTrait;
18
use Sylius\Component\Resource\Model\TranslationInterface;
19
20
class Page implements PageInterface
21
{
22
    use ToggleableTrait;
23
    use ProductsAwareTrait;
24
    use SectionableTrait;
25
    use TimestampableTrait;
26
    use ChannelsAwareTrait;
27
    use TranslatableTrait {
28
        __construct as protected initializeTranslationsCollection;
29
    }
30
31
    /** @var int */
32
    protected $id;
33
34
    /** @var string */
35
    protected $code;
36
37
    /** @var \DateTimeImmutable|null */
38
    protected $publishAt;
39
40
    public function __construct()
41
    {
42
        $this->initializeProductsCollection();
43
        $this->initializeSectionsCollection();
44
        $this->initializeTranslationsCollection();
45
        $this->initializeChannelsCollection();
46
        $this->initializeChannelsCollection();
47
48
        $this->createdAt = new \DateTime();
49
    }
50
51
    public function getId(): ?int
52
    {
53
        return $this->id;
54
    }
55
56
    public function setId(?int $id): void
57
    {
58
        $this->id = $id;
59
    }
60
61
    public function getCode(): ?string
62
    {
63
        return $this->code;
64
    }
65
66
    public function setCode(?string $code): void
67
    {
68
        $this->code = $code;
69
    }
70
71
    public function getSlug(): ?string
72
    {
73
        return $this->getPageTranslation()->getSlug();
74
    }
75
76
    public function setSlug(?string $slug): void
77
    {
78
        $this->getPageTranslation()->setSlug($slug);
79
    }
80
81
    public function getMetaKeywords(): ?string
82
    {
83
        return $this->getPageTranslation()->getMetaKeywords();
84
    }
85
86
    public function setMetaKeywords(?string $metaKeywords): void
87
    {
88
        $this->getPageTranslation()->setMetaKeywords($metaKeywords);
89
    }
90
91
    public function getMetaDescription(): ?string
92
    {
93
        return $this->getPageTranslation()->getMetaDescription();
94
    }
95
96
    public function setMetaDescription(?string $metaDescription): void
97
    {
98
        $this->getPageTranslation()->setMetaDescription($metaDescription);
99
    }
100
101
    public function getContent(): ?string
102
    {
103
        return $this->getPageTranslation()->getContent();
104
    }
105
106
    public function setContent(?string $content): void
107
    {
108
        $this->getPageTranslation()->setContent($content);
109
    }
110
111
    public function getName(): ?string
112
    {
113
        return $this->getPageTranslation()->getName();
114
    }
115
116
    public function setName(?string $name): void
117
    {
118
        $this->getPageTranslation()->setName($name);
119
    }
120
121
    public function getNameWhenLinked(): ?string
122
    {
123
        return $this->getPageTranslation()->getNameWhenLinked();
124
    }
125
126
    public function setNameWhenLinked(?string $nameWhenLinked): void
127
    {
128
        $this->getPageTranslation()->setNameWhenLinked($nameWhenLinked);
129
    }
130
131
    public function getDescriptionWhenLinked(): ?string
132
    {
133
        return $this->getPageTranslation()->getDescriptionWhenLinked();
134
    }
135
136
    public function setDescriptionWhenLinked(?string $descriptionWhenLinked): void
137
    {
138
        $this->getPageTranslation()->setDescriptionWhenLinked($descriptionWhenLinked);
139
    }
140
141
    public function getBreadcrumb(): ?string
142
    {
143
        return $this->getPageTranslation()->getBreadcrumb();
144
    }
145
146
    public function setBreadcrumb(?string $breadcrumb): void
147
    {
148
        $this->getPageTranslation()->setBreadcrumb($breadcrumb);
149
    }
150
151
    public function getImage(): ?MediaInterface
152
    {
153
        return $this->getPageTranslation()->getImage();
154
    }
155
156
    public function setImage(?MediaInterface $image): void
157
    {
158
        $this->getPageTranslation()->setImage($image);
159
    }
160
161
    public function getTitle(): ?string
162
    {
163
        return $this->getPageTranslation()->getTitle();
164
    }
165
166
    public function setTitle(?string $title): void
167
    {
168
        $this->getPageTranslation()->setTitle($title);
169
    }
170
171
    /**
172
     * @return PageTranslationInterface|TranslationInterface
173
     */
174
    protected function getPageTranslation(): PageTranslationInterface
175
    {
176
        return $this->getTranslation();
177
    }
178
179
    protected function createTranslation(): PageTranslationInterface
180
    {
181
        return new PageTranslation();
182
    }
183
184
    public function getPublishAt(): ?\DateTimeImmutable
185
    {
186
        return $this->publishAt;
187
    }
188
189
    public function setPublishAt(?\DateTimeImmutable $publishAt): void
190
    {
191
        $this->publishAt = $publishAt;
192
    }
193
}
194