File SpecialBlock.php
has 705 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Implements Special:Block
*
* This program is free software; you can redistribute it and/or modify
Function maybeAlterFormDefaults
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
protected function maybeAlterFormDefaults( &$fields ) {
// This will be overwritten by request data
$fields['Target']['default'] = (string)$this->target;
if ( $this->target ) {
- 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 getFormFields
has 187 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFormFields() {
$conf = $this->getConfig();
$blockAllowsUTEdit = $conf->get( MainConfigNames::BlockAllowsUTEdit );
$this->getOutput()->enableOOUI();
Function processFormInternal
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private static function processFormInternal(
array $data,
Authority $performer,
BlockUserFactory $blockUserFactory,
BlockUtils $blockUtils
- 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 processFormInternal
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function processFormInternal(
array $data,
Authority $performer,
BlockUserFactory $blockUserFactory,
BlockUtils $blockUtils
Method maybeAlterFormDefaults
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function maybeAlterFormDefaults( &$fields ) {
// This will be overwritten by request data
$fields['Target']['default'] = (string)$this->target;
if ( $this->target ) {
Method postHtml
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function postHtml() {
$links = [];
$this->getOutput()->addModuleStyles( 'mediawiki.special' );
SpecialBlock
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class SpecialBlock extends FormSpecialPage {
private BlockUtils $blockUtils;
private BlockPermissionCheckerFactory $blockPermissionCheckerFactory;
private BlockUserFactory $blockUserFactory;
Method preHtml
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function preHtml() {
$this->getOutput()->addModuleStyles( [ 'mediawiki.special' ] );
$this->getOutput()->addModules( [ 'mediawiki.special.block' ] );
$blockCIDRLimit = $this->getConfig()->get( MainConfigNames::BlockCIDRLimit );
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
BlockUtils $blockUtils,
BlockPermissionCheckerFactory $blockPermissionCheckerFactory,
BlockUserFactory $blockUserFactory,
DatabaseBlockStore $blockStore,
UserNameUtils $userNameUtils,
Function getFormFields
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getFormFields() {
$conf = $this->getConfig();
$blockAllowsUTEdit = $conf->get( MainConfigNames::BlockAllowsUTEdit );
$this->getOutput()->enableOOUI();
- 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 preHtml
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function preHtml() {
$this->getOutput()->addModuleStyles( [ 'mediawiki.special' ] );
$this->getOutput()->addModules( [ 'mediawiki.special.block' ] );
$blockCIDRLimit = $this->getConfig()->get( MainConfigNames::BlockCIDRLimit );
- 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 postHtml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function postHtml() {
$links = [];
$this->getOutput()->addModuleStyles( 'mediawiki.special' );
- 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 new ActionRestriction( 0, $id );
Avoid too many return
statements within this method. Open
return $status;
Avoid too many return
statements within this method. Open
return true;