ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
AbstractChildItem.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
21 
24 
29 abstract class AbstractChildItem extends AbstractBaseItem
30 {
34  protected $parent;
35 
39  public function withParent(IdentificationInterface $identification) : isItem
40  {
41  $clone = clone($this);
42  $clone->parent = $identification;
43 
44  return $clone;
45  }
46 
50  public function hasParent() : bool
51  {
52  return $this->parent instanceof IdentificationInterface;
53  }
54 
58  public function getParent() : IdentificationInterface
59  {
60  return $this->parent instanceof IdentificationInterface ? $this->parent : new NullIdentification();
61  }
62 
63  public function overrideParent(IdentificationInterface $identification) : isItem
64  {
65  $this->parent = $identification;
66 
67  return $this;
68  }
69 }
withParent(IdentificationInterface $identification)
overrideParent(IdentificationInterface $identification)