File TextPassDumper.php
has 733 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* BackupDumper that postprocesses XML dumps from dumpBackup.php to add page text
*
* Copyright (C) 2005 Brooke Vibber <bvibber@wikimedia.org>
Function getText
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
protected function getText( $id, $model = null, $format = null, $expSize = null ) {
if ( !$this->isValidTextId( $id ) ) {
$msg = "Skipping bad text id " . $id . " of revision " . $this->thisRev;
$this->progress( $msg );
return '';
- 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 getText
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getText( $id, $model = null, $format = null, $expSize = null ) {
if ( !$this->isValidTextId( $id ) ) {
$msg = "Skipping bad text id " . $id . " of revision " . $this->thisRev;
$this->progress( $msg );
return '';
TextPassDumper
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class TextPassDumper extends BackupDumper {
/** @var BaseDump|null */
public $prefetch = null;
/** @var string */
private $thisPage;
Method readDump
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function readDump( $input ) {
$this->buffer = "";
$this->openElement = false;
$this->atStart = true;
$this->state = "";
Function startElement
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function startElement( $parser, $name, $attribs ) {
$this->checkpointJustWritten = false;
$this->clearOpenElement( null );
$this->lastName = $name;
- 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 showReport
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showReport() {
if ( !$this->prefetch ) {
parent::showReport();
return;
Function showReport
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function showReport() {
if ( !$this->prefetch ) {
parent::showReport();
return;
- 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 endElement
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function endElement( $parser, $name ) {
$this->checkpointJustWritten = false;
if ( $this->openElement ) {
$this->clearOpenElement( "" );
Method getTextSpawnedOnce
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getTextSpawnedOnce( $address ) {
if ( is_int( $address ) || intval( $address ) ) {
$address = SqlBlobStore::makeAddressFromTextId( (int)$address );
}
Method startElement
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function startElement( $parser, $name, $attribs ) {
$this->checkpointJustWritten = false;
$this->clearOpenElement( null );
$this->lastName = $name;
Function getTextSpawnedOnce
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getTextSpawnedOnce( $address ) {
if ( is_int( $address ) || intval( $address ) ) {
$address = SqlBlobStore::makeAddressFromTextId( (int)$address );
}
- 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 endElement
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function endElement( $parser, $name ) {
$this->checkpointJustWritten = false;
if ( $this->openElement ) {
$this->clearOpenElement( "" );
- 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 readDump
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function readDump( $input ) {
$this->buffer = "";
$this->openElement = false;
$this->atStart = true;
$this->state = "";
- 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 openSpawn
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function openSpawn() {
global $IP;
$wiki = WikiMap::getCurrentWikiId();
if ( count( $this->php ) == 2 ) {
Function characterData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function characterData( $parser, $data ) {
$this->clearOpenElement( null );
if ( $this->lastName == "id" ) {
if ( $this->state == "revision" ) {
$this->thisRev .= $data;
- 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 __construct
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( $args = null ) {
parent::__construct();
$this->addDescription( <<<TEXT
This script postprocesses XML dumps from dumpBackup.php to add
Method processOptions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function processOptions() {
parent::processOptions();
if ( $this->hasOption( 'buffersize' ) ) {
$this->bufferSize = max( intval( $this->getOption( 'buffersize' ) ), 4 * 1024 );
Method processFileOpt
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function processFileOpt( $opt ) {
$split = explode( ':', $opt, 2 );
$val = $split[0];
$param = '';
if ( count( $split ) === 2 ) {
Function processOptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function processOptions() {
parent::processOptions();
if ( $this->hasOption( 'buffersize' ) ) {
$this->bufferSize = max( intval( $this->getOption( 'buffersize' ) ), 4 * 1024 );
- 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 finalOptionCheck
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function finalOptionCheck() {
if ( ( $this->checkpointFiles && !$this->maxTimeAllowed )
|| ( $this->maxTimeAllowed && !$this->checkpointFiles )
) {
throw new RuntimeException( "Options checkpointfile and maxtime must be specified together.\n" );
- 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 characterData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function characterData( $parser, $data ) {
$this->clearOpenElement( null );
if ( $this->lastName == "id" ) {
if ( $this->state == "revision" ) {
$this->thisRev .= $data;
Function processFileOpt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function processFileOpt( $opt ) {
$split = explode( ':', $opt, 2 );
$val = $split[0];
$param = '';
if ( count( $split ) === 2 ) {
- 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 false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $normalized;
Avoid too many return
statements within this method. Open
return false;
Function rotateDb
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function rotateDb() {
// Cleaning up old connections
if ( isset( $this->lb ) ) {
$this->lb->closeAll( __METHOD__ );
unset( $this->lb );
- 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"