piotrpolak/pepiscms

View on GitHub
pepiscms/application/libraries/MenuRendor.php

Summary

Maintainability
D
2 days
Test Coverage

Function render has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

    public function render($controller, $method, $language_code = '', $pull_submenu_from_controller = false, $current_module = false)
    {
        $menu = $this->config->item('menu');

        $pull_submenu_from_controller = $this->ensurePulledSumbenuFromControllerIsSet($controller, $pull_submenu_from_controller);
Severity: Minor
Found in pepiscms/application/libraries/MenuRendor.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

Method render has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function render($controller, $method, $language_code = '', $pull_submenu_from_controller = false, $current_module = false)
    {
        $menu = $this->config->item('menu');

        $pull_submenu_from_controller = $this->ensurePulledSumbenuFromControllerIsSet($controller, $pull_submenu_from_controller);
Severity: Major
Found in pepiscms/application/libraries/MenuRendor.php - About 3 hrs to fix

    File MenuRendor.php has 273 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * PepisCMS
     *
    Severity: Minor
    Found in pepiscms/application/libraries/MenuRendor.php - About 2 hrs to fix

      Method computeSubmenuItem has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function computeSubmenuItem($controller, $method, $language_code, $pull_submenu_from_controller,
                                              array $menu_map_item_template, $item, $module, array $menu_map_item)
      Severity: Major
      Found in pepiscms/application/libraries/MenuRendor.php - About 1 hr to fix

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

            private function buildSubmenuUrl($module, $item, $language_code)
            {
                if (!$module->name) {
                    $submenu_url = admin_url() . $item[self::PROP_CONTROLLER] . '/';
                } elseif (isset($item[self::PROP_MODULE]) && $item[self::PROP_MODULE]) {
        Severity: Minor
        Found in pepiscms/application/libraries/MenuRendor.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

        Method buildMenuItem has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private function buildMenuItem($language_code, $pull_submenu_from_controller, $current_module, array $menu_map_item_template, $item)
        Severity: Minor
        Found in pepiscms/application/libraries/MenuRendor.php - About 35 mins to fix

          Method render has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function render($controller, $method, $language_code = '', $pull_submenu_from_controller = false, $current_module = false)
          Severity: Minor
          Found in pepiscms/application/libraries/MenuRendor.php - About 35 mins to fix

            Method computeCacheVariableName has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private function computeCacheVariableName($controller, $method, $language_code, $pull_submenu_from_controller, $current_module)
            Severity: Minor
            Found in pepiscms/application/libraries/MenuRendor.php - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status