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

TimerPanel::setTimer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
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) 2018 Webino, s. r. o. (http://webino.sk/)
7
 * @license     BSD-3-Clause
8
 */
9
10
namespace WebinoDebug\Debugger;
11
12
/**
13
 * Class TimerPanel
14
 */
15
class TimerPanel extends AbstractPanel implements PanelInterface
16
{
17
    /**
18
     * @var string
19
     */
20
    protected $title = 'Timer';
21
22
    /**
23
     * @var array
24
     */
25
    protected $timers = [];
26
27
    /**
28
     * Set timer value
29
     *
30
     * @param string $name Timer name
31
     * @param float $value value
32
     * @return $this
33
     */
34
    public function setTimer(string $name, $value)
35
    {
36
        $this->timers[$name] = (string) $value;
37
        return $this;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getTab()
44
    {
45
        return $this->timers ? $this->createIcon('timer') : '';
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getPanel()
52
    {
53
        return $this->timers ? $this->renderTemplate('timer.panel') : '';
54
    }
55
}
56