File TranslatablePageMarker.php
has 408 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\PageTranslation;
Method markForTranslation
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function markForTranslation(
TranslatablePageMarkOperation $operation,
TranslatablePageSettings $pageSettings,
User $user
): int {
Function validateUnitNames
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function validateUnitNames(
TranslatablePage $page,
array $units,
bool $includePageDisplayTitle
): Status {
- 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 __construct
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
IConnectionProvider $dbProvider,
JobQueueGroup $jobQueueGroup,
LinkRenderer $linkRenderer,
MessageGroups $messageGroups,
MessageIndex $messageIndex,
Function prepareTranslationUnits
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function prepareTranslationUnits( TranslatablePage $page, ParserOutput $parserOutput ): array {
$highest = (int)$this->messageGroupMetadata->get( $page->getMessageGroupId(), 'maxid' );
$store = $this->translationUnitStoreFactory->getReader( $page->getPageIdentity() );
$storedUnits = $store->getUnits();
- 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 getMarkOperation
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMarkOperation(
PageRecord $page,
?int $revision,
bool $validateUnitTitle
): TranslatablePageMarkOperation {
Method handlePriorityLanguages
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handlePriorityLanguages(
TranslatablePage $page,
TranslatablePageSettings $pageSettings,
UserIdentity $user
): void {
Method validateUnitNames
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function validateUnitNames(
TranslatablePage $page,
array $units,
bool $includePageDisplayTitle
): Status {
Method prepareTranslationUnits
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function prepareTranslationUnits( TranslatablePage $page, ParserOutput $parserOutput ): array {
$highest = (int)$this->messageGroupMetadata->get( $page->getMessageGroupId(), 'maxid' );
$store = $this->translationUnitStoreFactory->getReader( $page->getPageIdentity() );
$storedUnits = $store->getUnits();
Function handlePriorityLanguages
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function handlePriorityLanguages(
TranslatablePage $page,
TranslatablePageSettings $pageSettings,
UserIdentity $user
): void {
- 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 markForTranslation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function markForTranslation(
TranslatablePageMarkOperation $operation,
TranslatablePageSettings $pageSettings,
User $user
): int {
- 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"