ILIAS  release_8 Revision v8.24
class.ilLSPostCondition.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
29{
30 protected static $known_operators = [
31 "always",
32 "failed",
33 "finished",
34 "learning_progress",
35 "not_finished",
36 "passed"
37 ];
38
39 protected int $ref_id;
40 protected string $operator;
41 protected ?string $value;
42
43 public function __construct(
44 int $ref_id,
45 string $operator,
46 ?string $value = null
47 ) {
48 if (!in_array($operator, self::$known_operators)) {
49 throw new \InvalidArgumentException(
50 "Unknown operator: $operator"
51 );
52 }
53
54 $this->ref_id = $ref_id;
55 $this->operator = $operator;
56 $this->value = $value;
57 }
58
59 public function getRefId(): int
60 {
61 return $this->ref_id;
62 }
63
64 public function withRefId(int $ref_id): self
65 {
66 $clone = clone $this;
67 $clone->ref_id = $ref_id;
68 return $clone;
69 }
70
71 public function getConditionOperator(): string
72 {
73 return $this->operator;
74 }
75
77 {
78 if (!in_array($operator, self::$known_operators)) {
79 throw new \InvalidArgumentException(
80 "Unknown operator: $operator"
81 );
82 }
83
84 $clone = clone $this;
85 $clone->operator = $operator;
86 return $clone;
87 }
88
89 public function getValue(): ?string
90 {
91 return $this->value;
92 }
93
94 public function withValue(string $value): ilLSPostCondition
95 {
96 $clone = clone $this;
97 $clone->value = $value;
98 return $clone;
99 }
100}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $ref_id, string $operator, ?string $value=null)
withConditionOperator(string $operator)