PressLabs/toplytics

View on GitHub
src/components/Backend.php

Summary

Maintainability
F
1 wk
Test Coverage

File Backend.php has 1398 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Toplytics;

use Exception;
Severity: Major
Found in src/components/Backend.php - About 3 days to fix

    Function convertDataToPosts has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
    Open

        private function convertDataToPosts($data, $when)
        {
            $new_data = [];
    
            if ($this->checkSetting('ignore_posts_ids')) {
    Severity: Minor
    Found in src/components/Backend.php - About 1 day 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

    Backend has 62 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Backend
    {
    
        /**
         * The ID of this plugin.
    Severity: Major
    Found in src/components/Backend.php - About 1 day to fix

      Method initSettings has 214 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function initSettings()
          {
              $options = get_option('toplytics_settings');
              if ($options == false) {
                  $options = $this->getDefaultSettings();
      Severity: Major
      Found in src/components/Backend.php - About 1 day to fix

        Method convertDataToPosts has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function convertDataToPosts($data, $when)
            {
                $new_data = [];
        
                if ($this->checkSetting('ignore_posts_ids')) {
        Severity: Major
        Found in src/components/Backend.php - About 2 hrs to fix

          Function update_additional_posts_data has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public function update_additional_posts_data()
              {
                  // Fetch the widgets data from the database, if not already retrieved.
                  $this->_maybe_fetch_widgets_data();
          
          
          Severity: Minor
          Found in src/components/Backend.php - About 2 hrs 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 getAnalyticsData has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getAnalyticsData( $extended_fetch = false )
              {
                  $propertyId = get_option('toplytics_property_id', false);
          
                  if (!$propertyId) return false;
          Severity: Major
          Found in src/components/Backend.php - About 2 hrs to fix

            Method update_additional_posts_data has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function update_additional_posts_data()
                {
                    // Fetch the widgets data from the database, if not already retrieved.
                    $this->_maybe_fetch_widgets_data();
            
            
            Severity: Major
            Found in src/components/Backend.php - About 2 hrs to fix

              Function _have_enough_results has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function _have_enough_results( $posts, $period )
                  {
                      // Fetch the widgets data from the database, if not already retrieved.
                      $this->_maybe_fetch_widgets_data();
              
              
              Severity: Minor
              Found in src/components/Backend.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 printInput has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function printInput($args)
                  {
                      $option = 'toplytics_settings';
                      $settings = get_option($option);
              
              
              Severity: Minor
              Found in src/components/Backend.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 getAnalyticsData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getAnalyticsData( $extended_fetch = false )
                  {
                      $propertyId = get_option('toplytics_property_id', false);
              
                      if (!$propertyId) return false;
              Severity: Minor
              Found in src/components/Backend.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 privateAuthorization has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function privateAuthorization()
                  {
                      if (empty($_POST['ToplyticsSubmitPrivateAuthorization'])) {
                          return false;
                      }
              Severity: Minor
              Found in src/components/Backend.php - About 1 hr to fix

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

                    public function updateAnalyticsDataResults( $extended_fetch = false )
                    {
                        try {
                            $data = $this->getAnalyticsData( $extended_fetch );
                        } catch (Exception $e) {
                Severity: Minor
                Found in src/components/Backend.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 serviceConnect has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function serviceConnect()
                    {
                        if (!$this->client) {
                            return false;
                        }
                Severity: Minor
                Found in src/components/Backend.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 openWindowToSettingsView has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function openWindowToSettingsView()
                    {
                        if (get_option('toplytics_google_token')) {
                            $profile = get_option('toplytics_profile_data');
                
                
                Severity: Minor
                Found in src/components/Backend.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 serviceDisconnect has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function serviceDisconnect($programatic = false, $silent = false)
                    {
                        if (empty($_POST['ToplyticsSubmitAccountDisconnect']) && !$programatic) {
                            return;
                        }
                Severity: Minor
                Found in src/components/Backend.php - About 1 hr to fix

                  Method serviceConnect has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function serviceConnect()
                      {
                          if (!$this->client) {
                              return false;
                          }
                  Severity: Minor
                  Found in src/components/Backend.php - About 1 hr to fix

                    Method printInput has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function printInput($args)
                        {
                            $option = 'toplytics_settings';
                            $settings = get_option($option);
                    
                    
                    Severity: Minor
                    Found in src/components/Backend.php - About 1 hr to fix

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

                          public function extraRowMeta($plugin_meta, $plugin_file = null)
                          {
                              global $toplytics_engine;
                      
                              if ( ! is_null( $plugin_file ) && $plugin_file !== $this->plugin_basename ) {
                      Severity: Minor
                      Found in src/components/Backend.php - About 1 hr to fix

                        Method getAnalyticsRealTimeData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function getAnalyticsRealTimeData( $extended_fetch = false )
                            {
                                if ( ! $this->checkSetting('fetch_realtime') ) {
                                    return [];
                                }
                        Severity: Minor
                        Found in src/components/Backend.php - About 1 hr to fix

                          Method openWindowToSettingsView has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function openWindowToSettingsView()
                              {
                                  if (get_option('toplytics_google_token')) {
                                      $profile = get_option('toplytics_profile_data');
                          
                          
                          Severity: Minor
                          Found in src/components/Backend.php - About 1 hr to fix

                            Method getAuthConfig has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getAuthConfig()
                                {
                                    $authType = get_option('toplytics_auth_type');
                            
                                    if ($authType == 'private') {
                            Severity: Minor
                            Found in src/components/Backend.php - About 1 hr to fix

                              Method updateAnalyticsDataResults has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function updateAnalyticsDataResults( $extended_fetch = false )
                                  {
                                      try {
                                          $data = $this->getAnalyticsData( $extended_fetch );
                                      } catch (Exception $e) {
                              Severity: Minor
                              Found in src/components/Backend.php - About 1 hr to fix

                                Function getAnalyticsRealTimeData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function getAnalyticsRealTimeData( $extended_fetch = false )
                                    {
                                        if ( ! $this->checkSetting('fetch_realtime') ) {
                                            return [];
                                        }
                                Severity: Minor
                                Found in src/components/Backend.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 getProfiles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function getProfiles()
                                    {
                                        $profiles = [];
                                        $accounts = $this->getAccounts();
                                        foreach ($accounts as $account_id => $account_name) {
                                Severity: Minor
                                Found in src/components/Backend.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

                                Consider simplifying this complex logical expression.
                                Open

                                        if (!empty($args['input']) && ($args['input'] == 'text' || $args['input'] == 'color')) {
                                            echo "<input type='text' id='" . $args['id'] . "' name='" . $option . "[" . $args['id'] . "]' value='" . (!empty($settings[$args['id']]) ? $settings[$args['id']] : '') . "' placeholder='" . (!empty($args['placeholder']) ? $args['placeholder'] : '') . "' " . (!empty($args['disabled']) && $args['disabled'] ? 'readonly="readonly"' : '') . " />";
                                        }
                                
                                        //Select
                                Severity: Major
                                Found in src/components/Backend.php - About 1 hr to fix

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

                                      public function act_before_settings_update($updated_settings)
                                      {
                                          // Fetch the current set of Toplytics settings from the DB.
                                          $current_settings = get_option('toplytics_settings');
                                  
                                  
                                  Severity: Minor
                                  Found in src/components/Backend.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 updateAnalyticsRealTimeDataResults has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function updateAnalyticsRealTimeDataResults( $extended_fetch = false )
                                      {
                                          try {
                                              $realtime = $this->getAnalyticsRealTimeData( $extended_fetch );
                                          } catch (Exception $e) {
                                  Severity: Minor
                                  Found in src/components/Backend.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

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

                                      private function _get_featured_image( $post_id )
                                      {
                                          $featured_image = $image_size = ''; // Sensible default.
                                          if ( $this->checkSetting( 'include_featured_image_in_json' ) ) {
                                              // Check if a value is set for the featured image size.
                                  Severity: Minor
                                  Found in src/components/Backend.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

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

                                      public function getAuthConfig()
                                      {
                                          $authType = get_option('toplytics_auth_type');
                                  
                                          if ($authType == 'private') {
                                  Severity: Minor
                                  Found in src/components/Backend.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

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

                                      public function serviceDisconnect($programatic = false, $silent = false)
                                      {
                                          if (empty($_POST['ToplyticsSubmitAccountDisconnect']) && !$programatic) {
                                              return;
                                          }
                                  Severity: Minor
                                  Found in src/components/Backend.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

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

                                      public function checkAuthorization()
                                      {
                                          if (isset($_GET['code']) && $_GET['page'] === 'toplytics') {
                                              if (isset($_GET['status']) && $_GET['status'] && $_GET['status'] == 'error') {
                                                  $get_error = filter_input(INPUT_GET, 'code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
                                  Severity: Minor
                                  Found in src/components/Backend.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

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

                                      public function profileSelect()
                                      {
                                          if (empty($_POST['ToplyticsProfileSelect']) || (empty($_POST['profile_id']) && empty($_POST['property_id']))) {
                                              return false;
                                          }
                                  Severity: Minor
                                  Found in src/components/Backend.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

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

                                      public function validateGoogleConfig($googleconfig, $skipUriCheck = false)
                                      {
                                          if (!is_object($googleconfig)) {
                                              return false;
                                          }
                                  Severity: Minor
                                  Found in src/components/Backend.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

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

                                      public function pluginUpgradeComplete( $upgraderObject, $options ) {
                                          // If an update has taken place and the updated type is plugins and the plugins element exists
                                          if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
                                              // Iterate through the plugins being updated and check if ours is there
                                              foreach( $options['plugins'] as $plugin ) {
                                  Severity: Minor
                                  Found in src/components/Backend.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

                                  Avoid too many return statements within this method.
                                  Open

                                              return true;
                                  Severity: Major
                                  Found in src/components/Backend.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return false;
                                    Severity: Major
                                    Found in src/components/Backend.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return true;
                                      Severity: Major
                                      Found in src/components/Backend.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return $googleconfig;
                                        Severity: Major
                                        Found in src/components/Backend.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return true;
                                          Severity: Major
                                          Found in src/components/Backend.php - About 30 mins to fix

                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                            Open

                                                    add_settings_field(
                                                        'allowed_post_types',
                                                        $this->getLabel(__('Allowed post types', TOPLYTICS_DOMAIN), 'allowed_post_types'),
                                                        [$this, 'printInput'],
                                                        'toplytics',
                                            Severity: Major
                                            Found in src/components/Backend.php and 2 other locations - About 55 mins to fix
                                            src/components/Backend.php on lines 657..670
                                            src/components/Backend.php on lines 720..733

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 99.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                            Open

                                                    add_settings_field(
                                                        'custom_output_post_variables',
                                                        $this->getLabel(__('Custom post variables in JSON output', TOPLYTICS_DOMAIN), 'custom_output_post_variables'),
                                                        [$this, 'printInput'],
                                                        'toplytics',
                                            Severity: Major
                                            Found in src/components/Backend.php and 2 other locations - About 55 mins to fix
                                            src/components/Backend.php on lines 704..717
                                            src/components/Backend.php on lines 720..733

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 99.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                            Open

                                                    add_settings_field(
                                                        'ignore_posts_ids',
                                                        $this->getLabel(__('Ignore Post IDs', TOPLYTICS_DOMAIN), 'ignore_posts_ids'),
                                                        [$this, 'printInput'],
                                                        'toplytics',
                                            Severity: Major
                                            Found in src/components/Backend.php and 2 other locations - About 55 mins to fix
                                            src/components/Backend.php on lines 657..670
                                            src/components/Backend.php on lines 704..717

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 99.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            There are no issues that match your filters.

                                            Category
                                            Status