Completed
Pull Request — master (#95)
by
unknown
01:26
created

FrequentlyAskedQuestion   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 115
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 12
lcom 1
cbo 1
dl 0
loc 115
rs 10
c 0
b 0
f 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A getCode() 0 4 1
A setCode() 0 4 1
A getPosition() 0 4 1
A setPosition() 0 4 1
A getQuestion() 0 4 1
A setQuestion() 0 4 1
A getAnswer() 0 4 1
A setAnswer() 0 4 1
A getFrequentlyAskedQuestionTranslation() 0 4 1
A createTranslation() 0 4 1
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\SyliusCmsPlugin\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
    public function __construct()
45
    {
46
        $this->initializeTranslationsCollection();
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getId(): ?int
53
    {
54
        return $this->id;
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getCode(): ?string
61
    {
62
        return $this->code;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function setCode(?string $code): void
69
    {
70
        $this->code = $code;
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function getPosition(): ?int
77
    {
78
        return $this->position;
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84
    public function setPosition(?int $position): void
85
    {
86
        $this->position = $position;
87
    }
88
89
    /**
90
     * {@inheritdoc}
91
     */
92
    public function getQuestion(): ?string
93
    {
94
        return $this->getFrequentlyAskedQuestionTranslation()->getQuestion();
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function setQuestion(?string $question): void
101
    {
102
        $this->getFrequentlyAskedQuestionTranslation()->setQuestion($question);
103
    }
104
105
    /**
106
     * {@inheritdoc}
107
     */
108
    public function getAnswer(): ?string
109
    {
110
        return $this->getFrequentlyAskedQuestionTranslation()->getAnswer();
111
    }
112
113
    /**
114
     * {@inheritdoc}
115
     */
116
    public function setAnswer(?string $answer): void
117
    {
118
        $this->getFrequentlyAskedQuestionTranslation()->setAnswer($answer);
119
    }
120
121
    /**
122
     * @return TranslationInterface|FrequentlyAskedQuestionTranslationInterface
123
     */
124
    protected function getFrequentlyAskedQuestionTranslation(): TranslationInterface
125
    {
126
        return $this->getTranslation();
127
    }
128
129
    /**
130
     * {@inheritdoc}
131
     */
132
    protected function createTranslation(): TranslationInterface
133
    {
134
        return new FrequentlyAskedQuestionTranslation();
135
    }
136
}
137