bcit-ci/CodeIgniter

View on GitHub
system/helpers/file_helper.php

Summary

Maintainability
D
1 day
Test Coverage

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

    function get_dir_file_info($source_dir, $top_level_only = TRUE, $_recursion = FALSE)
    {
        static $_filedata = array();
        $relative_path = $source_dir;

Severity: Minor
Found in system/helpers/file_helper.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 get_filenames has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
    {
        static $_filedata = array();

        if ($fp = @opendir($source_dir))
Severity: Minor
Found in system/helpers/file_helper.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 get_file_info has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
    {
        if ( ! file_exists($file))
        {
            return FALSE;
Severity: Minor
Found in system/helpers/file_helper.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 delete_files has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    function delete_files($path, $del_dir = FALSE, $htdocs = FALSE, $_level = 0)
    {
        // Trim the trailing slash
        $path = rtrim($path, '/\\');

Severity: Minor
Found in system/helpers/file_helper.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 symbolic_permissions has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function symbolic_permissions($perms)
    {
        if (($perms & 0xC000) === 0xC000)
        {
            $symbolic = 's'; // Socket
Severity: Minor
Found in system/helpers/file_helper.php - About 1 hr to fix

    Method get_file_info has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
        {
            if ( ! file_exists($file))
            {
                return FALSE;
    Severity: Minor
    Found in system/helpers/file_helper.php - About 1 hr to fix

      Method get_dir_file_info has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function get_dir_file_info($source_dir, $top_level_only = TRUE, $_recursion = FALSE)
          {
              static $_filedata = array();
              $relative_path = $source_dir;
      
      
      Severity: Minor
      Found in system/helpers/file_helper.php - About 1 hr to fix

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

            function symbolic_permissions($perms)
            {
                if (($perms & 0xC000) === 0xC000)
                {
                    $symbolic = 's'; // Socket
        Severity: Minor
        Found in system/helpers/file_helper.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

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

            function write_file($path, $data, $mode = 'wb')
            {
                if ( ! $fp = @fopen($path, $mode))
                {
                    return FALSE;
        Severity: Minor
        Found in system/helpers/file_helper.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 get_mime_by_extension has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            function get_mime_by_extension($filename)
            {
                static $mimes;
        
                if ( ! is_array($mimes))
        Severity: Minor
        Found in system/helpers/file_helper.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

        There are no issues that match your filters.

        Category
        Status