Function compress
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function compress() {
if ( !function_exists( 'xdiff_string_rabdiff' ) ) {
throw new RuntimeException( "Need xdiff support to write DiffHistoryBlob\n" );
}
if ( isset( $this->mDiffs ) ) {
- 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 compress
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function compress() {
if ( !function_exists( 'xdiff_string_rabdiff' ) ) {
throw new RuntimeException( "Need xdiff support to write DiffHistoryBlob\n" );
}
if ( isset( $this->mDiffs ) ) {
Method patch
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function patch( $base, $diff ) {
if ( function_exists( 'xdiff_string_bpatch' ) ) {
return xdiff_string_bpatch( $base, $diff );
}
Function __sleep
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __sleep() {
$this->compress();
if ( $this->mItems === [] ) {
$info = false;
} else {
- 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 patch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function patch( $base, $diff ) {
if ( function_exists( 'xdiff_string_bpatch' ) ) {
return xdiff_string_bpatch( $base, $diff );
}
- 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 $out;
Function __wakeup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __wakeup() {
// addItem() doesn't work if mItems is partially filled from mDiffs
$this->mFrozen = true;
$info = HistoryBlobUtils::unserializeArray( gzinflate( $this->mCompressed ) );
$this->mCompressed = null;
- 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"