ILIAS  release_8 Revision v8.24
class.assAnswerErrorText.php
Go to the documentation of this file.
1<?php
2
19require_once './Modules/Test/classes/inc.AssessmentConstants.php';
20
30{
31 protected string $text_wrong;
32 protected string $text_correct;
33 protected float $points;
34 protected ?int $position;
35
42 public function __construct(
43 string $text_wrong = "",
44 string $text_correct = "",
45 float $points = 0.0,
46 ?int $position = null
47 ) {
48 $this->text_wrong = $text_wrong;
49 $this->text_correct = $text_correct;
50 $this->points = $points;
51 $this->position = $position;
52
53 $word_array = preg_split("/\s+/", $text_wrong);
54
55 if ($word_array) {
56 $this->length = count($word_array);
57 }
58 }
59
60 public function getTextWrong(): string
61 {
62 return $this->text_wrong;
63 }
64
65 public function getTextCorrect(): string
66 {
68 }
69
70 public function getPoints(): string
71 {
72 return $this->points;
73 }
74
75 public function withPoints(float $points): self
76 {
77 $clone = clone $this;
78 $clone->points = $points;
79 return $clone;
80 }
81
82 public function getPosition(): ?int
83 {
84 return $this->position;
85 }
86
87 public function withPosition(int $position): self
88 {
89 $clone = clone $this;
90 $clone->position = $position;
91 return $clone;
92 }
93
94 public function getLength(): int
95 {
96 return $this->length;
97 }
98}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(string $text_wrong="", string $text_correct="", float $points=0.0, ?int $position=null)
assAnswerErrorText constructor