| Total Complexity | 72 |
| Total Lines | 776 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| Bugs | 2 | Features | 2 |
Complex classes like CQuiz often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use CQuiz, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 29 | class CQuiz extends AbstractResource implements ResourceInterface |
||
| 30 | { |
||
| 31 | use ShowCourseResourcesInSessionTrait; |
||
| 32 | public const ALL_ON_ONE_PAGE = 1; |
||
| 33 | public const ONE_PER_PAGE = 2; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @ORM\Column(name="iid", type="integer") |
||
| 37 | * @ORM\Id |
||
| 38 | * @ORM\GeneratedValue |
||
| 39 | */ |
||
| 40 | protected int $iid; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @Assert\NotBlank() |
||
| 44 | * @ORM\Column(name="title", type="text", nullable=false) |
||
| 45 | */ |
||
| 46 | protected string $title; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @ORM\Column(name="description", type="text", nullable=true) |
||
| 50 | */ |
||
| 51 | protected ?string $description = null; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @ORM\Column(name="sound", type="string", length=255, nullable=true) |
||
| 55 | */ |
||
| 56 | protected ?string $sound = null; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @ORM\Column(name="type", type="integer", nullable=false) |
||
| 60 | */ |
||
| 61 | protected int $type; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @ORM\Column(name="random", type="integer", nullable=false) |
||
| 65 | */ |
||
| 66 | protected int $random; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @ORM\Column(name="random_answers", type="boolean", nullable=false) |
||
| 70 | */ |
||
| 71 | protected bool $randomAnswers; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @ORM\Column(name="active", type="integer", nullable=false) |
||
| 75 | */ |
||
| 76 | protected int $active; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @ORM\Column(name="results_disabled", type="integer", nullable=false) |
||
| 80 | */ |
||
| 81 | protected int $resultsDisabled; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @ORM\Column(name="access_condition", type="text", nullable=true) |
||
| 85 | */ |
||
| 86 | protected ?string $accessCondition = null; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @ORM\Column(name="max_attempt", type="integer", nullable=false) |
||
| 90 | */ |
||
| 91 | protected int $maxAttempt; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @ORM\Column(name="start_time", type="datetime", nullable=true) |
||
| 95 | */ |
||
| 96 | protected ?DateTime $startTime = null; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @ORM\Column(name="end_time", type="datetime", nullable=true) |
||
| 100 | */ |
||
| 101 | protected ?DateTime $endTime = null; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @ORM\Column(name="feedback_type", type="integer", nullable=false) |
||
| 105 | */ |
||
| 106 | protected int $feedbackType; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @ORM\Column(name="expired_time", type="integer", nullable=false) |
||
| 110 | */ |
||
| 111 | protected int $expiredTime; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @ORM\Column(name="propagate_neg", type="integer", nullable=false) |
||
| 115 | */ |
||
| 116 | protected int $propagateNeg; |
||
| 117 | |||
| 118 | /** |
||
| 119 | * @ORm\Column(name="save_correct_answers", type="integer", nullable=true) |
||
| 120 | */ |
||
| 121 | protected ?int $saveCorrectAnswers; |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @ORM\Column(name="review_answers", type="integer", nullable=false) |
||
| 125 | */ |
||
| 126 | protected int $reviewAnswers; |
||
| 127 | |||
| 128 | /** |
||
| 129 | * @ORM\Column(name="random_by_category", type="integer", nullable=false) |
||
| 130 | */ |
||
| 131 | protected int $randomByCategory; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @ORM\Column(name="text_when_finished", type="text", nullable=true) |
||
| 135 | */ |
||
| 136 | protected ?string $textWhenFinished = null; |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @ORM\Column(name="display_category_name", type="integer", nullable=false) |
||
| 140 | */ |
||
| 141 | protected int $displayCategoryName; |
||
| 142 | |||
| 143 | /** |
||
| 144 | * @ORM\Column(name="pass_percentage", type="integer", nullable=true) |
||
| 145 | */ |
||
| 146 | protected ?int $passPercentage = null; |
||
| 147 | |||
| 148 | /** |
||
| 149 | * @ORM\Column(name="prevent_backwards", type="integer", nullable=false, options={"default":0}) |
||
| 150 | */ |
||
| 151 | protected int $preventBackwards; |
||
| 152 | |||
| 153 | /** |
||
| 154 | * @ORM\Column(name="question_selection_type", type="integer", nullable=true) |
||
| 155 | */ |
||
| 156 | protected ?int $questionSelectionType = null; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @ORM\Column(name="hide_question_number", type="integer", nullable=false, options={"default":0}) |
||
| 160 | */ |
||
| 161 | protected int $hideQuestionNumber; |
||
| 162 | |||
| 163 | /** |
||
| 164 | * @ORM\Column(name="hide_question_title", type="boolean", nullable=false) |
||
| 165 | */ |
||
| 166 | protected bool $hideQuestionTitle; |
||
| 167 | |||
| 168 | /** |
||
| 169 | * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CExerciseCategory", cascade={"persist"}) |
||
| 170 | * @ORM\JoinColumn(name="exercise_category_id", referencedColumnName="id", onDelete="SET NULL") |
||
| 171 | */ |
||
| 172 | protected ?CExerciseCategory $exerciseCategory = null; |
||
| 173 | |||
| 174 | /** |
||
| 175 | * @ORM\Column(name="show_previous_button", type="boolean", nullable=false, options={"default":1}) |
||
| 176 | */ |
||
| 177 | protected bool $showPreviousButton; |
||
| 178 | |||
| 179 | /** |
||
| 180 | * @ORM\Column(name="notifications", type="string", length=255, nullable=true) |
||
| 181 | */ |
||
| 182 | protected ?string $notifications; |
||
| 183 | |||
| 184 | /** |
||
| 185 | * @ORM\Column(name="autolaunch", type="boolean", nullable=true, options={"default":0}) |
||
| 186 | */ |
||
| 187 | protected ?bool $autoLaunch; |
||
| 188 | |||
| 189 | /** |
||
| 190 | * @ORM\Column(name="page_result_configuration", type="array") |
||
| 191 | */ |
||
| 192 | protected array $pageResultConfiguration = []; |
||
| 193 | |||
| 194 | /** |
||
| 195 | * @var Collection|CQuizRelQuestion[] |
||
| 196 | * |
||
| 197 | * @ORM\OneToMany(targetEntity="CQuizRelQuestion", mappedBy="quiz", cascade={"persist"}, orphanRemoval=true)) |
||
| 198 | */ |
||
| 199 | protected Collection $questions; |
||
| 200 | |||
| 201 | /** |
||
| 202 | * @var Collection|CQuizRelQuestionCategory[] |
||
| 203 | * |
||
| 204 | * @ORM\OneToMany(targetEntity="CQuizRelQuestionCategory", mappedBy="quiz", cascade={"persist"})) |
||
| 205 | */ |
||
| 206 | protected Collection $questionsCategories; |
||
| 207 | |||
| 208 | public function __construct() |
||
| 209 | { |
||
| 210 | $this->questions = new ArrayCollection(); |
||
| 211 | $this->questionsCategories = new ArrayCollection(); |
||
| 212 | $this->hideQuestionTitle = false; |
||
| 213 | $this->hideQuestionNumber = 0; |
||
| 214 | $this->type = self::ONE_PER_PAGE; |
||
| 215 | $this->showPreviousButton = true; |
||
| 216 | $this->notifications = ''; |
||
| 217 | $this->autoLaunch = false; |
||
| 218 | $this->preventBackwards = 0; |
||
| 219 | $this->random = 0; |
||
| 220 | $this->randomAnswers = false; |
||
| 221 | $this->active = 1; |
||
| 222 | $this->resultsDisabled = 0; |
||
| 223 | $this->maxAttempt = 1; |
||
| 224 | $this->feedbackType = 0; |
||
| 225 | $this->expiredTime = 0; |
||
| 226 | $this->propagateNeg = 0; |
||
| 227 | $this->saveCorrectAnswers = 0; |
||
| 228 | $this->reviewAnswers = 0; |
||
| 229 | $this->randomByCategory = 0; |
||
| 230 | $this->displayCategoryName = 0; |
||
| 231 | $this->pageResultConfiguration = []; |
||
| 232 | } |
||
| 233 | |||
| 234 | public function __toString(): string |
||
| 235 | { |
||
| 236 | return $this->getTitle(); |
||
| 237 | } |
||
| 238 | |||
| 239 | /** |
||
| 240 | * @return Collection|CQuizRelQuestion[] |
||
| 241 | */ |
||
| 242 | public function getQuestions() |
||
| 243 | { |
||
| 244 | return $this->questions; |
||
| 245 | } |
||
| 246 | |||
| 247 | public function setTitle(string $title): self |
||
| 248 | { |
||
| 249 | $this->title = $title; |
||
| 250 | |||
| 251 | return $this; |
||
| 252 | } |
||
| 253 | |||
| 254 | public function getTitle(): string |
||
| 257 | } |
||
| 258 | |||
| 259 | public function setDescription(string $description): self |
||
| 260 | { |
||
| 261 | $this->description = $description; |
||
| 262 | |||
| 263 | return $this; |
||
| 264 | } |
||
| 265 | |||
| 266 | /** |
||
| 267 | * Get description. |
||
| 268 | * |
||
| 269 | * @return string |
||
| 270 | */ |
||
| 271 | public function getDescription() |
||
| 272 | { |
||
| 273 | return $this->description; |
||
| 274 | } |
||
| 275 | |||
| 276 | public function setSound(string $sound): self |
||
| 277 | { |
||
| 278 | $this->sound = $sound; |
||
| 279 | |||
| 280 | return $this; |
||
| 281 | } |
||
| 282 | |||
| 283 | /** |
||
| 284 | * Get sound. |
||
| 285 | * |
||
| 286 | * @return string |
||
| 287 | */ |
||
| 288 | public function getSound() |
||
| 289 | { |
||
| 290 | return $this->sound; |
||
| 291 | } |
||
| 292 | |||
| 293 | public function setType(int $type): self |
||
| 294 | { |
||
| 295 | $this->type = $type; |
||
| 296 | |||
| 297 | return $this; |
||
| 298 | } |
||
| 299 | |||
| 300 | public function getType(): int |
||
| 301 | { |
||
| 302 | return $this->type; |
||
| 303 | } |
||
| 304 | |||
| 305 | public function setRandom(int $random): self |
||
| 306 | { |
||
| 307 | $this->random = $random; |
||
| 308 | |||
| 309 | return $this; |
||
| 310 | } |
||
| 311 | |||
| 312 | /** |
||
| 313 | * Get random. |
||
| 314 | * |
||
| 315 | * @return int |
||
| 316 | */ |
||
| 317 | public function getRandom() |
||
| 318 | { |
||
| 319 | return $this->random; |
||
| 320 | } |
||
| 321 | |||
| 322 | public function setRandomAnswers(bool $randomAnswers): self |
||
| 323 | { |
||
| 324 | $this->randomAnswers = $randomAnswers; |
||
| 325 | |||
| 326 | return $this; |
||
| 327 | } |
||
| 328 | |||
| 329 | /** |
||
| 330 | * Get randomAnswers. |
||
| 331 | * |
||
| 332 | * @return bool |
||
| 333 | */ |
||
| 334 | public function getRandomAnswers() |
||
| 335 | { |
||
| 336 | return $this->randomAnswers; |
||
| 337 | } |
||
| 338 | |||
| 339 | public function setActive(int $active): self |
||
| 340 | { |
||
| 341 | $this->active = $active; |
||
| 342 | |||
| 343 | return $this; |
||
| 344 | } |
||
| 345 | |||
| 346 | public function getActive(): int |
||
| 347 | { |
||
| 348 | return $this->active; |
||
| 349 | } |
||
| 350 | |||
| 351 | public function setResultsDisabled(int $resultsDisabled): self |
||
| 352 | { |
||
| 353 | $this->resultsDisabled = $resultsDisabled; |
||
| 354 | |||
| 355 | return $this; |
||
| 356 | } |
||
| 357 | |||
| 358 | /** |
||
| 359 | * Get resultsDisabled. |
||
| 360 | * |
||
| 361 | * @return int |
||
| 362 | */ |
||
| 363 | public function getResultsDisabled() |
||
| 364 | { |
||
| 365 | return $this->resultsDisabled; |
||
| 366 | } |
||
| 367 | |||
| 368 | /** |
||
| 369 | * Set accessCondition. |
||
| 370 | * |
||
| 371 | * @return CQuiz |
||
| 372 | */ |
||
| 373 | public function setAccessCondition(string $accessCondition) |
||
| 374 | { |
||
| 375 | $this->accessCondition = $accessCondition; |
||
| 376 | |||
| 377 | return $this; |
||
| 378 | } |
||
| 379 | |||
| 380 | /** |
||
| 381 | * Get accessCondition. |
||
| 382 | * |
||
| 383 | * @return string |
||
| 384 | */ |
||
| 385 | public function getAccessCondition() |
||
| 386 | { |
||
| 387 | return $this->accessCondition; |
||
| 388 | } |
||
| 389 | |||
| 390 | public function setMaxAttempt(int $maxAttempt): self |
||
| 391 | { |
||
| 392 | $this->maxAttempt = $maxAttempt; |
||
| 393 | |||
| 394 | return $this; |
||
| 395 | } |
||
| 396 | |||
| 397 | /** |
||
| 398 | * Get maxAttempt. |
||
| 399 | * |
||
| 400 | * @return int |
||
| 401 | */ |
||
| 402 | public function getMaxAttempt() |
||
| 405 | } |
||
| 406 | |||
| 407 | public function setStartTime(?DateTime $startTime): self |
||
| 408 | { |
||
| 409 | $this->startTime = $startTime; |
||
| 410 | |||
| 411 | return $this; |
||
| 412 | } |
||
| 413 | |||
| 414 | /** |
||
| 415 | * Get startTime. |
||
| 416 | * |
||
| 417 | * @return DateTime |
||
| 418 | */ |
||
| 419 | public function getStartTime() |
||
| 420 | { |
||
| 421 | return $this->startTime; |
||
| 422 | } |
||
| 423 | |||
| 424 | /** |
||
| 425 | * Set endTime. |
||
| 426 | * |
||
| 427 | * @return CQuiz |
||
| 428 | */ |
||
| 429 | public function setEndTime(?DateTime $endTime) |
||
| 430 | { |
||
| 431 | $this->endTime = $endTime; |
||
| 432 | |||
| 433 | return $this; |
||
| 434 | } |
||
| 435 | |||
| 436 | /** |
||
| 437 | * Get endTime. |
||
| 438 | * |
||
| 439 | * @return DateTime |
||
| 440 | */ |
||
| 441 | public function getEndTime() |
||
| 442 | { |
||
| 443 | return $this->endTime; |
||
| 444 | } |
||
| 445 | |||
| 446 | /** |
||
| 447 | * Set feedbackType. |
||
| 448 | * |
||
| 449 | * @return CQuiz |
||
| 450 | */ |
||
| 451 | public function setFeedbackType(int $feedbackType) |
||
| 452 | { |
||
| 453 | $this->feedbackType = $feedbackType; |
||
| 454 | |||
| 455 | return $this; |
||
| 456 | } |
||
| 457 | |||
| 458 | /** |
||
| 459 | * Get feedbackType. |
||
| 460 | * |
||
| 461 | * @return int |
||
| 462 | */ |
||
| 463 | public function getFeedbackType() |
||
| 464 | { |
||
| 465 | return $this->feedbackType; |
||
| 466 | } |
||
| 467 | |||
| 468 | /** |
||
| 469 | * Set expiredTime. |
||
| 470 | * |
||
| 471 | * @return CQuiz |
||
| 472 | */ |
||
| 473 | public function setExpiredTime(int $expiredTime) |
||
| 474 | { |
||
| 475 | $this->expiredTime = $expiredTime; |
||
| 476 | |||
| 477 | return $this; |
||
| 478 | } |
||
| 479 | |||
| 480 | /** |
||
| 481 | * Get expiredTime. |
||
| 482 | * |
||
| 483 | * @return int |
||
| 484 | */ |
||
| 485 | public function getExpiredTime() |
||
| 486 | { |
||
| 487 | return $this->expiredTime; |
||
| 488 | } |
||
| 489 | |||
| 490 | /** |
||
| 491 | * Set propagateNeg. |
||
| 492 | * |
||
| 493 | * @return CQuiz |
||
| 494 | */ |
||
| 495 | public function setPropagateNeg(int $propagateNeg) |
||
| 496 | { |
||
| 497 | $this->propagateNeg = $propagateNeg; |
||
| 498 | |||
| 499 | return $this; |
||
| 500 | } |
||
| 501 | |||
| 502 | /** |
||
| 503 | * Get propagateNeg. |
||
| 504 | * |
||
| 505 | * @return int |
||
| 506 | */ |
||
| 507 | public function getPropagateNeg() |
||
| 508 | { |
||
| 509 | return $this->propagateNeg; |
||
| 510 | } |
||
| 511 | |||
| 512 | /** |
||
| 513 | * @return CQuiz |
||
| 514 | */ |
||
| 515 | public function setSaveCorrectAnswers(int $saveCorrectAnswers) |
||
| 516 | { |
||
| 517 | $this->saveCorrectAnswers = $saveCorrectAnswers; |
||
| 518 | |||
| 519 | return $this; |
||
| 520 | } |
||
| 521 | |||
| 522 | /** |
||
| 523 | * @return int |
||
| 524 | */ |
||
| 525 | public function getSaveCorrectAnswers() |
||
| 526 | { |
||
| 527 | return $this->saveCorrectAnswers; |
||
| 528 | } |
||
| 529 | |||
| 530 | /** |
||
| 531 | * Set reviewAnswers. |
||
| 532 | * |
||
| 533 | * @return CQuiz |
||
| 534 | */ |
||
| 535 | public function setReviewAnswers(int $reviewAnswers) |
||
| 536 | { |
||
| 537 | $this->reviewAnswers = $reviewAnswers; |
||
| 538 | |||
| 539 | return $this; |
||
| 540 | } |
||
| 541 | |||
| 542 | /** |
||
| 543 | * Get reviewAnswers. |
||
| 544 | * |
||
| 545 | * @return int |
||
| 546 | */ |
||
| 547 | public function getReviewAnswers() |
||
| 548 | { |
||
| 549 | return $this->reviewAnswers; |
||
| 550 | } |
||
| 551 | |||
| 552 | /** |
||
| 553 | * Set randomByCategory. |
||
| 554 | * |
||
| 555 | * @return CQuiz |
||
| 556 | */ |
||
| 557 | public function setRandomByCategory(int $randomByCategory) |
||
| 558 | { |
||
| 559 | $this->randomByCategory = $randomByCategory; |
||
| 560 | |||
| 561 | return $this; |
||
| 562 | } |
||
| 563 | |||
| 564 | /** |
||
| 565 | * Get randomByCategory. |
||
| 566 | * |
||
| 567 | * @return int |
||
| 568 | */ |
||
| 569 | public function getRandomByCategory() |
||
| 570 | { |
||
| 571 | return $this->randomByCategory; |
||
| 572 | } |
||
| 573 | |||
| 574 | /** |
||
| 575 | * Set textWhenFinished. |
||
| 576 | * |
||
| 577 | * @return CQuiz |
||
| 578 | */ |
||
| 579 | public function setTextWhenFinished(string $textWhenFinished) |
||
| 580 | { |
||
| 581 | $this->textWhenFinished = $textWhenFinished; |
||
| 582 | |||
| 583 | return $this; |
||
| 584 | } |
||
| 585 | |||
| 586 | /** |
||
| 587 | * Get textWhenFinished. |
||
| 588 | * |
||
| 589 | * @return string |
||
| 590 | */ |
||
| 591 | public function getTextWhenFinished() |
||
| 592 | { |
||
| 593 | return $this->textWhenFinished; |
||
| 594 | } |
||
| 595 | |||
| 596 | /** |
||
| 597 | * Set displayCategoryName. |
||
| 598 | * |
||
| 599 | * @return CQuiz |
||
| 600 | */ |
||
| 601 | public function setDisplayCategoryName(int $displayCategoryName) |
||
| 602 | { |
||
| 603 | $this->displayCategoryName = $displayCategoryName; |
||
| 604 | |||
| 605 | return $this; |
||
| 606 | } |
||
| 607 | |||
| 608 | /** |
||
| 609 | * Get displayCategoryName. |
||
| 610 | * |
||
| 611 | * @return int |
||
| 612 | */ |
||
| 613 | public function getDisplayCategoryName() |
||
| 614 | { |
||
| 615 | return $this->displayCategoryName; |
||
| 616 | } |
||
| 617 | |||
| 618 | /** |
||
| 619 | * Set passPercentage. |
||
| 620 | * |
||
| 621 | * @return CQuiz |
||
| 622 | */ |
||
| 623 | public function setPassPercentage(int $passPercentage) |
||
| 624 | { |
||
| 625 | $this->passPercentage = $passPercentage; |
||
| 626 | |||
| 627 | return $this; |
||
| 628 | } |
||
| 629 | |||
| 630 | /** |
||
| 631 | * Get passPercentage. |
||
| 632 | * |
||
| 633 | * @return int |
||
| 634 | */ |
||
| 635 | public function getPassPercentage() |
||
| 636 | { |
||
| 637 | return $this->passPercentage; |
||
| 638 | } |
||
| 639 | |||
| 640 | public function getExerciseCategory(): ?CExerciseCategory |
||
| 641 | { |
||
| 642 | return $this->exerciseCategory; |
||
| 643 | } |
||
| 644 | |||
| 645 | public function setExerciseCategory(CExerciseCategory $exerciseCategory): self |
||
| 646 | { |
||
| 647 | $this->exerciseCategory = $exerciseCategory; |
||
| 648 | |||
| 649 | return $this; |
||
| 650 | } |
||
| 651 | |||
| 652 | /** |
||
| 653 | * @return int |
||
| 654 | */ |
||
| 655 | public function getQuestionSelectionType() |
||
| 656 | { |
||
| 657 | return $this->questionSelectionType; |
||
| 658 | } |
||
| 659 | |||
| 660 | public function setQuestionSelectionType(int $questionSelectionType): self |
||
| 661 | { |
||
| 662 | $this->questionSelectionType = $questionSelectionType; |
||
| 663 | |||
| 664 | return $this; |
||
| 665 | } |
||
| 666 | |||
| 667 | public function isHideQuestionTitle(): bool |
||
| 668 | { |
||
| 669 | return $this->hideQuestionTitle; |
||
| 670 | } |
||
| 671 | |||
| 672 | public function setHideQuestionTitle(bool $hideQuestionTitle): self |
||
| 673 | { |
||
| 674 | $this->hideQuestionTitle = $hideQuestionTitle; |
||
| 675 | |||
| 676 | return $this; |
||
| 677 | } |
||
| 678 | |||
| 679 | public function isShowPreviousButton(): bool |
||
| 682 | } |
||
| 683 | |||
| 684 | public function setShowPreviousButton(bool $showPreviousButton): self |
||
| 685 | { |
||
| 686 | $this->showPreviousButton = $showPreviousButton; |
||
| 687 | |||
| 688 | return $this; |
||
| 689 | } |
||
| 690 | |||
| 691 | public function getNotifications(): string |
||
| 692 | { |
||
| 693 | return $this->notifications; |
||
|
|
|||
| 694 | } |
||
| 695 | |||
| 696 | public function setNotifications(string $notifications): self |
||
| 697 | { |
||
| 698 | $this->notifications = $notifications; |
||
| 699 | |||
| 700 | return $this; |
||
| 701 | } |
||
| 702 | |||
| 703 | /** |
||
| 704 | * @return int |
||
| 705 | */ |
||
| 706 | public function getIid() |
||
| 707 | { |
||
| 708 | return $this->iid; |
||
| 709 | } |
||
| 710 | |||
| 711 | public function getPreventBackwards(): int |
||
| 712 | { |
||
| 713 | return $this->preventBackwards; |
||
| 714 | } |
||
| 715 | |||
| 716 | public function setPreventBackwards(int $preventBackwards): self |
||
| 717 | { |
||
| 718 | $this->preventBackwards = $preventBackwards; |
||
| 719 | |||
| 720 | return $this; |
||
| 721 | } |
||
| 722 | |||
| 723 | public function isAutoLaunch(): bool |
||
| 724 | { |
||
| 725 | return $this->autoLaunch; |
||
| 726 | } |
||
| 727 | |||
| 728 | public function setAutoLaunch(bool $autoLaunch): self |
||
| 729 | { |
||
| 730 | $this->autoLaunch = $autoLaunch; |
||
| 731 | |||
| 732 | return $this; |
||
| 733 | } |
||
| 734 | |||
| 735 | public function getPageResultConfiguration(): array |
||
| 738 | } |
||
| 739 | |||
| 740 | public function setPageResultConfiguration(array $pageResultConfiguration): self |
||
| 741 | { |
||
| 742 | $this->pageResultConfiguration = $pageResultConfiguration; |
||
| 743 | |||
| 744 | return $this; |
||
| 745 | } |
||
| 746 | |||
| 747 | /** |
||
| 748 | * @ORM\PostPersist() |
||
| 749 | */ |
||
| 750 | public function postPersist(LifecycleEventArgs $args): void |
||
| 751 | { |
||
| 752 | } |
||
| 753 | |||
| 754 | /** |
||
| 755 | * Returns the sum of question's ponderation. |
||
| 756 | */ |
||
| 757 | public function getMaxScore(): int |
||
| 758 | { |
||
| 759 | $maxScore = 0; |
||
| 760 | foreach ($this->questions as $relQuestion) { |
||
| 761 | $maxScore += $relQuestion->getQuestion()->getPonderation(); |
||
| 762 | } |
||
| 763 | |||
| 764 | return $maxScore; |
||
| 765 | } |
||
| 766 | |||
| 767 | public function getAutoLaunch(): ?bool |
||
| 768 | { |
||
| 769 | return $this->autoLaunch; |
||
| 770 | } |
||
| 771 | |||
| 772 | public function getHideQuestionNumber(): ?int |
||
| 773 | { |
||
| 774 | return $this->hideQuestionNumber; |
||
| 775 | } |
||
| 776 | |||
| 777 | public function setHideQuestionNumber(int $hideQuestionNumber): CQuiz |
||
| 778 | { |
||
| 779 | $this->hideQuestionNumber = $hideQuestionNumber; |
||
| 780 | |||
| 781 | return $this; |
||
| 782 | } |
||
| 783 | |||
| 784 | /** |
||
| 785 | * @return CQuizRelQuestionCategory[]|Collection |
||
| 786 | */ |
||
| 787 | public function getQuestionsCategories() |
||
| 788 | { |
||
| 789 | return $this->questionsCategories; |
||
| 790 | } |
||
| 791 | |||
| 792 | public function getResourceIdentifier(): int |
||
| 795 | } |
||
| 796 | |||
| 797 | public function getResourceName(): string |
||
| 798 | { |
||
| 799 | return $this->getTitle(); |
||
| 800 | } |
||
| 801 | |||
| 802 | public function setResourceName(string $name): self |
||
| 805 | } |
||
| 806 | } |
||
| 807 |