ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
BasicScreenContext.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
30{
33
34 public function __construct(protected string $context_identifier)
35 {
36 $this->additional_data = new Collection();
37 $this->reference_id = new ReferenceId(-1);
38 }
39
40 public function hasReferenceId(): bool
41 {
42 return $this->reference_id->toInt() > 0;
43 }
44
45 public function getReferenceId(): ReferenceId
46 {
48 }
49
51 {
52 if ($reference_id->toInt() < 1) {
53 throw new \InvalidArgumentException('ReferenceId must be greater than 0');
54 }
55
56 $clone = clone $this;
57 $clone->reference_id = $reference_id;
58
59 return $clone;
60 }
61
62 public function withAdditionalData(Collection $collection): ScreenContext
63 {
64 $clone = clone $this;
65 $clone->additional_data = $collection;
66
67 return $clone;
68 }
69
70 public function getAdditionalData(): Collection
71 {
73 }
74
75 public function addAdditionalData(string $key, $value): ScreenContext
76 {
77 $this->additional_data->add($key, $value);
78
79 return $this;
80 }
81
82 public function getUniqueContextIdentifier(): string
83 {
84 return $this->context_identifier;
85 }
86}
__construct(protected string $context_identifier)