1<?php namespace ILIAS\GlobalScreen\Scope\MainMenu\Factory\TopItem;
2
3use ILIAS\GlobalScreen\Scope\MainMenu\Factory\AbstractParentItem;
4use ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasSymbol;
5use ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasSymbolTrait;
6use ILIAS\GlobalScreen\Scope\MainMenu\Factory\hasTitle;
7use ILIAS\GlobalScreen\Scope\MainMenu\Factory\isTopItem;
8use ILIAS\GlobalScreen\Scope\MainMenu\Factory\SymbolDecoratorTrait;
9use ILIAS\GlobalScreen\Scope\MainMenu\Factory\supportsAsynchronousLoading;
10
11/**
12 * Class TopParentItem
13 * @author Fabian Schmid <fs@studer-raimann.ch>
14 */
15class TopParentItem extends AbstractParentItem implements isTopItem, hasTitle, hasSymbol, supportsAsynchronousLoading
16{
17    use SymbolDecoratorTrait;
18    use hasSymbolTrait;
19
20    /**
21     * @var string
22     */
23    protected $title = '';
24    /**
25     * @var bool
26     */
27    protected $supports_async_loading = false;
28
29    /**
30     * @param string $title
31     * @return TopParentItem
32     */
33    public function withTitle(string $title) : hasTitle
34    {
35        $clone = clone($this);
36        $clone->title = $title;
37
38        return $clone;
39    }
40
41    /**
42     * @inheritDoc
43     */
44    public function getTitle() : string
45    {
46        return $this->title;
47    }
48
49    public function withSupportsAsynchronousLoading(bool $supported) : supportsAsynchronousLoading
50    {
51        $clone = clone($this);
52        $clone->supports_async_loading = $supported;
53
54        return $clone;
55    }
56
57    public function supportsAsynchronousLoading() : bool
58    {
59        return $this->supports_async_loading;
60    }
61
62}
63