ApplicationContextToolbarItem   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 70
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getIndex() 0 3 1
A checkAccess() 0 3 1
A __construct() 0 3 1
A getItem() 0 3 1
A hasDropDown() 0 3 1
A getAdditionalAttributes() 0 3 1
A getDropDown() 0 3 1
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