Showing 60 of 2,474 total issues
File PaymentProcessor.php
has 949 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace VindiPaymentGateways;
use DateTime;
VindiPaymentProcessor
has 62 functions (exceeds 20 allowed). Consider refactoring. Open
class VindiPaymentProcessor
{
/**
* Order type is invalid.
*/
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) {
File Webhooks.php
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace VindiPaymentGateways;
use WC_Subscriptions_Manager;
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
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) {
- Read upRead up
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;
/**
VindiRoutes
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class VindiRoutes
{
/**
* @var VindiSettings
File RoutesApi.php
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace VindiPaymentGateways;
class VindiRoutes
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();
- Read upRead up
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
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)) {
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();
VindiWebhooks
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class VindiWebhooks
{
/**
* @var VindiSettings
*/
Function array_sort
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function array_sort($array, $on, $order=SORT_ASC)
{
$new_array = array();
$sortable_array = array();
- Read upRead up
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 update
has a Cognitive Complexity of 20 (exceeds 5 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)) {
- Read upRead up
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 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
- Read upRead up
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
Method init_form_fields
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init_form_fields()
{
$url = admin_url(sprintf('admin.php?page=wc-status&tab=logs&log_file=%s-%s-log', VINDI, $this->get_token()));
$logs_url = '<a href="' . $url . '" target="_blank">' . __('Ver Logs', VINDI) . '</a>';
$nfe_know_more = '<a href="http://atendimento.vindi.com.br/hc/pt-br/articles/204450944-Notas-fiscais" target="_blank">' . __('Saiba mais', VINDI) . '</a>';
Method init_form_fields
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function init_form_fields()
{
$this->form_fields = array(
'enabled' => array(
Method create
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function create($user_id, $order = null)
{
$customer = new WC_Customer($user_id);
Function getPaymentMethods
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getPaymentMethods()
{
if (false === ($payment_methods = get_transient('vindi_payment_methods'))) {
$payment_methods = array(
- Read upRead up
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"