File LinkCache.php
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Page existence cache.
*
* This program is free software; you can redistribute it and/or modify
Method getGoodLinkRowInternal
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getGoodLinkRowInternal(
TitleValue $link,
callable $fetchCallback = null,
int $queryFlags = IDBAccessObject::READ_NORMAL
): array {
Method getCacheKey
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getCacheKey( $page, $passThrough = false ) {
if ( is_string( $page ) ) {
if ( $passThrough ) {
return $page;
} else {
Function getGoodLinkRowInternal
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function getGoodLinkRowInternal(
TitleValue $link,
callable $fetchCallback = null,
int $queryFlags = IDBAccessObject::READ_NORMAL
): array {
- 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 getGoodLinkFieldObj
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGoodLinkFieldObj( $page, string $field ) {
$key = $this->getCacheKey( $page );
if ( $key === null ) {
return null;
}
Function getCacheKey
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function getCacheKey( $page, $passThrough = false ) {
if ( is_string( $page ) ) {
if ( $passThrough ) {
return $page;
} else {
- 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 getGoodLinkRow
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGoodLinkRow(
int $ns,
string $dbkey,
callable $fetchCallback = null,
int $queryFlags = IDBAccessObject::READ_NORMAL
Function getGoodLinkRow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getGoodLinkRow(
int $ns,
string $dbkey,
callable $fetchCallback = null,
int $queryFlags = IDBAccessObject::READ_NORMAL
- 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
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return (int)$row->page_len;
Avoid too many return
statements within this method. Open
return $this->titleFormatter->getPrefixedDBkey( $page );
Avoid too many return
statements within this method. Open
return [ $callerShouldAddGoodLink, $row ?: null ];
Avoid too many return
statements within this method. Open
return (int)$row->page_latest;
Avoid too many return
statements within this method. Open
return !empty( $row->page_content_model )
? (string)$row->page_content_model
: null;
Avoid too many return
statements within this method. Open
return (int)$row->page_is_redirect;
Avoid too many return
statements within this method. Open
return !empty( $row->page_lang )
? (string)$row->page_lang
: null;