vindi/vindi-woocommerce

View on GitHub
src/utils/SubscriptionStatusHandler.php

Summary

Maintainability
A
1 hr
Test Coverage

Showing 11 of 11 total issues

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

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

Function filter_pre_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

public function filter_pre_status($wc_subscription, $new_status, $old_status)
{
switch ($new_status) {
case 'on-hold':
$this->suspend_status($wc_subscription);
Severity: Minor
Found in src/utils/SubscriptionStatusHandler.php - About 25 mins to fix

Avoid unused local variables such as '$item'.
Open

foreach ($vindi_order as $key => $item) {

The property $vindi_settings is not named in camelCase.
Open

class VindiSubscriptionStatusHandler
{
/**
* @var VindiSettings
*/

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

), array('a' => array('href' => true))));

Line exceeds 120 characters; contains 127 characters
Open

if (wcs_get_objects_property($order, 'id') == $latest_order && $subscription->can_be_updated_to('cancelled')) {

Line exceeds 120 characters; contains 126 characters
Open

sprintf('<a href="%s">', esc_url(wcs_get_edit_post_link(wcs_get_objects_property($order, 'id')))),

Line exceeds 120 characters; contains 152 characters
Open

$subscriptions = wcs_get_subscriptions_for_order(wcs_get_objects_property($order, 'id'), array('order_type' => array('parent', 'renewal')));

Closing parenthesis of a multi-line function call must be on a line by itself
Open

), array('a' => array('href' => true))));

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

), array('a' => array('href' => true))));

There are no issues that match your filters.

Category
Status