includes/Category/CategoryViewer.php
File CategoryViewer.php
has 532 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* List and paging of category members.
*
* This program is free software; you can redistribute it and/or modify
Method doCategoryQuery
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function doCategoryQuery() {
$dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
$this->nextPage = [
'page' => null,
Function doCategoryQuery
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function doCategoryQuery() {
$dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
$this->nextPage = [
'page' => 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
CategoryViewer
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class CategoryViewer extends ContextSource {
use ProtectedHookAccessorTrait;
use DeprecationHelper;
/** @var int */
Method getHTML
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getHTML() {
$this->showGallery = $this->getConfig()->get( MainConfigNames::CategoryMagicGallery )
&& !$this->getOutput()->mNoGallery;
$this->clearCategoryState();
Method columnList
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function columnList(
$articles,
$articles_start_char,
$cssClasses = 'mw-category mw-category-columns'
) {
Method pagingLinks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function pagingLinks( $first, $last, $type = '' ) {
$prevLink = $this->msg( 'prev-page' )->escaped();
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( $first != '' ) {
Function getCountMessage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
private function getCountMessage( $rescnt, $dbcnt, $type ) {
// There are three cases:
// 1) The category table figure seems good. It might be wrong, but
// we can't do anything about it if we don't recalculate it on ev-
// ery category view.
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function __construct( PageIdentity $page, IContextSource $context, array $from = [],
array $until = [], array $query = []