Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor printFileCounts method #273

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading