tuhin18003/WooCommerce-AltCoin-Payment-Gateway

View on GitHub

Showing 87 of 92 total issues

Method get_crypto_prices has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function get_crypto_prices() {
        $settings = CsPaymentGateway::get_product_page_options();
        if ( ! isset( $settings['show_live_price'] ) || $settings['show_live_price'] != 'yes' ) {
            return wp_send_json(
                array(
Severity: Minor
Found in core/frontend/functions/CsMiscellaneous.php - About 1 hr to fix

    Method widget_get_live_coin_prices has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function widget_get_live_coin_prices( $user_data ) {
    
            // get widget options
            $widget_options = CsSaveWidgetOptions::get_widget_options();
    
    
    Severity: Minor
    Found in core/frontend/functions/widgets/CsWidgets.php - About 1 hr to fix

      Method save_settings has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function save_settings( $user_input ) {
      
              $user_data = array_map( array( '\WooGateWayCoreLib\lib\Util', 'check_evil_script' ), $user_input['cs_altcoin_config'] );
      
              // check is valid api / credentials
      Severity: Minor
      Found in core/admin/functions/CsAutomaticOrderConfirmationSettings.php - About 1 hr to fix

        Method generate_html_fields has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function generate_html_fields( $fields, $return_array = false ) {
                if ( empty( $fields ) ) {
                    return false; }
        
                $html_fields = array();
        Severity: Minor
        Found in core/admin/builders/CsFormBuilder.php - About 1 hr to fix

          Function add_new_coin has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function add_new_coin( $user_data ) {
                  global $wpdb, $wapg_tables;
                  $coin_info = Util::check_evil_script( $user_data['cs_add_new'] );
          
                  if ( empty( $coin_info['coin_address'] ) || empty( $coin_info['checkout_type'] ) || empty( $coin_info['coin_name'] ) ) {
          Severity: Minor
          Found in core/admin/functions/CsAdminQuery.php - About 1 hr 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

          Function get_coin_name has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function get_coin_name( $user_input ) {
                  $oc_type = $user_input['oc_type'];
                  if ( $oc_type == 1 ) {
                      $query = $user_input['query'];
                      if ( empty( $query ) ) {
          Severity: Minor
          Found in core/admin/functions/CsAdminQuery.php - About 1 hr 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

          Function get_crypto_prices has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function get_crypto_prices() {
                  $settings = CsPaymentGateway::get_product_page_options();
                  if ( ! isset( $settings['show_live_price'] ) || $settings['show_live_price'] != 'yes' ) {
                      return wp_send_json(
                          array(
          Severity: Minor
          Found in core/frontend/functions/CsMiscellaneous.php - About 1 hr 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

          Method generate_product_options_settings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function generate_product_options_settings( $args ) {
          
                  $fields = array(
                      'st1'          => array(
                          'type'     => 'section_title',
          Severity: Minor
          Found in core/admin/options/pages/WidgetPageOptions.php - About 1 hr to fix

            Method customForm has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function customForm( $refObj ) {
                    global $wp;
            
                    $active_coins = CsAdminQuery::get_coins( array( 'where' => ' c.status = 1 ' ) );
                    if ( empty( $active_coins ) ) {
            Severity: Minor
            Found in core/admin/builders/CsWapgForm.php - About 1 hr to fix

              Function get_coin_martket_price has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function get_coin_martket_price( $coin_slug, $coinType ) {
                      if ( $coinType == 1 ) {
                          $api_url = sprintf( $this->coinmarketstats_free_api_url, $coin_slug );
                      } elseif ( $coinType == 2 ) {
                          $api_url = sprintf( $this->coinmarketstats_api_url, $coin_slug );
              Severity: Minor
              Found in core/frontend/functions/CsWapgCoinCal.php - About 1 hr 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

              Function action_admin_notices has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function action_admin_notices() {
                      global $altcoin_menu;
                      $screen = get_current_screen();
              
                      if ( \in_array( $screen->id, $altcoin_menu ) ) {
              Severity: Minor
              Found in core/admin/notices/wapgNotice.php - About 1 hr 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

              Function process_bulk_action has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  function process_bulk_action() {
                      global $wpdb, $wapg_tables;
                        // security check!
                      if ( isset( $_GET['_wpnonce'] ) && ! empty( $_GET['_wpnonce'] ) ) {
              
              
              Severity: Minor
              Found in core/admin/options/functions/Coin_List.php - About 1 hr 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

              Function poulate_the_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function poulate_the_data() {
                      global $wpdb, $wapg_tables;
                      $search = '';
                      if ( isset( $_GET['s'] ) && ! empty( $skey = $_GET['s'] ) ) {
                          $search = " where c.name like '%{$skey}%'";
              Severity: Minor
              Found in core/admin/options/functions/Coin_List.php - About 1 hr 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

              Function wapg_enqueue_admin_script has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function wapg_enqueue_admin_script( $page_id ) {
                      global $altcoin_menu;
              
                      // menu id
                      $apply_script_on = array(
              Severity: Minor
              Found in core/actions/WapgEnqueueScripts.php - About 1 hr 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

              Method action_admin_notices has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function action_admin_notices() {
                      global $altcoin_menu;
                      $screen = get_current_screen();
              
                      if ( \in_array( $screen->id, $altcoin_menu ) ) {
              Severity: Minor
              Found in core/admin/notices/wapgNotice.php - About 1 hr to fix

                Method wapg_enqueue_admin_script has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function wapg_enqueue_admin_script( $page_id ) {
                        global $altcoin_menu;
                
                        // menu id
                        $apply_script_on = array(
                Severity: Minor
                Found in core/actions/WapgEnqueueScripts.php - About 1 hr to fix

                  Method remote_call has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function remote_call( $url, $method = 'GET', $params = array() ) {
                          if ( $method == 'GET' ) {
                              $response = wp_remote_get(
                                  $url,
                                  array(
                  Severity: Minor
                  Found in core/lib/Util.php - About 1 hr to fix

                    Method show_more_less has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function show_more_less() {
                            ?>
                                <script type="text/javascript">
                                    jQuery(document).ready(function( $ ){
                                        $('.address').each(function( e ){
                    Severity: Minor
                    Found in core/admin/options/Scripts_Settings.php - About 1 hr to fix

                      Function _cs_wapg_custom_call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function _cs_wapg_custom_call() {
                      
                              if ( ! isset( $_REQUEST['cs_token'] ) || false === check_ajax_referer( SECURE_AUTH_SALT, 'cs_token', false ) ) {
                                  wp_send_json(
                                      array(
                      Severity: Minor
                      Found in core/actions/CustomAjax.php - About 55 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

                      Function udpate_coin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function udpate_coin( $user_data ) {
                              global $wpdb, $wapg_tables;
                              $coin_info           = Util::check_evil_script( $user_data['cs_add_new'] );
                              $more_address_fields = Util::check_evil_script( $user_data['more_coin_address'] );
                      
                      
                      Severity: Minor
                      Found in core/admin/functions/CsAdminQuery.php - About 45 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

                      Severity
                      Category
                      Status
                      Source
                      Language