ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
Property.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
28 
33 class Property extends Listing implements IListing\Property
34 {
35  use ComponentHelper;
36  protected const ALLOWED_VALUE_TYPES = [
37  Symbol::class,
38  Legacy::class,
39  StandardLink::class
40  ];
41 
42  public function __construct()
43  {
44  $this->items = [];
45  }
46 
50  public function withItems(array $items): self
51  {
52  $clone = clone $this;
53  $clone->items = [];
54  foreach ($items as $item) {
55  $clone = $clone->withProperty(...$item);
56  }
57  return $clone;
58  }
59 
60  public function withProperty(
61  string $label,
62  string | Symbol | Legacy | StandardLink $value,
63  bool $show_label = true
64  ): self {
65  if (is_array($value)) {
66  $this->checkArgListElements("value", $value, self::ALLOWED_VALUE_TYPES);
67  }
68  $clone = clone $this;
69  $clone->items[] = [$label, $value, $show_label];
70  return $clone;
71  }
72 }
This describes a symbol.
Definition: Symbol.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withItems(array $items)
Sets the items to be listed.(Component|string)[]
Definition: Property.php:50
withProperty(string $label, string|Symbol|Legacy|StandardLink $value, bool $show_label=true)
Definition: Property.php:60
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...