File AllMessagesTablePager.php
has 265 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
Method formatValue
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formatValue( $field, $value ) {
$linkRenderer = $this->getLinkRenderer();
switch ( $field ) {
case 'am_title':
$title = Title::makeTitle( NS_MEDIAWIKI, $value . $this->suffix );
Consider simplifying this complex logical expression. Open
if ( $customised !== $this->custom &&
( ( $asc && ( $key < $offset || !$offset ) ) || ( !$asc && $key > $offset ) ) &&
( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix === false )
) {
$actual = $this->msg( $key )->inLanguage( $this->lang )->plain();
Function getCustomisedStatuses
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getCustomisedStatuses(
$messageNames,
$langcode = 'en',
$foreign = false,
IReadableDatabase $dbr = 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 reallyDoQuery
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function reallyDoQuery( $offset, $limit, $order ) {
$asc = ( $order === self::QUERY_ASCENDING );
$messageNames = $this->getAllMessages( $order );
$statuses = self::getCustomisedStatuses(
Method getCustomisedStatuses
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getCustomisedStatuses(
$messageNames,
$langcode = 'en',
$foreign = false,
IReadableDatabase $dbr = null
Method __construct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
IContextSource $context,
Language $contentLanguage,
LanguageFactory $languageFactory,
LinkRenderer $linkRenderer,
Function reallyDoQuery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function reallyDoQuery( $offset, $limit, $order ) {
$asc = ( $order === self::QUERY_ASCENDING );
$messageNames = $this->getAllMessages( $order );
$statuses = self::getCustomisedStatuses(
- 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 __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
IContextSource $context,
Language $contentLanguage,
LanguageFactory $languageFactory,
LinkRenderer $linkRenderer,
IConnectionProvider $dbProvider,
Function getCellAttrs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getCellAttrs( $field, $value ) {
$attr = [];
if ( $field === 'am_title' ) {
if ( $this->mCurrentRow->am_customised ) {
$attr += [ 'rowspan' => '2' ];
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(
IContextSource $context,
Language $contentLanguage,
LanguageFactory $languageFactory,
LinkRenderer $linkRenderer,
- 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"