Completed
Push — develop ( e297ce...b5d464 )
by Peter
02:16
created

InfoPanel::init()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
1
<?php
2
/**
3
 * Webino (http://webino.sk/)
4
 *
5
 * @link        https://github.com/webino/WebinoDebug/ for the canonical source repository
6
 * @copyright   Copyright (c) 2014-2018 Webino, s. r. o. (http://webino.sk/)
7
 * @license     BSD-3-Clause
8
 */
9
10
namespace WebinoDebug\Debugger;
11
12
use WebinoDebug\Factory\DebuggerFactory;
13
use WebinoDebug\Options\ModuleOptions;
14
use Zend\ServiceManager\ServiceManager;
15
16
/**
17
 * Class InfoPanel
18
 */
19
class InfoPanel extends AbstractPanel implements
20
    PanelInterface,
21
    PanelInitInterface
22
{
23
    /**
24
     * @var string|null
25
     */
26
    protected $barTitle;
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function init(ServiceManager $services)
32
    {
33
        /** @var \WebinoDebug\Options\ModuleOptions $options */
34
        $options = $services->get(ModuleOptions::class);
35
        /** @var \WebinoDebug\Service\Debugger $debugger */
36
        $debugger = $services->get(DebuggerFactory::SERVICE);
37
38
        // set bar title
39
        $this->barTitle = $options->getBarTitle();
40
41
        // set bar info
42
        foreach ($options->getBarInfo() as $name => $value) {
43
            $debugger->setBarInfo($name, $value);
44
        }
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getTab()
51
    {
52
        return '<span id="webino-debug-bar-meta" data-bar-title="' . $this->barTitle . '"></span>';
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function getPanel()
59
    {
60
        return ' ';
61
    }
62
}
63