File MergeHistory.php
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright © 2015 Geoffrey Mon <geofbot@gmail.com>
*
Method updateSourcePage
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateSourcePage( $status, $user, $reason ) {
$deleteSource = false;
$legacySourceTitle = $this->titleFactory->newFromPageIdentity( $this->source );
$legacyDestTitle = $this->titleFactory->newFromPageIdentity( $this->dest );
$sourceModel = $legacySourceTitle->getContentModel();
Method merge
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function merge( Authority $performer, $reason = '' ) {
$status = new Status();
// Check validity and permissions required for merge
$validCheck = $this->isValidMerge(); // Check this first to check for null pages
Method initTimestampLimits
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function initTimestampLimits() {
// Max timestamp should be min of destination page
$firstDestTimestamp = $this->dbw->newSelectQueryBuilder()
->select( 'MIN(rev_timestamp)' )
->from( 'revision' )
Method __construct
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
PageIdentity $source,
PageIdentity $dest,
?string $timestamp,
IConnectionProvider $dbProvider,
IContentHandlerFactory $contentHandlerFactory,
Function initTimestampLimits
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function initTimestampLimits() {
// Max timestamp should be min of destination page
$firstDestTimestamp = $this->dbw->newSelectQueryBuilder()
->select( 'MIN(rev_timestamp)' )
->from( 'revision' )
- 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 updateSourcePage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function updateSourcePage( $status, $user, $reason ) {
$deleteSource = false;
$legacySourceTitle = $this->titleFactory->newFromPageIdentity( $this->source );
$legacyDestTitle = $this->titleFactory->newFromPageIdentity( $this->dest );
$sourceModel = $legacySourceTitle->getContentModel();
- 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 merge
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function merge( Authority $performer, $reason = '' ) {
$status = new Status();
// Check validity and permissions required for merge
$validCheck = $this->isValidMerge(); // Check this first to check for null pages
- 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 isValidMerge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function isValidMerge() {
$status = new Status();
// If either article ID is 0, then revisions cannot be reliably selected
if ( $this->source->getId() === 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"