lion0k/project-lvl2-s385

View on GitHub

Showing 6 of 6 total issues

Method makeDiff has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function makeDiff($data1, $data2)
{
    $arrUniqKeys = array_unique(array_merge(array_keys($data1), array_keys($data2)));
    $result = array_reduce($arrUniqKeys, function ($acc, $key) use ($data1, $data2) {
        if (array_key_exists($key, $data1) && array_key_exists($key, $data2)) {
Severity: Minor
Found in src/differ.php - About 1 hr to fix

    Method renderPretty has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function renderPretty($data, $depth = 0)
    {
        $result = array_map(function ($node) use ($depth) {
    
            ['typeInfo' => $typeInfo,
    Severity: Minor
    Found in src/renderer/pretty.php - About 1 hr to fix

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

      function buildMessages($data, $parents = []):array
      {
          $plain = array_reduce($data, function ($acc, $node) use ($parents) {
              $parents[] = $node['nameKey'];
              $parentsPath = implode('.', $parents);
      Severity: Minor
      Found in src/renderer/plain.php - About 1 hr to fix

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

        function buildDataStructure($typeInfo, $nameKey, $oldValue, $newValue, $children = null)
        Severity: Minor
        Found in src/differ.php - About 35 mins to fix

          Avoid too many return statements within this method.
          Open

                          return makeString($depth, 'specialEmpty', $nameKey, renderPretty($children, $depth + 1));
          Severity: Major
          Found in src/renderer/pretty.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return '{' . PHP_EOL . $outStr . addSpace($depth) . '}';
            Severity: Major
            Found in src/renderer/pretty.php - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language