ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AbstractParentItem.php
Go to the documentation of this file.
2 
8 abstract class AbstractParentItem extends AbstractBaseItem implements isParent
9 {
10 
14  protected $children = [];
15 
16 
20  public function getChildren() : array
21  {
22  return $this->children;
23  }
24 
25 
29  public function withChildren(array $children) : isParent
30  {
31  $clone = clone($this);
32  $clone->children = $children;
33 
34  return $clone;
35  }
36 
37 
41  public function appendChild(isChild $child) : isParent
42  {
43  $this->children[] = $child;
44 
45  return $this;
46  }
47 
48 
52  public function hasChildren() : bool
53  {
54  return (count($this->children) > 0);
55  }
56 }