ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
Info.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ilCondition;
25
26class Info
27{
28 protected int $object_id;
29 protected int $reference_id;
30 protected string $object_type;
32
33 public function __construct()
34 {
35 }
36
37 public function getObjectId(): int
38 {
39 return $this->object_id;
40 }
41
42 public function getReferenceId(): int
43 {
45 }
46
47 public function getObjectType(): string
48 {
49 return $this->object_type;
50 }
51
53 {
55 }
56
57 public function withConditionSet(
59 ): Info {
60 $clone = clone $this;
61 $clone->condition_set = $condition_set;
62 return $clone;
63 }
64
65 public function withObjectId(
66 int $object_id
67 ): Info {
68 $clone = clone $this;
69 $clone->object_id = $object_id;
70 return $clone;
71 }
72
73 public function withObjectType(
74 string $object_type
75 ): Info {
76 $clone = clone $this;
77 $clone->object_type = $object_type;
78 return $clone;
79 }
80
81 public function withReferenceId(
82 int $reference_id
83 ): Info {
84 $clone = clone $this;
85 $clone->reference_id = $reference_id;
86 return $clone;
87 }
88
89 public function __toString(): string
90 {
91 $msg = sprintf("Info (OID:%s, RID%s:, TYPE:%s", $this->object_id, $this->reference_id, $this->object_type);
92 $msg .= sprintf("\nNumberObligatory: %s\nAllObligatory: %s\nHidden: %s", $this->condition_set->getNumObligatory(), ($this->condition_set->getAllObligatory() ? 'true' : 'false'), ($this->condition_set->getHiddenStatus() ? 'true' : 'false'));
93 foreach ($this->condition_set->getConditions() as $condition) {
94 $msg .= sprintf("\n- Condition(ID:%s, Operator:%s, Obligatory: %s):\n-- Value: %s", $condition->getId(), $condition->getOperator(), ($condition->getObligatory() ? 'true' : 'false'), $condition->getValue());
95 $msg .= sprintf("\n-- Trigger: RID:%s OID:%s Type:%s", $condition->getTrigger()->getRefId(), $condition->getTrigger()->getObjId(), $condition->getTrigger()->getType());
96 }
97 return $msg;
98 }
99}
withReferenceId(int $reference_id)
Definition: Info.php:81
withObjectType(string $object_type)
Definition: Info.php:73
withObjectId(int $object_id)
Definition: Info.php:65
ilConditionSet $condition_set
Definition: Info.php:31
withConditionSet(ilConditionSet $condition_set)
Definition: Info.php:57
Condition set Note: This object currently focuses on repository objects as targets.
Condition class.