piotrpolak/pepiscms

View on GitHub
pepiscms/application/controllers/admin/Ajaxfilemanager.php

Summary

Maintainability
D
2 days
Test Coverage

File Ajaxfilemanager.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * PepisCMS
 *
Severity: Minor
Found in pepiscms/application/controllers/admin/Ajaxfilemanager.php - About 3 hrs to fix

    Function getjsonfilelist has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getjsonfilelist()
        {
            $files = $dirs = array();
            $user_files_dir = $this->uploadsPath;
            $current_path = isset($_POST['path']) ? str_replace('//', '/', str_replace('../', '', $_POST['path'] . '/')) : '/';
    Severity: Minor
    Found in pepiscms/application/controllers/admin/Ajaxfilemanager.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 getjsonfilelist has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getjsonfilelist()
        {
            $files = $dirs = array();
            $user_files_dir = $this->uploadsPath;
            $current_path = isset($_POST['path']) ? str_replace('//', '/', str_replace('../', '', $_POST['path'] . '/')) : '/';
    Severity: Major
    Found in pepiscms/application/controllers/admin/Ajaxfilemanager.php - About 2 hrs to fix

      Method genericthumb has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function genericthumb($absolute = false, $size = 50, $current_path = false)
          {
              if (!$current_path) {
                  $start_word = 'thumb';
                  $pos = strpos($_SERVER['REQUEST_URI'], $start_word);
      Severity: Major
      Found in pepiscms/application/controllers/admin/Ajaxfilemanager.php - About 2 hrs to fix

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

            private function genericthumb($absolute = false, $size = 50, $current_path = false)
            {
                if (!$current_path) {
                    $start_word = 'thumb';
                    $pos = strpos($_SERVER['REQUEST_URI'], $start_word);
        Severity: Minor
        Found in pepiscms/application/controllers/admin/Ajaxfilemanager.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 genericupload has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private function genericupload($current_path = '', $file_field_name = 'file')
            {
                $make_filenames_nice = true;
        
                $error = false;
        Severity: Minor
        Found in pepiscms/application/controllers/admin/Ajaxfilemanager.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 genericupload has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function genericupload($current_path = '', $file_field_name = 'file')
            {
                $make_filenames_nice = true;
        
                $error = false;
        Severity: Minor
        Found in pepiscms/application/controllers/admin/Ajaxfilemanager.php - About 1 hr to fix

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

              public function getfile()
              {
                  $max = $this->uri->total_segments() + 1;
                  $current_path = '';
                  for ($i = 4; $i < $max; $i++) {
          Severity: Minor
          Found in pepiscms/application/controllers/admin/Ajaxfilemanager.php - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status