ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilADTGroupDefinition.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 {
7  protected array $elements = [];
8 
9  public function __clone()
10  {
11  if (is_array($this->elements)) {
12  foreach ($this->elements as $id => $element) {
13  $this->elements[$id] = clone $element;
14  }
15  }
16  }
17 
18  // defaults
19 
20  public function reset(): void
21  {
22  parent::reset();
23  $this->elements = array();
24  }
25 
26  // properties
27 
28  public function addElement($a_name, ilADTDefinition $a_def): void
29  {
30  $this->elements[$a_name] = $a_def;
31  }
32 
33  public function hasElement($a_name): bool
34  {
35  return array_key_exists($a_name, $this->elements);
36  }
37 
38  public function getElement(string $a_name): ?ilADTDefinition
39  {
40  if ($this->hasElement($a_name)) {
41  return $this->elements[$a_name];
42  }
43  return null;
44  }
45 
46  public function getElements(): array
47  {
48  return $this->elements;
49  }
50 
51  // comparison
52 
53  public function isComparableTo(ilADT $a_adt): bool
54  {
55  // has to be group-based
56  return ($a_adt instanceof ilADTGroup);
57  }
58 }
ADT base class.
Definition: class.ilADT.php:11
addElement($a_name, ilADTDefinition $a_def)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
ADT definition base class.