vindi/vindi-woocommerce

View on GitHub

Showing 2,474 of 2,474 total issues

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 4 and the first side effect is on line 17.
Open

<?php
Severity: Minor
Found in src/i18n/Languages.php by phpcodesniffer

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 14 and the first side effect is on line 8.
Open

<?php

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 9 and the first side effect is on line 6.
Open

<?php

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 18 and the first side effect is on line 6.
Open

<?php

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 20 and the first side effect is on line 8.
Open

<?php

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 10 and the first side effect is on line 6.
Open

<?php

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 9 and the first side effect is on line 6.
Open

<?php

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 10 and the first side effect is on line 6.
Open

<?php

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 24 and the first side effect is on line 11.
Open

<?php
Severity: Minor
Found in src/utils/PaymentGateway.php by phpcodesniffer

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 10 and the first side effect is on line 19.
Open

<?php

Function order_fully_refunded has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function order_fully_refunded($order)
    {
        if (!is_object($order)) {
            $order = wc_get_order($order);
        }
Severity: Minor
Found in src/utils/SubscriptionStatusHandler.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

Function build_sign_up_fee_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function build_sign_up_fee_item($order_items)
    {
        foreach ($order_items as $order_item) {
            if (!is_object($order_item) || !method_exists($order_item, 'get_product')) {
                continue;
Severity: Minor
Found in src/utils/PaymentProcessor.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

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

Function check_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function check_response($response)
    {
        if (isset($response['errors']) && !empty($response['errors'])) {
            foreach ($response['errors'] as $error) {
                $message = $this->get_error_message($error);
Severity: Minor
Found in src/services/Api.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

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

  public function process_refund($order_id, $amount = null, $reason = '') {
    $order_id = filter_var($order_id, FILTER_SANITIZE_NUMBER_INT);
    $amount = filter_var($amount, FILTER_SANITIZE_NUMBER_FLOAT);
    $reason = sanitize_text_field($reason);
    $order = wc_get_order($order_id);
Severity: Minor
Found in src/utils/PaymentGateway.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_plan_from_order_item has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_plan_from_order_item($order_item)
    {
        $product = $order_item->get_product();

        if (isset($order_item['variation_id']) && $order_item['variation_id'] != 0) {
Severity: Minor
Found in src/utils/PaymentProcessor.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 build_product_items_for_subscription has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function build_product_items_for_subscription($order_item)
    {
        $plan_cycles = $this->get_cycle_from_product_type($order_item);
        $product_item = array(
            'product_id' => $order_item['vindi_id'],
Severity: Minor
Found in src/utils/PaymentProcessor.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 build_shipping_item has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function build_shipping_item($order_items)
    {
        $shipping_item = [];
        $shipping_method = $this->order->get_shipping_method();
        $get_total_shipping = $this->order->get_shipping_total();
Severity: Minor
Found in src/utils/PaymentProcessor.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_product has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_product($order_item)
    {

        $product = $order_item->get_product();
        $product_id = $order_item->get_id();
Severity: Minor
Found in src/utils/PaymentProcessor.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 order_canceled has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function order_canceled($order)
    {
        if (!is_object($order)) {
            $order = wc_get_order($order);
        }
Severity: Minor
Found in src/utils/SubscriptionStatusHandler.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

Severity
Category
Status
Source
Language