ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLSPostCondition.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29{
30 public const OPERATOR_LP = 'learning_progress';
31 public const OPERATOR_ALWAYS = 'always';
32 public const OPERATOR_FAILED = 'failed';
33 public const OPERATOR_FINISHED = 'finished';
34 public const OPERATOR_NOT_FINISHED = 'not_finished';
35 public const OPERATOR_PASSED = 'passed';
36
37 protected static $known_operators = [
44 ];
45
46 protected int $ref_id;
47 protected string $operator;
48 protected ?string $value;
49
50 public function __construct(
51 int $ref_id,
52 string $operator,
53 ?string $value = null
54 ) {
55 if (!in_array($operator, self::$known_operators)) {
56 throw new \InvalidArgumentException(
57 "Unknown operator: $operator"
58 );
59 }
60
61 $this->ref_id = $ref_id;
62 $this->operator = $operator;
63 $this->value = $value;
64 }
65
66 public function getRefId(): int
67 {
68 return $this->ref_id;
69 }
70
71 public function withRefId(int $ref_id): self
72 {
73 $clone = clone $this;
74 $clone->ref_id = $ref_id;
75 return $clone;
76 }
77
78 public function getConditionOperator(): string
79 {
80 return $this->operator;
81 }
82
84 {
85 if (!in_array($operator, self::$known_operators)) {
86 throw new \InvalidArgumentException(
87 "Unknown operator: $operator"
88 );
89 }
90
91 $clone = clone $this;
92 $clone->operator = $operator;
93 return $clone;
94 }
95
96 public function getValue(): ?string
97 {
98 return $this->value;
99 }
100
101 public function withValue(string $value): ilLSPostCondition
102 {
103 $clone = clone $this;
104 $clone->value = $value;
105 return $clone;
106 }
107}
A PostCondition does restrict the progression of a user through the learning sequence.
__construct(int $ref_id, string $operator, ?string $value=null)
withConditionOperator(string $operator)