Showing 691 of 718 total issues
Method searchArchive
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function searchArchive( $term ) {
$this->searchContext->setOriginalSearchTerm( $term );
$term = $this->searchContext->escaper()->fixupWholeQueryString( $term );
$this->setResultsType( new TitleResultsType() );
Method getMapping
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMapping( SearchEngine $engine ) {
if ( !( $engine instanceof CirrusSearch ) ) {
throw new \LogicException( "Cannot map CirrusSearch fields for another engine." );
}
$this->initFlags();
Method getSearchRequest
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSearchRequest( Client $client ) {
$fixablePart = $this->queryFixer->getFixablePart();
if ( $fixablePart === null ) {
return null;
}
Method toArray
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toArray() {
$output = [
'type' => $this->highlighterType
];
Method extractResponseVariables
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function extractResponseVariables( $responseData ) {
if ( !is_array( $responseData ) ) {
// No known offenders, but just in case...
return [];
}
Method format
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function format( array $queryResult ) {
$result = [];
if ( isset( $queryResult['result']['hits']['hits'] ) ) {
$queryResult = [ $queryResult ];
}
Method getValueRegex
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getValueRegex() {
Assert::invariant( $this->hasValue(), __METHOD__ . ' called but hasValue() is false' );
if ( $this->greedy() ) {
Assert::precondition( !$this->allowEmptyValue(), "greedy keywords must not accept empty value" );
// XXX: we ignore value delimiter for greedy keywords
Method toArray
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toArray() {
$ar = [
'query' => $this->query,
'rawQuery' => $this->rawQuery
];
Method initProfile
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function initProfile() {
$res = $this->getDB( DB_REPLICA )
->newSelectQueryBuilder()
->select( [ 'min_id' => 'MIN(page_id)', 'max_id' => 'MAX(page_id)' ] )
->table( 'page' )
Method validateSpecificAlias
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function validateSpecificAlias() {
$connection = $this->getConnection();
$fieldsToCleanup = array_filter( explode( ',', $this->getOption( 'fieldsToDelete', '' ) ) );
$fieldsToCleanup = array_merge( $fieldsToCleanup, $this->getSearchConfig()->get( "CirrusSearchIndexFieldsToCleanup" ) );
Method execute
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->indexSuffix = $this->getOption( 'indexSuffix' );
$this->indexBaseName = $this->getOption( 'baseName',
$this->getSearchConfig()->get( SearchConfig::INDEX_BASE_NAME ) );
Function listExposedProfiles
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function listExposedProfiles( $type ) {
$profiles = [];
if ( isset( $this->repositories[$type] ) ) {
foreach ( $this->repositories[$type] as $repo ) {
foreach ( $repo->listExposedProfiles() as $name => $profile ) {
- 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 getProfileName
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getProfileName( $type, $context = self::CONTEXT_DEFAULT, array $contextParams = [] ) {
$minPrio = PHP_INT_MAX;
if ( !isset( $this->defaultProfiles[$type][$context] ) ) {
throw new SearchProfileException( "No default profile found for $type in context $context" );
}
- 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 collectPrefixSearchResults
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function collectPrefixSearchResults( CompletionResultsCollector $collector, array $results, CompletionRequestLog $log ) {
if ( !isset( $results[self::MSEARCH_KEY_PREFIX] ) ) {
return 0;
}
$indexName = $this->prefixSearchRequestBuilder->getIndex()->getName();
- 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 __construct
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( SearchConfig $config, $weight, $profile ) {
parent::__construct( $config, $weight );
if ( isset( $profile['k'] ) ) {
$this->k = $this->getOverriddenFactor( $profile['k'] );
if ( $this->k <= 0 ) {
- 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 getQuery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getQuery() {
if ( !$this->nonTextQueries ) {
$mainQuery = $this->mainQuery ?: new \Elastica\Query\MatchAll();
} else {
$mainQuery = new \Elastica\Query\BoolQuery();
- 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 extractResults
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
final public function extractResults() {
if ( $this->results === null ) {
$this->results = [];
$elasticaResults = $this->getElasticaResultSet();
if ( $elasticaResults !== 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
Function __construct
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( SearchConfig $config, $weight, $profile ) {
parent::__construct( $config, $weight );
if ( isset( $profile['impact'] ) ) {
$this->impact = $this->getOverriddenFactor( $profile['impact'] );
if ( $this->impact <= 0 ) {
- 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 append
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function append( FunctionScore $functionScore ) {
if ( !$this->namespacesToBoost || count( $this->namespacesToBoost ) == 1 ) {
// nothing to boost, no need to initialize anything else.
return;
}
- 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 get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function get( array $docIds, $sourceFiltering, $usePoolCounter = true ) {
$connection = $this->getOverriddenConnection();
$indexSuffix = $connection->pickIndexSuffixForNamespaces(
$this->searchContext->getNamespaces()
);
- 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"