ILIAS  release_7 Revision v7.30-3-g800a261c036
AbstractChildItem.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
21
24
29abstract 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
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}
An exception for terminatinating execution or to throw for unit testing.
withParent(IdentificationInterface $identification)
@inheritDoc
overrideParent(IdentificationInterface $identification)