Showing 13 of 21 total issues
Function isValidRemoveTags
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function isValidRemoveTags( $removeTags ) {
if ( !is_array( $removeTags ) ) {
return false;
}
foreach ( $removeTags as $tagName => $rule ) {
- 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 addContent
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function addContent( $node ) {
if ( !$node instanceof DOMComment && !$this->matchesRemove( $node ) ) {
foreach ( $node->childNodes as $child ) {
if (
!self::lastElement( $this->cleanedContent )
- 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 processPageContent
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function processPageContent(
$displayTitle,
$pageContent,
$outputFormats,
$removeTags,
- 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 matchesRemove
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function matchesRemove( $node ) {
if ( !array_key_exists( $node->nodeName, $this->removeTags ) ) {
// The node name isn't found in the removal list.
return false;
}
- 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 deeply nested control flow statements. Open
if ( offset <= maxOffset ) {
// For the last node, check if position is
// before end of utterance.
return true;
}
Function addSegment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function addSegment( $text, $startOffset=0 ) {
if ( $this->currentSegment['startOffset'] === null ) {
// Move the start offset ahead by the number of leading
// whitespaces. This means that whitespaces before or
// between segments aren't included.
- 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 processPageContent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$displayTitle,
$pageContent,
$outputFormats,
$removeTags,
$segmentBreakingTags
Function isPointInItems
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
node,
items,
offset,
minOffset,
maxOffset
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Function isSentenceFinal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function isSentenceFinal( $string, $index ) {
$character = mb_substr( $string, $index, 1 );
$nextCharacter = null;
if ( mb_strlen( $string ) > $index + 1 ) {
$nextCharacter = mb_substr( $string, $index + 1, 1 );
- 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"