bluetree-service/filesystem

View on GitHub

Showing 8 of 83 total issues

File Fs.php has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace BlueFilesystem\StaticObjects;

use BlueEvent\Event\Base\Interfaces\EventDispatcherInterface;
Severity: Minor
Found in src/StaticObjects/Fs.php - About 2 hrs to fix

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

        protected function readDirectoryRecursive(string $path, bool $recursive): array
        {
            $list = [];
    
            if (!self::exist($path)) {
    Severity: Minor
    Found in src/StaticObjects/Structure.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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function load()
        {
    //        Loader::callEvent('load_directory_object_instance_before', $this);
    
            if (!Fs::exist($this->getMainPath())) {
    Severity: Minor
    Found in src/Directory.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 returnPathsRecursive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function returnPathsRecursive(array $array): array
        {
            $pathList = [
                'dir' => [],
                'file' => [],
    Severity: Minor
    Found in src/StaticObjects/Structure.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 mkdir has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function mkdir(string $path): array
        {
            $newPath = '';
            $operationList = [];
            $bool = \preg_match(self::RESTRICTED_SYMBOLS, $path);
    Severity: Minor
    Found in src/StaticObjects/Fs.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 buildDirStructure has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            array $dirPaths,
            string $source,
            string $target,
            string $dirToCopy,
            array $operationList
    Severity: Minor
    Found in src/StaticObjects/Fs.php - About 35 mins to fix

      Function rename has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function rename(string $source, string $target, bool $force = false): bool
          {
              $status = true;
      
              self::setForceMode([$source], $force);
      Severity: Minor
      Found in src/StaticObjects/Fs.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

      Function mkfile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function mkfile(string $path, string $fileName, $data = null): bool
          {
              $status = false;
      
              self::triggerEvent(self::CREATE_FILE_BEFORE, [&$path, &$fileName, &$data]);
      Severity: Minor
      Found in src/StaticObjects/Fs.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

      Severity
      Category
      Status
      Source
      Language