ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
SystemInfo.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use ILIAS\UI\Implementation\Component\ComponentHelper;
29use InvalidArgumentException;
30
36{
37 use ComponentHelper;
39
40 protected string $head_line;
41 protected string $information_text;
42 protected ?URI $dismiss_action = null;
46
47 public function __construct(SignalGeneratorInterface $signal_generator, string $head_line, string $information_text)
48 {
49 $this->signal_generator = $signal_generator;
50 $this->head_line = $head_line;
51 $this->information_text = $information_text;
52 $this->initSignals();
53 }
54
55 protected function initSignals(): void
56 {
57 $this->close_signal = $this->signal_generator->create();
58 }
59
60 public function getHeadLine(): string
61 {
62 return $this->head_line;
63 }
64
65 public function getInformationText(): string
66 {
67 return $this->information_text;
68 }
69
70 public function isDismissable(): bool
71 {
72 return !is_null($this->dismiss_action);
73 }
74
75 public function getDismissAction(): URI
76 {
77 return $this->dismiss_action;
78 }
79
80 public function withDismissAction(?URI $uri): MainControls\SystemInfo
81 {
82 $clone = clone $this;
83 $clone->dismiss_action = $uri;
84 return $clone;
85 }
86
87 public function withDenotation(string $denotation): MainControls\SystemInfo
88 {
89 if (
90 $denotation !== MainControls\SystemInfo::DENOTATION_NEUTRAL
91 && $denotation !== MainControls\SystemInfo::DENOTATION_IMPORTANT
92 && $denotation !== MainControls\SystemInfo::DENOTATION_BREAKING
93 ) {
94 throw new InvalidArgumentException("Unknown denotation '$denotation'");
95 }
96
97 $clone = clone $this;
98 $clone->denotation = $denotation;
99 return $clone;
100 }
101
102 public function getDenotation(): string
103 {
104 return $this->denotation;
105 }
106
107 public function getCloseSignal(): Signal
108 {
109 return $this->close_signal;
110 }
111
115 public function withResetSignals(): SystemInfo
116 {
117 $clone = clone $this;
118 $clone->initSignals();
119 return $clone;
120 }
121}
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
__construct(SignalGeneratorInterface $signal_generator, string $head_line, string $information_text)
Definition: SystemInfo.php:47
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.