piotrpolak/pepiscms

View on GitHub
pepiscms/application/core/PEPISCMS_Loader.php

Summary

Maintainability
D
2 days
Test Coverage

Function model has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    public function model($model, $name = '', $db_conn = false, $hardfail = true)
    {
        // Keep this redundancy
        $original_model = $model;
        $original_name = $name;
Severity: Minor
Found in pepiscms/application/core/PEPISCMS_Loader.php - About 5 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 _model has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    private function _model($model, $name = '', $db_conn = false, $hardfail = true)
    {
        if (is_array($model)) {
            foreach ($model as $babe) {
                $this->model($babe);
Severity: Minor
Found in pepiscms/application/core/PEPISCMS_Loader.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 model has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function model($model, $name = '', $db_conn = false, $hardfail = true)
    {
        // Keep this redundancy
        $original_model = $model;
        $original_name = $name;
Severity: Major
Found in pepiscms/application/core/PEPISCMS_Loader.php - About 2 hrs to fix

    File PEPISCMS_Loader.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Method _model has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function _model($model, $name = '', $db_conn = false, $hardfail = true)
          {
              if (is_array($model)) {
                  foreach ($model as $babe) {
                      $this->model($babe);
      Severity: Minor
      Found in pepiscms/application/core/PEPISCMS_Loader.php - About 1 hr to fix

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

            public function library($library = '', $params = null, $object_name = null)
            {
                if (empty($library)) {
                    return $this;
                } elseif (is_array($library)) {
        Severity: Minor
        Found in pepiscms/application/core/PEPISCMS_Loader.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 resolveModuleDirectory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function resolveModuleDirectory($module_name, $web_path = false)
            {
                if (isset($this->module_directory_cache[$module_name][$web_path])) {
                    // Some kind of runtime cache
                    return $this->module_directory_cache[$module_name][$web_path];
        Severity: Minor
        Found in pepiscms/application/core/PEPISCMS_Loader.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 moduleLibrary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function moduleLibrary($module_name, $library, $params = null)
            {
                if ($library == '') {
                    return false;
                }
        Severity: Minor
        Found in pepiscms/application/core/PEPISCMS_Loader.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 moduleLanguage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function moduleLanguage($module_name = false, $langfile = false, $idiom = false)
            {
                if (!$idiom) {
                    if (class_exists('Dispatcher') && ($d_lang = Dispatcher::getSiteLanguage())) {
                        $idiom = $d_lang->ci_language;
        Severity: Minor
        Found in pepiscms/application/core/PEPISCMS_Loader.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