AlexeyShobanov/php-project-lvl2

View on GitHub

Showing 9 of 9 total issues

Method renderAstForPrettyFormat has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function renderAstForPrettyFormat($ast)
{
    $renderAstForPrettyFormat = function ($ast, $depth) use (&$renderAstForPrettyFormat) {
        $textRepresentationOfNodes = array_reduce(
            $ast,
Severity: Minor
Found in src/formatters/Pretty.php - About 1 hr to fix

    Method renderAstForPlainFormat has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function renderAstForPlainFormat($ast)
    {
        $renderAst = function ($ast, $root) use (&$renderAst) {
            $textRepresentationOfNodes = array_reduce($ast, function ($acc, $node) use ($root, &$renderAst) {
                ['type' => $type, 'key' => $key, 'value' => $value, 'oldValue' => $oldValue] = $node;
    Severity: Minor
    Found in src/formatters/Plain.php - About 1 hr to fix

      Method buildNode has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function buildNode($type, $key, $value, $oldValue = null, $children = [])
      Severity: Minor
      Found in src/Compare.php - About 35 mins to fix

        Avoid too many return statements within this method.
        Open

                                return array_merge(
                                    $acc,
                                    [$indent . '+' . $keyValuePairText],
                                    [$indent . '-' . $keyOldValuePairText]
                                );
        Severity: Major
        Found in src/formatters/Pretty.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return $renderAstForPrettyFormat($ast, 0);
          Severity: Major
          Found in src/formatters/Pretty.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return buildNode('added', $key, $data2[$key]);
            Severity: Major
            Found in src/Compare.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return "{\n{$textRepresentationOfAst}\n{$indent}}";
              Severity: Major
              Found in src/formatters/Pretty.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

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

                  Avoid too many return statements within this method.
                  Open

                      return $iter($obj1, $obj2);
                  Severity: Major
                  Found in src/Compare.php - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language