| Total Complexity | 65 |
| Total Lines | 971 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 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 |
||
| 24 | class CQuiz extends AbstractResource implements ResourceInterface |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * @var int |
||
| 28 | * |
||
| 29 | * @ORM\Column(name="iid", type="integer") |
||
| 30 | * @ORM\Id |
||
| 31 | * @ORM\GeneratedValue |
||
| 32 | */ |
||
| 33 | protected $iid; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var int |
||
| 37 | * |
||
| 38 | * @ORM\Column(name="c_id", type="integer") |
||
| 39 | */ |
||
| 40 | protected $cId; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @var int |
||
| 44 | * |
||
| 45 | * @ORM\Column(name="id", type="integer", nullable=true) |
||
| 46 | */ |
||
| 47 | protected $id; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @var string |
||
| 51 | * |
||
| 52 | * @ORM\Column(name="title", type="text", nullable=false) |
||
| 53 | */ |
||
| 54 | protected $title; |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @var string |
||
| 58 | * |
||
| 59 | * @ORM\Column(name="description", type="text", nullable=true) |
||
| 60 | */ |
||
| 61 | protected $description; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @var string |
||
| 65 | * |
||
| 66 | * @ORM\Column(name="sound", type="string", length=255, nullable=true) |
||
| 67 | */ |
||
| 68 | protected $sound; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @var bool |
||
| 72 | * |
||
| 73 | * @ORM\Column(name="type", type="boolean", nullable=false) |
||
| 74 | */ |
||
| 75 | protected $type; |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @var int |
||
| 79 | * |
||
| 80 | * @ORM\Column(name="random", type="integer", nullable=false) |
||
| 81 | */ |
||
| 82 | protected $random; |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @var bool |
||
| 86 | * |
||
| 87 | * @ORM\Column(name="random_answers", type="boolean", nullable=false) |
||
| 88 | */ |
||
| 89 | protected $randomAnswers; |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @var bool |
||
| 93 | * |
||
| 94 | * @ORM\Column(name="active", type="boolean", nullable=false) |
||
| 95 | */ |
||
| 96 | protected $active; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var int |
||
| 100 | * |
||
| 101 | * @ORM\Column(name="results_disabled", type="integer", nullable=false) |
||
| 102 | */ |
||
| 103 | protected $resultsDisabled; |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @var string |
||
| 107 | * |
||
| 108 | * @ORM\Column(name="access_condition", type="text", nullable=true) |
||
| 109 | */ |
||
| 110 | protected $accessCondition; |
||
| 111 | |||
| 112 | /** |
||
| 113 | * @var int |
||
| 114 | * |
||
| 115 | * @ORM\Column(name="max_attempt", type="integer", nullable=false) |
||
| 116 | */ |
||
| 117 | protected $maxAttempt; |
||
| 118 | |||
| 119 | /** |
||
| 120 | * @var \DateTime |
||
| 121 | * |
||
| 122 | * @ORM\Column(name="start_time", type="datetime", nullable=true) |
||
| 123 | */ |
||
| 124 | protected $startTime; |
||
| 125 | |||
| 126 | /** |
||
| 127 | * @var \DateTime |
||
| 128 | * |
||
| 129 | * @ORM\Column(name="end_time", type="datetime", nullable=true) |
||
| 130 | */ |
||
| 131 | protected $endTime; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @var int |
||
| 135 | * |
||
| 136 | * @ORM\Column(name="feedback_type", type="integer", nullable=false) |
||
| 137 | */ |
||
| 138 | protected $feedbackType; |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @var int |
||
| 142 | * |
||
| 143 | * @ORM\Column(name="expired_time", type="integer", nullable=false) |
||
| 144 | */ |
||
| 145 | protected $expiredTime; |
||
| 146 | |||
| 147 | /** |
||
| 148 | * @var int |
||
| 149 | * |
||
| 150 | * @ORM\Column(name="session_id", type="integer", nullable=true) |
||
| 151 | */ |
||
| 152 | protected $sessionId; |
||
| 153 | |||
| 154 | /** |
||
| 155 | * @var int |
||
| 156 | * |
||
| 157 | * @ORM\Column(name="propagate_neg", type="integer", nullable=false) |
||
| 158 | */ |
||
| 159 | protected $propagateNeg; |
||
| 160 | |||
| 161 | /** |
||
| 162 | * @var int |
||
| 163 | * |
||
| 164 | * @ORm\Column(name="save_correct_answers", type="integer", nullable=true) |
||
| 165 | */ |
||
| 166 | protected $saveCorrectAnswers; |
||
| 167 | |||
| 168 | /** |
||
| 169 | * @var int |
||
| 170 | * |
||
| 171 | * @ORM\Column(name="review_answers", type="integer", nullable=false) |
||
| 172 | */ |
||
| 173 | protected $reviewAnswers; |
||
| 174 | |||
| 175 | /** |
||
| 176 | * @var int |
||
| 177 | * |
||
| 178 | * @ORM\Column(name="random_by_category", type="integer", nullable=false) |
||
| 179 | */ |
||
| 180 | protected $randomByCategory; |
||
| 181 | |||
| 182 | /** |
||
| 183 | * @var string |
||
| 184 | * |
||
| 185 | * @ORM\Column(name="text_when_finished", type="text", nullable=true) |
||
| 186 | */ |
||
| 187 | protected $textWhenFinished; |
||
| 188 | |||
| 189 | /** |
||
| 190 | * @var int |
||
| 191 | * |
||
| 192 | * @ORM\Column(name="display_category_name", type="integer", nullable=false) |
||
| 193 | */ |
||
| 194 | protected $displayCategoryName; |
||
| 195 | |||
| 196 | /** |
||
| 197 | * @var int |
||
| 198 | * |
||
| 199 | * @ORM\Column(name="pass_percentage", type="integer", nullable=true) |
||
| 200 | */ |
||
| 201 | protected $passPercentage; |
||
| 202 | |||
| 203 | /** |
||
| 204 | * @var int |
||
| 205 | * |
||
| 206 | * @ORM\Column(name="question_selection_type", type="integer", nullable=true) |
||
| 207 | */ |
||
| 208 | protected $questionSelectionType; |
||
| 209 | |||
| 210 | /** |
||
| 211 | * @var bool |
||
| 212 | * |
||
| 213 | * @ORM\Column(name="hide_question_title", type="boolean", nullable=true) |
||
| 214 | */ |
||
| 215 | protected $hideQuestionTitle; |
||
| 216 | |||
| 217 | /** |
||
| 218 | * @var CExerciseCategory |
||
| 219 | * |
||
| 220 | * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CExerciseCategory", cascade={"persist"}) |
||
| 221 | * @ORM\JoinColumn(name="exercise_category_id", referencedColumnName="id", onDelete="SET NULL") |
||
| 222 | * |
||
| 223 | */ |
||
| 224 | protected $exerciseCategory; |
||
| 225 | |||
| 226 | /** |
||
| 227 | * @var bool |
||
| 228 | * |
||
| 229 | * @ORM\Column(name="show_previous_button", type="boolean", nullable=true, options={"default":1}) |
||
| 230 | */ |
||
| 231 | protected $showPreviousButton; |
||
| 232 | |||
| 233 | /** |
||
| 234 | * @var string |
||
| 235 | * |
||
| 236 | * @ORM\Column(name="notifications", type="string", length=255, nullable=true) |
||
| 237 | */ |
||
| 238 | protected $notifications; |
||
| 239 | |||
| 240 | /** |
||
| 241 | * @var bool |
||
| 242 | * |
||
| 243 | * @ORM\Column(name="autolaunch", type="boolean", nullable=true, options={"default":0}) |
||
| 244 | */ |
||
| 245 | protected $autoLaunch; |
||
| 246 | |||
| 247 | /** |
||
| 248 | * @var int |
||
| 249 | * |
||
| 250 | * @ORM\Column(name="page_result_configuration", type="array", nullable=true) |
||
| 251 | */ |
||
| 252 | protected $pageResultConfiguration; |
||
| 253 | |||
| 254 | /** |
||
| 255 | * CQuiz constructor. |
||
| 256 | */ |
||
| 257 | public function __construct() |
||
| 258 | { |
||
| 259 | $this->hideQuestionTitle = false; |
||
| 260 | $this->showPreviousButton = true; |
||
| 261 | $this->notifications = ''; |
||
| 262 | $this->autoLaunch = 0; |
||
|
|
|||
| 263 | } |
||
| 264 | |||
| 265 | /** |
||
| 266 | * Set title. |
||
| 267 | * |
||
| 268 | * @param string $title |
||
| 269 | * |
||
| 270 | * @return CQuiz |
||
| 271 | */ |
||
| 272 | public function setTitle($title) |
||
| 273 | { |
||
| 274 | $this->title = $title; |
||
| 275 | |||
| 276 | return $this; |
||
| 277 | } |
||
| 278 | |||
| 279 | /** |
||
| 280 | * Get title. |
||
| 281 | * |
||
| 282 | * @return string |
||
| 283 | */ |
||
| 284 | public function getTitle() |
||
| 285 | { |
||
| 286 | return $this->title; |
||
| 287 | } |
||
| 288 | |||
| 289 | /** |
||
| 290 | * Set description. |
||
| 291 | * |
||
| 292 | * @param string $description |
||
| 293 | * |
||
| 294 | * @return CQuiz |
||
| 295 | */ |
||
| 296 | public function setDescription($description) |
||
| 297 | { |
||
| 298 | $this->description = $description; |
||
| 299 | |||
| 300 | return $this; |
||
| 301 | } |
||
| 302 | |||
| 303 | /** |
||
| 304 | * Get description. |
||
| 305 | * |
||
| 306 | * @return string |
||
| 307 | */ |
||
| 308 | public function getDescription() |
||
| 309 | { |
||
| 310 | return $this->description; |
||
| 311 | } |
||
| 312 | |||
| 313 | /** |
||
| 314 | * Set sound. |
||
| 315 | * |
||
| 316 | * @param string $sound |
||
| 317 | * |
||
| 318 | * @return CQuiz |
||
| 319 | */ |
||
| 320 | public function setSound($sound) |
||
| 321 | { |
||
| 322 | $this->sound = $sound; |
||
| 323 | |||
| 324 | return $this; |
||
| 325 | } |
||
| 326 | |||
| 327 | /** |
||
| 328 | * Get sound. |
||
| 329 | * |
||
| 330 | * @return string |
||
| 331 | */ |
||
| 332 | public function getSound() |
||
| 333 | { |
||
| 334 | return $this->sound; |
||
| 335 | } |
||
| 336 | |||
| 337 | /** |
||
| 338 | * Set type. |
||
| 339 | * |
||
| 340 | * @param bool $type |
||
| 341 | * |
||
| 342 | * @return CQuiz |
||
| 343 | */ |
||
| 344 | public function setType($type) |
||
| 345 | { |
||
| 346 | $this->type = $type; |
||
| 347 | |||
| 348 | return $this; |
||
| 349 | } |
||
| 350 | |||
| 351 | /** |
||
| 352 | * Get type. |
||
| 353 | * |
||
| 354 | * @return bool |
||
| 355 | */ |
||
| 356 | public function getType() |
||
| 357 | { |
||
| 358 | return $this->type; |
||
| 359 | } |
||
| 360 | |||
| 361 | /** |
||
| 362 | * Set random. |
||
| 363 | * |
||
| 364 | * @param int $random |
||
| 365 | * |
||
| 366 | * @return CQuiz |
||
| 367 | */ |
||
| 368 | public function setRandom($random) |
||
| 369 | { |
||
| 370 | $this->random = $random; |
||
| 371 | |||
| 372 | return $this; |
||
| 373 | } |
||
| 374 | |||
| 375 | /** |
||
| 376 | * Get random. |
||
| 377 | * |
||
| 378 | * @return int |
||
| 379 | */ |
||
| 380 | public function getRandom() |
||
| 381 | { |
||
| 382 | return $this->random; |
||
| 383 | } |
||
| 384 | |||
| 385 | /** |
||
| 386 | * Set randomAnswers. |
||
| 387 | * |
||
| 388 | * @param bool $randomAnswers |
||
| 389 | * |
||
| 390 | * @return CQuiz |
||
| 391 | */ |
||
| 392 | public function setRandomAnswers($randomAnswers) |
||
| 393 | { |
||
| 394 | $this->randomAnswers = $randomAnswers; |
||
| 395 | |||
| 396 | return $this; |
||
| 397 | } |
||
| 398 | |||
| 399 | /** |
||
| 400 | * Get randomAnswers. |
||
| 401 | * |
||
| 402 | * @return bool |
||
| 403 | */ |
||
| 404 | public function getRandomAnswers() |
||
| 405 | { |
||
| 406 | return $this->randomAnswers; |
||
| 407 | } |
||
| 408 | |||
| 409 | /** |
||
| 410 | * Set active. |
||
| 411 | * |
||
| 412 | * @param bool $active |
||
| 413 | * |
||
| 414 | * @return CQuiz |
||
| 415 | */ |
||
| 416 | public function setActive($active) |
||
| 417 | { |
||
| 418 | $this->active = $active; |
||
| 419 | |||
| 420 | return $this; |
||
| 421 | } |
||
| 422 | |||
| 423 | /** |
||
| 424 | * Get active. |
||
| 425 | * |
||
| 426 | * @return bool |
||
| 427 | */ |
||
| 428 | public function getActive() |
||
| 429 | { |
||
| 430 | return $this->active; |
||
| 431 | } |
||
| 432 | |||
| 433 | /** |
||
| 434 | * Set resultsDisabled. |
||
| 435 | * |
||
| 436 | * @param int $resultsDisabled |
||
| 437 | * |
||
| 438 | * @return CQuiz |
||
| 439 | */ |
||
| 440 | public function setResultsDisabled($resultsDisabled) |
||
| 441 | { |
||
| 442 | $this->resultsDisabled = $resultsDisabled; |
||
| 443 | |||
| 444 | return $this; |
||
| 445 | } |
||
| 446 | |||
| 447 | /** |
||
| 448 | * Get resultsDisabled. |
||
| 449 | * |
||
| 450 | * @return int |
||
| 451 | */ |
||
| 452 | public function getResultsDisabled() |
||
| 453 | { |
||
| 454 | return $this->resultsDisabled; |
||
| 455 | } |
||
| 456 | |||
| 457 | /** |
||
| 458 | * Set accessCondition. |
||
| 459 | * |
||
| 460 | * @param string $accessCondition |
||
| 461 | * |
||
| 462 | * @return CQuiz |
||
| 463 | */ |
||
| 464 | public function setAccessCondition($accessCondition) |
||
| 465 | { |
||
| 466 | $this->accessCondition = $accessCondition; |
||
| 467 | |||
| 468 | return $this; |
||
| 469 | } |
||
| 470 | |||
| 471 | /** |
||
| 472 | * Get accessCondition. |
||
| 473 | * |
||
| 474 | * @return string |
||
| 475 | */ |
||
| 476 | public function getAccessCondition() |
||
| 477 | { |
||
| 478 | return $this->accessCondition; |
||
| 479 | } |
||
| 480 | |||
| 481 | /** |
||
| 482 | * Set maxAttempt. |
||
| 483 | * |
||
| 484 | * @param int $maxAttempt |
||
| 485 | * |
||
| 486 | * @return CQuiz |
||
| 487 | */ |
||
| 488 | public function setMaxAttempt($maxAttempt) |
||
| 489 | { |
||
| 490 | $this->maxAttempt = $maxAttempt; |
||
| 491 | |||
| 492 | return $this; |
||
| 493 | } |
||
| 494 | |||
| 495 | /** |
||
| 496 | * Get maxAttempt. |
||
| 497 | * |
||
| 498 | * @return int |
||
| 499 | */ |
||
| 500 | public function getMaxAttempt() |
||
| 503 | } |
||
| 504 | |||
| 505 | /** |
||
| 506 | * Set startTime. |
||
| 507 | * |
||
| 508 | * @param \DateTime $startTime |
||
| 509 | * |
||
| 510 | * @return CQuiz |
||
| 511 | */ |
||
| 512 | public function setStartTime($startTime) |
||
| 513 | { |
||
| 514 | $this->startTime = $startTime; |
||
| 515 | |||
| 516 | return $this; |
||
| 517 | } |
||
| 518 | |||
| 519 | /** |
||
| 520 | * Get startTime. |
||
| 521 | * |
||
| 522 | * @return \DateTime |
||
| 523 | */ |
||
| 524 | public function getStartTime() |
||
| 525 | { |
||
| 526 | return $this->startTime; |
||
| 527 | } |
||
| 528 | |||
| 529 | /** |
||
| 530 | * Set endTime. |
||
| 531 | * |
||
| 532 | * @param \DateTime $endTime |
||
| 533 | * |
||
| 534 | * @return CQuiz |
||
| 535 | */ |
||
| 536 | public function setEndTime($endTime) |
||
| 537 | { |
||
| 538 | $this->endTime = $endTime; |
||
| 539 | |||
| 540 | return $this; |
||
| 541 | } |
||
| 542 | |||
| 543 | /** |
||
| 544 | * Get endTime. |
||
| 545 | * |
||
| 546 | * @return \DateTime |
||
| 547 | */ |
||
| 548 | public function getEndTime() |
||
| 549 | { |
||
| 550 | return $this->endTime; |
||
| 551 | } |
||
| 552 | |||
| 553 | /** |
||
| 554 | * Set feedbackType. |
||
| 555 | * |
||
| 556 | * @param int $feedbackType |
||
| 557 | * |
||
| 558 | * @return CQuiz |
||
| 559 | */ |
||
| 560 | public function setFeedbackType($feedbackType) |
||
| 561 | { |
||
| 562 | $this->feedbackType = $feedbackType; |
||
| 563 | |||
| 564 | return $this; |
||
| 565 | } |
||
| 566 | |||
| 567 | /** |
||
| 568 | * Get feedbackType. |
||
| 569 | * |
||
| 570 | * @return int |
||
| 571 | */ |
||
| 572 | public function getFeedbackType() |
||
| 573 | { |
||
| 574 | return $this->feedbackType; |
||
| 575 | } |
||
| 576 | |||
| 577 | /** |
||
| 578 | * Set expiredTime. |
||
| 579 | * |
||
| 580 | * @param int $expiredTime |
||
| 581 | * |
||
| 582 | * @return CQuiz |
||
| 583 | */ |
||
| 584 | public function setExpiredTime($expiredTime) |
||
| 585 | { |
||
| 586 | $this->expiredTime = $expiredTime; |
||
| 587 | |||
| 588 | return $this; |
||
| 589 | } |
||
| 590 | |||
| 591 | /** |
||
| 592 | * Get expiredTime. |
||
| 593 | * |
||
| 594 | * @return int |
||
| 595 | */ |
||
| 596 | public function getExpiredTime() |
||
| 597 | { |
||
| 598 | return $this->expiredTime; |
||
| 599 | } |
||
| 600 | |||
| 601 | /** |
||
| 602 | * Set sessionId. |
||
| 603 | * |
||
| 604 | * @param int $sessionId |
||
| 605 | * |
||
| 606 | * @return CQuiz |
||
| 607 | */ |
||
| 608 | public function setSessionId($sessionId) |
||
| 609 | { |
||
| 610 | $this->sessionId = $sessionId; |
||
| 611 | |||
| 612 | return $this; |
||
| 613 | } |
||
| 614 | |||
| 615 | /** |
||
| 616 | * Get sessionId. |
||
| 617 | * |
||
| 618 | * @return int |
||
| 619 | */ |
||
| 620 | public function getSessionId() |
||
| 621 | { |
||
| 622 | return $this->sessionId; |
||
| 623 | } |
||
| 624 | |||
| 625 | /** |
||
| 626 | * Set propagateNeg. |
||
| 627 | * |
||
| 628 | * @param int $propagateNeg |
||
| 629 | * |
||
| 630 | * @return CQuiz |
||
| 631 | */ |
||
| 632 | public function setPropagateNeg($propagateNeg) |
||
| 633 | { |
||
| 634 | $this->propagateNeg = $propagateNeg; |
||
| 635 | |||
| 636 | return $this; |
||
| 637 | } |
||
| 638 | |||
| 639 | /** |
||
| 640 | * Get propagateNeg. |
||
| 641 | * |
||
| 642 | * @return int |
||
| 643 | */ |
||
| 644 | public function getPropagateNeg() |
||
| 645 | { |
||
| 646 | return $this->propagateNeg; |
||
| 647 | } |
||
| 648 | |||
| 649 | /** |
||
| 650 | * @param int $saveCorrectAnswers |
||
| 651 | * |
||
| 652 | * @return CQuiz |
||
| 653 | */ |
||
| 654 | public function setSaveCorrectAnswers($saveCorrectAnswers) |
||
| 655 | { |
||
| 656 | $this->saveCorrectAnswers = $saveCorrectAnswers; |
||
| 657 | |||
| 658 | return $this; |
||
| 659 | } |
||
| 660 | |||
| 661 | /** |
||
| 662 | * @return int |
||
| 663 | */ |
||
| 664 | public function getSaveCorrectAnswers() |
||
| 665 | { |
||
| 666 | return $this->saveCorrectAnswers; |
||
| 667 | } |
||
| 668 | |||
| 669 | /** |
||
| 670 | * Set reviewAnswers. |
||
| 671 | * |
||
| 672 | * @param int $reviewAnswers |
||
| 673 | * |
||
| 674 | * @return CQuiz |
||
| 675 | */ |
||
| 676 | public function setReviewAnswers($reviewAnswers) |
||
| 677 | { |
||
| 678 | $this->reviewAnswers = $reviewAnswers; |
||
| 679 | |||
| 680 | return $this; |
||
| 681 | } |
||
| 682 | |||
| 683 | /** |
||
| 684 | * Get reviewAnswers. |
||
| 685 | * |
||
| 686 | * @return int |
||
| 687 | */ |
||
| 688 | public function getReviewAnswers() |
||
| 689 | { |
||
| 690 | return $this->reviewAnswers; |
||
| 691 | } |
||
| 692 | |||
| 693 | /** |
||
| 694 | * Set randomByCategory. |
||
| 695 | * |
||
| 696 | * @param int $randomByCategory |
||
| 697 | * |
||
| 698 | * @return CQuiz |
||
| 699 | */ |
||
| 700 | public function setRandomByCategory($randomByCategory) |
||
| 701 | { |
||
| 702 | $this->randomByCategory = $randomByCategory; |
||
| 703 | |||
| 704 | return $this; |
||
| 705 | } |
||
| 706 | |||
| 707 | /** |
||
| 708 | * Get randomByCategory. |
||
| 709 | * |
||
| 710 | * @return int |
||
| 711 | */ |
||
| 712 | public function getRandomByCategory() |
||
| 713 | { |
||
| 714 | return $this->randomByCategory; |
||
| 715 | } |
||
| 716 | |||
| 717 | /** |
||
| 718 | * Set textWhenFinished. |
||
| 719 | * |
||
| 720 | * @param string $textWhenFinished |
||
| 721 | * |
||
| 722 | * @return CQuiz |
||
| 723 | */ |
||
| 724 | public function setTextWhenFinished($textWhenFinished) |
||
| 725 | { |
||
| 726 | $this->textWhenFinished = $textWhenFinished; |
||
| 727 | |||
| 728 | return $this; |
||
| 729 | } |
||
| 730 | |||
| 731 | /** |
||
| 732 | * Get textWhenFinished. |
||
| 733 | * |
||
| 734 | * @return string |
||
| 735 | */ |
||
| 736 | public function getTextWhenFinished() |
||
| 737 | { |
||
| 738 | return $this->textWhenFinished; |
||
| 739 | } |
||
| 740 | |||
| 741 | /** |
||
| 742 | * Set displayCategoryName. |
||
| 743 | * |
||
| 744 | * @param int $displayCategoryName |
||
| 745 | * |
||
| 746 | * @return CQuiz |
||
| 747 | */ |
||
| 748 | public function setDisplayCategoryName($displayCategoryName) |
||
| 749 | { |
||
| 750 | $this->displayCategoryName = $displayCategoryName; |
||
| 751 | |||
| 752 | return $this; |
||
| 753 | } |
||
| 754 | |||
| 755 | /** |
||
| 756 | * Get displayCategoryName. |
||
| 757 | * |
||
| 758 | * @return int |
||
| 759 | */ |
||
| 760 | public function getDisplayCategoryName() |
||
| 761 | { |
||
| 762 | return $this->displayCategoryName; |
||
| 763 | } |
||
| 764 | |||
| 765 | /** |
||
| 766 | * Set passPercentage. |
||
| 767 | * |
||
| 768 | * @param int $passPercentage |
||
| 769 | * |
||
| 770 | * @return CQuiz |
||
| 771 | */ |
||
| 772 | public function setPassPercentage($passPercentage) |
||
| 773 | { |
||
| 774 | $this->passPercentage = $passPercentage; |
||
| 775 | |||
| 776 | return $this; |
||
| 777 | } |
||
| 778 | |||
| 779 | /** |
||
| 780 | * Get passPercentage. |
||
| 781 | * |
||
| 782 | * @return int |
||
| 783 | */ |
||
| 784 | public function getPassPercentage() |
||
| 785 | { |
||
| 786 | return $this->passPercentage; |
||
| 787 | } |
||
| 788 | |||
| 789 | /** |
||
| 790 | * Set id. |
||
| 791 | * |
||
| 792 | * @param int $id |
||
| 793 | * |
||
| 794 | * @return CQuiz |
||
| 795 | */ |
||
| 796 | public function setId($id) |
||
| 797 | { |
||
| 798 | $this->id = $id; |
||
| 799 | |||
| 800 | return $this; |
||
| 801 | } |
||
| 802 | |||
| 803 | /** |
||
| 804 | * Get id. |
||
| 805 | * |
||
| 806 | * @return int |
||
| 807 | */ |
||
| 808 | public function getId() |
||
| 809 | { |
||
| 810 | return $this->id; |
||
| 811 | } |
||
| 812 | |||
| 813 | /** |
||
| 814 | * Set cId. |
||
| 815 | * |
||
| 816 | * @param int $cId |
||
| 817 | * |
||
| 818 | * @return CQuiz |
||
| 819 | */ |
||
| 820 | public function setCId($cId) |
||
| 821 | { |
||
| 822 | $this->cId = $cId; |
||
| 823 | |||
| 824 | return $this; |
||
| 825 | } |
||
| 826 | |||
| 827 | /** |
||
| 828 | * Get cId. |
||
| 829 | * |
||
| 830 | * @return int |
||
| 831 | */ |
||
| 832 | public function getCId() |
||
| 833 | { |
||
| 834 | return $this->cId; |
||
| 835 | } |
||
| 836 | |||
| 837 | /** |
||
| 838 | * @return CExerciseCategory |
||
| 839 | */ |
||
| 840 | public function getExerciseCategory(): ?CExerciseCategory |
||
| 841 | { |
||
| 842 | return $this->exerciseCategory; |
||
| 843 | } |
||
| 844 | |||
| 845 | /** |
||
| 846 | * @param CExerciseCategory $exerciseCategory |
||
| 847 | * |
||
| 848 | * @return CQuiz |
||
| 849 | */ |
||
| 850 | public function setExerciseCategory(CExerciseCategory $exerciseCategory): CQuiz |
||
| 851 | { |
||
| 852 | $this->exerciseCategory = $exerciseCategory; |
||
| 853 | |||
| 854 | return $this; |
||
| 855 | } |
||
| 856 | |||
| 857 | /** |
||
| 858 | * @return int |
||
| 859 | */ |
||
| 860 | public function getQuestionSelectionType() |
||
| 861 | { |
||
| 862 | return $this->questionSelectionType; |
||
| 863 | } |
||
| 864 | |||
| 865 | /** |
||
| 866 | * @param int $questionSelectionType |
||
| 867 | * |
||
| 868 | * @return CQuiz |
||
| 869 | */ |
||
| 870 | public function setQuestionSelectionType($questionSelectionType) |
||
| 871 | { |
||
| 872 | $this->questionSelectionType = $questionSelectionType; |
||
| 873 | |||
| 874 | return $this; |
||
| 875 | } |
||
| 876 | |||
| 877 | /** |
||
| 878 | * @return bool |
||
| 879 | */ |
||
| 880 | public function isHideQuestionTitle() |
||
| 881 | { |
||
| 882 | return $this->hideQuestionTitle; |
||
| 883 | } |
||
| 884 | |||
| 885 | /** |
||
| 886 | * @param bool $hideQuestionTitle |
||
| 887 | * |
||
| 888 | * @return CQuiz |
||
| 889 | */ |
||
| 890 | public function setHideQuestionTitle($hideQuestionTitle) |
||
| 891 | { |
||
| 892 | $this->hideQuestionTitle = $hideQuestionTitle; |
||
| 893 | |||
| 894 | return $this; |
||
| 895 | } |
||
| 896 | |||
| 897 | /** |
||
| 898 | * @return bool |
||
| 899 | */ |
||
| 900 | public function isShowPreviousButton(): bool |
||
| 903 | } |
||
| 904 | |||
| 905 | /** |
||
| 906 | * @param bool $showPreviousButton |
||
| 907 | * |
||
| 908 | * @return CQuiz |
||
| 909 | */ |
||
| 910 | public function setShowPreviousButton(bool $showPreviousButton): CQuiz |
||
| 911 | { |
||
| 912 | $this->showPreviousButton = $showPreviousButton; |
||
| 913 | |||
| 914 | return $this; |
||
| 915 | } |
||
| 916 | |||
| 917 | /** |
||
| 918 | * @return string |
||
| 919 | */ |
||
| 920 | public function getNotifications(): string |
||
| 921 | { |
||
| 922 | return $this->notifications; |
||
| 923 | } |
||
| 924 | |||
| 925 | /** |
||
| 926 | * @param string $notifications |
||
| 927 | * |
||
| 928 | * @return CQuiz |
||
| 929 | */ |
||
| 930 | public function setNotifications(string $notifications): CQuiz |
||
| 931 | { |
||
| 932 | $this->notifications = $notifications; |
||
| 933 | |||
| 934 | return $this; |
||
| 935 | } |
||
| 936 | |||
| 937 | /** |
||
| 938 | * @return int |
||
| 939 | */ |
||
| 940 | public function getIid() |
||
| 941 | { |
||
| 942 | return $this->iid; |
||
| 943 | } |
||
| 944 | |||
| 945 | /** |
||
| 946 | * @param int $iid |
||
| 947 | * |
||
| 948 | * @return CQuiz |
||
| 949 | */ |
||
| 950 | public function setIid($iid) |
||
| 951 | { |
||
| 952 | $this->iid = $iid; |
||
| 953 | |||
| 954 | return $this; |
||
| 955 | } |
||
| 956 | |||
| 957 | /** |
||
| 958 | * @ORM\PostPersist() |
||
| 959 | * |
||
| 960 | * @param LifecycleEventArgs $args |
||
| 961 | */ |
||
| 962 | public function postPersist(LifecycleEventArgs $args) |
||
| 963 | { |
||
| 964 | // Update id with iid value |
||
| 965 | $em = $args->getEntityManager(); |
||
| 966 | $this->setId($this->iid); |
||
| 967 | $em->persist($this); |
||
| 968 | $em->flush(); |
||
| 969 | } |
||
| 970 | |||
| 971 | /** |
||
| 972 | * Resource identifier. |
||
| 973 | * |
||
| 974 | * @return int |
||
| 975 | */ |
||
| 976 | public function getResourceIdentifier(): int |
||
| 979 | } |
||
| 980 | |||
| 981 | /** |
||
| 982 | * @return string |
||
| 983 | */ |
||
| 984 | public function getResourceName(): string |
||
| 985 | { |
||
| 986 | return $this->getTitle(); |
||
| 987 | } |
||
| 988 | |||
| 989 | /** |
||
| 990 | * @return string |
||
| 991 | */ |
||
| 992 | public function getToolName(): string |
||
| 993 | { |
||
| 995 | } |
||
| 996 | } |
||
| 997 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.