ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
canHaveParentTrait.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
29{
30 protected ?IdentificationInterface $parent = null;
31
32 public function hasParent(): bool
33 {
34 return $this->parent !== null;
35 }
36
38 {
39 return $this->parent;
40 }
41
42 public function withParent(IdentificationInterface $identification): self
43 {
44 if ($this->parent !== null && $this->parent === $identification) {
45 return $this;
46 }
47
48 $clone = clone $this;
49 $clone->parent = $identification;
50 return $clone;
51 }
52}
withParent(IdentificationInterface $identification)