1 | <?php |
||
28 | class Logger |
||
29 | { |
||
30 | const DEFAULT_NAMESPACE = 'PSFS'; |
||
31 | use SingletonTrait; |
||
32 | /** |
||
33 | * @var \Monolog\Logger |
||
34 | */ |
||
35 | protected $logger; |
||
36 | /** |
||
37 | * @var resource |
||
38 | */ |
||
39 | private $stream; |
||
40 | /** |
||
41 | * @var UidProcessor |
||
42 | */ |
||
43 | private $uuid; |
||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $log_level; |
||
48 | |||
49 | /** |
||
50 | * Logger constructor. |
||
51 | * @throws exception\GeneratorException |
||
52 | */ |
||
53 | 2 | public function __construct() |
|
62 | |||
63 | 1 | public function __destruct() |
|
67 | |||
68 | /** |
||
69 | * @param string $msg |
||
70 | * @param array $context |
||
71 | * @return bool |
||
72 | */ |
||
73 | 1 | public function defaultLog($msg = '', array $context = []) |
|
77 | |||
78 | /** |
||
79 | * @param string $msg |
||
80 | * @param array $context |
||
81 | * |
||
82 | * @return bool |
||
83 | */ |
||
84 | 4 | public function infoLog($msg = '', array $context = []) |
|
88 | |||
89 | /** |
||
90 | * @param string $msg |
||
91 | * @param array $context |
||
92 | * |
||
93 | * @return bool |
||
94 | */ |
||
95 | 21 | public function debugLog($msg = '', array $context = []) |
|
99 | |||
100 | /** |
||
101 | * @param $msg |
||
102 | * @param array $context |
||
103 | * |
||
104 | * @return bool |
||
105 | */ |
||
106 | 4 | public function errorLog($msg, array $context = []) |
|
110 | |||
111 | /** |
||
112 | * @param $msg |
||
113 | * @param array $context |
||
114 | * |
||
115 | * @return bool |
||
116 | */ |
||
117 | 1 | public function criticalLog($msg, array $context = []) |
|
124 | |||
125 | /** |
||
126 | * @param $msg |
||
127 | * @param array $context |
||
128 | * @return bool |
||
129 | */ |
||
130 | 2 | public function warningLog($msg, array $context = []) |
|
134 | |||
135 | /** |
||
136 | * @param string $logger |
||
137 | * @param boolean $debug |
||
138 | * @param Config $config |
||
139 | * @throws \Exception |
||
140 | */ |
||
141 | 2 | private function addPushLogger($logger, $debug, Config $config) |
|
158 | |||
159 | /** |
||
160 | * @param Config $config |
||
161 | * @param array $args |
||
162 | * @return array |
||
163 | * @throws exception\GeneratorException |
||
164 | */ |
||
165 | 2 | private function setup(Config $config, array $args = []) |
|
177 | |||
178 | /** |
||
179 | * @param Config $config |
||
180 | * |
||
181 | * @return string |
||
182 | */ |
||
183 | 2 | private function setLoggerName(Config $config) |
|
190 | |||
191 | /** |
||
192 | * @param $logger |
||
193 | * |
||
194 | * @return mixed |
||
195 | */ |
||
196 | 2 | private function cleanLoggerName($logger) |
|
203 | |||
204 | /** |
||
205 | * @param Config $config |
||
206 | * @return string |
||
207 | * @throws exception\GeneratorException |
||
208 | */ |
||
209 | 2 | private function createLoggerPath(Config $config) |
|
217 | |||
218 | /** |
||
219 | * @param string $msg |
||
220 | * @param int $type |
||
221 | * @param array $context |
||
|
|||
222 | */ |
||
223 | 22 | public static function log($msg, $type = LOG_DEBUG, array $context = null) |
|
252 | |||
253 | /** |
||
254 | * @param bool $debug |
||
255 | * @return StreamHandler |
||
256 | * @throws \Exception |
||
257 | */ |
||
258 | 2 | private function addDefaultStreamHandler($debug = false) |
|
270 | |||
271 | /** |
||
272 | * @param array $context |
||
273 | * @return array |
||
274 | */ |
||
275 | 7 | private function addMinimalContext(array $context = []) |
|
284 | |||
285 | /** |
||
286 | * @return string |
||
287 | */ |
||
288 | public function getLogUid() { |
||
291 | |||
292 | /** |
||
293 | * @return string |
||
294 | */ |
||
295 | public static function getUid() { |
||
298 | } |
||
299 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type
array
and suggests a stricter type likearray<String>
.Most often this is a case of a parameter that can be null in addition to its declared types.