Function find_middle_snake
has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring. Open
private function find_middle_snake( $bottoml1, $topl1, $bottoml2, $topl2, &$V, &$snake ) {
$from = &$this->from;
$to = &$this->to;
$V0 = &$V[0];
$V1 = &$V[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"
Further reading
File DiffEngine.php
has 494 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* New version of the difference engine
*
* Copyright © 2008 Guy Van den Broeck <guy@guyvdb.eu>
Method find_middle_snake
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function find_middle_snake( $bottoml1, $topl1, $bottoml2, $topl2, &$V, &$snake ) {
$from = &$this->from;
$to = &$this->to;
$V0 = &$V[0];
$V1 = &$V[1];
Function shiftBoundaries
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
private function shiftBoundaries( array $lines, array &$changed, array $other_changed ) {
$i = 0;
$j = 0;
assert( count( $lines ) == count( $changed ) );
- 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 diffInternal
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
protected function diffInternal( array $from, array $to ) {
// remember initial lengths
$m = count( $from );
$n = count( $to );
- 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 diffInternal
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function diffInternal( array $from, array $to ) {
// remember initial lengths
$m = count( $from );
$n = count( $to );
Function findMostProgress
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private static function findMostProgress( $M, $N, $limit, $V ) {
$delta = $N - $M;
if ( ( $M & 1 ) == ( $limit & 1 ) ) {
$forward_start_diag = max( -$M, -$limit );
- 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 shiftBoundaries
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function shiftBoundaries( array $lines, array &$changed, array $other_changed ) {
$i = 0;
$j = 0;
assert( count( $lines ) == count( $changed ) );
Method findMostProgress
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function findMostProgress( $M, $N, $limit, $V ) {
$delta = $N - $M;
if ( ( $M & 1 ) == ( $limit & 1 ) ) {
$forward_start_diag = max( -$M, -$limit );
Function diff
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function diff( $from_lines, $to_lines ) {
// Diff and store locally
$this->diffInternal( $from_lines, $to_lines );
// Merge edits when possible
- 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
Consider simplifying this complex logical expression. Open
if ( $delta & 1 ) {
for ( $d = 0; $d <= $limit; ++$d ) {
$start_diag = max( $value_to_add_forward + $start_forward, -$d );
$end_diag = min( $end_forward, $d );
$value_to_add_forward = 1 - $value_to_add_forward;
Method diff
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function diff( $from_lines, $to_lines ) {
// Diff and store locally
$this->diffInternal( $from_lines, $to_lines );
// Merge edits when possible
Method find_middle_snake
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function find_middle_snake( $bottoml1, $topl1, $bottoml2, $topl2, &$V, &$snake ) {
Method lcs_rec
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function lcs_rec( $bottoml1, $topl1, $bottoml2, $topl2, &$V, &$snake ) {
Function lcs_rec
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function lcs_rec( $bottoml1, $topl1, $bottoml2, $topl2, &$V, &$snake ) {
// check that both sequences are non-empty
if ( $bottoml1 > $topl1 || $bottoml2 > $topl2 ) {
return 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"