File MessageGroupStats.php
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Statistics;
MessageGroupStats
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class MessageGroupStats {
/** Name of the database table */
private const TABLE = 'translate_groupstats';
/** Cache key for storage of all language stats */
private const LANGUAGE_STATS_KEY = 'translate-all-language-stats';
Method queueUpdates
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function queueUpdates( int $flags ): void {
$mwInstance = MediaWikiServices::getInstance();
if ( self::$updates === [] || $mwInstance->getReadOnlyMode()->isReadOnly() ) {
return;
}
Method forItemInternal
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function forItemInternal(
array &$stats,
MessageGroup $group,
string $languageCode,
int $flags
Function calculateGroup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function calculateGroup( MessageGroup $group, string $languageCode ): array {
global $wgTranslateDocumentationLanguageCode;
// Calculate if missing and store in the db
$collection = $group->initCollection( $languageCode );
- 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 calculateAggregateGroup
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function calculateAggregateGroup(
array &$stats,
AggregateMessageGroup $group,
string $code,
int $flags
- 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 queueUpdates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function queueUpdates( int $flags ): void {
$mwInstance = MediaWikiServices::getInstance();
if ( self::$updates === [] || $mwInstance->getReadOnlyMode()->isReadOnly() ) {
return;
}
- 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 forItemInternal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function forItemInternal(
array &$stats,
MessageGroup $group,
string $languageCode,
int $flags
- 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"