Function run
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
private function run( $resultPageSet = null ) {
$params = $this->extractRequestParams();
// Extract parameters
$query = $params['search'];
- 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 run
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function run( $resultPageSet = null ) {
$params = $this->extractRequestParams();
// Extract parameters
$query = $params['search'];
File ApiQuerySearch.php
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright © 2007 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
Function getSearchResultData
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private function getSearchResultData( SearchResult $result, $prop ) {
// Silently skip broken and missing titles
if ( $result->isBrokenTitle() || $result->isMissingRevision() ) {
return 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
Method getAllowedParams
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllowedParams() {
$allowedParams = $this->buildCommonApiParams() + [
'what' => [
ParamValidator::PARAM_TYPE => [
'title',
Method getSearchResultData
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getSearchResultData( SearchResult $result, $prop ) {
// Silently skip broken and missing titles
if ( $result->isBrokenTitle() || $result->isMissingRevision() ) {
return null;
}
Function addInterwikiResults
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function addInterwikiResults(
ISearchResultSet $matches, ApiResult $apiResult, $prop,
$section, $type
) {
$totalhits = 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
Method addInterwikiResults
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addInterwikiResults(
ISearchResultSet $matches, ApiResult $apiResult, $prop,
$section, $type
) {
$totalhits = null;
Method addInterwikiResults
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ISearchResultSet $matches, ApiResult $apiResult, $prop,
$section, $type
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiQuery $query,
$moduleName,
SearchEngineConfig $searchEngineConfig,
SearchEngineFactory $searchEngineFactory,
TitleMatcher $titleMatcher