File HtmlOutputRendererHelper.php
has 503 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
Function getParserOutputInternal
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
private function getParserOutputInternal( ParserOptions $parserOptions ): Status {
// NOTE: ParsoidOutputAccess::getParserOutput() should be used for revisions
// that comes from the database. Either this revision is null to indicate
// the current revision or the revision must have an ID.
// If we have a revision and the ID is 0 or null, then it's a fake revision
- 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 getParserOutputInternal
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getParserOutputInternal( ParserOptions $parserOptions ): Status {
// NOTE: ParsoidOutputAccess::getParserOutput() should be used for revisions
// that comes from the database. Either this revision is null to indicate
// the current revision or the revision must have an ID.
// If we have a revision and the ID is 0 or null, then it's a fake revision
HtmlOutputRendererHelper
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class HtmlOutputRendererHelper implements HtmlOutputHelper {
use RestAuthorizeTrait;
use RestStatusTrait;
/**
Function getParserOutput
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function getParserOutput(): ParserOutput {
if ( !$this->parserOutput ) {
$parserOptions = ParserOptions::newFromAnon();
$parserOptions->setRenderReason( __METHOD__ );
- 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 getHtml
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getHtml(): ParserOutput {
if ( $this->processedParserOutput ) {
return $this->processedParserOutput;
}
Method getParserOutput
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getParserOutput(): ParserOutput {
if ( !$this->parserOutput ) {
$parserOptions = ParserOptions::newFromAnon();
$parserOptions->setRenderReason( __METHOD__ );
Method __construct
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
ParsoidOutputStash $parsoidOutputStash,
StatsdDataFactoryInterface $statsDataFactory,
ParsoidOutputAccess $parsoidOutputAccess,
ParserOutputAccess $parserOutputAccess,
PageLookup $pageLookup,
Function getHtml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getHtml(): ParserOutput {
if ( $this->processedParserOutput ) {
return $this->processedParserOutput;
}
- 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 stripParsoidSectionTags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function stripParsoidSectionTags( Element $elt ): void {
$n = $elt->firstChild;
while ( $n ) {
$next = $n->nextSibling;
if ( $n instanceof Element ) {
- 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"