src/TranslatorInterface/TranslateSpecialPage.php
File TranslateSpecialPage.php
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\TranslatorInterface;
Function setup
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
private function setup( ?string $parameters ): void {
$request = $this->getRequest();
$defaults = [
'language' => $this->getLanguage()->getCode(),
- 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 tabify
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function tabify( Skin $skin, array &$tabs ): bool {
$title = $skin->getTitle();
if ( !$title->isSpecialPage() ) {
return true;
}
Method messageSelector
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function messageSelector(): string {
$output = Html::openElement( 'div', [ 'class' => 'row tux-messagetable-header hide' ] );
$output .= Html::openElement( 'div', [ 'class' => 'nine columns' ] );
$output .= Html::openElement( 'ul', [ 'class' => 'row tux-message-selector' ] );
$userId = $this->getUser()->getId();
Method setup
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function setup( ?string $parameters ): void {
$request = $this->getRequest();
$defaults = [
'language' => $this->getLanguage()->getCode(),
Method tuxLanguageSelector
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function tuxLanguageSelector(): string {
if ( $this->options['language'] === $this->getConfig()->get( 'TranslateDocumentationLanguageCode' ) ) {
$targetLangName = $this->msg( 'translate-documentation-language' )->text();
$targetLanguage = $this->contentLanguage;
} else {
Function tabify
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function tabify( Skin $skin, array &$tabs ): bool {
$title = $skin->getTitle();
if ( !$title->isSpecialPage() ) {
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
Method execute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute( $parameters ) {
$out = $this->getOutput();
$out->addModuleStyles( [
'ext.translate.special.translate.styles',
'jquery.uls.grid',
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Language $contentLanguage,
LanguageFactory $languageFactory,
LanguageNameUtils $languageNameUtils,
HookRunner $hookRunner,
Config $config