Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
57.89% covered (warning)
57.89%
11 / 19
46.67% covered (danger)
46.67%
7 / 15
CRAP
0.00% covered (danger)
0.00%
0 / 1
Answer
57.89% covered (warning)
57.89%
11 / 19
46.67% covered (danger)
46.67%
7 / 15
31.80
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 deserialize
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getResponse
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setResponse
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getQuestion
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setQuestion
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getRecommendation
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setRecommendation
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getPosition
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPosition
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAnswerSurveys
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setAnswerSurveys
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * This file is part of the MADIS - RGPD Management application.
5 *
6 * @copyright Copyright (c) 2018-2019 Soluris - Solutions Numériques Territoriales Innovantes
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22declare(strict_types=1);
23
24namespace App\Domain\Maturity\Model;
25
26use JMS\Serializer\Annotation as Serializer;
27use Ramsey\Uuid\Uuid;
28use Ramsey\Uuid\UuidInterface;
29
30class Answer
31{
32    /**
33     * @var UuidInterface
34     *
35     * @Serializer\Exclude
36     */
37    private $id;
38
39    private string $name;
40
41    private int $position;
42
43    private ?string $recommendation;
44
45    private ?string $response;
46
47    /**
48     * @var Question|null
49     *
50     * @Serializer\Exclude
51     */
52    private $question;
53
54    /**
55     * @var iterable|null
56     *
57     * @Serializer\Exclude
58     */
59    private $answerSurveys;
60
61    /**
62     * Answer constructor.
63     *
64     * @throws \Exception
65     */
66    public function __construct()
67    {
68        $this->id             = Uuid::uuid4();
69        $this->name           = '';
70        $this->response       = '';
71        $this->recommendation = '';
72        $this->answerSurveys  = [];
73    }
74
75    public function deserialize(): void
76    {
77        $this->id = Uuid::uuid4();
78    }
79
80    public function getId(): UuidInterface
81    {
82        return $this->id;
83    }
84
85    public function getResponse(): ?string
86    {
87        return $this->response;
88    }
89
90    public function setResponse(?string $response): void
91    {
92        $this->response = $response;
93    }
94
95    public function getQuestion(): ?Question
96    {
97        return $this->question;
98    }
99
100    public function setQuestion(?Question $question): void
101    {
102        $this->question = $question;
103    }
104
105    public function getName(): ?string
106    {
107        return $this->name;
108    }
109
110    public function setName(?string $name): void
111    {
112        $this->name = $name;
113    }
114
115    public function getRecommendation(): ?string
116    {
117        return $this->recommendation;
118    }
119
120    public function setRecommendation(?string $recommendation): void
121    {
122        $this->recommendation = $recommendation;
123    }
124
125    public function getPosition(): ?int
126    {
127        return $this->position;
128    }
129
130    public function setPosition(?int $position): void
131    {
132        $this->position = $position;
133    }
134
135    public function getAnswerSurveys(): ?iterable
136    {
137        return $this->answerSurveys;
138    }
139
140    public function setAnswerSurveys(?iterable $answerSurveys): void
141    {
142        $this->answerSurveys = $answerSurveys;
143    }
144}