File importDump.php
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Import XML dump files into the current wiki.
*
* Copyright © 2005 Brooke Vibber <bvibber@wikimedia.org>
Method importFromHandle
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function importFromHandle( $handle ) {
$this->startTime = microtime( true );
$user = User::newSystemUser( User::MAINTENANCE_SCRIPT_USER, [ 'steal' => true ] );
Method __construct
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
$gz = in_array( 'compress.zlib', stream_get_wrappers() )
? 'ok'
: '(disabled; requires PHP zlib module)';
Function importFromHandle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function importFromHandle( $handle ) {
$this->startTime = microtime( true );
$user = User::newSystemUser( User::MAINTENANCE_SCRIPT_USER, [ 'steal' => true ] );
- 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 showReport
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function showReport() {
if ( !$this->mQuiet ) {
$delta = microtime( true ) - $this->startTime;
if ( $delta ) {
$rate = sprintf( "%.2f", $this->pageCount / $delta );
- 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 execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
if ( $this->getServiceContainer()->getReadOnlyMode()->isReadOnly() ) {
$this->fatalError( "Wiki is in read-only mode; you'll need to disable it for import to work." );
}
- 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"