ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SpgrContainer.php
Go to the documentation of this file.
1<?php
2
4
6{
12 private $parent;
13
19 private $children = [];
20
26 public function setParent($parent): void
27 {
28 $this->parent = $parent;
29 }
30
36 public function getParent()
37 {
38 return $this->parent;
39 }
40
46 public function addChild($child): void
47 {
48 $this->children[] = $child;
49 $child->setParent($this);
50 }
51
55 public function getChildren()
56 {
57 return $this->children;
58 }
59
65 public function getAllSpContainers()
66 {
67 $allSpContainers = [];
68
69 foreach ($this->children as $child) {
70 if ($child instanceof self) {
71 $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers());
72 } else {
73 $allSpContainers[] = $child;
74 }
75 }
76
77 return $allSpContainers;
78 }
79}
An exception for terminatinating execution or to throw for unit testing.
getParent()
Get the parent Shape Group Container if any.
setParent($parent)
Set parent Shape Group Container.
getAllSpContainers()
Recursively get all spContainers within this spgrContainer.