gregorybesson /
PlaygroundGame
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace PlaygroundGame\Entity; |
||
| 4 | |||
| 5 | use Doctrine\Common\Collections\ArrayCollection; |
||
| 6 | use Doctrine\ORM\Mapping as ORM; |
||
| 7 | use Doctrine\ORM\Mapping\HasLifecycleCallbacks; |
||
| 8 | use Doctrine\ORM\Mapping\PrePersist; |
||
| 9 | use Doctrine\ORM\Mapping\PreUpdate; |
||
| 10 | use Zend\InputFilter\InputFilter; |
||
| 11 | use Zend\InputFilter\InputFilterAwareInterface; |
||
| 12 | use Zend\InputFilter\InputFilterInterface; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @ORM\Entity @HasLifecycleCallbacks |
||
| 16 | * @ORM\Table(name="game_quiz_reply") |
||
| 17 | */ |
||
| 18 | class QuizReply implements InputFilterAwareInterface |
||
| 19 | { |
||
| 20 | protected $inputFilter; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @ORM\Id |
||
| 24 | * @ORM\Column(type="integer"); |
||
| 25 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 26 | */ |
||
| 27 | protected $id; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @ORM\ManyToOne(targetEntity="Entry") |
||
| 31 | * @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="CASCADE") |
||
| 32 | **/ |
||
| 33 | protected $entry; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @ORM\Column(type="integer") |
||
| 37 | **/ |
||
| 38 | protected $totalCorrectAnswers; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @ORM\Column(type="integer") |
||
| 42 | **/ |
||
| 43 | protected $maxCorrectAnswers; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @ORM\Column(type="integer") |
||
| 47 | **/ |
||
| 48 | protected $totalQuestions; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @ORM\OneToMany(targetEntity="QuizReplyAnswer", mappedBy="reply", cascade={"persist","remove"}) |
||
| 52 | */ |
||
| 53 | private $answers; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @ORM\Column(type="datetime") |
||
| 57 | */ |
||
| 58 | protected $created_at; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @ORM\Column(type="datetime") |
||
| 62 | */ |
||
| 63 | protected $updated_at; |
||
| 64 | |||
| 65 | public function __construct() |
||
| 66 | { |
||
| 67 | $this->answers = new ArrayCollection(); |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @PrePersist |
||
| 72 | */ |
||
| 73 | public function createChrono() |
||
| 74 | { |
||
| 75 | $this->created_at = new \DateTime("now"); |
||
| 76 | $this->updated_at = new \DateTime("now"); |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @PreUpdate |
||
| 81 | */ |
||
| 82 | public function updateChrono() |
||
| 83 | { |
||
| 84 | $this->updated_at = new \DateTime("now"); |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @return the unknown_type |
||
| 89 | */ |
||
| 90 | public function getId() |
||
| 91 | { |
||
| 92 | return $this->id; |
||
| 93 | } |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @param unknown_type $id |
||
| 97 | */ |
||
| 98 | public function setId($id) |
||
| 99 | { |
||
| 100 | $this->id = $id; |
||
| 101 | |||
| 102 | return $this; |
||
| 103 | } |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @return PlaygroundGame\Entity\Entry |
||
| 107 | */ |
||
| 108 | public function getEntry() |
||
| 109 | { |
||
| 110 | return $this->entry; |
||
| 111 | } |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @param PlaygroundGame\Entity\Entry $entry |
||
| 115 | */ |
||
| 116 | public function setEntry($entry) |
||
| 117 | { |
||
| 118 | $this->entry = $entry; |
||
| 119 | |||
| 120 | return $this; |
||
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @return integer $totalCorrectAnswers |
||
| 125 | */ |
||
| 126 | public function getTotalCorrectAnswers() |
||
| 127 | { |
||
| 128 | return $this->totalCorrectAnswers; |
||
| 129 | } |
||
| 130 | |||
| 131 | /** |
||
| 132 | * @param integer $totalCorrectAnswers |
||
| 133 | */ |
||
| 134 | public function setTotalCorrectAnswers($totalCorrectAnswers) |
||
| 135 | { |
||
| 136 | $this->totalCorrectAnswers = $totalCorrectAnswers; |
||
| 137 | |||
| 138 | return $this; |
||
| 139 | } |
||
| 140 | |||
| 141 | /** |
||
| 142 | * @return the $maxCorrectAnswers |
||
| 143 | */ |
||
| 144 | public function getMaxCorrectAnswers() |
||
| 145 | { |
||
| 146 | return $this->maxCorrectAnswers; |
||
| 147 | } |
||
| 148 | |||
| 149 | /** |
||
| 150 | * @param field_type $maxCorrectAnswers |
||
| 151 | */ |
||
| 152 | public function setMaxCorrectAnswers($maxCorrectAnswers) |
||
| 153 | { |
||
| 154 | $this->maxCorrectAnswers = $maxCorrectAnswers; |
||
| 155 | |||
| 156 | return $this; |
||
| 157 | } |
||
| 158 | |||
| 159 | /** |
||
| 160 | * @return integer $totalQuestions |
||
| 161 | */ |
||
| 162 | public function getTotalQuestions() |
||
| 163 | { |
||
| 164 | return $this->totalQuestions; |
||
| 165 | } |
||
| 166 | |||
| 167 | /** |
||
| 168 | * @param integer $totalQuestions |
||
| 169 | */ |
||
| 170 | public function setTotalQuestions($totalQuestions) |
||
| 171 | { |
||
| 172 | $this->totalQuestions = $totalQuestions; |
||
| 173 | |||
| 174 | return $this; |
||
| 175 | } |
||
| 176 | |||
| 177 | /** |
||
| 178 | * @return ArrayCollection $answers |
||
| 179 | */ |
||
| 180 | public function getAnswers() |
||
| 181 | { |
||
| 182 | return $this->answers; |
||
| 183 | } |
||
| 184 | |||
| 185 | /** |
||
| 186 | * frm collection solution |
||
| 187 | * @param ArrayCollection $answers |
||
| 188 | */ |
||
| 189 | public function setAnswers(ArrayCollection $answers) |
||
| 190 | { |
||
| 191 | $this->answers = $answers; |
||
| 192 | |||
| 193 | return $this; |
||
| 194 | } |
||
| 195 | |||
| 196 | public function addAnswers(ArrayCollection $answers) |
||
| 197 | { |
||
| 198 | foreach ($answers as $answer) { |
||
| 199 | $answer->setReply($this); |
||
| 200 | $this->answers->add($answer); |
||
| 201 | } |
||
| 202 | } |
||
| 203 | |||
| 204 | public function removeAnswers(\Doctrine\Common\Collections\Collection $answers) |
||
| 205 | { |
||
| 206 | foreach ($answers as $answer) { |
||
| 207 | $answer->setReply(null); |
||
| 208 | $this->answers->removeElement($answer); |
||
| 209 | } |
||
| 210 | } |
||
| 211 | |||
| 212 | /** |
||
| 213 | * Add an answer to the quiz. |
||
| 214 | * |
||
| 215 | * @param QuizReplyAnswer $answer |
||
| 216 | * |
||
| 217 | * @return void |
||
| 218 | */ |
||
| 219 | public function addAnswer(QuizReplyAnswer $answer) |
||
| 220 | { |
||
| 221 | $answer->setReply($this); |
||
| 222 | $this->answers[] = $answer; |
||
| 223 | } |
||
| 224 | |||
| 225 | /** |
||
| 226 | * @return the unknown_type |
||
| 227 | */ |
||
| 228 | public function getCreatedAt() |
||
| 229 | { |
||
| 230 | return $this->created_at; |
||
| 231 | } |
||
| 232 | |||
| 233 | /** |
||
| 234 | * @param unknown_type $created_at |
||
| 235 | */ |
||
| 236 | public function setCreatedAt($created_at) |
||
| 237 | { |
||
| 238 | $this->created_at = $created_at; |
||
| 239 | |||
| 240 | return $this; |
||
| 241 | } |
||
| 242 | |||
| 243 | /** |
||
| 244 | * @return the unknown_type |
||
| 245 | */ |
||
| 246 | public function getUpdatedAt() |
||
| 247 | { |
||
| 248 | return $this->updated_at; |
||
| 249 | } |
||
| 250 | |||
| 251 | /** |
||
| 252 | * @param unknown_type $updated_at |
||
| 253 | */ |
||
| 254 | public function setUpdatedAt($updated_at) |
||
| 255 | { |
||
| 256 | $this->updated_at = $updated_at; |
||
| 257 | |||
| 258 | return $this; |
||
| 259 | } |
||
| 260 | |||
| 261 | /** |
||
| 262 | * Convert the object to an array. |
||
| 263 | * |
||
| 264 | * @return array |
||
| 265 | */ |
||
| 266 | public function getArrayCopy() |
||
| 267 | { |
||
| 268 | $obj_vars = get_object_vars($this); |
||
| 269 | |||
| 270 | return $obj_vars; |
||
| 271 | } |
||
| 272 | |||
| 273 | /** |
||
| 274 | * Populate from an array. |
||
| 275 | * |
||
| 276 | * @param array $data |
||
| 277 | */ |
||
| 278 | public function populate($data = array()) |
||
|
0 ignored issues
–
show
|
|||
| 279 | { |
||
| 280 | } |
||
| 281 | |||
| 282 | public function setInputFilter(InputFilterInterface $inputFilter) |
||
| 283 | { |
||
| 284 | throw new \Exception("Not used"); |
||
| 285 | } |
||
| 286 | |||
| 287 | public function getInputFilter() |
||
| 288 | { |
||
| 289 | if (!$this->inputFilter) { |
||
| 290 | $inputFilter = new InputFilter(); |
||
| 291 | $this->inputFilter = $inputFilter; |
||
| 292 | } |
||
| 293 | |||
| 294 | return $this->inputFilter; |
||
| 295 | } |
||
| 296 | } |
||
| 297 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.