ManifoldTextDiffer
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ManifoldTextDiffer implements TextDiffer {
/** @var MessageLocalizer */
private $localizer;
/** @var Language|null */
private $contentLanguage;
Function getDiffers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function getDiffers() {
if ( $this->differs === null ) {
$differs = [];
if ( $this->diffEngine === null ) {
$differNames = [ 'external', 'wikidiff2', 'php' ];
- 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 maybeCreateDiffer
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function maybeCreateDiffer( $engine, &$failureReason ) {
switch ( $engine ) {
case 'external':
if ( is_string( $this->externalPath ) ) {
if ( is_executable( $this->externalPath ) ) {
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageLocalizer $localizer,
?Language $contentLanguage,
$diffEngine,
$externalPath,
$wikidiff2Options
Function maybeCreateDiffer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function maybeCreateDiffer( $engine, &$failureReason ) {
switch ( $engine ) {
case 'external':
if ( is_string( $this->externalPath ) ) {
if ( is_executable( $this->externalPath ) ) {
- 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 new PhpTextDiffer(
$this->contentLanguage
);
Function getDiffersByFormat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getDiffersByFormat() {
if ( $this->differsByFormat === null ) {
$differs = [];
foreach ( $this->getDiffers() as $differ ) {
foreach ( $differ->getFormats() as $format ) {
- 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"