ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
AttemptResult.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Test\Results\Data;
22 
24 {
25  public function __construct(
26  private int $active_id,
27  private int $attempt_id,
28  private float $max_points,
29  private float $reached_points,
30  private int $question_count,
31  private int $answered_questions,
32  private int $working_time,
33  private int $timestamp,
34  private string $exam_id,
35  private string $finalized_by,
36  ) {
37  }
38 
39  public function withMaxPoints(float $max_points): self
40  {
41  $clone = clone $this;
42  $clone->max_points = $max_points;
43  return $clone;
44  }
45 
46  public function withQuestionCount(int $question_count): self
47  {
48  $clone = clone $this;
49  $clone->question_count = $question_count;
50  return $clone;
51  }
52 
53  public function withWorkingTime(int $working_time): self
54  {
55  $clone = clone $this;
56  $clone->working_time = $working_time;
57  return $clone;
58  }
59 
60  public function withExamId(string $exam_id): self
61  {
62  $clone = clone $this;
63  $clone->exam_id = $exam_id;
64  return $clone;
65  }
66 
67  public function withTimestamp(int $timestamp = -1): self
68  {
69  $clone = clone $this;
70  $clone->timestamp = $timestamp > 0 ? $timestamp : time();
71  return $clone;
72  }
73 
74  public function getActiveId(): int
75  {
76  return $this->active_id;
77  }
78 
79  public function getAttempt(): int
80  {
81  return $this->attempt_id;
82  }
83 
84  public function getMaxPoints(): float
85  {
86  return $this->max_points;
87  }
88 
89  public function getReachedPoints(): float
90  {
91  return $this->reached_points;
92  }
93 
94  public function getQuestionCount(): int
95  {
96  return $this->question_count;
97  }
98 
99  public function getAnsweredQuestions(): int
100  {
101  return $this->answered_questions;
102  }
103 
104  public function getWorkingTime(): int
105  {
106  return $this->working_time;
107  }
108 
109  public function getTimestamp(): int
110  {
111  return $this->timestamp;
112  }
113 
114  public function getExamId(): string
115  {
116  return $this->exam_id;
117  }
118 
119  public function getFinalizedBy(): string
120  {
121  return $this->finalized_by;
122  }
123 }
__construct(private int $active_id, private int $attempt_id, private float $max_points, private float $reached_points, private int $question_count, private int $answered_questions, private int $working_time, private int $timestamp, private string $exam_id, private string $finalized_by,)
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70
withQuestionCount(int $question_count)