File Text_Diff.php
has 456 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @brief XCL/PHP7 @gigamaster replace 'each' (deprecated) with foreach
*
* Text_Diff
Function _shiftBoundaries
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public function _shiftBoundaries( $lines, &$changed, $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 _diag
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function _diag( $xoff, $xlim, $yoff, $ylim, $nchunks ) {
$flip = false;
if ( $xlim - $xoff > $ylim - $yoff ) {
/* Things seems faster (I'm not sure I understand why) when the
- 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 diff
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function diff( $from_lines, $to_lines ) {
$n_from = count( $from_lines );
$n_to = count( $to_lines );
$this->xchanged = $this->ychanged = [];
- 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 diff
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function diff( $from_lines, $to_lines ) {
$n_from = count( $from_lines );
$n_to = count( $to_lines );
$this->xchanged = $this->ychanged = [];
Method _shiftBoundaries
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _shiftBoundaries( $lines, &$changed, $other_changed ) {
$i = 0;
$j = 0;
assert( count( $lines ) == count( $changed ) );
Method _diag
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _diag( $xoff, $xlim, $yoff, $ylim, $nchunks ) {
$flip = false;
if ( $xlim - $xoff > $ylim - $yoff ) {
/* Things seems faster (I'm not sure I understand why) when the
Function _compareseq
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function _compareseq( $xoff, $xlim, $yoff, $ylim ) {
/* Slide down the bottom initial diagonal. */
while ( $xoff < $xlim && $yoff < $ylim
&& $this->xv[ $xoff ] == $this->yv[ $yoff ] ) {
++ $xoff;
- 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 _compareseq
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _compareseq( $xoff, $xlim, $yoff, $ylim ) {
/* Slide down the bottom initial diagonal. */
while ( $xoff < $xlim && $yoff < $ylim
&& $this->xv[ $xoff ] == $this->yv[ $yoff ] ) {
++ $xoff;
Method _diag
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _diag( $xoff, $xlim, $yoff, $ylim, $nchunks ) {
Function _check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _check( $from_lines, $to_lines ) {
if ( serialize( $from_lines ) != serialize( $this->getOriginal() ) ) {
trigger_error( "Reconstructed original doesn't match", E_USER_ERROR );
}
if ( serialize( $to_lines ) != serialize( $this->getFinal() ) ) {
- 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 _lcsPos
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _lcsPos( $ypos ) {
$end = $this->lcs;
if ( 0 == $end || $ypos > $this->seq[ $end ] ) {
$this->seq[ ++ $this->lcs ] = $ypos;
$this->in_seq[ $ypos ] = 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"