These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Automation tool mixed with code generator for easier continuous development |
||
4 | * |
||
5 | * @link https://github.com/hiqdev/hidev |
||
6 | * @package hidev |
||
7 | * @license BSD-3-Clause |
||
8 | * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/) |
||
9 | */ |
||
10 | |||
11 | namespace hidev\log; |
||
12 | |||
13 | use Psr\Log\LogLevel; |
||
14 | use Yii; |
||
15 | use yii\helpers\Console; |
||
16 | use yii\log\Logger; |
||
17 | |||
18 | class ConsoleTarget extends \yii\log\Target |
||
19 | { |
||
20 | public $exportInterval = 1; |
||
21 | |||
22 | public static $styles = [ |
||
23 | LogLevel::EMERGENCY => [Console::FG_RED], |
||
24 | LogLevel::ALERT => [Console::FG_RED], |
||
25 | LogLevel::CRITICAL => [Console::FG_RED], |
||
26 | LogLevel::ERROR => [Console::FG_RED], |
||
27 | LogLevel::WARNING => [Console::FG_YELLOW], |
||
28 | LogLevel::NOTICE => [Console::FG_YELLOW], |
||
29 | ]; |
||
30 | |||
31 | public function export() |
||
32 | { |
||
33 | foreach ($this->messages as $message) { |
||
34 | $this->out($message[0], $message[1]); |
||
35 | } |
||
36 | } |
||
37 | |||
38 | View Code Duplication | public function out($level, $message) |
|
39 | { |
||
40 | /*if ($level > $this->getLevel()) { |
||
0 ignored issues
–
show
|
|||
41 | return; |
||
42 | }*/ |
||
43 | $style = self::$styles[$level]; |
||
44 | if ($style) { |
||
45 | $message = Console::ansiFormat($message, $style); |
||
46 | } |
||
47 | Console::stdout($message . "\n"); |
||
48 | } |
||
49 | |||
50 | protected function getContextMessage() |
||
51 | { |
||
52 | return ''; |
||
53 | } |
||
54 | } |
||
55 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.