ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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 30 of file ContextStack.php.

Member Function Documentation

◆ getLast()

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

Definition at line 51 of file ContextStack.php.

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

◆ getStack()

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

Definition at line 59 of file ContextStack.php.

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

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

◆ getStackAsArray()

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

Definition at line 67 of file ContextStack.php.

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

◆ push()

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

Definition at line 40 of file ContextStack.php.

References $context.

40  : void
41  {
42  if (in_array($context, $this->stack)) {
43  throw new LogicException("A context can only be claimed once");
44  }
45  $this->stack[] = $context;
46  }
$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: