Completed
Push — master ( d81c19...f57266 )
by Kamil
20s
created

src/Sylius/Component/Core/Model/Channel.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Sylius\Component\Core\Model;
15
16
use Doctrine\Common\Collections\ArrayCollection;
17
use Doctrine\Common\Collections\Collection;
18
use Sylius\Component\Addressing\Model\ZoneInterface;
19
use Sylius\Component\Channel\Model\Channel as BaseChannel;
20
use Sylius\Component\Currency\Model\CurrencyInterface;
21
use Sylius\Component\Locale\Model\LocaleInterface;
22
23
class Channel extends BaseChannel implements ChannelInterface
24
{
25
    /**
26
     * @var CurrencyInterface
27
     */
28
    protected $baseCurrency;
29
30
    /**
31
     * @var LocaleInterface
32
     */
33
    protected $defaultLocale;
34
35
    /**
36
     * @var ZoneInterface
37
     */
38
    protected $defaultTaxZone;
39
40
    /**
41
     * @var string
42
     */
43
    protected $taxCalculationStrategy;
44
45
    /**
46
     * @var CurrencyInterface[]|Collection
47
     */
48
    protected $currencies;
49
50
    /**
51
     * @var LocaleInterface[]|Collection
52
     */
53
    protected $locales;
54
55
    /**
56
     * @var string
57
     */
58
    protected $themeName;
59
60
    /**
61
     * @var string
62
     */
63
    protected $contactEmail;
64
65
    /**
66
     * @var bool
67
     */
68
    protected $skippingShippingStepAllowed = false;
69
70
    /**
71
     * @var bool
72
     */
73
    protected $skippingPaymentStepAllowed = false;
74
75
    /**
76
     * @var bool
77
     */
78
    protected $accountVerificationRequired = true;
79
80
    public function __construct()
81
    {
82
        parent::__construct();
83
84
        $this->currencies = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,object<Syl...Collections\Collection> of property $currencies.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
85
        $this->locales = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,object<Syl...Collections\Collection> of property $locales.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
86
    }
87
88
    /**
89
     * {@inheritdoc}
90
     */
91
    public function getBaseCurrency(): ?CurrencyInterface
92
    {
93
        return $this->baseCurrency;
94
    }
95
96
    /**
97
     * {@inheritdoc}
98
     */
99
    public function setBaseCurrency(?CurrencyInterface $baseCurrency): void
100
    {
101
        $this->baseCurrency = $baseCurrency;
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107
    public function getDefaultLocale(): ?LocaleInterface
108
    {
109
        return $this->defaultLocale;
110
    }
111
112
    /**
113
     * {@inheritdoc}
114
     */
115
    public function setDefaultLocale(?LocaleInterface $defaultLocale): void
116
    {
117
        $this->defaultLocale = $defaultLocale;
118
    }
119
120
    /**
121
     * {@inheritdoc}
122
     */
123
    public function getDefaultTaxZone(): ?ZoneInterface
124
    {
125
        return $this->defaultTaxZone;
126
    }
127
128
    /**
129
     * {@inheritdoc}
130
     */
131
    public function setDefaultTaxZone(?ZoneInterface $defaultTaxZone): void
132
    {
133
        $this->defaultTaxZone = $defaultTaxZone;
134
    }
135
136
    /**
137
     * {@inheritdoc}
138
     */
139
    public function getTaxCalculationStrategy(): ?string
140
    {
141
        return $this->taxCalculationStrategy;
142
    }
143
144
    /**
145
     * {@inheritdoc}
146
     */
147
    public function setTaxCalculationStrategy(?string $taxCalculationStrategy): void
148
    {
149
        $this->taxCalculationStrategy = $taxCalculationStrategy;
150
    }
151
152
    /**
153
     * {@inheritdoc}
154
     */
155
    public function getCurrencies(): Collection
156
    {
157
        return $this->currencies;
158
    }
159
160
    /**
161
     * {@inheritdoc}
162
     */
163
    public function addCurrency(CurrencyInterface $currency): void
164
    {
165
        if (!$this->hasCurrency($currency)) {
166
            $this->currencies->add($currency);
167
        }
168
    }
169
170
    /**
171
     * {@inheritdoc}
172
     */
173
    public function removeCurrency(CurrencyInterface $currency): void
174
    {
175
        if ($this->hasCurrency($currency)) {
176
            $this->currencies->removeElement($currency);
177
        }
178
    }
179
180
    /**
181
     * {@inheritdoc}
182
     */
183
    public function hasCurrency(CurrencyInterface $currency): bool
184
    {
185
        return $this->currencies->contains($currency);
186
    }
187
188
    /**
189
     * {@inheritdoc}
190
     */
191
    public function getLocales(): Collection
192
    {
193
        return $this->locales;
194
    }
195
196
    /**
197
     * {@inheritdoc}
198
     */
199
    public function addLocale(LocaleInterface $locale): void
200
    {
201
        if (!$this->hasLocale($locale)) {
202
            $this->locales->add($locale);
203
        }
204
    }
205
206
    /**
207
     * {@inheritdoc}
208
     */
209
    public function removeLocale(LocaleInterface $locale): void
210
    {
211
        if ($this->hasLocale($locale)) {
212
            $this->locales->removeElement($locale);
213
        }
214
    }
215
216
    /**
217
     * {@inheritdoc}
218
     */
219
    public function hasLocale(LocaleInterface $locale): bool
220
    {
221
        return $this->locales->contains($locale);
222
    }
223
224
    /**
225
     * {@inheritdoc}
226
     */
227
    public function getThemeName(): ?string
228
    {
229
        return $this->themeName;
230
    }
231
232
    /**
233
     * {@inheritdoc}
234
     */
235
    public function setThemeName(?string $themeName): void
236
    {
237
        $this->themeName = $themeName;
238
    }
239
240
    /**
241
     * {@inheritdoc}
242
     */
243
    public function getContactEmail(): ?string
244
    {
245
        return $this->contactEmail;
246
    }
247
248
    /**
249
     * {@inheritdoc}
250
     */
251
    public function setContactEmail(?string $contactEmail): void
252
    {
253
        $this->contactEmail = $contactEmail;
254
    }
255
256
    /**
257
     * {@inheritdoc}
258
     */
259
    public function isSkippingShippingStepAllowed(): bool
260
    {
261
        return $this->skippingShippingStepAllowed;
262
    }
263
264
    /**
265
     * {@inheritdoc}
266
     */
267
    public function setSkippingShippingStepAllowed(bool $skippingShippingStepAllowed): void
268
    {
269
        $this->skippingShippingStepAllowed = $skippingShippingStepAllowed;
270
    }
271
272
    /**
273
     * {@inheritdoc}
274
     */
275
    public function isSkippingPaymentStepAllowed(): bool
276
    {
277
        return $this->skippingPaymentStepAllowed;
278
    }
279
280
    /**
281
     * {@inheritdoc}
282
     */
283
    public function setSkippingPaymentStepAllowed(bool $skippingPaymentStepAllowed): void
284
    {
285
        $this->skippingPaymentStepAllowed = $skippingPaymentStepAllowed;
286
    }
287
288
    /**
289
     * {@inheritdoc}
290
     */
291
    public function isAccountVerificationRequired(): bool
292
    {
293
        return $this->accountVerificationRequired;
294
    }
295
296
    /**
297
     * {@inheritdoc}
298
     */
299
    public function setAccountVerificationRequired(bool $accountVerificationRequired): void
300
    {
301
        $this->accountVerificationRequired = $accountVerificationRequired;
302
    }
303
}
304