File IndexPager.php
has 432 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
IndexPager
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class IndexPager extends ContextSource implements Pager {
/** Backwards-compatible constant for $mDefaultDirection field (do not change) */
public const DIR_ASCENDING = false;
/** Backwards-compatible constant for $mDefaultDirection field (do not change) */
Function extractResultInfo
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function extractResultInfo( $isFirst, $limit, IResultWrapper $res ) {
$numRows = $res->numRows();
$firstIndex = [];
$lastIndex = [];
- 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 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( IContextSource $context = null, LinkRenderer $linkRenderer = null ) {
if ( $context ) {
$this->setContext( $context );
}
Method extractResultInfo
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function extractResultInfo( $isFirst, $limit, IResultWrapper $res ) {
$numRows = $res->numRows();
$firstIndex = [];
$lastIndex = [];
Function getBody
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getBody() {
$this->getOutput()->addModuleStyles( $this->getModuleStyles() );
if ( !$this->mQueryDone ) {
$this->doQuery();
}
- 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( IContextSource $context = null, LinkRenderer $linkRenderer = null ) {
if ( $context ) {
$this->setContext( $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
Method getBody
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBody() {
$this->getOutput()->addModuleStyles( $this->getModuleStyles() );
if ( !$this->mQueryDone ) {
$this->doQuery();
}
Method buildQueryInfo
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildQueryInfo( $offset, $limit, $order ) {
$fname = __METHOD__ . ' (' . $this->getSqlComment() . ')';
$info = $this->getQueryInfo();
$tables = $info['tables'];
$fields = $info['fields'];
Method getPagingQueries
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPagingQueries() {
if ( !$this->mQueryDone ) {
$this->doQuery();
}
Function makeLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function makeLink( $text, array $query = null, $type = null ) {
$attrs = [];
if ( $query !== null && in_array( $type, [ 'prev', 'next' ] ) ) {
$attrs['rel'] = $type;
}
- 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"