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

EventPanel::getPanel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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\Exception;
13
use WebinoDebug\Factory\EventProfilerFactory;
14
use WebinoDebug\Service\EventProfiler;
15
use Zend\ModuleManager\ModuleManager;
16
17
/**
18
 * Class EventPanel
19
 */
20
class EventPanel extends AbstractPanel implements PanelInterface
21
{
22
    /**
23
     * @var EventProfiler
24
     */
25
    private $eventProfiler;
26
27
    /**
28
     * @var string
29
     */
30
    protected $title = 'Application events';
31
32
    /**
33
     * @var string
34
     */
35
    protected $content;
36
37
    /**
38
     * @param ModuleManager $modules
39
     */
40
    public function __construct(ModuleManager $modules)
41
    {
42
        $this->setEventProfiler((new EventProfilerFactory)->create($modules));
43
    }
44
45
    /**
46
     * @return EventProfiler
47
     * @throws Exception\LogicException
48
     */
49
    protected function getEventProfiler()
50
    {
51
        if (null === $this->eventProfiler) {
52
            throw new Exception\LogicException('Expected `eventProfiler`');
53
        }
54
        return $this->eventProfiler;
55
    }
56
57
    /**
58
     * @param EventProfiler $eventProfiler
59
     * @return self
60
     */
61
    public function setEventProfiler(EventProfiler $eventProfiler)
62
    {
63
        $this->eventProfiler = $eventProfiler;
64
        return $this;
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function getTab()
71
    {
72
        return $this->createIcon('events', 'left: -1px; top: -3px;') . parent::getTab();
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78
    public function getPanel()
79
    {
80
        return $this->renderTemplate('events.panel');
81
    }
82
}
83