File BlockListPager.php
has 490 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 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formatValue( $name, $value ) {
static $msg = null;
if ( $msg === null ) {
$keys = [
'anononlyblock',
Method getQueryInfo
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getQueryInfo() {
$db = $this->getDatabase();
if ( $this->readStage === SCHEMA_COMPAT_READ_OLD ) {
$commentQuery = $this->commentStore->getJoin( 'ipb_reason' );
$info = [
Function formatValue
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function formatValue( $name, $value ) {
static $msg = null;
if ( $msg === null ) {
$keys = [
'anononlyblock',
- 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 getRestrictionListHTML
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getRestrictionListHTML( stdClass $row ) {
$items = [];
$linkRenderer = $this->getLinkRenderer();
foreach ( $this->restrictions as $restriction ) {
Function preprocessResults
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function preprocessResults( $result ) {
// Do a link batch query
$lb = $this->linkBatchFactory->newLinkBatch();
$lb->setCaller( __METHOD__ );
- 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 getRestrictionListHTML
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function getRestrictionListHTML( stdClass $row ) {
$items = [];
$linkRenderer = $this->getLinkRenderer();
foreach ( $this->restrictions as $restriction ) {
- 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 12 arguments (exceeds 4 allowed). Consider refactoring. Open
IContextSource $context,
BlockActionInfo $blockActionInfo,
BlockRestrictionStore $blockRestrictionStore,
BlockUtils $blockUtils,
HideUserUtils $hideUserUtils,
Method preprocessResults
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preprocessResults( $result ) {
// Do a link batch query
$lb = $this->linkBatchFactory->newLinkBatch();
$lb->setCaller( __METHOD__ );
Method formatTarget
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function formatTarget( $row ) {
if ( $row->bt_auto ) {
return $this->msg( 'autoblockid', $row->bl_id )->parse();
}
Function formatTarget
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function formatTarget( $row ) {
if ( $row->bt_auto ) {
return $this->msg( 'autoblockid', $row->bl_id )->parse();
}
- 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
Avoid too many return
statements within this method. Open
return Linker::userLink( $userId, $userName ) .
Linker::userToolLinks(
$userId,
$userName,
false,
Function getQueryInfo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getQueryInfo() {
$db = $this->getDatabase();
if ( $this->readStage === SCHEMA_COMPAT_READ_OLD ) {
$commentQuery = $this->commentStore->getJoin( 'ipb_reason' );
$info = [
- 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"