File LanguageStatsSpecialPage.php
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Statistics;
Function execute
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $par ) {
$this->target = $this->getLanguage()->getCode();
$request = $this->getRequest();
$this->purge = $request->getVal( 'action' ) === 'purge';
- 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 execute
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $par ) {
$this->target = $this->getLanguage()->getCode();
$request = $this->getRequest();
$this->purge = $request->getVal( 'action' ) === 'purge';
Method makeGroupRow
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function makeGroupRow(
MessageGroup $group,
array $cache,
MessageGroup $parent = null,
int $depth = 0
Method addForm
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addForm(): void {
$formDescriptor = [
'language' => [
'type' => 'text',
'name' => 'language',
Method getTable
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getTable( array $stats ): string {
$table = $this->table;
$out = '';
// This avoids a database query per translatable page, which would be caused by
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
LinkBatchFactory $linkBatchFactory,
ProgressStatsTableFactory $progressStatsTableFactory,
LanguageNameUtils $languageNameUtils,
JobQueueGroup $jobQueueGroup,
MessageGroupReviewStore $groupReviewStore,
Function getTable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getTable( array $stats ): string {
$table = $this->table;
$out = '';
// This avoids a database query per translatable page, which would be caused by
- 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 makeGroupRow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function makeGroupRow(
MessageGroup $group,
array $cache,
MessageGroup $parent = null,
int $depth = 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"