1<?php
2
3/* Copyright (c) 2016 Timon Amstutz <timon.amstutz@ilub.unibe.ch> Extended GPL, see docs/LICENSE */
4
5namespace ILIAS\UI\Implementation\Component\Panel;
6
7use ILIAS\UI\Component as C;
8use ILIAS\UI\Implementation\Component\ComponentHelper;
9
10/**
11 * Class Panel
12 * @package ILIAS\UI\Implementation\Component\Panel
13 */
14class Panel implements C\Panel\Panel
15{
16    use ComponentHelper;
17
18    /**
19     * @var string
20     */
21    protected $title;
22
23    /**
24     * @var \ILIAS\UI\Component\Component[] | \ILIAS\UI\Component\Component
25     */
26    private $content;
27
28    /**
29     * @var \ILIAS\UI\Component\Dropdown\Standard | null
30     */
31    protected $actions = null;
32
33    /**
34     * @param string $title
35     * @param \ILIAS\UI\Component\Component[] | \ILIAS\UI\Component\Component $content
36     */
37    public function __construct($title, $content)
38    {
39        $this->checkStringArg("title", $title);
40        $content = $this->toArray($content);
41        $types = [C\Component::class];
42        $this->checkArgListElements("content", $content, $types);
43
44        $this->title = $title;
45        $this->content = $content;
46    }
47
48    /**
49     * @inheritdoc
50     */
51    public function getTitle()
52    {
53        return $this->title;
54    }
55
56    /**
57     * @inheritdoc
58     */
59    public function getContent()
60    {
61        return $this->content;
62    }
63
64    /**
65     * @inheritdoc
66     */
67    public function withActions(\ILIAS\UI\Component\Dropdown\Standard $actions)
68    {
69        $clone = clone $this;
70        $clone->actions = $actions;
71        return $clone;
72    }
73
74    /**
75     * @inheritdoc
76     */
77    public function getActions()
78    {
79        return $this->actions;
80    }
81}
82