File LegacyLogger.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Function shouldEmit
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function shouldEmit( $channel, $message, $level, $context ) {
global $wgDebugLogFile, $wgDBerrorLog, $wgDebugLogGroups;
if ( is_string( $level ) ) {
$level = self::$levelMapping[$level];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function flatten
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected static function flatten( $item ) {
if ( $item === null ) {
return '[Null]';
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method flatten
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function flatten( $item ) {
if ( $item === null ) {
return '[Null]';
}
Method log
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function log( $level, $message, array $context = [] ) {
if ( is_string( $level ) ) {
$level = self::$levelMapping[$level];
}
if ( $level < $this->minimumLevel ) {
Function format
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function format( $channel, $message, $context ) {
global $wgDebugLogGroups, $wgLogExceptionBacktrace;
if ( $channel === 'wfDebug' ) {
$text = self::formatAsWfDebug( $channel, $message, $context );
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __construct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $channel ) {
global $wgDebugLogFile, $wgDBerrorLog, $wgDebugLogGroups, $wgDebugToolbar, $wgDebugRawPage, $wgShowDebug;
$this->channel = $channel;
$this->isDB = ( $channel === 'rdbms' );
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method shouldEmit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function shouldEmit( $channel, $message, $level, $context ) {
global $wgDebugLogFile, $wgDBerrorLog, $wgDebugLogGroups;
if ( is_string( $level ) ) {
$level = self::$levelMapping[$level];
Function log
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function log( $level, $message, array $context = [] ) {
if ( is_string( $level ) ) {
$level = self::$levelMapping[$level];
}
if ( $level < $this->minimumLevel ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function destination
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected static function destination( $channel, $message, $context ) {
global $wgDebugLogFile, $wgDBerrorLog, $wgDebugLogGroups;
// Default destination is the debug log file as historically used by
// the wfDebug function.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return '[' . $which . ' ' . get_class( $item ) . '( ' .
$item->getFile() . ':' . $item->getLine() . ') ' .
$item->getMessage() . ']';
Avoid too many return
statements within this method. Open
return (string)$item;
Avoid too many return
statements within this method. Open
return (string)$item;
Avoid too many return
statements within this method. Open
return '[Resource ' . get_resource_type( $item ) . ']';
Avoid too many return
statements within this method. Open
return (string)$item;
Avoid too many return
statements within this method. Open
return '[Unknown ' . gettype( $item ) . ']';
Avoid too many return
statements within this method. Open
return '[Object ' . get_class( $item ) . ']';
Avoid too many return
statements within this method. Open
return '[Array(' . count( $item ) . ')]';
Avoid too many return
statements within this method. Open
return $item->format( 'c' );
Function emit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function emit( $text, $file ) {
if ( str_starts_with( $file, 'udp:' ) ) {
$transport = UDPTransport::newFromString( $file );
$transport->emit( $text );
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"