ILIAS  release_8 Revision v8.24
ContextStack.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
21
23use LogicException;
24
30{
34 protected array $stack = [];
35
39 public function push(ScreenContext $context): void
40 {
41 if (in_array($context, $this->stack)) {
42 throw new LogicException("A context can only be claimed once");
43 }
44 $this->stack[] = $context;
45 }
46
50 public function getLast(): ScreenContext
51 {
52 return end($this->stack);
53 }
54
58 public function getStack(): array
59 {
60 return $this->stack;
61 }
62
66 public function getStackAsArray(): array
67 {
68 $return = [];
69 foreach ($this->stack as $item) {
70 $return[] = $item->getUniqueContextIdentifier();
71 }
72
73 return $return;
74 }
75}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$context
Definition: webdav.php:29