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