get_cc_payment_type accesses the super-global variable $_POST.
public function get_cc_payment_type($customer_id)
{
if ($this->gateway->verify_user_payment_profile()) {
return false;
}
installments accesses the super-global variable $_POST.
protected function installments()
{
if (
'credit_card' == $this->payment_method_code() &&
isset($_POST['vindi_cc_installments'])
get_cc_payment_type accesses the super-global variable $_POST.
public function get_cc_payment_type($customer_id)
{
if ($this->gateway->verify_user_payment_profile()) {
return false;
}
get_cc_payment_type accesses the super-global variable $_POST.
public function get_cc_payment_type($customer_id)
{
if ($this->gateway->verify_user_payment_profile()) {
return false;
}
get_cc_payment_type accesses the super-global variable $_POST.
public function get_cc_payment_type($customer_id)
{
if ($this->gateway->verify_user_payment_profile()) {
return false;
}
get_cc_payment_type accesses the super-global variable $_POST.
public function get_cc_payment_type($customer_id)
{
if ($this->gateway->verify_user_payment_profile()) {
return false;
}
installments accesses the super-global variable $_POST.
protected function installments()
{
if (
'credit_card' == $this->payment_method_code() &&
isset($_POST['vindi_cc_installments'])
get_cc_payment_type accesses the super-global variable $_POST.
public function get_cc_payment_type($customer_id)
{
if ($this->gateway->verify_user_payment_profile()) {
return false;
}
File PaymentProcessor.php
has 1056 lines of code (exceeds 250 allowed). Consider refactoring.
<?php
namespace VindiPaymentGateways;
use DateTime;
VindiPaymentProcessor
has 69 functions (exceeds 20 allowed). Consider refactoring.
class VindiPaymentProcessor
{
* Order type is invalid.
*/
The class VindiPaymentProcessor has 52 non-getter- and setter-methods. Consider refactoring VindiPaymentProcessor to keep number of methods under 25.
class VindiPaymentProcessor
{
* Order type is invalid.
*/
The class VindiPaymentProcessor has an overall complexity of 250 which is very high. The configured complexity threshold is 50.
class VindiPaymentProcessor
{
* Order type is invalid.
*/
Method process_order
has 71 lines of code (exceeds 25 allowed). Consider refactoring.
public function process_order()
{
$subscription_id = $this->order->get_meta('vindi_subscription_id');
$subscription_exists = $this->exist_subscription($subscription_id);
if ($subscription_exists) {
Function process_order
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
public function process_order()
{
$subscription_id = $this->order->get_meta('vindi_subscription_id');
$subscription_exists = $this->exist_subscription($subscription_id);
if ($subscription_exists) {
Function build_tax_item
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
protected function build_tax_item($order_items)
{
$total_tax = 0;
$taxItem = [];
Function order_has_trial_and_simple_product
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
public function order_has_trial_and_simple_product()
{
$has_trial = false;
$has_simple_product = false;
$order_items = $this->order->get_items();
Function get_cycle_from_product_type
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
private function get_cycle_from_product_type($item)
{
$cycles = null;
$product = is_object($item) && method_exists($item, 'get_product') ? $item->get_product() : false;
Function build_sign_up_fee_item
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
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;
Function build_shipping_item
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
protected function build_shipping_item($order_items)
{
$shipping_item = [];
$shipping_method = $this->order->get_shipping_method();
$get_total_shipping = $this->order->get_shipping_total();
Function build_product_items_for_subscription
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
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'],
Function get_product
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
protected function get_product($order_item)
{
$product = $order_item->get_product();
$product_id = $order_item->get_id();
Function get_plan_from_order_item
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
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) {
Avoid too many return
statements within this method.
return $cycles > 0 ? $cycles : null;
Function coupon_supports_product
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
protected function coupon_supports_product($order_item, $coupon)
{
$product_id = $order_item->get_product()->get_id();
$included_products = $coupon->get_product_ids();
$excluded_products = $coupon->get_excluded_product_ids();
The class VindiPaymentProcessor has 1608 lines of code. Current threshold is 1000. Avoid really long classes.
class VindiPaymentProcessor
{
* Order type is invalid.
*/
The method process_order() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
public function process_order()
{
$subscription_id = $this->order->get_meta('vindi_subscription_id');
$subscription_exists = $this->exist_subscription($subscription_id);
if ($subscription_exists) {
The method get_cycle_from_product_type() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
private function get_cycle_from_product_type($item)
{
$cycles = null;
$product = is_object($item) && method_exists($item, 'get_product') ? $item->get_product() : false;
The method abort has a boolean flag argument $throw_exception, which is a certain sign of a Single Responsibility Principle violation.
public function abort($message, $throw_exception = false)
The method add_additional_items uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$order_items[] = $this->build_product_from_order_item($order_type, $product);
}
The method order_has_trial_and_simple_product uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$has_simple_product = true;
if ($has_trial) {
return true;
}
The method build_product_from_order_item uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$order_items['price'] = (float) $order_items['subtotal'] / $order_items['qty'];
}
Avoid using static access to class 'VindiPaymentGateways\VindiHelpers' in method 'get_trial_matching_subscription_item'.
$subscription = VindiHelpers::get_matching_subscription($this->order, $order_item);
The method get_plan_from_order_item uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$vindi_plan = get_post_meta($product->get_id(), 'vindi_plan_id', true);
}
Avoid using static access to class 'VindiPaymentGateways\VindiHelpers' in method 'build_shipping_item'.
$wc_subscription = VindiHelpers::get_matching_subscription($this->order, $order_item);
The method get_product uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$vindi_product = $this->controllers->plans->create($product_id, '', '', true);
}
The method build_tax_item uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$total_tax += (float) ($order_item->get_total_tax());
}
Avoid using static access to class 'VindiPaymentGateways\VindiHelpers' in method 'get_trial_matching_subscription_item'.
$matching_item = VindiHelpers::get_matching_subscription_item($subscription, $order_item);
The method build_tax_item uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
!empty($order_item['type']) && $total_tax += ($order_item['type'] === 'shipping' ? (float) $this->order->get_shipping_tax() : (float) $order_item->get_total_tax());
}
Avoid using static access to class '\WC_Subscriptions_Product' in method 'subscription_has_trial'.
return $this->is_subscription_type($product) && class_exists('WC_Subscriptions_Product') && WC_Subscriptions_Product::get_trial_length($product->get_id()) > 0;
Avoid unused local variables such as '$orderType'.
switch ($orderType = $this->get_order_type()) {
Avoid unused local variables such as '$index'.
foreach ($cart->get_fees() as $index => $fee) {
Avoid unused parameters such as '$order_items'.
protected function build_interest_rate_item($order_items)
The property $vindi_settings is not named in camelCase.
class VindiPaymentProcessor
{
* Order type is invalid.
*/
The property $single_freight is not named in camelCase.
class VindiPaymentProcessor
{
* Order type is invalid.
*/
Blank line found at start of control structure
if ($sign_up_fee != null && $sign_up_fee > 0) {
The DEFAULT body must start on the line following the statement
default:
The CASE body must start on the line following the statement
case static::ORDER_TYPE_SUBSCRIPTION:
Line exceeds 120 characters; contains 130 characters
$this->abort(__('Falha ao registrar o método de pagamento. Verifique os dados e tente novamente.', VINDI), true);
Inline control structures are not allowed
if ($product->id === null) $product->id = 63;
Line exceeds 120 characters; contains 140 characters
public function __construct(WC_Order $order, VindiPaymentGateway $gateway, VindiSettings $vindi_settings, VindiControllers $controllers)
Line exceeds 120 characters; contains 180 characters
!empty($order_item['type']) && $total_tax += ($order_item['type'] === 'shipping' ? (float) $this->order->get_shipping_tax() : (float) $order_item->get_total_tax());
Line exceeds 120 characters; contains 182 characters
'card_expiration' => filter_var($_POST['vindi_cc_monthexpiry'], FILTER_SANITIZE_NUMBER_INT) . '/' . filter_var($_POST['vindi_cc_yearexpiry'], FILTER_SANITIZE_NUMBER_INT),
Line exceeds 120 characters; contains 145 characters
return $this->abort(__('Falha ao processar carrinho de compras. Verifique os itens escolhidos e tente novamente.', VINDI), true);
Line exceeds 120 characters; contains 128 characters
if (function_exists('wcs_order_contains_subscription') && wcs_order_contains_subscription($this->order, array('any'))) {
Line exceeds 120 characters; contains 169 characters
* @param WC_Order_Item_Product|WC_Order_Item_Product[] $product The product to be built. If the order type is 'bill' this will be an array of WC_Order_Item_Product,
Line exceeds 120 characters; contains 149 characters
return $this->abort(__('Falha ao recuperar informações sobre o produto na Vindi. Verifique os dados e tente novamente.', VINDI), true);
Line exceeds 120 characters; contains 121 characters
* @param WC_Order_Item_Product|WC_Order_Item_Product[] $order_items. Subscriptions will pass only one order_item and
Line exceeds 120 characters; contains 126 characters
$this->abort(__('Falha ao registrar o método de pagamento. Verifique os dados e tente novamente.', VINDI), true);
Line exceeds 120 characters; contains 167 characters
return $this->is_subscription_type($product) && class_exists('WC_Subscriptions_Product') && WC_Subscriptions_Product::get_trial_length($product->get_id()) > 0;
Inline control structures are not allowed
if (empty($subscription_order_item))
Line exceeds 120 characters; contains 122 characters
'tax' == $order_item['type'] || 'interest_rate' == $order_item['type'] || 'sign_up_fee' == $order_item['type']
Expected 0 spaces after opening bracket; newline found
if (
Expected 0 spaces after opening bracket; newline found
if (
Expected 0 spaces after opening bracket; newline found
if (
There are no issues that match your filters.