vindi/vindi-woocommerce

View on GitHub

Showing 2,474 of 2,474 total issues

The method update() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10.
Open

  function update($post_id)
  {
    $product = wc_get_product($post_id);

    // Check if the post is of the signature type
Severity: Minor
Found in src/controllers/PlansController.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method create() has a Cyclomatic Complexity of 23. The configured cyclomatic complexity threshold is 10.
Open

  function create($user_id, $order = null)
  {

    $customer = new WC_Customer($user_id);

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

save accesses the super-global variable $_POST.
Open

    public static function save($post_id, $post)
    {
        // Check the nonce (again).
        if (empty(VindiHelpers::sanitize_xss($_POST['woocommerce_meta_nonce'])) ||
            !wp_verify_nonce(VindiHelpers::sanitize_xss($_POST['woocommerce_meta_nonce']), 'woocommerce_save_data')) {
Severity: Minor
Found in src/includes/admin/CouponsMetaBox.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

save accesses the super-global variable $_POST.
Open

    public static function save($post_id, $post)
    {
        // Check the nonce (again).
        if (empty(VindiHelpers::sanitize_xss($_POST['woocommerce_meta_nonce'])) ||
            !wp_verify_nonce(VindiHelpers::sanitize_xss($_POST['woocommerce_meta_nonce']), 'woocommerce_save_data')) {
Severity: Minor
Found in src/includes/admin/CouponsMetaBox.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The method update() has a Cyclomatic Complexity of 26. The configured cyclomatic complexity threshold is 10.
Open

  function update($user_id, $order = null)
  {
    $vindi_customer_id = get_user_meta($user_id, 'vindi_customer_id', true);
    // Check meta Vindi ID
    if (empty($vindi_customer_id)) {

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method create() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Open

  function create($post_id, $post, $update, $recreated = false)
  {
        // Check if the post is a draft
        if (strpos(get_post_status($post_id), 'draft') !== false) {
          return;
Severity: Minor
Found in src/controllers/ProductController.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

save accesses the super-global variable $_POST.
Open

    public static function save($post_id, $post)
    {
        // Check the nonce (again).
        if (empty(VindiHelpers::sanitize_xss($_POST['woocommerce_meta_nonce'])) ||
            !wp_verify_nonce(VindiHelpers::sanitize_xss($_POST['woocommerce_meta_nonce']), 'woocommerce_save_data')) {
Severity: Minor
Found in src/includes/admin/CouponsMetaBox.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The method process_order() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Open

    public function process_order()
    {
        $this->check_trial_and_single_product();
        $customer = $this->get_customer();
        $order_items = $this->order->get_items();
Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

get_country_code accesses the super-global variable $_GET.
Open

  public function get_country_code()
  {
    if (isset($_GET['order_id'])) {
      $order = new WC_Order(filter_var($_GET['order_id'], FILTER_SANITIZE_NUMBER_INT));
      return $order->billing_country;
Severity: Minor
Found in src/utils/PaymentGateway.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_cc_payment_type accesses the super-global variable $_POST.
Open

    public function get_cc_payment_type($customer_id)
    {
        if ($this->gateway->verify_user_payment_profile()) {
            return false;
        }
Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_cc_payment_type accesses the super-global variable $_POST.
Open

    public function get_cc_payment_type($customer_id)
    {
        if ($this->gateway->verify_user_payment_profile()) {
            return false;
        }
Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_cc_payment_type accesses the super-global variable $_POST.
Open

    public function get_cc_payment_type($customer_id)
    {
        if ($this->gateway->verify_user_payment_profile()) {
            return false;
        }
Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

installments accesses the super-global variable $_POST.
Open

    protected function installments()
    {
        if (
            'credit_card' == $this->payment_method_code() &&
            isset($_POST['vindi_cc_installments'])
Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

installments accesses the super-global variable $_POST.
Open

    protected function installments()
    {
        if (
            'credit_card' == $this->payment_method_code() &&
            isset($_POST['vindi_cc_installments'])
Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_cc_payment_type accesses the super-global variable $_POST.
Open

    public function get_cc_payment_type($customer_id)
    {
        if ($this->gateway->verify_user_payment_profile()) {
            return false;
        }
Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_cc_payment_type accesses the super-global variable $_POST.
Open

    public function get_cc_payment_type($customer_id)
    {
        if ($this->gateway->verify_user_payment_profile()) {
            return false;
        }
Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The method get_cycle_from_product_type() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Open

    private function get_cycle_from_product_type($item)
    {
        $cycles = null;
        $product = is_object($item) && method_exists($item, 'get_product') ? $item->get_product() : false;

Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

get_country_code accesses the super-global variable $_GET.
Open

  public function get_country_code()
  {
    if (isset($_GET['order_id'])) {
      $order = new WC_Order(filter_var($_GET['order_id'], FILTER_SANITIZE_NUMBER_INT));
      return $order->billing_country;
Severity: Minor
Found in src/utils/PaymentGateway.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_cc_payment_type accesses the super-global variable $_POST.
Open

    public function get_cc_payment_type($customer_id)
    {
        if ($this->gateway->verify_user_payment_profile()) {
            return false;
        }
Severity: Minor
Found in src/utils/PaymentProcessor.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Only one argument is allowed per line in a multi-line function call
Open

      sprintf('subscriptions/%s%s', filter_var($subscription_id, FILTER_SANITIZE_NUMBER_INT), $query), 'DELETE');
Severity: Minor
Found in src/routes/RoutesApi.php by phpcodesniffer
Severity
Category
Status
Source
Language