includes/legacy/class-wc-legacy-cart.php
Function __get
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
public function &__get( $name ) {
$value = '';
switch ( $name ) {
case 'dp' :
- 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 __get
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function &__get( $name ) {
$value = '';
switch ( $name ) {
case 'dp' :
WC_Legacy_Cart
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
abstract class WC_Legacy_Cart {
/**
* Array of defaults. Not used since 3.2.
*
File class-wc-legacy-cart.php
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Legacy cart
*
* Legacy and deprecated functions are here to keep the WC_Cart class clean.
Function __set
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
public function __set( $name, $value ) {
switch ( $name ) {
case 'cart_contents_total' :
$this->set_cart_contents_total( $value );
break;
- 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 __set
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __set( $name, $value ) {
switch ( $name ) {
case 'cart_contents_total' :
$this->set_cart_contents_total( $value );
break;
Method __isset
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __isset( $name ) {
$legacy_keys = array_merge(
array(
'dp',
'prices_include_tax',