includes/api/ApiQueryBlocks.php
Function execute
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
Open
public function execute() {
$db = $this->getDB();
$params = $this->extractRequestParams();
$this->requireMaxOneParameter( $params, 'users', 'ip' );
- 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 execute
has 264 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute() {
$db = $this->getDB();
$params = $this->extractRequestParams();
$this->requireMaxOneParameter( $params, 'users', 'ip' );
File ApiQueryBlocks.php
has 438 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Copyright © 2007 Roan Kattouw <roan.kattouw@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
Method getAllowedParams
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getAllowedParams() {
$blockCIDRLimit = $this->getConfig()->get( MainConfigNames::BlockCIDRLimit );
return [
'start' => [
Method getRestrictionData
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getRestrictionData( IResultWrapper $result, $limit ) {
$partialIds = [];
$count = 0;
foreach ( $result as $row ) {
if ( ++$count <= $limit && !( $row->ipb_sitewide ?? $row->bl_sitewide ) ) {
Function getRestrictionData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
private function getRestrictionData( IResultWrapper $result, $limit ) {
$partialIds = [];
$count = 0;
foreach ( $result as $row ) {
if ( ++$count <= $limit && !( $row->ipb_sitewide ?? $row->bl_sitewide ) ) {
- 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
Consider simplifying this complex logical expression. Open
Open
if ( ( isset( $show['account'] ) && isset( $show['!account'] ) )
|| ( isset( $show['ip'] ) && isset( $show['!ip'] ) )
|| ( isset( $show['range'] ) && isset( $show['!range'] ) )
|| ( isset( $show['temp'] ) && isset( $show['!temp'] ) )
) {
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ApiQuery $query,
$moduleName,
DatabaseBlockStore $blockStore,
BlockActionInfo $blockActionInfo,
BlockRestrictionStore $blockRestrictionStore,