Function deduplicateAnalysisConfig
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function deduplicateAnalysisConfig( array $analysis ) {
// Deduplicate children first to normalize analyzer configuration.
foreach ( [ 'tokenizer', 'filter', 'char_filter' ] as $k ) {
if ( !isset( $analysis[$k] ) ) {
continue;
- 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 filterUnusedAnalysisChain
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function filterUnusedAnalysisChain( $analysis, Set $usedAnalyzers ) {
$sets = [
'analyzer' => $usedAnalyzers,
'filter' => new Set(),
'char_filter' => new Set(),
- 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 pushAnalyzerAliasesIntoField
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function pushAnalyzerAliasesIntoField( array $properties, array $aliases ) {
foreach ( $properties as &$config ) {
foreach ( self::$ANALYZER_FIELDS as $key ) {
if ( isset( $config[$key] ) && isset( $aliases[$config[$key]] ) ) {
$config[$key] = $aliases[$config[$key]];
- 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 findUsedFromField
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function findUsedFromField( array $properties ) {
$analyzers = new Set();
foreach ( $properties as $name => $config ) {
foreach ( self::$ANALYZER_FIELDS as $key ) {
if ( isset( $config[$key] ) ) {
- 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"