NullDebugger   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 74
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ __call() 0 4 1
A dump() 0 5 2
A timer() 0 5 2
A setBarPanel() 0 4 1
A setBarInfo() 0 4 1
A initDummy() 0 9 1
A dumpStr() 0 4 1
A barDump() 0 4 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\Service;
11
12
use WebinoDebug\Debugger\PanelInterface;
13
use WebinoDebug\Debugger\DebuggerBarInterface;
14
use WebinoDebug\Debugger\DebuggerInterface;
15
16
/**
17
 * Class NullDebugger
18
 */
19
class NullDebugger implements
20
    DebuggerInterface,
21
    DebuggerBarInterface
22
{
23
    /**
24
     * @var object
25
     */
26
    private $dummy;
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function dump($subject)
32
    {
33
        $this->dummy or $this->initDummy();
34
        return $this->dummy;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function timer($name = null)
41
    {
42
        $this->dummy or $this->initDummy();
43
        return $this->dummy;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function setBarPanel(PanelInterface $panel = null, $id = null)
50
    {
51
        return;
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function setBarInfo(string $label, $value)
58
    {
59
        return;
60
    }
61
62
    /**
63
     * Initialize dummy object
64
     */
65
    private function initDummy()
66
    {
67
        $this->dummy = new class {
68
            public function __call($name, $arguments)
69
            {
70
                return null;
71
            }
72
        };
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     * @deprecated use dump() instead, now it returns stringable object
78
     */
79
    public function dumpStr($subject)
80
    {
81
        return '';
82
    }
83
84
    /**
85
     * {@inheritdoc}
86
     * @deprecated use dump() instead, now it returns object
87
     */
88
    public function barDump($subject, $title = null, array $options = null)
89
    {
90
        return;
91
    }
92
}
93