File ImageListPager.php
has 444 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 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formatValue( $field, $value ) {
$linkRenderer = $this->getLinkRenderer();
switch ( $field ) {
case 'thumb':
$opt = [ 'time' => wfTimestamp( TS_MW, $this->mCurrentRow->img_timestamp ) ];
ImageListPager
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ImageListPager extends TablePager {
/** @var string[]|null */
protected $mFieldNames = null;
/**
Function __construct
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(
IContextSource $context,
CommentStore $commentStore,
LinkRenderer $linkRenderer,
IConnectionProvider $dbProvider,
- 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 getQueryInfoReal
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getQueryInfoReal( $table ) {
$dbr = $this->getDatabase();
$prefix = $table === 'oldimage' ? 'oi' : 'img';
$tables = [ $table, 'actor' ];
Function formatValue
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function formatValue( $field, $value ) {
$linkRenderer = $this->getLinkRenderer();
switch ( $field ) {
case 'thumb':
$opt = [ 'time' => wfTimestamp( TS_MW, $this->mCurrentRow->img_timestamp ) ];
- 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 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function reallyDoQuery( $offset, $limit, $order ) {
$dbr = $this->getDatabase();
$prevTableName = $this->mTableName;
$this->mTableName = 'image';
[ $tables, $fields, $conds, $fname, $options, $join_conds ] =
Method getForm
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getForm() {
$formDescriptor = [];
$formDescriptor['limit'] = [
'type' => 'radio',
'name' => 'limit',
Method __construct
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
IContextSource $context,
CommentStore $commentStore,
LinkRenderer $linkRenderer,
IConnectionProvider $dbProvider,
RepoGroup $repoGroup,
Function combineResult
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function combineResult( $res1, $res2, $limit, $order ) {
$res1->rewind();
$res2->rewind();
$topRes1 = $res1->fetchObject();
$topRes2 = $res2->fetchObject();
- 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 combineResult
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function combineResult( $res1, $res2, $limit, $order ) {
$res1->rewind();
$res2->rewind();
$topRes1 = $res1->fetchObject();
$topRes2 = $res2->fetchObject();
Method __construct
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
IContextSource $context,
CommentStore $commentStore,
LinkRenderer $linkRenderer,
IConnectionProvider $dbProvider,
Avoid too many return
statements within this method. Open
return htmlspecialchars( $this->getLanguage()->formatNum( intval( $value ) + 1 ) );
Avoid too many return
statements within this method. Open
return htmlspecialchars( $value );
Avoid too many return
statements within this method. Open
return $html;
Avoid too many return
statements within this method. Open
return $link;
Avoid too many return
statements within this method. Open
return $this->commentFormatter->format( $value );
Avoid too many return
statements within this method. Open
return htmlspecialchars( $this->getLanguage()->formatSize( (int)$value ) );
Avoid too many return
statements within this method. Open
return $this->msg( 'listfiles-latestversion-' . $value )->escaped();
Function getPagingQueries
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getPagingQueries() {
$queries = parent::getPagingQueries();
if ( $this->mUserName !== null ) {
# Append the username to the query string
foreach ( $queries as &$query ) {
- 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 getFieldNames
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getFieldNames() {
if ( !$this->mFieldNames ) {
$this->mFieldNames = [
'img_timestamp' => $this->msg( 'listfiles_date' )->text(),
'img_name' => $this->msg( 'listfiles_name' )->text(),
- 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"