ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Descriptive.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2016 Timon Amstutz <timon.amstutz@ilub.unibe.ch> Extended GPL, see docs/LICENSE */
4 
6 
7 use ILIAS\UI\Component as C;
9 
14 class Descriptive implements C\Listing\Descriptive {
15  use ComponentHelper;
16 
20  private $items;
21 
25  public function __construct(array $items) {
26  $this->checkArgList(
27  "Descriptive List items",
28  $items,
29  function($k,$v) {
30  return is_string($k) && (is_string($v) || $v instanceof C\Component);
31  },
32  function($k, $v) {
33  return "expected keys of type string and values of type string|Component, got ($k => $v)";
34  });
35 
36  $this->items = $items;
37  }
38 
42  public function withItems(array $items){
43  $this->checkArgList(
44  "Descriptive List items",
45  $items,
46  function($k,$v) {
47  return is_string($k) && (is_string($v) || $v instanceof C\Component);
48  },
49  function($k, $v) {
50  return "expected keys of type string and values of type string|Component, got ($k => $v)";
51  });
52 
53  $clone = clone $this;
54  $clone->items = $items;
55  return $clone;
56  }
57 
61  public function getItems() {
62  return $this->items;
63  }
64 }
A component is the most general form of an entity in the UI.
Definition: Component.php:13
Create styles array
The data for the language used.