wikimedia/mediawiki-core

View on GitHub
includes/parser/ParserOutput.php

Summary

Maintainability
F
1 wk
Test Coverage

File ParserOutput.php has 1328 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
Severity: Major
Found in includes/parser/ParserOutput.php - About 3 days to fix

    ParserOutput has 143 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ParserOutput extends CacheTime implements ContentMetadataCollector {
        use GhostFieldAccessTrait;
        use JsonUnserializableTrait;
        // This is used to break cyclic dependencies and allow a measure
        // of compatibility when new methods are added to ContentMetadataCollector
    Severity: Major
    Found in includes/parser/ParserOutput.php - About 2 days to fix

      Function collectMetadata has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

          public function collectMetadata( ContentMetadataCollector $metadata ): void {
              // Uniform handling of all boolean flags: they are OR'ed together.
              $flags = array_keys(
                  $this->mFlags + array_flip( ParserOutputFlags::cases() )
              );
      Severity: Minor
      Found in includes/parser/ParserOutput.php - About 7 hrs to fix

      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 collectMetadata has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function collectMetadata( ContentMetadataCollector $metadata ): void {
              // Uniform handling of all boolean flags: they are OR'ed together.
              $flags = array_keys(
                  $this->mFlags + array_flip( ParserOutputFlags::cases() )
              );
      Severity: Major
      Found in includes/parser/ParserOutput.php - About 3 hrs to fix

        Function mergeMapStrategy has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function mergeMapStrategy( array $a, array $b ): array {
                foreach ( $b as $key => $bValue ) {
                    if ( !array_key_exists( $key, $a ) ) {
                        $a[$key] = $bValue;
                    } elseif (
        Severity: Minor
        Found in includes/parser/ParserOutput.php - About 2 hrs to fix

        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 toJsonArray has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function toJsonArray(): array {
                // WARNING: When changing how this class is serialized, follow the instructions
                // at <https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility>!
        
                $data = [
        Severity: Major
        Found in includes/parser/ParserOutput.php - About 2 hrs to fix

          Method initFromJson has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function initFromJson( JsonUnserializer $unserializer, array $jsonData ): void {
                  parent::initFromJson( $unserializer, $jsonData );
          
                  // WARNING: When changing how this class is serialized, follow the instructions
                  // at <https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility>!
          Severity: Major
          Found in includes/parser/ParserOutput.php - About 2 hrs to fix

            Method mergeInternalMetaDataFrom has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function mergeInternalMetaDataFrom( ParserOutput $source ): void {
                    $this->mWarnings = self::mergeMap( $this->mWarnings, $source->mWarnings ); // don't use getter
                    $this->mTimestamp = $this->useMaxValue( $this->mTimestamp, $source->getRevisionTimestamp() );
                    if ( $source->hasCacheTime() ) {
                        $sourceCacheTime = $source->getCacheTime();
            Severity: Major
            Found in includes/parser/ParserOutput.php - About 2 hrs to fix

              Function mergeInternalMetaDataFrom has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function mergeInternalMetaDataFrom( ParserOutput $source ): void {
                      $this->mWarnings = self::mergeMap( $this->mWarnings, $source->mWarnings ); // don't use getter
                      $this->mTimestamp = $this->useMaxValue( $this->mTimestamp, $source->getRevisionTimestamp() );
                      if ( $source->hasCacheTime() ) {
                          $sourceCacheTime = $source->getCacheTime();
              Severity: Minor
              Found in includes/parser/ParserOutput.php - About 1 hr to fix

              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 mergeHtmlMetaDataFrom has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function mergeHtmlMetaDataFrom( ParserOutput $source ): void {
                      // HTML and HTTP
                      $this->mHeadItems = self::mergeMixedList( $this->mHeadItems, $source->getHeadItems() );
                      $this->addModules( $source->getModules() );
                      $this->addModuleStyles( $source->getModuleStyles() );
              Severity: Minor
              Found in includes/parser/ParserOutput.php - About 1 hr to fix

                Method mergeMapStrategy has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static function mergeMapStrategy( array $a, array $b ): array {
                        foreach ( $b as $key => $bValue ) {
                            if ( !array_key_exists( $key, $a ) ) {
                                $a[$key] = $bValue;
                            } elseif (
                Severity: Minor
                Found in includes/parser/ParserOutput.php - About 1 hr to fix

                  Function setOutputFlag has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function setOutputFlag( string $name, bool $val = true ): void {
                          switch ( $name ) {
                              case ParserOutputFlags::NO_GALLERY:
                                  $this->setNoGallery( $val );
                                  break;
                  Severity: Minor
                  Found in includes/parser/ParserOutput.php - About 1 hr to fix

                  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 setOutputFlag has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function setOutputFlag( string $name, bool $val = true ): void {
                          switch ( $name ) {
                              case ParserOutputFlags::NO_GALLERY:
                                  $this->setNoGallery( $val );
                                  break;
                  Severity: Minor
                  Found in includes/parser/ParserOutput.php - About 1 hr to fix

                    Function mergeHtmlMetaDataFrom has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function mergeHtmlMetaDataFrom( ParserOutput $source ): void {
                            // HTML and HTTP
                            $this->mHeadItems = self::mergeMixedList( $this->mHeadItems, $source->getHeadItems() );
                            $this->addModules( $source->getModules() );
                            $this->addModuleStyles( $source->getModuleStyles() );
                    Severity: Minor
                    Found in includes/parser/ParserOutput.php - About 55 mins to fix

                    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 appendOutputStrings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function appendOutputStrings( string $name, array $value ): void {
                            switch ( $name ) {
                                case ParserOutputStringSets::MODULE:
                                    $this->addModules( $value );
                                    break;
                    Severity: Minor
                    Found in includes/parser/ParserOutput.php - About 55 mins to fix

                    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 setLimitReportData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function setLimitReportData( $key, $value ): void {
                            $this->mLimitReportData[$key] = $value;
                    
                            if ( is_array( $value ) ) {
                                if ( array_keys( $value ) === [ 0, 1 ]
                    Severity: Minor
                    Found in includes/parser/ParserOutput.php - About 45 mins to fix

                    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 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function __construct( $text = null, $languageLinks = [], $categoryLinks = [],
                            $unused = false, $titletext = ''
                    Severity: Minor
                    Found in includes/parser/ParserOutput.php - About 35 mins to fix

                      Function merge2D has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private static function merge2D( array $a, array $b ): array {
                              $values = [];
                              $keys = array_merge( array_keys( $a ), array_keys( $b ) );
                      
                              foreach ( $keys as $k ) {
                      Severity: Minor
                      Found in includes/parser/ParserOutput.php - About 35 mins to fix

                      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 detectAndDecodeBinary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private static function detectAndDecodeBinary( array $properties ) {
                              foreach ( $properties as $key => $value ) {
                                  if ( is_array( $value ) && isset( $value['_encoding_'] ) ) {
                                      if ( $value['_encoding_'] === 'base64' ) {
                                          $properties[$key] = base64_decode( $value['_data_'] );
                      Severity: Minor
                      Found in includes/parser/ParserOutput.php - About 35 mins to fix

                      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 initFromJson has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function initFromJson( JsonUnserializer $unserializer, array $jsonData ): void {
                              parent::initFromJson( $unserializer, $jsonData );
                      
                              // WARNING: When changing how this class is serialized, follow the instructions
                              // at <https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility>!
                      Severity: Minor
                      Found in includes/parser/ParserOutput.php - About 35 mins to fix

                      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 __wakeup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function __wakeup() {
                              // Backwards compatibility, pre 1.36
                              $priorAccessedOptions = $this->getGhostFieldValue( 'mAccessedOptions' );
                              if ( $priorAccessedOptions ) {
                                  $this->mParseUsedOptions = $priorAccessedOptions;
                      Severity: Minor
                      Found in includes/parser/ParserOutput.php - About 35 mins to fix

                      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 $this->getPreventClickjacking();
                      Severity: Major
                      Found in includes/parser/ParserOutput.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return isset( $this->mFlags[$name] );
                        Severity: Major
                        Found in includes/parser/ParserOutput.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return $this->getNewSection();
                          Severity: Major
                          Found in includes/parser/ParserOutput.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return $this->getHideNewSection();
                            Severity: Major
                            Found in includes/parser/ParserOutput.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $this->getExtraCSPStyleSrcs();
                              Severity: Major
                              Found in includes/parser/ParserOutput.php - About 30 mins to fix

                                Function detectAndEncodeBinary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private static function detectAndEncodeBinary( array $properties ) {
                                        foreach ( $properties as $key => $value ) {
                                            if ( is_string( $value ) ) {
                                                if ( !mb_detect_encoding( $value, 'UTF-8', true ) ) {
                                                    $properties[$key] = [
                                Severity: Minor
                                Found in includes/parser/ParserOutput.php - About 25 mins to fix

                                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

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    public function appendExtensionData(
                                        string $key,
                                        $value,
                                        string $strategy = self::MW_MERGE_STRATEGY_UNION
                                    ): void {
                                Severity: Major
                                Found in includes/parser/ParserOutput.php and 1 other location - About 4 hrs to fix
                                includes/parser/ParserOutput.php on lines 1225..1244

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 181.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    public function appendJsConfigVar(
                                        string $key,
                                        string $value,
                                        string $strategy = self::MW_MERGE_STRATEGY_UNION
                                    ): void {
                                Severity: Major
                                Found in includes/parser/ParserOutput.php and 1 other location - About 4 hrs to fix
                                includes/parser/ParserOutput.php on lines 1811..1830

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 181.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        foreach ( $this->mJsConfigVars as $key => $value ) {
                                            if ( is_array( $value ) && isset( $value[self::MW_MERGE_STRATEGY_KEY] ) ) {
                                                $strategy = $value[self::MW_MERGE_STRATEGY_KEY];
                                                foreach ( $value as $item => $ignore ) {
                                                    if ( $item !== self::MW_MERGE_STRATEGY_KEY ) {
                                Severity: Major
                                Found in includes/parser/ParserOutput.php and 1 other location - About 2 hrs to fix
                                includes/parser/ParserOutput.php on lines 2398..2418

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 137.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        foreach ( $this->mExtensionData as $key => $value ) {
                                            if ( is_array( $value ) && isset( $value[self::MW_MERGE_STRATEGY_KEY] ) ) {
                                                $strategy = $value[self::MW_MERGE_STRATEGY_KEY];
                                                foreach ( $value as $item => $ignore ) {
                                                    if ( $item !== self::MW_MERGE_STRATEGY_KEY ) {
                                Severity: Major
                                Found in includes/parser/ParserOutput.php and 1 other location - About 2 hrs to fix
                                includes/parser/ParserOutput.php on lines 2377..2397

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 137.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    public function __get( $name ) {
                                        if ( property_exists( get_called_class(), $name ) ) {
                                            // Direct access to a public property, deprecated.
                                            wfDeprecatedMsg( "ParserOutput::{$name} public read access deprecated", '1.38' );
                                            return $this->$name;
                                Severity: Major
                                Found in includes/parser/ParserOutput.php and 1 other location - About 1 hr to fix
                                includes/parser/CacheTime.php on lines 302..315

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 111.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    public function __set( $name, $value ) {
                                        if ( property_exists( get_called_class(), $name ) ) {
                                            // Direct access to a public property, deprecated.
                                            wfDeprecatedMsg( "ParserOutput::$name public write access deprecated", '1.38' );
                                            $this->$name = $value;
                                Severity: Minor
                                Found in includes/parser/ParserOutput.php and 1 other location - About 30 mins to fix
                                includes/parser/CacheTime.php on lines 317..327

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 90.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                There are no issues that match your filters.

                                Category
                                Status