ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
Group.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 
28 class 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 
50  public function addEntries(canHaveParent ...$entries): isGroup
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 }
addEntries(canHaveParent ... $entries)
Definition: Group.php:50
__construct(IdentificationInterface $provider_identification, string $title)
Definition: Group.php:34
__construct(Container $dic, ilPlugin $plugin)