File MediaWikiEntryPoint.php
has 623 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
MediaWikiEntryPoint
has 63 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class MediaWikiEntryPoint {
use ProtectedHookAccessorTrait;
private IContextSource $context;
private Config $config;
Function commitMainTransaction
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
protected function commitMainTransaction() {
$context = $this->context;
$config = $context->getConfig();
$request = $context->getRequest();
- 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 commitMainTransaction
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function commitMainTransaction() {
$context = $this->context;
$config = $context->getConfig();
$request = $context->getRequest();
Method triggerAsyncJobs
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function triggerAsyncJobs( $n, LoggerInterface $runJobsLogger ) {
// Do not send request if there are probably no jobs
$group = $this->getJobQueueGroupFactory()->makeJobQueueGroup();
if ( !$group->queuesHaveJobs( JobQueueGroup::TYPE_DEFAULT ) ) {
return true;
Method outputResponsePayload
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function outputResponsePayload( $content ) {
// Append any visible profiling data in a manner appropriate for the Content-Type
$this->startOutputBuffer();
try {
Profiler::instance()->logDataPageOutputOnly();
Function outputResponsePayload
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function outputResponsePayload( $content ) {
// Append any visible profiling data in a manner appropriate for the Content-Type
$this->startOutputBuffer();
try {
Profiler::instance()->logDataPageOutputOnly();
- 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 schedulePostSendJobs
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function schedulePostSendJobs() {
$jobRunRate = $this->config->get( MainConfigNames::JobRunRate );
if (
// Post-send job running disabled
$jobRunRate <= 0 ||
Function schedulePostSendJobs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function schedulePostSendJobs() {
$jobRunRate = $this->config->get( MainConfigNames::JobRunRate );
if (
// Post-send job running disabled
$jobRunRate <= 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"
Further reading
Method doPostOutputShutdown
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doPostOutputShutdown() {
// Record backend request timing
$timing = $this->context->getTiming();
$timing->mark( 'requestShutdown' );
Function triggerAsyncJobs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function triggerAsyncJobs( $n, LoggerInterface $runJobsLogger ) {
// Do not send request if there are probably no jobs
$group = $this->getJobQueueGroupFactory()->makeJobQueueGroup();
if ( !$group->queuesHaveJobs( JobQueueGroup::TYPE_DEFAULT ) ) {
return 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 flushOutputBuffer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function flushOutputBuffer(): void {
// NOTE: Use a for-loop, so we don't loop indefinitely in case
// we fail to delete a buffer. This will routinely happen for
// PHP's zlib.compression buffer.
// See https://www.php.net/manual/en/function.ob-end-flush.php#103387
- 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 shouldDoHttpRedirect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function shouldDoHttpRedirect() {
$request = $this->context->getRequest();
// Don't redirect if we're already on HTTPS
if ( $request->getProtocol() !== 'http' ) {
- 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"