Prionyx/project-lvl2-s197

View on GitHub
src/diffAST.php

Summary

Maintainability
B
6 hrs
Test Coverage

Method getAST has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getAST($content1, $content2)
{
    $nodeTypes = [
      [
        "type" => 'nested',
Severity: Major
Found in src/diffAST.php - About 2 hrs to fix

    Avoid too many return statements within this method.
    Open

                return (in_array($key, array_keys($content1)) && in_array($key, array_keys($content2)) && $content1[$key] === $content2[$key]);
    Severity: Major
    Found in src/diffAST.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return ["type" => 'added', 'key' => $key, 'newValue' => $content2[$key]];
      Severity: Major
      Found in src/diffAST.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

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

          Avoid too many return statements within this method.
          Open

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

            Avoid too many return statements within this method.
            Open

                        return (in_array($key, array_keys($content1)) && !in_array($key, array_keys($content2)));
            Severity: Major
            Found in src/diffAST.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return ["type" => 'removed', 'key' => $key, 'oldValue' => $content1[$key]];
              Severity: Major
              Found in src/diffAST.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return ["type" => 'unchanged', 'key' => $key, 'value' => $content1[$key]];
                Severity: Major
                Found in src/diffAST.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return (!in_array($key, array_keys($content1)) && in_array($key, array_keys($content2)));
                  Severity: Major
                  Found in src/diffAST.php - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status