bezrukov/php-project-lvl2

View on GitHub

Showing 6 of 6 total issues

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

function makeDiff(array $firstData, array $secondData): array
{
    $keys = array_unique(array_merge(array_keys($firstData), array_keys($secondData)));

    return array_reduce(
Severity: Minor
Found in src/differ.php - About 1 hr to fix

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

    function formatToPretty(array $data, $deep = ''): string
    {
        $view = array_map(
            static function ($elem) use ($deep) {
                switch ($elem['type']) {
    Severity: Minor
    Found in src/Formatters/pretty.php - About 1 hr to fix

      Avoid too many return statements within this method.
      Open

          return "{\n{$joined}\n{$deep}}";
      Severity: Major
      Found in src/Formatters/pretty.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

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

          Avoid too many return statements within this method.
          Open

                              return formatToString(
                                  $elem['key'],
                                  formatToPretty($elem['children'], $deep . INDENTATION),
                                  $deep,
                                  ' '
          Severity: Major
          Found in src/Formatters/pretty.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return "Property '{$ancestry}{$key}' was changed. From '{$oldValue}' to '{$value}'";
            Severity: Major
            Found in src/Formatters/plain.php - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language