src/Statistics/ActiveLanguagesSpecialPage.php
File ActiveLanguagesSpecialPage.php
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\Statistics;
Method makeUserList
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function makeUserList( array $userStats ): void {
$day = 60 * 60 * 24;
// Scale of the activity colors, anything
// longer than this is just inactive
Method showLanguage
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function showLanguage( string $code, array $users, int $cachedAt ): void {
$out = $this->getOutput();
$lang = $this->getLanguage();
// Information to be used inside the foreach loop.
Method execute
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute( $par ): void {
$out = $this->getOutput();
$lang = $this->getLanguage();
$this->progressStatsTable = $this->progressStatsTableFactory->newFromContext( $this->getContext() );
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Config $config,
TranslatorActivity $translatorActivity,
LanguageNameUtils $langNameUtils,
ILoadBalancer $loadBalancer,
ConfigHelper $configHelper,
Method languageCloud
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function languageCloud(): array {
$cacheKey = $this->cache->makeKey( 'translate-supportedlanguages-language-cloud', 'v2' );
$data = $this->cache->get( $cacheKey );
if ( is_array( $data ) ) {
Function makeUserList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
private function makeUserList( array $userStats ): void {
$day = 60 * 60 * 24;
// Scale of the activity colors, anything
// longer than this is just inactive
- 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"