ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
ilDclStack Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilDclStack:

Public Member Functions

 push ($elem)
 
 pop ()
 
 top ()
 
 isEmpty ()
 
 reset ()
 
 count ()
 
 debug ()
 

Protected Attributes

array $stack = array()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilDclStack.php.

Member Function Documentation

◆ count()

ilDclStack::count ( )

Definition at line 70 of file class.ilDclStack.php.

70 : int
71 {
72 return count($this->stack);
73 }

References count().

Referenced by count(), ILIAS\UI\Implementation\Component\Table\Data\getColumnCount(), isEmpty(), pop(), and top().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ debug()

ilDclStack::debug ( )

Definition at line 75 of file class.ilDclStack.php.

75 : void
76 {
77 echo "<pre>" . print_r($this->stack, 1) . "</pre>";
78 }

◆ isEmpty()

ilDclStack::isEmpty ( )

Definition at line 60 of file class.ilDclStack.php.

60 : bool
61 {
62 return !(bool) count($this->stack);
63 }

References count().

Referenced by pop(), and top().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pop()

ilDclStack::pop ( )
Returns
?float|int|string

Definition at line 34 of file class.ilDclStack.php.

35 {
36 if (!$this->isEmpty()) {
37 $last_index = count($this->stack) - 1;
38 $elem = $this->stack[$last_index];
39 unset($this->stack[$last_index]);
40 $this->stack = array_values($this->stack); // re-index
41
42 return $elem;
43 }
44
45 return null;
46 }

References count(), and isEmpty().

+ Here is the call graph for this function:

◆ push()

ilDclStack::push (   $elem)
Parameters
float | int | string$elem

Definition at line 26 of file class.ilDclStack.php.

27 {
28 $this->stack[] = $elem;
29 }

◆ reset()

ilDclStack::reset ( )

Definition at line 65 of file class.ilDclStack.php.

65 : void
66 {
67 $this->stack = array();
68 }

◆ top()

ilDclStack::top ( )
Returns
?float|int|string

Definition at line 51 of file class.ilDclStack.php.

52 {
53 if (!$this->isEmpty()) {
54 return $this->stack[count($this->stack) - 1];
55 }
56
57 return null;
58 }

References count(), and isEmpty().

+ Here is the call graph for this function:

Field Documentation

◆ $stack

array ilDclStack::$stack = array()
protected

Definition at line 21 of file class.ilDclStack.php.


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