wikimedia/mediawiki-core

View on GitHub
includes/libs/objectcache/MultiWriteBagOStuff.php

Summary

Maintainability
B
6 hrs
Test Coverage

Method get has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get( $key, $flags = 0 ) {
        $args = func_get_args();

        if ( $this->fieldHasFlags( $flags, self::READ_LATEST ) ) {
            // If the latest write was a delete(), we do NOT want to fallback
Severity: Minor
Found in includes/libs/objectcache/MultiWriteBagOStuff.php - About 1 hr to fix

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

        private function callKeyWriteMethodOnTierCaches(
            array $indexes,
            $method,
            $arg0Sig,
            $resSig,
    Severity: Minor
    Found in includes/libs/objectcache/MultiWriteBagOStuff.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 incrWithInit has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function incrWithInit( $key, $exptime, $step = 1, $init = null, $flags = 0 ) {
    Severity: Minor
    Found in includes/libs/objectcache/MultiWriteBagOStuff.php - About 35 mins to fix

      Method callKeyMethodOnTierCache has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function callKeyMethodOnTierCache( $index, $method, $arg0Sig, $rvSig, array $args ) {
      Severity: Minor
      Found in includes/libs/objectcache/MultiWriteBagOStuff.php - About 35 mins to fix

        Method callKeyWriteMethodOnTierCaches has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                array $indexes,
                $method,
                $arg0Sig,
                $resSig,
                array $args
        Severity: Minor
        Found in includes/libs/objectcache/MultiWriteBagOStuff.php - About 35 mins to fix

          Method merge has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
          Severity: Minor
          Found in includes/libs/objectcache/MultiWriteBagOStuff.php - About 35 mins to fix

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

                public function __construct( $params ) {
                    parent::__construct( $params );
            
                    if ( empty( $params['caches'] ) || !is_array( $params['caches'] ) ) {
                        throw new InvalidArgumentException(
            Severity: Minor
            Found in includes/libs/objectcache/MultiWriteBagOStuff.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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function get( $key, $flags = 0 ) {
                    $args = func_get_args();
            
                    if ( $this->fieldHasFlags( $flags, self::READ_LATEST ) ) {
                        // If the latest write was a delete(), we do NOT want to fallback
            Severity: Minor
            Found in includes/libs/objectcache/MultiWriteBagOStuff.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

            There are no issues that match your filters.

            Category
            Status