hallernsk/php-project-lvl2

View on GitHub

Showing 8 of 8 total issues

Method formatToStylish has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function formatToStylish(array $diffTree, int $depth = 0): array
{
    $indent = getIndent($depth);
    $nextDepth = $depth + 1;
    $result = array_map(function ($node) use ($indent, $nextDepth): string {
Severity: Minor
Found in src/Formatters/Stylish.php - About 1 hr to fix

    Avoid too many return statements within this method.
    Open

        return $result;
    Severity: Major
    Found in src/Formatters/Stylish.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return ['key' => $key, 'type' => 'changed', 'valueOld' => $data1[$key], 'valueNew' => $data2[$key]];
      Severity: Major
      Found in src/DiffTreeBuilder.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return $diffTree;
        Severity: Major
        Found in src/DiffTreeBuilder.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return "{$indent}    {$node['key']}: {" . PHP_EOL .
                               "{$stringNested}" . PHP_EOL . "{$indent}    }";
          Severity: Major
          Found in src/Formatters/Stylish.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return array_filter($result);
            Severity: Major
            Found in src/Formatters/Plain.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return "'{$value}'";
              Severity: Major
              Found in src/Formatters/Plain.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return implode(PHP_EOL, formatToPlain($node['children'], $ancestryPath));
                Severity: Major
                Found in src/Formatters/Plain.php - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language