piotrpolak/pepiscms

View on GitHub
pepiscms/modules/pages/controllers/PagesAdmin.php

Summary

Maintainability
F
4 days
Test Coverage

File PagesAdmin.php has 515 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * PepisCMS
 *
Severity: Major
Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 1 day to fix

    Method _getPageEditDefinition has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function _getPageEditDefinition($input_groups, $page_id, $site_language)
        {
            $definition = array();
            $definition['page_title'] = array(
                'input_group' => $input_groups['document'],
    Severity: Major
    Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 4 hrs to fix

      Function _on_page_save_callback has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _on_page_save_callback(&$data)
          {
              /*
               * TESTS
               * Update page contents
      Severity: Minor
      Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 4 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 _on_page_save_callback has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _on_page_save_callback(&$data)
          {
              /*
               * TESTS
               * Update page contents
      Severity: Major
      Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 3 hrs to fix

        PagesAdmin has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class PagesAdmin extends ModuleAdminController
        {
            /**
             * Base path for file uploads
             *
        Severity: Minor
        Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 2 hrs to fix

          Function deletemenuelement has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function deletemenuelement()
              {
                  $item_id = $this->input->getParam('item_id');
          
                  $success = false;
          Severity: Minor
          Found in pepiscms/modules/pages/controllers/PagesAdmin.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

          Function _fb_callback_make_filename_seo_friendly has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function _fb_callback_make_filename_seo_friendly(&$filename, $base_path, &$data, $current_image_field_name)
              {
                  // List of the fields to be used, if no value is present for a given key
                  // then the key will be ignored. By default all values of the keys
                  // specified will be concatenated
          Severity: Minor
          Found in pepiscms/modules/pages/controllers/PagesAdmin.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 _fb_callback_make_filename_seo_friendly has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _fb_callback_make_filename_seo_friendly(&$filename, $base_path, &$data, $current_image_field_name)
              {
                  // List of the fields to be used, if no value is present for a given key
                  // then the key will be ignored. By default all values of the keys
                  // specified will be concatenated
          Severity: Minor
          Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 1 hr to fix

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

                public function menuedit()
                {
                    $site_language = $this->getAttribute('site_language');
                    $item_id = $this->input->getParam('item_id');
            
            
            Severity: Minor
            Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 1 hr to fix

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

                  public function deletemenuelement()
                  {
                      $item_id = $this->input->getParam('item_id');
              
                      $success = false;
              Severity: Minor
              Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 1 hr to fix

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

                    public function edit()
                    {
                        $url_suffix = $this->config->item('url_suffix');
                        $site_language = $this->getAttribute('site_language');
                        $view = $this->input->getParam('view');
                Severity: Minor
                Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 1 hr to fix

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

                      private function _getPageEditDefinition($input_groups, $page_id, $site_language)
                      {
                          $definition = array();
                          $definition['page_title'] = array(
                              'input_group' => $input_groups['document'],
                  Severity: Minor
                  Found in pepiscms/modules/pages/controllers/PagesAdmin.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

                  Avoid too many return statements within this method.
                  Open

                                  return false;
                  Severity: Major
                  Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return true;
                    Severity: Major
                    Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 30 mins to fix

                      Function _menu_item_name_check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function _menu_item_name_check($str)
                          {
                              if ($this->formbuilder->getId()) {
                                  $item = $this->Menu_model->getById($this->formbuilder->getId(), 'item_name, parent_item_id');
                      
                      
                      Severity: Minor
                      Found in pepiscms/modules/pages/controllers/PagesAdmin.php - About 25 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

                      There are no issues that match your filters.

                      Category
                      Status