Passed
Push — master ( 4b500f...63b2b9 )
by Jerome
10:05 queued 13s
created

engine/classes/Elgg/Cli/ErrorFormatter.php (5 issues)

1
<?php
2
3
namespace Elgg\Cli;
4
5
use Elgg\Logger\ElggLogFormatter;
6
use Monolog\Logger;
7
use Monolog\LogRecord;
8
use Symfony\Component\Console\Helper\FormatterHelper;
9
10
/**
11
 * Format errors for console output
12
 */
13
class ErrorFormatter extends ElggLogFormatter {
14
15
	const SIMPLE_FORMAT = '%level_name%: %message%';
16
17
	/**
18
	 * {@inheritdoc}
19
	 */
20 12
	public function format(LogRecord $record): string {
21 12
		$message = parent::format($record);
22
23 12
		$formatter = new FormatterHelper();
24
25 12
		switch ($record->level->value) {
26
			case Logger::EMERGENCY:
0 ignored issues
show
Deprecated Code introduced by
The constant Monolog\Logger::EMERGENCY has been deprecated: Use \Monolog\Level::Emergency ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

26
			case /** @scrutinizer ignore-deprecated */ Logger::EMERGENCY:

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
27
			case Logger::CRITICAL:
0 ignored issues
show
Deprecated Code introduced by
The constant Monolog\Logger::CRITICAL has been deprecated: Use \Monolog\Level::Critical ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

27
			case /** @scrutinizer ignore-deprecated */ Logger::CRITICAL:

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
28
			case Logger::ALERT:
0 ignored issues
show
Deprecated Code introduced by
The constant Monolog\Logger::ALERT has been deprecated: Use \Monolog\Level::Alert ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

28
			case /** @scrutinizer ignore-deprecated */ Logger::ALERT:

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
29
			case Logger::ERROR:
0 ignored issues
show
Deprecated Code introduced by
The constant Monolog\Logger::ERROR has been deprecated: Use \Monolog\Level::Error ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

29
			case /** @scrutinizer ignore-deprecated */ Logger::ERROR:

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
30 12
				$style = 'error';
31 12
				break;
32
33
			case Logger::WARNING:
0 ignored issues
show
Deprecated Code introduced by
The constant Monolog\Logger::WARNING has been deprecated: Use \Monolog\Level::Warning ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

33
			case /** @scrutinizer ignore-deprecated */ Logger::WARNING:

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
34
				$style = 'comment';
35
				break;
36
37
			default:
38
				$style = 'info';
39
				break;
40
		}
41
42 12
		return $formatter->formatBlock($message, $style);
43
	}
44
}
45