ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\GlobalScreen\ScreenContext\Stack\ContextStack Class Reference

Class ContextStack. More...

+ Collaboration diagram for ILIAS\GlobalScreen\ScreenContext\Stack\ContextStack:

Public Member Functions

 push (ScreenContext $context)
 
 getLast ()
 
 getStack ()
 
 getStackAsArray ()
 

Protected Attributes

array $stack = []
 

Detailed Description

Class ContextStack.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 29 of file ContextStack.php.

Member Function Documentation

◆ getLast()

ILIAS\GlobalScreen\ScreenContext\Stack\ContextStack::getLast ( )
Returns
ScreenContext

Definition at line 50 of file ContextStack.php.

50  : ScreenContext
51  {
52  return end($this->stack);
53  }

◆ getStack()

ILIAS\GlobalScreen\ScreenContext\Stack\ContextStack::getStack ( )
Returns
ScreenContext[]

Definition at line 58 of file ContextStack.php.

References ILIAS\GlobalScreen\ScreenContext\Stack\ContextStack\$stack.

58  : array
59  {
60  return $this->stack;
61  }

◆ getStackAsArray()

ILIAS\GlobalScreen\ScreenContext\Stack\ContextStack::getStackAsArray ( )
Returns
string[]

Definition at line 66 of file ContextStack.php.

66  : array
67  {
68  $return = [];
69  foreach ($this->stack as $item) {
70  $return[] = $item->getUniqueContextIdentifier();
71  }
72 
73  return $return;
74  }

◆ push()

ILIAS\GlobalScreen\ScreenContext\Stack\ContextStack::push ( ScreenContext  $context)
Parameters
ScreenContext$context

Definition at line 39 of file ContextStack.php.

References $context.

39  : 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  }
$context
Definition: webdav.php:31

Field Documentation

◆ $stack

array ILIAS\GlobalScreen\ScreenContext\Stack\ContextStack::$stack = []
protected

The documentation for this class was generated from the following file: