ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
BasicScreenContext.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
30 {
33  protected string $context_identifier = '';
34 
35  public function __construct(string $context_identifier)
36  {
37  $this->context_identifier = $context_identifier;
38  $this->additional_data = new Collection();
39  $this->reference_id = new ReferenceId(-1);
40  }
41 
42  public function hasReferenceId(): bool
43  {
44  return $this->reference_id->toInt() > 0;
45  }
46 
47  public function getReferenceId(): ReferenceId
48  {
49  return $this->reference_id;
50  }
51 
52  public function withReferenceId(ReferenceId $reference_id): ScreenContext
53  {
54  if ($reference_id->toInt() < 1) {
55  throw new \InvalidArgumentException('ReferenceId must be greater than 0');
56  }
57 
58  $clone = clone $this;
59  $clone->reference_id = $reference_id;
60 
61  return $clone;
62  }
63 
64  public function withAdditionalData(Collection $collection): ScreenContext
65  {
66  $clone = clone $this;
67  $clone->additional_data = $collection;
68 
69  return $clone;
70  }
71 
72  public function getAdditionalData(): Collection
73  {
75  }
76 
77  public function addAdditionalData(string $key, $value): ScreenContext
78  {
79  $this->additional_data->add($key, $value);
80 
81  return $this;
82  }
83 
84  public function getUniqueContextIdentifier(): string
85  {
87  }
88 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...