vindi/vindi-woocommerce

View on GitHub

Showing 2,474 of 2,474 total issues

File PaymentProcessor.php has 949 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace VindiPaymentGateways;

use DateTime;
Severity: Major
Found in src/utils/PaymentProcessor.php - About 2 days to fix

    VindiPaymentProcessor has 62 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class VindiPaymentProcessor
    {
        /**
         * Order type is invalid.
         */
    Severity: Major
    Found in src/utils/PaymentProcessor.php - About 1 day to fix

      Method create has 155 lines of code (exceeds 25 allowed). Consider refactoring.
      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) {
      Severity: Major
      Found in src/controllers/PlansController.php - About 6 hrs to fix

        File Webhooks.php has 374 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace VindiPaymentGateways;
        
        use WC_Subscriptions_Manager;
        Severity: Minor
        Found in src/services/Webhooks.php - About 5 hrs to fix

          Method update has 120 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function update($post_id)
            {
              $product = wc_get_product($post_id);
          
              // Check if the post is of the signature type
          Severity: Major
          Found in src/controllers/PlansController.php - About 4 hrs to fix

            Function create has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
            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) {
            Severity: Minor
            Found in src/controllers/PlansController.php - About 4 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

            File PlansController.php has 349 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace VindiPaymentGateways;
            
            /**
            Severity: Minor
            Found in src/controllers/PlansController.php - About 4 hrs to fix

              VindiRoutes has 32 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class VindiRoutes
              {
              
                /**
                 * @var VindiSettings
              Severity: Minor
              Found in src/routes/RoutesApi.php - About 4 hrs to fix

                File RoutesApi.php has 328 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace VindiPaymentGateways;
                
                class VindiRoutes
                Severity: Minor
                Found in src/routes/RoutesApi.php - About 3 hrs to fix

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

                  The class PlansController has an overall complexity of 70 which is very high. The configured complexity threshold is 50.
                  Open

                  class PlansController
                  {
                    /**
                     * @var array
                     */
                  Severity: Minor
                  Found in src/controllers/PlansController.php by phpmd

                  The class CustomerController has an overall complexity of 53 which is very high. The configured complexity threshold is 50.
                  Open

                  class CustomerController
                  {
                  
                    /**
                     * @var VindiSettings

                  The class VindiRoutes has 23 public methods. Consider refactoring VindiRoutes to keep number of public methods under 10.
                  Open

                  class VindiRoutes
                  {
                  
                    /**
                     * @var VindiSettings
                  Severity: Minor
                  Found in src/routes/RoutesApi.php by phpmd

                  TooManyPublicMethods

                  Since: 0.1

                  A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                  By default it ignores methods starting with 'get' or 'set'.

                  Example

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

                  The class VindiWebhooks has an overall complexity of 74 which is very high. The configured complexity threshold is 50.
                  Open

                  class VindiWebhooks
                  {
                    /**
                     * @var VindiSettings
                     */
                  Severity: Minor
                  Found in src/services/Webhooks.php by phpmd

                  The class VindiRoutes has an overall complexity of 77 which is very high. The configured complexity threshold is 50.
                  Open

                  class VindiRoutes
                  {
                  
                    /**
                     * @var VindiSettings
                  Severity: Minor
                  Found in src/routes/RoutesApi.php by phpmd

                  The class VindiPaymentProcessor has 45 non-getter- and setter-methods. Consider refactoring VindiPaymentProcessor to keep number of methods under 25.
                  Open

                  class VindiPaymentProcessor
                  {
                      /**
                       * Order type is invalid.
                       */
                  Severity: Minor
                  Found in src/utils/PaymentProcessor.php by phpmd

                  TooManyMethods

                  Since: 0.1

                  A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                  By default it ignores methods starting with 'get' or 'set'.

                  The default was changed from 10 to 25 in PHPMD 2.3.

                  Example

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

                  The class VindiPaymentProcessor has an overall complexity of 234 which is very high. The configured complexity threshold is 50.
                  Open

                  class VindiPaymentProcessor
                  {
                      /**
                       * Order type is invalid.
                       */
                  Severity: Minor
                  Found in src/utils/PaymentProcessor.php by phpmd

                  Method update has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  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)) {
                  Severity: Major
                  Found in src/controllers/CustomerController.php - About 3 hrs to fix

                    Method process_order has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function process_order()
                        {
                            $this->check_trial_and_single_product();
                            $customer = $this->get_customer();
                            $order_items = $this->order->get_items();
                    Severity: Major
                    Found in src/utils/PaymentProcessor.php - About 3 hrs to fix

                      VindiWebhooks has 26 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class VindiWebhooks
                      {
                        /**
                         * @var VindiSettings
                         */
                      Severity: Minor
                      Found in src/services/Webhooks.php - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language