Issues (63)

src/Entity/FrequentlyAskedQuestion.php (1 issue)

Labels
Severity
1
<?php
2
3
/*
4
 * This file was created by developers working at BitBag
5
 * Do you need more information about us and what we do? Visit our https://bitbag.io website!
6
 * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7
*/
8
9
declare(strict_types=1);
10
11
namespace BitBag\SyliusCmsPlugin\Entity;
12
13
use Sylius\Component\Resource\Model\ToggleableTrait;
14
use Sylius\Component\Resource\Model\TranslatableTrait;
15
use Sylius\Component\Resource\Model\TranslationInterface;
16
17
class FrequentlyAskedQuestion implements FrequentlyAskedQuestionInterface
18
{
19
    use ChannelsAwareTrait;
20
21
    use ToggleableTrait,
22
        TranslatableTrait {
23
        __construct as private initializeTranslationsCollection;
24
    }
25
26
    /** @var int */
27
    protected $id;
28
29
    /** @var string|null */
30
    protected $code;
31
32
    /** @var int|null */
33
    protected $position;
34
35
    public function __construct()
36
    {
37
        $this->initializeTranslationsCollection();
0 ignored issues
show
The method initializeTranslationsCollection() does not exist on BitBag\SyliusCmsPlugin\E...FrequentlyAskedQuestion. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
        $this->/** @scrutinizer ignore-call */ 
38
               initializeTranslationsCollection();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
        $this->initializeChannelsCollection();
39
    }
40
41
    public function getId(): ?int
42
    {
43
        return $this->id;
44
    }
45
46
    public function getCode(): ?string
47
    {
48
        return $this->code;
49
    }
50
51
    public function setCode(?string $code): void
52
    {
53
        $this->code = $code;
54
    }
55
56
    public function getPosition(): ?int
57
    {
58
        return $this->position;
59
    }
60
61
    public function setPosition(?int $position): void
62
    {
63
        $this->position = $position;
64
    }
65
66
    public function getQuestion(): ?string
67
    {
68
        /** @var FrequentlyAskedQuestionInterface $frequentlyAskedQuestionInterface */
69
        $frequentlyAskedQuestionInterface = $this->getFrequentlyAskedQuestionTranslation();
70
71
        return $frequentlyAskedQuestionInterface->getQuestion();
72
    }
73
74
    public function setQuestion(?string $question): void
75
    {
76
        /** @var FrequentlyAskedQuestionInterface $frequentlyAskedQuestionInterface */
77
        $frequentlyAskedQuestionInterface = $this->getFrequentlyAskedQuestionTranslation();
78
        $frequentlyAskedQuestionInterface->setQuestion($question);
79
    }
80
81
    public function getAnswer(): ?string
82
    {
83
        /** @var FrequentlyAskedQuestionInterface $frequentlyAskedQuestionInterface */
84
        $frequentlyAskedQuestionInterface = $this->getFrequentlyAskedQuestionTranslation();
85
86
        return $frequentlyAskedQuestionInterface->getAnswer();
87
    }
88
89
    public function setAnswer(?string $answer): void
90
    {
91
        /** @var FrequentlyAskedQuestionInterface $frequentlyAskedQuestionInterface */
92
        $frequentlyAskedQuestionInterface = $this->getFrequentlyAskedQuestionTranslation();
93
        $frequentlyAskedQuestionInterface->setAnswer($answer);
94
    }
95
96
    /**
97
     * @return TranslationInterface|FrequentlyAskedQuestionTranslationInterface
98
     */
99
    protected function getFrequentlyAskedQuestionTranslation(): TranslationInterface
100
    {
101
        return $this->getTranslation();
102
    }
103
104
    protected function createTranslation(): TranslationInterface
105
    {
106
        return new FrequentlyAskedQuestionTranslation();
107
    }
108
}
109