woothemes/woocommerce

View on GitHub
includes/legacy/class-wc-legacy-cart.php

Summary

Maintainability
D
2 days
Test Coverage

Function __get has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function &__get( $name ) {
        $value = '';

        switch ( $name ) {
            case 'dp' :
Severity: Minor
Found in includes/legacy/class-wc-legacy-cart.php - About 3 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 __get has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function &__get( $name ) {
        $value = '';

        switch ( $name ) {
            case 'dp' :
Severity: Major
Found in includes/legacy/class-wc-legacy-cart.php - About 3 hrs to fix

    WC_Legacy_Cart has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class WC_Legacy_Cart {
    
        /**
         * Array of defaults. Not used since 3.2.
         *
    Severity: Minor
    Found in includes/legacy/class-wc-legacy-cart.php - About 2 hrs to fix

      File class-wc-legacy-cart.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Legacy cart
       *
       * Legacy and deprecated functions are here to keep the WC_Cart class clean.
      Severity: Minor
      Found in includes/legacy/class-wc-legacy-cart.php - About 2 hrs to fix

        Function __set has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __set( $name, $value ) {
                switch ( $name ) {
                    case 'cart_contents_total' :
                        $this->set_cart_contents_total( $value );
                        break;
        Severity: Minor
        Found in includes/legacy/class-wc-legacy-cart.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 __set has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __set( $name, $value ) {
                switch ( $name ) {
                    case 'cart_contents_total' :
                        $this->set_cart_contents_total( $value );
                        break;
        Severity: Major
        Found in includes/legacy/class-wc-legacy-cart.php - About 2 hrs to fix

          Method __isset has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __isset( $name ) {
                  $legacy_keys = array_merge(
                      array(
                          'dp',
                          'prices_include_tax',
          Severity: Minor
          Found in includes/legacy/class-wc-legacy-cart.php - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status