ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Group.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
28class Group extends AbstractBaseItem implements isGroup
29{
30 use hasTitleTrait;
31
32 protected array $entries = [];
33
34 public function __construct(IdentificationInterface $provider_identification, string $title)
35 {
36 parent::__construct($provider_identification);
37 $this->title = $title;
38 }
39
40 public function getEntries(): array
41 {
42 return $this->entries;
43 }
44
45 public function withEntries(array $entries): isGroup
46 {
47 return $this->addEntries(...$entries);
48 }
49
51 {
52 foreach ($entries as $entry) {
53 if (isset($this->entries[$entry->getProviderIdentification()->serialize()])) {
54 continue;
55 }
56 $this->entries[$entry->getProviderIdentification()->serialize()] = $entry;
57 }
58
59 return $this;
60 }
61
62 public function addEntry(canHaveParent $entry): isGroup
63 {
64 return $this->addEntries($entry);
65 }
66
67 public function isTop(): bool
68 {
69 return true;
70 }
71
72}
__construct(IdentificationInterface $provider_identification, string $title)
Definition: Group.php:34
addEntry(canHaveParent $entry)
@mutable
Definition: Group.php:62
withEntries(array $entries)
@mutable
Definition: Group.php:45
addEntries(canHaveParent ... $entries)
@mutable
Definition: Group.php:50
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc