piotrpolak/pepiscms

View on GitHub
pepiscms/modules/cms_users/controllers/Cms_usersAdmin.php

Summary

Maintainability
D
2 days
Test Coverage

Method __construct has 141 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct()
    {
        parent::__construct();

        $lang_field_prefix = $this->module_name . '_';
Severity: Major
Found in pepiscms/modules/cms_users/controllers/Cms_usersAdmin.php - About 5 hrs to fix

    File Cms_usersAdmin.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * PepisCMS
     *
    Severity: Minor
    Found in pepiscms/modules/cms_users/controllers/Cms_usersAdmin.php - About 4 hrs to fix

      Function _fb_callback_on_save has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _fb_callback_on_save(&$data)
          {
              $user_id = $this->formbuilder->getId();
      
              if (!$data['birth_date'] || $data['birth_date'] = '0000-00-00') {
      Severity: Minor
      Found in pepiscms/modules/cms_users/controllers/Cms_usersAdmin.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 _fb_callback_on_save has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _fb_callback_on_save(&$data)
          {
              $user_id = $this->formbuilder->getId();
      
              if (!$data['birth_date'] || $data['birth_date'] = '0000-00-00') {
      Severity: Minor
      Found in pepiscms/modules/cms_users/controllers/Cms_usersAdmin.php - About 2 hrs to fix

        Function _fb_format_title_and_modify_option has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _fb_format_title_and_modify_option($content, $line)
            {
                $this->removeMetaActions();
                if ($line->status == 0) {
                    $this->setEditable(false);
        Severity: Minor
        Found in pepiscms/modules/cms_users/controllers/Cms_usersAdmin.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 edit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function edit($display_view = true)
            {
                $id = $this->input->getParam('id');
                $sameuser = $this->auth->getUserId() == $id;
        
        
        Severity: Minor
        Found in pepiscms/modules/cms_users/controllers/Cms_usersAdmin.php - About 1 hr to fix

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

              public function edit($display_view = true)
              {
                  $id = $this->input->getParam('id');
                  $sameuser = $this->auth->getUserId() == $id;
          
          
          Severity: Minor
          Found in pepiscms/modules/cms_users/controllers/Cms_usersAdmin.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 pepiscms/modules/cms_users/controllers/Cms_usersAdmin.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

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

              There are no issues that match your filters.

              Category
              Status