Skip to content

Commit

Permalink
Merge pull request #273 from HPWebdeveloper/master
Browse files Browse the repository at this point in the history
Refactor printFileCounts method
  • Loading branch information
imanghafoori1 authored Dec 16, 2023
2 parents 71a20d7 + 308d928 commit 5f76758
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/Features/CheckImports/CheckImportReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,31 @@ public static function report($psr4Stats, $foldersStats, $bladeStats, int $route
private static function printFileCounts($foldersStats, $bladeStats, int $countRouteFiles): string
{
$output = ' <fg=blue>Overall:'."</>\n";
$checkedFilesCount = ChecksOnPsr4Classes::$checkedFilesCount;
$checkedFilesCount && $output .= self::getFilesStats($checkedFilesCount);

$bladeStats && ($output .= self::getBladeStats($bladeStats, BladeFiles::$checkedFilesCount));
$foldersStats && ($output .= self::foldersStats($foldersStats));

$output .= self::compileCheckedFilesStats();
$output .= self::compileBladeStats($bladeStats);
$output .= self::compileFolderStats($foldersStats);
$output .= self::getRouteStats($countRouteFiles);

return $output;
}

private static function compileCheckedFilesStats(): string
{
$checkedFilesCount = ChecksOnPsr4Classes::$checkedFilesCount;
return $checkedFilesCount ? self::getFilesStats($checkedFilesCount) : '';
}

private static function compileBladeStats($bladeStats): string
{
return $bladeStats ? self::getBladeStats($bladeStats, BladeFiles::$checkedFilesCount) : '';
}

private static function compileFolderStats($foldersStats): string
{
return $foldersStats ? self::foldersStats($foldersStats) : '';
}


public static function printErrorsCount($errorsList)
{
$wrongUsedClassCount = count($errorsList['wrongClassRef'] ?? []);
Expand Down

0 comments on commit 5f76758

Please sign in to comment.