1 | <?php |
||
12 | class Log implements LogInterface, LoggerInterface |
||
13 | { |
||
14 | use LoggerTrait; |
||
15 | |||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $defaultParams = [ |
||
20 | 'log_path' => './log', |
||
21 | 'level' => 'notice', |
||
22 | 'storage' => \SimpleLog\Storage\File::class, |
||
23 | 'message' => \SimpleLog\Message\DefaultMessage::class, |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * @var \SimpleLog\Storage\StorageInterface |
||
28 | */ |
||
29 | protected $storage; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $levels = []; |
||
35 | |||
36 | /** |
||
37 | * @var \SimpleLog\Message\MessageInterface |
||
38 | */ |
||
39 | protected $message; |
||
40 | |||
41 | /** |
||
42 | * @param array $params |
||
43 | * @throws \ReflectionException |
||
44 | */ |
||
45 | public function __construct(array $params = []) |
||
55 | |||
56 | /** |
||
57 | * log event information into file |
||
58 | * |
||
59 | * @param array|string|object $message |
||
60 | * @param array $context |
||
61 | * @return $this |
||
62 | */ |
||
63 | public function makeLog($message, array $context = []) |
||
69 | |||
70 | /** |
||
71 | * @param string $level |
||
72 | * @param string|array|object $message |
||
73 | * @param array $context |
||
74 | * @throws \Psr\Log\InvalidArgumentException |
||
75 | */ |
||
76 | public function log($level, $message, array $context = []) |
||
88 | |||
89 | /** |
||
90 | * @return $this |
||
91 | */ |
||
92 | protected function reloadStorage() |
||
102 | |||
103 | /** |
||
104 | * @return $this |
||
105 | */ |
||
106 | protected function reloadMessage() |
||
116 | |||
117 | /** |
||
118 | * set log option for all future executions of makeLog |
||
119 | * |
||
120 | * @param string $key |
||
121 | * @param mixed $val |
||
122 | * @return $this |
||
123 | */ |
||
124 | public function setOption($key, $val) |
||
129 | |||
130 | /** |
||
131 | * return all configuration or only given key value |
||
132 | * |
||
133 | * @param null|string $key |
||
134 | * @return array|mixed |
||
135 | */ |
||
136 | public function getOption($key = null) |
||
144 | |||
145 | /** |
||
146 | * @return string |
||
147 | */ |
||
148 | public function getLastMessage() |
||
152 | } |
||
153 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.