ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Descriptive.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\UI\Implementation\Component\ComponentHelper;
25
31{
32 use ComponentHelper;
33
34 private array $items;
35
36 public function __construct(array $items)
37 {
38 $this->checkArgList(
39 "Descriptive List items",
40 $items,
41 fn ($k, $v) => is_string($k) && (is_string($v) || $v instanceof C\Component),
42 fn ($k, $v) => "expected keys of type string and values of type string|Component, got ($k => $v)"
43 );
44
45 $this->items = $items;
46 }
47
51 public function withItems(array $items): C\Listing\Descriptive
52 {
53 $this->checkArgList(
54 "Descriptive List items",
55 $items,
56 fn ($k, $v) => is_string($k) && (is_string($v) || $v instanceof C\Component),
57 fn ($k, $v) => "expected keys of type string and values of type string|Component, got ($k => $v)"
58 );
59
60 $clone = clone $this;
61 $clone->items = $items;
62 return $clone;
63 }
64
68 public function getItems(): array
69 {
70 return $this->items;
71 }
72}