This file is indexed.

/usr/share/php/Icinga/Web/Menu/SummaryMenuItemRenderer.php is in php-icinga 2.1.0-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */

namespace Icinga\Web\Menu;

use Icinga\Web\Menu;
use Icinga\Data\ConfigObject;

/**
 * Summary badge adding up all badges in the sub-menus that have the same state
 */
class SummaryMenuItemRenderer extends BadgeMenuItemRenderer
{
    /**
     * Set of summarized problems from submenus
     *
     * @var array
     */
    protected $titles = array();

    /**
     * The amount of problems
     *
     * @var int
     */
    protected $count = 0;

    /**
     * The state that should be summarized
     *
     * @var string
     */
    protected $state;

    /**
     * The amount of problems
     */
    public function __construct(ConfigObject $configuration)
    {
        $this->state = $configuration->get('state', self::STATE_CRITICAL);
    }

    /**
     * Renders the html content of a single menu item and summarized sub-menus
     *
     * @param Menu $menu
     *
     * @return string
     */
    public function render(Menu $menu)
    {
        /** @var $submenu Menu */
        foreach ($menu->getSubMenus() as $submenu) {
            $renderer = $submenu->getRenderer();
            if ($renderer instanceof BadgeMenuItemRenderer) {
                if ($renderer->getState() === $this->state) {
                    $this->titles[] = $renderer->getTitle();
                    $this->count += $renderer->getCount();
                }
            }
        }
        return $this->renderBadge() . $this->createLink($menu);
    }

    /**
     * The amount of items to display in the badge
     *
     * @return int
     */
    public function getCount()
    {
        return $this->count;
    }

    /**
     * Defines the color of the badge
     *
     * @return string
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * The tooltip title
     *
     * @return string
     */
    public function getTitle()
    {
        return implode(', ', $this->titles);
    }
}