vindi/vindi-woocommerce

View on GitHub

Showing 2,474 of 2,474 total issues

Function isSubscriptionActive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public function isSubscriptionActive($subscription_id)
  {
    $subscription_id = filter_var($subscription_id, FILTER_SANITIZE_NUMBER_INT);
    if (isset($this->recentRequest)
      && $this->recentRequest['id'] == $subscription_id) {
Severity: Minor
Found in src/routes/RoutesApi.php - About 35 mins 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

Visibility must be declared on method "delete"
Open

  function delete($user_id)

Visibility must be declared on method "update"
Open

  function update($user_id, $order = null)

Visibility must be declared on method "__construct"
Open

  function __construct(VindiSettings $vindi_settings)

Visibility must be declared on method "create"
Open

  function create($user_id, $order = null)

Blank line found at start of control structure
Open

    if (!$vindiUser) {

Visibility must be declared on property "$instance"
Open

    static $instance = null;
Severity: Minor
Found in src/VindiWoocommerce.php by phpcodesniffer

Blank line found at start of control structure
Open

    if (empty($vindi_customer_id)) {

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 (!$vindiUser) {

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_customer_id)) {

Visibility must be declared on method "__construct"
Open

  function __construct(VindiSettings $vindi_settings)

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() == 'variable-subscription') {

Blank line found at start of control structure
Open

      if (empty($vindi_plan_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 (empty($vindi_plan_id)) {

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)
Severity
Category
Status
Source
Language