Showing 7 of 11 total issues

File has 34 functions (exceeds 20 allowed). Consider refactoring.
Open

class File
{
    const DS = DIRECTORY_SEPARATOR;
    
    private $path;
Severity: Minor
Found in src/File.php - About 4 hrs to fix

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

        public static function write(string $filename, array $data, string $line_end = "\r\n")
        {
            $fp = fopen($filename, 'w');
            if (!$fp){
                throw new FileOpenException(new File($filename));
    Severity: Minor
    Found in src/Util/IniFileWriter.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

    Function listFiles has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        public function listFiles( $filter = NULL ) : array
        {
            $path = $this->path;
    
            if ( !file_exists($path) )    return [];
    Severity: Minor
    Found in src/File.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

    Function removeDirectoryRecursive has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function removeDirectoryRecursive(string $path) : bool
        {
            if ( !file_exists($path) ){
                return true;
            }
    Severity: Minor
    Found in src/File.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 write has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function write(string $filename, array $data, string $line_end = "\r\n")
        {
            $fp = fopen($filename, 'w');
            if (!$fp){
                throw new FileOpenException(new File($filename));
    Severity: Minor
    Found in src/Util/IniFileWriter.php - About 1 hr to fix

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

          public function listFiles( $filter = NULL ) : array
          {
              $path = $this->path;
      
              if ( !file_exists($path) )    return [];
      Severity: Minor
      Found in src/File.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                return @rmdir($path);
        Severity: Major
        Found in src/File.php - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language