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