1
|
|
|
<?php namespace Comodojo\RpcClient\Utils; |
2
|
|
|
|
3
|
|
|
use Psr\Log\LoggerInterface; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* A simple, PSR-3 compliant, null logger. |
7
|
|
|
* |
8
|
|
|
* @package Comodojo Spare Parts |
9
|
|
|
* @author Marco Giovinazzi <[email protected]> |
10
|
|
|
* @license MIT |
11
|
|
|
* |
12
|
|
|
* LICENSE: |
13
|
|
|
* |
14
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
15
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
17
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
18
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
19
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
20
|
|
|
* THE SOFTWARE. |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
View Code Duplication |
class NullLogger implements LoggerInterface { |
|
|
|
|
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* emergency |
27
|
|
|
* |
28
|
|
|
* @param string $message |
29
|
|
|
* @param array $context |
30
|
|
|
* |
31
|
|
|
* @return null |
32
|
|
|
*/ |
33
|
|
|
public function emergency($message, array $context = array()) { return; } |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* alert |
37
|
|
|
* |
38
|
|
|
* @param string $message |
39
|
|
|
* @param array $context |
40
|
|
|
* |
41
|
|
|
* @return null |
42
|
|
|
*/ |
43
|
|
|
public function alert($message, array $context = array()) { return; } |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* critical |
47
|
|
|
* |
48
|
|
|
* @param string $message |
49
|
|
|
* @param array $context |
50
|
|
|
* |
51
|
|
|
* @return null |
52
|
|
|
*/ |
53
|
|
|
public function critical($message, array $context = array()) { return; } |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* error |
57
|
|
|
* |
58
|
|
|
* @param string $message |
59
|
|
|
* @param array $context |
60
|
|
|
* |
61
|
|
|
* @return null |
62
|
|
|
*/ |
63
|
|
|
public function error($message, array $context = array()) { return; } |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* warning |
67
|
|
|
* |
68
|
|
|
* @param string $message |
69
|
|
|
* @param array $context |
70
|
|
|
* |
71
|
|
|
* @return null |
72
|
|
|
*/ |
73
|
|
|
public function warning($message, array $context = array()) { return; } |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* notice |
77
|
|
|
* |
78
|
|
|
* @param string $message |
79
|
|
|
* @param array $context |
80
|
|
|
* |
81
|
|
|
* @return null |
82
|
|
|
*/ |
83
|
|
|
public function notice($message, array $context = array()) { return; } |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* info |
87
|
|
|
* |
88
|
|
|
* @param string $message |
89
|
|
|
* @param array $context |
90
|
|
|
* |
91
|
|
|
* @return null |
92
|
|
|
*/ |
93
|
|
|
public function info($message, array $context = array()) { return; } |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* debug |
97
|
|
|
* |
98
|
|
|
* @param string $message |
99
|
|
|
* @param array $context |
100
|
|
|
* |
101
|
|
|
* @return null |
102
|
|
|
*/ |
103
|
|
|
public function debug($message, array $context = array()) { return; } |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* log |
107
|
|
|
* |
108
|
|
|
* @param mixed $level |
109
|
|
|
* @param string $message |
110
|
|
|
* @param array $context |
111
|
|
|
* |
112
|
|
|
* @return null |
113
|
|
|
*/ |
114
|
|
|
public function log($level, $message, array $context = array()) { return; } |
115
|
|
|
|
116
|
|
|
} |
117
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.