File DeletePage.php
has 565 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace MediaWiki\Page;
use BadMethodCallException;
Method deleteInternal
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteInternal(
WikiPage $page,
string $pageRole,
string $reason,
?string $webRequestId = null
Method archiveRevisions
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function archiveRevisions( WikiPage $page, int $id ): bool {
// Given the lock above, we can be confident in the title and page ID values
$namespace = $page->getTitle()->getNamespace();
$dbKey = $page->getTitle()->getDBkey();
Function deleteInternal
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function deleteInternal(
WikiPage $page,
string $pageRole,
string $reason,
?string $webRequestId = 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"
Further reading
DeletePage
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class DeletePage {
/**
* @internal For use by PageCommandFactory
*/
public const CONSTRUCTOR_OPTIONS = [
Method __construct
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
HookContainer $hookContainer,
RevisionStore $revisionStore,
LBFactory $lbFactory,
JobQueueGroup $jobQueueGroup,
CommentStore $commentStore,
Method doDeleteUpdates
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function doDeleteUpdates( WikiPage $page, RevisionRecord $revRecord ): void {
try {
$countable = $page->isCountable();
} catch ( TimeoutException $e ) {
throw $e;
Function runPreDeleteHooks
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function runPreDeleteHooks( WikiPage $page, string &$reason ): Status {
$status = Status::newGood();
$legacyDeleter = $this->userFactory->newFromAuthority( $this->deleter );
if ( !$this->hookRunner->onArticleDelete(
- 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 archiveRevisions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function archiveRevisions( WikiPage $page, int $id ): bool {
// Given the lock above, we can be confident in the title and page ID values
$namespace = $page->getTitle()->getNamespace();
$dbKey = $page->getTitle()->getDBkey();
- 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 deleteUnsafe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function deleteUnsafe( string $reason ): Status {
$this->setDeletionAttempted();
$origReason = $reason;
$hookStatus = $this->runPreDeleteHooks( $this->page, $reason );
if ( !$hookStatus->isGood() ) {
- 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"