ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.assAnswerErrorText.php
Go to the documentation of this file.
1<?php
2
28{
29 protected string $text_wrong;
30 protected string $text_correct;
31 protected float $points;
32 protected ?int $position;
33 protected int $length;
34
41 public function __construct(
42 string $text_wrong = "",
43 string $text_correct = "",
44 float $points = 0.0,
45 ?int $position = null
46 ) {
47 $this->text_wrong = $text_wrong;
48 $this->text_correct = $text_correct;
49 $this->points = $points;
50 $this->position = $position;
51
52 $word_array = preg_split("/\s+/", $text_wrong);
53
54 if ($word_array) {
55 $this->length = count($word_array);
56 }
57 }
58
59 public function getTextWrong(): string
60 {
61 return $this->text_wrong;
62 }
63
64 public function getTextCorrect(): string
65 {
67 }
68
69 public function getPoints(): float
70 {
71 return $this->points;
72 }
73
74 public function withPoints(float $points): self
75 {
76 $clone = clone $this;
77 $clone->points = $points;
78 return $clone;
79 }
80
81 public function getPosition(): ?int
82 {
83 return $this->position;
84 }
85
86 public function withPosition(int $position): self
87 {
88 $clone = clone $this;
89 $clone->position = $position;
90 return $clone;
91 }
92
93 public function getLength(): int
94 {
95 return $this->length;
96 }
97}
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