File ParserOutputAccess.php
has 409 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Method getParserOutput
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getParserOutput(
PageRecord $page,
ParserOptions $parserOptions,
?RevisionRecord $revision = null,
int $options = 0
Function getParserOutput
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getParserOutput(
PageRecord $page,
ParserOptions $parserOptions,
?RevisionRecord $revision = null,
int $options = 0
- 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 newPoolWorkArticleView
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function newPoolWorkArticleView(
PageRecord $page,
ParserOptions $parserOptions,
RevisionRecord $revision,
int $options
Method renderRevision
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function renderRevision(
PageRecord $page,
ParserOptions $parserOptions,
RevisionRecord $revision,
int $options,
Method getCachedParserOutput
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCachedParserOutput(
PageRecord $page,
ParserOptions $parserOptions,
?RevisionRecord $revision = null,
int $options = 0
Function renderRevision
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function renderRevision(
PageRecord $page,
ParserOptions $parserOptions,
RevisionRecord $revision,
int $options,
- 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 getCachedParserOutput
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getCachedParserOutput(
PageRecord $page,
ParserOptions $parserOptions,
?RevisionRecord $revision = null,
int $options = 0
- 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 9 arguments (exceeds 4 allowed). Consider refactoring. Open
ParserCacheFactory $parserCacheFactory,
RevisionLookup $revisionLookup,
RevisionRenderer $revisionRenderer,
StatsFactory $statsFactory,
ILBFactory $lbFactory,
Method renderRevision
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
PageRecord $page,
ParserOptions $parserOptions,
RevisionRecord $revision,
int $options,
?ParserOutput $previousOutput = null
Function shouldUseCache
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function shouldUseCache(
PageRecord $page,
?RevisionRecord $rev
) {
if ( $rev && !$rev->getId() ) {
- 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 checkPreconditions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function checkPreconditions(
PageRecord $page,
?RevisionRecord $revision = null,
int $options = 0
): ?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
Avoid too many return
statements within this method. Open
return self::CACHE_SECONDARY;