Drumsid/php-project-lvl2

View on GitHub

Showing 13 of 13 total issues

Method builder has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function builder(object $objBefore, object $objAfter): array
{
    $unicKey = union(array_keys(get_object_vars($objBefore)), array_keys(get_object_vars($objAfter)));
    $sortedUnicKey = array_values(sortBy($unicKey, function ($key) {
        return $key;
Severity: Minor
Found in src/builder.php - About 1 hr to fix

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

    function stylish(array $tree, int $depth = 0): string
    {
        $indent = str_repeat('    ', $depth);
        $stylishData = array_map(function ($node) use ($indent, $depth): string {
            $type = $node['type'];
    Severity: Minor
    Found in src/formatters/stylish.php - About 1 hr to fix

      Avoid too many return statements within this method.
      Open

              return $acc;
      Severity: Major
      Found in src/formatters/plain.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return [
                        'name' => $key,
                        'type' => 'changed',
                        'valueBefore' => $objBefore->$key,
                        'valueAfter' => $objAfter->$key
        Severity: Major
        Found in src/builder.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return implode("\n", addBrackets($stylishData, $indent));
          Severity: Major
          Found in src/formatters/stylish.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return $plainData;
            Severity: Major
            Found in src/formatters/plain.php - About 30 mins 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 $data;
                Severity: Major
                Found in src/formatters/stylish.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return arrToStr($dataFromObject, $depth);
                  Severity: Major
                  Found in src/formatters/stylish.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

                                  return [
                                      'name' => $key,
                                      'type' => 'unchanged',
                                      'value' => $objBefore->$key
                                  ];
                      Severity: Major
                      Found in src/builder.php - About 30 mins 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 "{$indent}  + {$name}: {$added}";
                          Severity: Major
                          Found in src/formatters/stylish.php - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language