ApplicationContextToolbarItem::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace CarstenWindler\ContextBanner\Backend\ToolbarItems;
4
5
use CarstenWindler\ContextBanner\Main;
6
use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
7
8
class ApplicationContextToolbarItem implements ToolbarItemInterface
9
{
10
    /**
11
     * @var Main
12
     */
13
    protected $main;
14
15
    public function __construct()
16
    {
17
        $this->main = new Main();
18
    }
19
20
    /**
21
     * Checks whether the user has access to this toolbar item.
22
     *
23
     * @return bool true if user has access, false if not
24
     */
25
    public function checkAccess()
26
    {
27
        return $this->main->isToolbarItemShown();
28
    }
29
30
    /**
31
     * Renders the toolbar icon.
32
     *
33
     * @return string HTML
34
     */
35
    public function getItem()
36
    {
37
        return $this->main->renderToolbarItem();
38
    }
39
40
    /**
41
     * Renders the drop down.
42
     *
43
     * @return string HTML
44
     */
45
    public function getDropDown()
46
    {
47
        return '';
48
    }
49
50
    /**
51
     * No additional attributes.
52
     *
53
     * @return array List item HTML attributes
54
     */
55
    public function getAdditionalAttributes()
56
    {
57
        return [];
58
    }
59
60
    /**
61
     * This item has a drop down.
62
     *
63
     * @return bool
64
     */
65
    public function hasDropDown()
66
    {
67
        return false;
68
    }
69
70
    /**
71
     * Position relative to others.
72
     *
73
     * @return int
74
     */
75
    public function getIndex()
76
    {
77
        return 0;
78
    }
79
}
80