Method searchFor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function searchFor( $query ) {
$searchType = $this->getOption( 'type', 'full_text' );
if ( $searchType === 'archive' ) {
// Archive has its own engine so go directly there
Method processResultSet
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function processResultSet( CirrusSearchResultSet $value, $query ) {
// these are prefix or full text results
$rows = [];
foreach ( $value as $result ) {
/** @var CirrusSearch\Search\CirrusSearchResult $result */
Function applyGlobals
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function applyGlobals() {
$optionsData = $this->getOption( 'options', 'false' );
if ( substr_compare( $optionsData, 'B64://', 0, strlen( 'B64://' ) ) === 0 ) {
$optionsData = base64_decode( substr( $optionsData, strlen( 'B64://' ) ) );
}
- 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 consume
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function consume( $query ) {
if ( $this->getOption( 'decode' ) ) {
$query = urldecode( $query );
}
$data = [ 'query' => $query ];
- 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 Status::newGood( $result );
Avoid too many return
statements within this method. Open
return $result;
Function searchFor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function searchFor( $query ) {
$searchType = $this->getOption( 'type', 'full_text' );
if ( $searchType === 'archive' ) {
// Archive has its own engine so go directly there
- 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 processResultSet
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function processResultSet( CirrusSearchResultSet $value, $query ) {
// these are prefix or full text results
$rows = [];
foreach ( $value as $result ) {
/** @var CirrusSearch\Search\CirrusSearchResult $result */
- 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"