GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 1b1689...78d303 )
by
unknown
09:54
created

Banner::getImageFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusBannerPlugin\Entity;
6
7
use Doctrine\Common\Collections\ArrayCollection;
8
use Doctrine\Common\Collections\Collection;
9
use Sylius\Component\Channel\Model\ChannelInterface;
10
use Sylius\Component\Resource\Model\TimestampableTrait;
11
use Sylius\Component\Resource\Model\ToggleableTrait;
12
use Sylius\Component\Resource\Model\TranslatableTrait;
13
use Sylius\Component\Resource\Model\TranslationInterface;
14
use Sylius\Component\Taxonomy\Model\TaxonInterface;
15
use Symfony\Component\HttpFoundation\File\File;
16
17
class Banner implements BannerInterface
18
{
19
    use TranslatableTrait {
20
        __construct as private initializeTranslationsCollection;
21
        getTranslation as private doGetTranslation;
22
    }
23
    use TimestampableTrait;
24
    use ToggleableTrait;
25
26
    /** @var int|null */
27
    private $id;
28
29
    /** @var string|null */
30
    private $code;
31
32
    /** @var ArrayCollection|ChannelInterface[] */
33
    private $channels;
34
35
    /** @var ArrayCollection|TaxonInterface[] */
36
    private $taxons;
37
38
    public function __construct()
39
    {
40
        $this->initializeTranslationsCollection();
41
42
        $this->channels = new ArrayCollection();
43
        $this->taxons = new ArrayCollection();
44
        $this->createdAt = new \DateTime();
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getId(): ?int
51
    {
52
        return $this->id;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function getCode(): ?string
59
    {
60
        return $this->code;
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function setCode(?string $code): void
67
    {
68
        $this->code = $code;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function getImageFile(): ?File
75
    {
76
        /** @var BannerTranslationInterface $bannerTranslation */
77
        $bannerTranslation = $this->getTranslation();
78
79
        return $bannerTranslation->getImageFile();
80
    }
81
82
    /**
83
     * {@inheritdoc}
84
     */
85
    public function setImageFile(File $file): void
86
    {
87
        /** @var BannerTranslationInterface $bannerTranslation */
88
        $bannerTranslation = $this->getTranslation();
89
90
        $bannerTranslation->setImageFile($file);
91
    }
92
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function getImageName(): string
97
    {
98
        /** @var BannerTranslationInterface $bannerTranslation */
99
        $bannerTranslation = $this->getTranslation();
100
101
        return $bannerTranslation->getImageName();
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107
    public function setImageName($imageName): void
108
    {
109
        /** @var BannerTranslationInterface $bannerTranslation */
110
        $bannerTranslation = $this->getTranslation();
111
112
        $bannerTranslation->setImageName($imageName);
113
    }
114
115
    /**
116
     * {@inheritdoc}
117
     */
118
    public function getUrl(): ?string
119
    {
120
        /** @var BannerTranslationInterface $bannerTranslation */
121
        $bannerTranslation = $this->getTranslation();
122
123
        return $bannerTranslation->getUrl();
124
    }
125
126
    /**
127
     * {@inheritdoc}
128
     */
129
    public function setUrl($url): void
130
    {
131
        /** @var BannerTranslationInterface $bannerTranslation */
132
        $bannerTranslation = $this->getTranslation();
133
134
        $bannerTranslation->setUrl($url);
135
    }
136
137
    /**
138
     * {@inheritdoc}
139
     */
140
    public function getChannels(): Collection
141
    {
142
        return $this->channels;
143
    }
144
145
    /**
146
     * {@inheritdoc}
147
     */
148
    public function hasChannel(ChannelInterface $channel): bool
149
    {
150
        return $this->channels->contains($channel);
151
    }
152
153
    /**
154
     * {@inheritdoc}
155
     */
156
    public function addChannel(ChannelInterface $channel): void
157
    {
158
        if (!$this->hasChannel($channel)) {
159
            $this->channels->add($channel);
160
        }
161
    }
162
163
    /**
164
     * {@inheritdoc}
165
     */
166
    public function removeChannel(ChannelInterface $channel): void
167
    {
168
        if ($this->hasChannel($channel)) {
169
            $this->channels->removeElement($channel);
170
        }
171
    }
172
173
    /**
174
     * {@inheritdoc}
175
     */
176
    public function getTaxons(): Collection
177
    {
178
        return $this->taxons;
179
    }
180
181
    /**
182
     * {@inheritdoc}
183
     */
184
    public function hasTaxon(TaxonInterface $taxon): bool
185
    {
186
        return $this->taxons->contains($taxon);
187
    }
188
189
    /**
190
     * {@inheritdoc}
191
     */
192
    public function addTaxon(TaxonInterface $taxon): void
193
    {
194
        if (!$this->taxons->contains($taxon)) {
195
            $this->taxons->add($taxon);
196
        }
197
    }
198
199
    /**
200
     * {@inheritdoc}
201
     */
202
    public function removeTaxon(TaxonInterface $taxon): void
203
    {
204
        if ($this->taxons->contains($taxon)) {
205
            $this->taxons->removeElement($taxon);
206
        }
207
    }
208
209
    /**
210
     * {@inheritdoc}
211
     */
212
    public function getTranslation(?string $locale = null): TranslationInterface
213
    {
214
        /** @var BannerTranslation $translation */
215
        $translation = $this->doGetTranslation($locale);
216
217
        return $translation;
218
    }
219
220
    /**
221
     * {@inheritdoc}
222
     */
223
    protected function createTranslation(): TranslationInterface
224
    {
225
        return new BannerTranslation();
226
    }
227
}
228