Completed
Push — master ( b77bbc...7eba37 )
by Mikołaj
02:49 queued 01:41
created

FrequentlyAskedQuestion::getQuestion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file was created by the 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\CmsPlugin\Entity;
14
15
use Sylius\Component\Resource\Model\ToggleableTrait;
16
use Sylius\Component\Resource\Model\TranslatableTrait;
17
use Sylius\Component\Resource\Model\TranslationInterface;
18
19
/**
20
 * @author Mikołaj Król <[email protected]>
21
 */
22
class FrequentlyAskedQuestion implements FrequentlyAskedQuestionInterface
23
{
24
    use ToggleableTrait,
25
        TranslatableTrait {
26
        __construct as private initializeTranslationsCollection;
27
    }
28
29
    /**
30
     * @var int
31
     */
32
    protected $id;
33
34
    /**
35
     * @var null|string
36
     */
37
    protected $code;
38
39
    /**
40
     * @var null|int
41
     */
42
    protected $position;
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getId(): int
48
    {
49
        return $this->id;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function getCode(): ?string
56
    {
57
        return $this->code;
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function setCode(?string $code): void
64
    {
65
        $this->code = $code;
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function getPosition(): ?int
72
    {
73
        return $this->position;
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79
    public function setPosition(?int $position): void
80
    {
81
        $this->position = $position;
82
    }
83
84
    /**
85
     * {@inheritdoc}
86
     */
87
    public function getQuestion(): ?string
88
    {
89
        return $this->getFrequentlyAskedQuestionTranslation()->getQuestion();
90
    }
91
92
    /**
93
     * {@inheritdoc}
94
     */
95
    public function setQuestion(?string $question): void
96
    {
97
        $this->getFrequentlyAskedQuestionTranslation()->setQuestion($question);
98
    }
99
100
    /**
101
     * {@inheritdoc}
102
     */
103
    public function getAnswer(): ?string
104
    {
105
        return $this->getFrequentlyAskedQuestionTranslation()->getAnswer();
106
    }
107
108
    /**
109
     * {@inheritdoc}
110
     */
111
    public function setAnswer(?string $answer): void
112
    {
113
        $this->getFrequentlyAskedQuestionTranslation()->setAnswer($answer);
114
    }
115
116
    /**
117
     * @return TranslationInterface|FrequentlyAskedQuestionTranslationInterface
118
     */
119
    protected function getFrequentlyAskedQuestionTranslation(): TranslationInterface
120
    {
121
        return $this->getTranslation();
122
    }
123
124
    /**
125
     * {@inheritdoc}
126
     */
127
    protected function createTranslation(): TranslationInterface
128
    {
129
        return new FrequentlyAskedQuestionTranslation();
130
    }
131
}
132