vindi/vindi-woocommerce

View on GitHub
src/utils/RedirectCheckout.php

Summary

Maintainability
A
0 mins
Test Coverage

The function VindiRedirectToMyAccount() contains an exit expression.
Open

      exit;
Severity: Minor
Found in src/utils/RedirectCheckout.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 10 and the first side effect is on line 19.
Open

<?php

Inline control structures are not allowed
Open

  if(is_user_logged_in() || get_option('woocommerce_enable_guest_checkout') == "yes") return;

Whitespace found at end of line
Open

      (! is_user_logged_in() && get_option('woocommerce_enable_guest_checkout') == "no") 

Whitespace found at end of line
Open

      && (is_checkout()) 

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

      exit;

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

      wp_redirect(get_permalink( wc_get_page_id( 'myaccount' ) ));

Line indented incorrectly; expected 4 spaces, found 2
Open

  }

Space after opening parenthesis of function call prohibited
Open

      <a href="<?php echo get_permalink( wc_get_page_id( 'myaccount' ) ); ?>">

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

  if(is_user_logged_in() || get_option('woocommerce_enable_guest_checkout') == "yes") return;

Line indented incorrectly; expected 4 spaces, found 2
Open

  if (

Space after opening parenthesis of function call prohibited
Open

      wp_redirect(get_permalink( wc_get_page_id( 'myaccount' ) ));

Opening brace should be on a new line
Open

function VindiRedirectToMyAccount() {

Space after opening parenthesis of function call prohibited
Open

      wp_redirect(get_permalink( wc_get_page_id( 'myaccount' ) ));

Opening brace should be on a new line
Open

function VindiRedirectInfo() {

Expected 1 space after IF keyword; 0 found
Open

  if(is_user_logged_in() || get_option('woocommerce_enable_guest_checkout') == "yes") return;

Expected 0 spaces before closing bracket; 1 found
Open

      <?php _e('Clique aqui para acessar uma conta existente ou criá-la.', VINDI ); ?>

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

  ) {

Line indented incorrectly; expected 8 spaces, found 6
Open

      <?php _e('Para finalizar sua compra, é necessário estar logado', VINDI); ?>

Line indented incorrectly; expected 8 spaces, found 6
Open

      <?php _e('Clique aqui para acessar uma conta existente ou criá-la.', VINDI ); ?>

Expected 0 spaces after opening bracket; newline found
Open

  if (

Line indented incorrectly; expected 4 spaces, found 2
Open

  ?>

Expected 0 spaces before closing bracket; 1 found
Open

      wp_redirect(get_permalink( wc_get_page_id( 'myaccount' ) ));

Space after opening parenthesis of function call prohibited
Open

      <a href="<?php echo get_permalink( wc_get_page_id( 'myaccount' ) ); ?>">

Expected 0 spaces before closing bracket; 1 found
Open

      wp_redirect(get_permalink( wc_get_page_id( 'myaccount' ) ));

Expected 0 spaces before closing bracket; 1 found
Open

      <a href="<?php echo get_permalink( wc_get_page_id( 'myaccount' ) ); ?>">

Expected 0 spaces before closing bracket; 1 found
Open

      <a href="<?php echo get_permalink( wc_get_page_id( 'myaccount' ) ); ?>">

There are no issues that match your filters.

Category
Status