ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ContextStack.php
Go to the documentation of this file.
2
4
11{
12
16 protected $stack = [];
17
18
22 public function push(ScreenContext $context)
23 {
24 if (in_array($context, $this->stack)) {
25 throw new \LogicException("A context can only be claimed once");
26 }
27 array_push($this->stack, $context);
28 }
29
30
34 public function getLast() : ScreenContext
35 {
36 return end($this->stack);
37 }
38
39
43 public function getStack() : array
44 {
45 return $this->stack;
46 }
47
48
49 public function getStackAsArray() : array
50 {
51 $return = [];
52 foreach ($this->stack as $item) {
53 $return[] = $item->getUniqueContextIdentifier();
54 }
55
56 return $return;
57 }
58}
An exception for terminatinating execution or to throw for unit testing.
$context
Definition: webdav.php:26