Showing 11,545 of 11,545 total issues
Function doUnlockByType
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function doUnlockByType( array $pathsByType ) {
$status = StatusValue::newGood();
$pathsByTypeByBucket = []; // (bucket => type => paths)
foreach ( $pathsByType as $type => $paths ) {
- 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 getDirectoryListInternal
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function getDirectoryListInternal( $container, $dir, array $params ) {
$dirs = [];
$prefix = rtrim( "$container/$dir", '/' ) . '/';
$prefixLen = strlen( $prefix );
foreach ( $this->files as $path => $data ) {
- 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 getFileStat
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
final public function getFileStat( array $params ) {
/** @noinspection PhpUnusedLocalVariableInspection */
$ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
$path = self::normalizeStoragePath( $params['src'] );
- 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 objectToArray
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function objectToArray( $object ) {
$vars = (array)$object;
$class = new \ReflectionClass( $object );
while ( $class ) {
foreach ( $class->getProperties() as $property ) {
- 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 loadFiles
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function loadFiles(): void {
# Allow media handling extensions adding MIME-types and MIME-info
if ( $this->initCallback ) {
call_user_func( $this->initCallback, $this );
}
- 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 assertValidUpsertSetArray
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
final public function assertValidUpsertSetArray(
array $set,
array $uniqueKey,
array $rows
) {
- 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 executeQuery
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
final protected function executeQuery( $sql, $fname, $flags ) {
$this->assertHasConnectionHandle();
$isPermWrite = false;
$isWrite = $sql->isWriteQuery();
- 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 reallyOpenConnection
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function reallyOpenConnection( $i, DatabaseDomain $domain, array $lbInfo ) {
if ( $this->disabled ) {
throw new DBAccessError();
}
- 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 18 arguments (exceeds 4 allowed). Consider refactoring. Open
ServiceOptions $options,
BlockRestrictionStore $blockRestrictionStore,
BlockPermissionCheckerFactory $blockPermissionCheckerFactory,
BlockUtils $blockUtils,
BlockActionInfo $blockActionInfo,
Method __construct
has 18 arguments (exceeds 4 allowed). Consider refactoring. Open
Article $article,
IContextSource $context,
Language $contentLanguage,
LanguageNameUtils $languageNameUtils,
LinkBatchFactory $linkBatchFactory,
Function getTemplate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function getTemplate( $templateName ) {
$templateKey = $templateName . '|' . $this->compileFlags;
// If a renderer has already been defined for this template, reuse it
if ( isset( $this->renderers[$templateKey] ) &&
- 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 onView
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function onView() {
$this->getOutput()->disable();
$request = $this->getRequest();
$response = $request->response();
$config = $this->context->getConfig();
- 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 getButtons
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function getButtons() {
$buttons = [];
if ( $this->mShowSubmit ) {
$value = $this->getSubmitText();
- 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 getLanguageNamesUncached
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function getLanguageNamesUncached( $inLanguage, $include ) {
// If passed an invalid language code to use, fallback to en
if ( $inLanguage !== self::AUTONYMS && !$this->isValidCode( $inLanguage ) ) {
$inLanguage = 'en';
}
- 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 simplifyFormDescriptor
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function simplifyFormDescriptor( array $descriptor ) {
foreach ( $descriptor as $name => &$params ) {
// Info fields are useless and can use complicated closure to provide
// text, skip all of them.
if ( ( isset( $params['type'] ) && $params['type'] === 'info' ) ||
- 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 firstChar
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function firstChar( $s ) {
$firstChar = mb_substr( $s, 0, 1 );
if ( $firstChar === '' || strlen( $firstChar ) != 3 ) {
return $firstChar;
- 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 loadItem
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function loadItem( $code, $key ) {
if ( isset( $this->loadedItems[$code][$key] ) ) {
return;
}
- 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 getHeaderVariant
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function getHeaderVariant() {
if ( $this->mHeaderVariant ) {
return $this->mHeaderVariant;
}
- 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 extractPageRecord
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private static function extractPageRecord( $externalData, $pageTitle ) {
// If there is a special case with only one returned page
// we can cheat, and only return
// the single page in the "pages" substructure.
if ( isset( $externalData['query']['pages'] ) ) {
- 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 rename
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function rename() {
$dbw = $this->dbProvider->getPrimaryDatabase();
$atomicId = $dbw->startAtomic( __METHOD__, $dbw::ATOMIC_CANCELABLE );
$this->hookRunner->onRenameUserPreRename( $this->uid, $this->old, $this->new );
- 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"