MT-cod/php-project-lvl2

View on GitHub

Showing 8 of 8 total issues

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

function genDiffFromArrays(array $arr1, array $arr2): array
{
    $mergedAndSortedArrays = mergeAndSortArrays($arr1, $arr2);
    return array_map(function ($nodeData) use ($arr1, $arr2) {
        if (!key_exists($nodeData['nodeKey'], $arr1) && key_exists($nodeData['nodeKey'], $arr2)) {
Severity: Minor
Found in src/GenDiff.php - About 1 hr to fix

    Method stylishMapping has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function stylishMapping(array $resultDiffArr): array
    {
        $stylishResult = array_map(function ($node): array {
            if (array_key_exists('diffStatus', $node)) {
                switch ($node['diffStatus']) {
    Severity: Minor
    Found in src/Formatters/FormatStylish.php - About 1 hr to fix

      Avoid too many return statements within this method.
      Open

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

        Avoid too many return statements within this method.
        Open

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

          Avoid too many return statements within this method.
          Open

                  return [];
          Severity: Major
          Found in src/Formatters/FormatStylish.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return implode("\n", $filteredPlainResultArr);
            Severity: Major
            Found in src/Formatters/FormatPlain.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return '';
              Severity: Major
              Found in src/Formatters/FormatPlain.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return ["  " . $node['nodeKey'] => $childRecurs];
                Severity: Major
                Found in src/Formatters/FormatStylish.php - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language