ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
Signal.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30{
31 protected string $id;
32 protected array $options = array();
33
34 public function __construct(string $id)
35 {
36 $this->id = $id;
37 }
38
42 public function getId(): string
43 {
44 return $this->id;
45 }
46
47 public function withOptions(array $options): static
48 {
49 $clone = clone $this;
50 foreach ($options as $key => $value) {
51 $clone->addOption($key, $value);
52 }
53 return $clone;
54 }
55
56 public function getOptions(): array
57 {
58 return $this->options;
59 }
60
64 public function addOption(string $key, $value): void
65 {
66 $this->options[$key] = $value;
67 }
68
72 protected function getOption(string $key)
73 {
74 return (isset($this->options[$key])) ? $this->options[$key] : null;
75 }
76
77 public function __toString(): string
78 {
79 return $this->id;
80 }
81}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
addOption(string $key, $value)
Definition: Signal.php:64
getId()
Get the ID of this signal.
Definition: Signal.php:42
withOptions(array $options)
Get a Signal like this, but provide it with a set of options.
Definition: Signal.php:47
getOptions()
Get the options of this signal.
Definition: Signal.php:56