vindi/vindi-woocommerce

View on GitHub
src/controllers/PlansController.php

Summary

Maintainability
D
3 days
Test Coverage

Showing 327 of 327 total issues

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

    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

      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

        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

        Function update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        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 - About 2 hrs to fix

        Avoid too many return statements within this method.
        Open

        return $response;
        Severity: Major
        Found in src/controllers/PlansController.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

          return $response;
          Severity: Major
          Found in src/controllers/PlansController.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

            return array(
            'product' => $variations_products,
            'plan' => $variations_plans,
            );
            Severity: Major
            Found in src/controllers/PlansController.php - About 30 mins to fix

              The method update() has an NPath complexity of 84672. The configured NPath complexity threshold is 200.
              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

              The method create() has an NPath complexity of 1291438080. The configured NPath complexity threshold is 200.
              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 by phpmd

              The method update() has 160 lines of code. Current threshold is set to 100. Avoid really long methods.
              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

              The method create() has 204 lines of code. Current threshold is set to 100. Avoid really long methods.
              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 by phpmd

              The method create() has a Cyclomatic Complexity of 38. 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) {
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              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

              The method create has a boolean flag argument $recreated, which is a certain sign of a Single Responsibility Principle violation.
              Open

              function create($post_id, $post, $update, $recreated = false)
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid using static access to class 'VindiPaymentGateways\VindiConversions' in method 'create'.
              Open

              $trigger_day = VindiConversions::convertTriggerToDay(
              $product->get_meta('_subscription_trial_length'),
              $product->get_meta('_subscription_trial_period')
              );
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid using static access to class 'VindiPaymentGateways\VindiConversions' in method 'create'.
              Open

              $plan_interval = VindiConversions::convert_interval($interval_count, $interval_type);
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid using static access to class 'VindiPaymentGateways\VindiConversions' in method 'create'.
              Open

              $trigger_day = VindiConversions::convertTriggerToDay(
              $product->get_meta('_subscription_trial_length'),
              $product->get_meta('_subscription_trial_period')
              );
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              The method update uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

              } else {
              set_transient('vindi_product_message', 'error', 60);
              }
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              The method create uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

              } else {
              set_transient('vindi_product_message', 'error', 60);
              }
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid using static access to class 'VindiPaymentGateways\VindiConversions' in method 'update'.
              Open

              $trigger_day = VindiConversions::convertTriggerToDay(
              $product->get_meta('_subscription_trial_length'),
              $product->get_meta('_subscription_trial_period')
              );
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid using static access to class 'VindiPaymentGateways\VindiConversions' in method 'create'.
              Open

              $plan_interval = VindiConversions::convert_interval($interval_count, $interval_type);
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid using static access to class 'VindiPaymentGateways\VindiConversions' in method 'update'.
              Open

              $plan_interval = VindiConversions::convert_interval($interval_count, $interval_type);
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid using static access to class 'VindiPaymentGateways\VindiConversions' in method 'update'.
              Open

              $plan_interval = VindiConversions::convert_interval($interval_count, $interval_type);
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid using static access to class 'VindiPaymentGateways\VindiConversions' in method 'update'.
              Open

              $trigger_day = VindiConversions::convertTriggerToDay(
              $product->get_meta('_subscription_trial_length'),
              $product->get_meta('_subscription_trial_period')
              );
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid unused parameters such as '$post'.
              Open

              function create($post_id, $post, $update, $recreated = false)
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid unused private fields such as '$types'.
              Open

              private $types;
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Avoid unused parameters such as '$update'.
              Open

              function create($post_id, $post, $update, $recreated = false)
              Severity: Minor
              Found in src/controllers/PlansController.php by phpmd

              Visibility must be declared on method "__construct"
              Open

              function __construct(VindiSettings $vindi_settings)

              Visibility must be declared on method "create"
              Open

              function create($post_id, $post, $update, $recreated = false)

              Blank line found at start of control structure
              Open

              if ($product->get_type() == 'variable-subscription') {

              Blank line found at start of control structure
              Open

              if (empty($vindi_plan_id)) {

              Visibility must be declared on method "update"
              Open

              function update($post_id)

              Blank line found at start of control structure
              Open

              if ($product->get_type() == 'subscription') {

              Blank line found at start of control structure
              Open

              if ($product->get_type() == 'variable-subscription') {

              Blank line found at start of control structure
              Open

              if (empty($vindi_plan_id)) {

              Visibility must be declared on method "trash"
              Open

              function trash($post_id)

              Visibility must be declared on method "untrash"
              Open

              function untrash($post_id)

              Line exceeds 120 characters; contains 132 characters
              Open

              'billing_cycles' => ($product->get_meta('_subscription_length') == 0) ? null : $product->get_meta('_subscription_length'),

              Line exceeds 120 characters; contains 134 characters
              Open

              'billing_cycles' => ($product->get_meta('_subscription_length') == 0) ? null : $product->get_meta('_subscription_length'),

              Line exceeds 120 characters; contains 128 characters
              Open

              'billing_cycles' => ($product->get_meta('_subscription_length') == 0) ? null : $product->get_meta('_subscription_length'),

              Line exceeds 120 characters; contains 130 characters
              Open

              'billing_cycles' => ($product->get_meta('_subscription_length') == 0) ? null : $product->get_meta('_subscription_length'),

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              function create($post_id, $post, $update, $recreated = false)

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $interval_type = $variation_product->get_meta('_subscription_period');

              Multi-line function call not indented correctly; expected 22 spaces but found 20
              Open

              );

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              'interval' => $plan_interval['interval'],

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              ),

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              if ($product->get_type() == 'variable-subscription') {

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              }

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              return;

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $plan_interval = VindiConversions::convert_interval($interval_count, $interval_type);

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $trigger_day = VindiConversions::convertTriggerToDay(

              Multi-line function call not indented correctly; expected 26 spaces but found 22
              Open

              )

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              'billing_trigger_day' => $trigger_day,

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              'billing_cycles' => ($product->get_meta('_subscription_length') == 0) ? null : $product->get_meta('_subscription_length'),

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              private $routes;

              Line indented incorrectly; expected at least 4 spaces, found 2
              Open

              {

              Line indented incorrectly; expected at least 16 spaces, found 10
              Open

              $product->get_meta('_subscription_trial_length'),

              Line indented incorrectly; expected at least 22 spaces, found 14
              Open

              'product_id' => $createdProduct['id']

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              function __construct(VindiSettings $vindi_settings)

              Line indented incorrectly; expected at least 4 spaces, found 2
              Open

              {

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              }

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              }

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $product = wc_get_product($post_id);

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              $vindi_product_id = get_post_meta($post_id, 'vindi_product_id', true);

              Line indented incorrectly; expected at least 22 spaces, found 20
              Open

              );

              Line indented incorrectly; expected 12 spaces, found 6
              Open

              foreach ($variations as $variation) {

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $variation_product = wc_get_product($variation['variation_id']);

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              $product->get_meta('_subscription_trial_period')

              Multi-line function call not indented correctly; expected 26 spaces but found 22
              Open

              array(

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              'name' => VINDI_PREFIX_PLAN . $data['name'],

              Line indented incorrectly; expected at least 22 spaces, found 14
              Open

              'cycles' => $product->get_meta('_subscription_length'),

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              'plan_items' => array(

              Line indented incorrectly; expected at least 22 spaces, found 14
              Open

              'product_id' => $createdProduct['id']

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              add_action('wp_insert_post', array($this, 'create'), 10, 3);

              Line indented incorrectly; expected at least 12 spaces, found 10
              Open

              return;

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              $createdPlan = $this->routes->createPlan(array(

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              'interval_count' => $plan_interval['interval_count'],

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              'code' => 'WC-' . $data['id'],

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              ($product->get_meta('_subscription_length') == 0) ? array(

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $this->logger = $vindi_settings->logger;

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              add_action('wp_trash_post', array($this, 'trash'), 10, 1);

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              if (get_post_type($post_id) != 'product') {

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              $product->get_meta('_subscription_trial_length'),

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              );

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              ) : array(

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $this->routes = $vindi_settings->routes;

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              $this->routes->findProductById($vindi_product_id) :

              Multi-line function call not indented correctly; expected 26 spaces but found 24
              Open

              )

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              ));

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              private $types;

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              if (strpos(get_post_status($post_id), 'draft') !== false) {

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              $variations = $product->get_available_variations();

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              $variations_products = $variations_plans = [];

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              'billing_trigger_type' => 'beginning_of_period',

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $data = $product->get_data();

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              $product->get_meta('_subscription_trial_period')

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'code' => 'WC-' . $data['id'],

              Line indented incorrectly; expected at least 10 spaces, found 8
              Open

              ) : array(

              Line indented incorrectly; expected at least 12 spaces, found 4
              Open

              $response = array(

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $trigger_day = VindiConversions::convertTriggerToDay(

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              array(

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'name' => VINDI_PREFIX_PRODUCT . $data['name'],

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              )

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'plan' => $variations_plans,

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $interval_type = $product->get_meta('_subscription_period');

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              'status' => ($data['status'] == 'publish') ? 'active' : 'inactive',

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              }

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $interval_type = $product->get_meta('_subscription_period');

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $product = wc_get_product($post_id);

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              if ($product->get_type() == 'variable-subscription') {

              Line indented incorrectly; expected 16 spaces, found 8
              Open

              }

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              );

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              $product->get_meta('_subscription_trial_period')

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              array(

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              add_action('untrash_post', array($this, 'untrash'), 10, 1);

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $interval_count = $variation_product->get_meta('_subscription_period_interval');

              Line indented incorrectly; expected at least 16 spaces, found 10
              Open

              $product->get_meta('_subscription_trial_period')

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              )

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              $variations_plans[$variation['variation_id']] = $createdPlan;

              Line indented incorrectly; expected at least 16 spaces, found 6
              Open

              set_transient('vindi_product_message', 'created', 60);

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              'product' => $createdProduct,

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              }

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $interval_type = $variation_product->get_meta('_subscription_period');

              Line indented incorrectly; expected at least 22 spaces, found 14
              Open

              'price' => ($data['price']) ? $data['price'] : 0,

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              $product->get_meta('_subscription_trial_length'),

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              $vindi_product_id,

              Line indented incorrectly; expected at least 10 spaces, found 8
              Open

              'code' => 'WC-' . $data['id'],

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              return;

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $data = $variation_product->get_data();

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              $createdProduct = !empty($vindi_product_id) ?

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'plan' => $variations_plans,

              Line indented incorrectly; expected at least 16 spaces, found 6
              Open

              );

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'billing_trigger_type' => 'beginning_of_period',

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'billing_cycles' => ($product->get_meta('_subscription_length') == 0) ? null : $product->get_meta('_subscription_length'),

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              function update($post_id)

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $vindi_product_id = get_post_meta($variation['variation_id'], 'vindi_product_id', true);

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $plan_interval = VindiConversions::convert_interval($interval_count, $interval_type);

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              $this->routes->findProductById($vindi_product_id) :

              Multi-line function call not indented correctly; expected 16 spaces but found 14
              Open

              array(

              Line indented incorrectly; expected 12 spaces, found 10
              Open

              }

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              $vindi_product_id,

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'code' => 'WC-' . $data['id'],

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'status' => ($data['status'] == 'publish') ? 'active' : 'inactive',

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              )

              Line indented incorrectly; expected 24 spaces, found 22
              Open

              }

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              return array(

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'product' => $variations_products,

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $trigger_day = VindiConversions::convertTriggerToDay(

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'status' => ($data['status'] == 'publish') ? 'active' : 'inactive',

              Line indented incorrectly; expected at least 14 spaces, found 12
              Open

              update_post_meta($post_id, 'vindi_product_id', $createdProduct['id']);

              Line indented incorrectly; expected 12 spaces, found 6
              Open

              foreach ($variations as $variation) {

              Line indented incorrectly; expected 16 spaces, found 8
              Open

              if (empty($vindi_plan_id)) {

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              )

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'interval' => $plan_interval['interval'],

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $plan_interval = VindiConversions::convert_interval($interval_count, $interval_type);

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              $vindi_product_id = get_post_meta($post_id, 'vindi_product_id', true);

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              $product->get_meta('_subscription_trial_length'),

              Line indented incorrectly; expected at least 10 spaces, found 8
              Open

              'name' => VINDI_PREFIX_PRODUCT . $data['name'],

              Line indented incorrectly; expected at least 12 spaces, found 4
              Open

              $vindi_product_id = get_post_meta($post_id, 'vindi_product_id', true);

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'billing_trigger_day' => $trigger_day,

              Line indented incorrectly; expected at least 10 spaces, found 8
              Open

              )

              Line indented incorrectly; expected 12 spaces, found 4
              Open

              } else {

              Line indented incorrectly; expected 12 spaces, found 4
              Open

              }

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              'plan' => $createdPlan,

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              return $response;

              Line indented incorrectly; expected at least 4 spaces, found 2
              Open

              {

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              if ($product->get_type() == 'subscription') {

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              );

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              $variations_products[$variation['variation_id']] = $createdProduct;

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              );

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'name' => VINDI_PREFIX_PLAN . $data['name'],

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              array(

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              array(

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              return array(

              Line indented incorrectly; expected at least 8 spaces, found 6
              Open

              $product->get_meta('_subscription_trial_period')

              Line indented incorrectly; expected 12 spaces, found 10
              Open

              }

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              $createdPlan = $this->routes->createPlan(array(

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'interval' => $plan_interval['interval'],

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'plan_items' => array(

              Line indented incorrectly; expected 12 spaces, found 4
              Open

              if ($createdPlan && $createdProduct) {

              Line indented incorrectly; expected 12 spaces, found 6
              Open

              if (empty($vindi_plan_id)) {

              Line indented incorrectly; expected at least 20 spaces, found 10
              Open

              break;

              Line indented incorrectly; expected at least 16 spaces, found 10
              Open

              $product->get_meta('_subscription_trial_length'),

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              $variations_products[$variation['variation_id']] = $updatedProduct;

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'product' => $variations_products,

              Line indented incorrectly; expected at least 16 spaces, found 6
              Open

              );

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              array(

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              ));

              Line indented incorrectly; expected at least 16 spaces, found 6
              Open

              set_transient('vindi_product_message', 'error', 60);

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              $variations_products = $variations_plans = [];

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              $vindi_product_id,

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'invoice' => 'always',

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              $vindi_plan_id,

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'billing_trigger_type' => 'beginning_of_period',

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'status' => ($data['status'] == 'publish') ? 'active' : 'inactive',

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              }

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              $vindi_product_id,

              Line indented incorrectly; expected at least 16 spaces, found 14
              Open

              update_post_meta($post_id, 'vindi_plan_id', $createdPlan['id']);

              Line indented incorrectly; expected at least 12 spaces, found 10
              Open

              return;

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              return $this->create($post_id, '', '', true);

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $data = $variation_product->get_data();

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $interval_count = $variation_product->get_meta('_subscription_period_interval');

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              $updatedProduct = $this->routes->updateProduct(

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'code' => 'WC-' . $data['id'],

              Line indented incorrectly; expected 12 spaces, found 6
              Open

              }

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $data = $product->get_data();

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $trigger_day = VindiConversions::convertTriggerToDay(

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $interval_count = $product->get_meta('_subscription_period_interval');

              Multi-line function call not indented correctly; expected 16 spaces but found 14
              Open

              )

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              }

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $vindi_plan_id = get_post_meta($variation['variation_id'], 'vindi_plan_id', true);

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              $product->get_meta('_subscription_trial_length'),

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              $vindi_plan_id,

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              $updatedProduct = $this->routes->updateProduct(

              Line indented incorrectly; expected at least 8 spaces, found 6
              Open

              $product->get_meta('_subscription_trial_length'),

              Line indented incorrectly; expected at least 12 spaces, found 4
              Open

              $createdProduct = !empty($vindi_product_id) ?

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              ),

              Line indented incorrectly; expected 12 spaces, found 6
              Open

              }

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              $product->get_meta('_subscription_trial_period')

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'interval_count' => $plan_interval['interval_count'],

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'billing_trigger_day' => $trigger_day,

              Line indented incorrectly; expected at least 8 spaces, found 6
              Open

              $product->get_meta('_subscription_trial_length'),

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $plan_interval = VindiConversions::convert_interval($interval_count, $interval_type);

              Line indented incorrectly; expected at least 10 spaces, found 8
              Open

              ($product->get_meta('_subscription_length') == 0) ? array(

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              );

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              $vindi_plan_id = get_post_meta($post_id, 'vindi_plan_id', true);

              Line indented incorrectly; expected at least 22 spaces, found 14
              Open

              'schema_type' => 'flat',

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              $updatedPlan = $this->routes->updatePlan(

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'billing_cycles' => ($product->get_meta('_subscription_length') == 0) ? null : $product->get_meta('_subscription_length'),

              Line indented incorrectly; expected at least 8 spaces, found 6
              Open

              $product->get_meta('_subscription_trial_period')

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              );

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              $variations = $product->get_available_variations();

              Line indented incorrectly; expected at least 16 spaces, found 8
              Open

              $variation_product = wc_get_product($variation['variation_id']);

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              )

              Line indented incorrectly; expected 12 spaces, found 6
              Open

              }

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'interval_count' => $plan_interval['interval_count'],

              Line indented incorrectly; expected at least 20 spaces, found 10
              Open

              return $this->create($post_id, '', '', true);

              Line indented incorrectly; expected at least 16 spaces, found 10
              Open

              $product->get_meta('_subscription_trial_period')

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'pricing_schema' => array(

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              );

              Multi-line function call not indented correctly; expected 12 spaces but found 10
              Open

              array(

              Line indented incorrectly; expected at least 22 spaces, found 12
              Open

              'name' => VINDI_PREFIX_PLAN . $data['name'],

              Line indented incorrectly; expected at least 22 spaces, found 10
              Open

              )

              Line indented incorrectly; expected at least 22 spaces, found 8
              Open

              $variations_plans[$variation['variation_id']] = $updatedPlan;

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $interval_count = $product->get_meta('_subscription_period_interval');

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'name' => VINDI_PREFIX_PLAN . $data['name'],

              Line indented incorrectly; expected at least 14 spaces, found 6
              Open

              set_transient('vindi_product_message', 'updated', 60);

              Line indented incorrectly; expected at least 16 spaces, found 6
              Open

              set_transient('vindi_product_message', 'error', 60);

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              'plan' => $updatedPlan,

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $vindi_product_id = get_post_meta($product->id, 'vindi_product_id', true);

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $inactivatedProduct = $this->routes->updateProduct($vindi_product_id, array(

              Line indented incorrectly; expected at least 8 spaces, found 6
              Open

              'status' => 'inactive',

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              }

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              )

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'billing_trigger_day' => $trigger_day,

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              )

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              'product' => $updatedProduct,

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              );

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              }

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              ));

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'interval' => $plan_interval['interval'],

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              ));

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'plan' => $inactivatedPlan,

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'product' => $activatedProduct,

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              }

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              )

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              $vindi_plan_id = get_post_meta($post_id, 'vindi_plan_id', true);

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              function trash($post_id)

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              }

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              ));

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'plan' => $activatedPlan,

              Line indented incorrectly; expected 10 spaces, found 4
              Open

              if ($updatedPlan && $updatedProduct) {

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              return;

              Line indented incorrectly; expected at least 4 spaces, found 2
              Open

              {

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $product = wc_get_product($post_id);

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $activatedProduct = $this->routes->updateProduct($vindi_product_id, array(

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              ));

              Line indented incorrectly; expected at least 10 spaces, found 8
              Open

              'pricing_schema' => array(

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'status' => 'inactive',

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              }

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'interval_count' => $plan_interval['interval_count'],

              Line indented incorrectly; expected 12 spaces, found 4
              Open

              } else {

              Line indented incorrectly; expected at least 12 spaces, found 4
              Open

              $response = array(

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              return;

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              );

              Line indented incorrectly; expected at least 10 spaces, found 8
              Open

              'invoice' => 'always',

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'status' => 'active',

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              $vindi_plan_id,

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              return $response;

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              array(

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'billing_trigger_type' => 'beginning_of_period',

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $vindi_plan_id = get_post_meta($product->id, 'vindi_plan_id', true);

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $vindi_product_id = get_post_meta($product->id, 'vindi_product_id', true);

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              $activatedPlan = $this->routes->updatePlan($vindi_plan_id, array(

              Line indented incorrectly; expected 12 spaces, found 10
              Open

              }

              Line indented incorrectly; expected at least 4 spaces, found 2
              Open

              {

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              return array(

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              );

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              if (empty($vindi_product_id) || empty($vindi_plan_id)) {

              Line indented incorrectly; expected at least 10 spaces, found 6
              Open

              'product' => $inactivatedProduct,

              Line indented incorrectly; expected at least 10 spaces, found 8
              Open

              'status' => ($data['status'] == 'publish') ? 'active' : 'inactive',

              Line indented incorrectly; expected at least 12 spaces, found 4
              Open

              $updatedPlan = $this->routes->updatePlan(

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              array(

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'code' => 'WC-' . $data['id'],

              Multi-line function call not indented correctly; expected 8 spaces but found 6
              Open

              $vindi_plan_id,

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'billing_cycles' => ($product->get_meta('_subscription_length') == 0) ? null : $product->get_meta('_subscription_length'),

              Line indented incorrectly; expected at least 12 spaces, found 8
              Open

              'status' => ($data['status'] == 'publish') ? 'active' : 'inactive',

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              if (get_post_type($post_id) != 'product') {

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $product = wc_get_product($post_id);

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              function untrash($post_id)

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              if (get_post_type($post_id) != 'product') {

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              if (empty($vindi_product_id) || empty($vindi_plan_id)) {

              Line indented incorrectly; expected at least 10 spaces, found 8
              Open

              )

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              )

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              );

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              return array(

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              return;

              Line indented incorrectly; expected at least 8 spaces, found 4
              Open

              $vindi_plan_id = get_post_meta($product->id, 'vindi_plan_id', true);

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              );

              Line indented incorrectly; expected 12 spaces, found 4
              Open

              }

              Line indented incorrectly; expected 4 spaces, found 2
              Open

              }

              Line indented incorrectly; expected 8 spaces, found 4
              Open

              }

              Line indented incorrectly; expected at least 10 spaces, found 4
              Open

              $inactivatedPlan = $this->routes->updatePlan($vindi_plan_id, array(

              Line indented incorrectly; expected at least 12 spaces, found 6
              Open

              return;

              Line indented incorrectly; expected at least 8 spaces, found 6
              Open

              'status' => 'active',

              There are no issues that match your filters.

              Category
              Status