From 308d928cb7160bd5f0e11df75d08878ff9649561 Mon Sep 17 00:00:00 2001 From: Hamed Panjeh Date: Sat, 16 Dec 2023 18:10:55 -0300 Subject: [PATCH] Refactor --- .../CheckImports/CheckImportReporter.php | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Features/CheckImports/CheckImportReporter.php b/src/Features/CheckImports/CheckImportReporter.php index fa201e2e..e7935bd3 100644 --- a/src/Features/CheckImports/CheckImportReporter.php +++ b/src/Features/CheckImports/CheckImportReporter.php @@ -21,17 +21,31 @@ public static function report($psr4Stats, $foldersStats, $bladeStats, int $route private static function printFileCounts($foldersStats, $bladeStats, int $countRouteFiles): string { $output = ' 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'] ?? []);