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;
8
9class Standard extends Item implements C\Item\Standard
10{
11    /**
12     * @var \ILIAS\Data\Color color
13     */
14    protected $color = null;
15    /**
16     * @var null|string|\ILIAS\UI\Component\Image\Image
17     */
18    protected $lead = null;
19
20    /**
21     * @inheritdoc
22     */
23    public function withColor(\ILIAS\Data\Color $color) : C\Item\Item
24    {
25        $clone = clone $this;
26        $clone->color = $color;
27        return $clone;
28    }
29
30    /**
31     * @inheritdoc
32     */
33    public function getColor() : ?\ILIAS\Data\Color
34    {
35        return $this->color;
36    }
37
38    /**
39     * @inheritdoc
40     */
41    public function withLeadImage(\ILIAS\UI\Component\Image\Image $image) : C\Item\Item
42    {
43        $clone = clone $this;
44        $clone->lead = $image;
45        return $clone;
46    }
47
48    /**
49     * @inheritdoc
50     */
51    public function withLeadIcon(\ILIAS\UI\Component\Symbol\Icon\Icon $icon) : C\Item\Item
52    {
53        $clone = clone $this;
54        $clone->lead = $icon;
55        return $clone;
56    }
57
58    /**
59     * @inheritdoc
60     */
61    public function withLeadText(string $text) : C\Item\Item
62    {
63        $this->checkStringArg("lead_text", $text);
64        $clone = clone $this;
65        $clone->lead = (string) $text;
66        return $clone;
67    }
68
69    /**
70     * @inheritdoc
71     */
72    public function withNoLead() : C\Item\Item
73    {
74        $clone = clone $this;
75        $clone->lead = null;
76        return $clone;
77    }
78
79    /**
80     * @inheritdoc
81     */
82    public function getLead()
83    {
84        return $this->lead;
85    }
86}
87