1<?php
2
3/* Copyright (c) 2017 Alex Killing <killing@leifos.de> Extended GPL, see docs/LICENSE */
4
5namespace ILIAS\UI\Implementation\Component\Item;
6
7use ILIAS\UI\Component as C;
8use ILIAS\UI\Implementation\Component\ComponentHelper;
9
10/**
11 * Common interface to all items.
12 */
13class Group implements C\Item\Group
14{
15    use ComponentHelper;
16
17    /**
18     * @var string
19     */
20    protected $title;
21
22    /**
23     * @var C\Item\Item[]
24     */
25    protected $items;
26
27    /**
28     * @var \ILIAS\UI\Component\Dropdown\Standard
29     */
30    protected $actions;
31
32    /**
33     * Group constructor.
34     * @param $title
35     * @param C\Item\Item[] $items
36     */
37    public function __construct($title, array $items)
38    {
39        $this->checkStringArg("title", $title);
40        $this->title = $title;
41        $this->items = $items;
42    }
43
44    /**
45     * @inheritdoc
46     */
47    public function getTitle()
48    {
49        return $this->title;
50    }
51
52    /**
53     * @inheritdoc
54     */
55    public function getItems()
56    {
57        return $this->items;
58    }
59
60    /**
61     * @inheritdoc
62     */
63    public function withActions(\ILIAS\UI\Component\Dropdown\Standard $actions)
64    {
65        $clone = clone $this;
66        $clone->actions = $actions;
67        return $clone;
68    }
69
70    /**
71     * @inheritdoc
72     */
73    public function getActions()
74    {
75        return $this->actions;
76    }
77}
78