-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
350e973
commit 160130c
Showing
11 changed files
with
318 additions
and
255 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Imanghafoori\LaravelMicroscope\Features\CheckImports\Reporters; | ||
|
||
class BladeReport | ||
{ | ||
use Reporting; | ||
|
||
/** | ||
* @param array<string, int> $stats | ||
* @param int $filesCount | ||
* @return string | ||
*/ | ||
public static function getBladeStats($stats, $filesCount): string | ||
{ | ||
$output = self::blue($filesCount).'blade'.($filesCount === 0 ? '' : 's'); | ||
foreach ($stats as $path => $count) { | ||
$count && ($output .= self::addLine($path, $count)); | ||
} | ||
|
||
return $output; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Features/CheckImports/Reporters/CheckImportReporter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Imanghafoori\LaravelMicroscope\Features\CheckImports\Reporters; | ||
|
||
class CheckImportReporter | ||
{ | ||
use Reporting; | ||
|
||
public static function totalImportsMsg($refCount) | ||
{ | ||
return '<options=bold;fg=yellow>'.$refCount.' imports were checked under:</>'; | ||
} | ||
|
||
public static function getRouteStats($count) | ||
{ | ||
return self::blue($count).' route'.($count <= 1 ? '' : 's'); | ||
} | ||
|
||
public static function getFilesStats($count) | ||
{ | ||
return self::blue($count).'class'.($count <= 1 ? '' : 'es'); | ||
} | ||
|
||
public static function header(): string | ||
{ | ||
return ' ⬛️ <fg=blue>Overall:</>'; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Features/CheckImports/Reporters/LaravelFoldersReport.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Imanghafoori\LaravelMicroscope\Features\CheckImports\Reporters; | ||
|
||
class LaravelFoldersReport | ||
{ | ||
use Reporting; | ||
|
||
/** | ||
* @param array<string, array<string, array<string, array<int, string>>>> $foldersStats | ||
* @return string | ||
*/ | ||
public static function foldersStats($foldersStats) | ||
{ | ||
$output = ''; | ||
foreach ($foldersStats as $fileType => $stats) { | ||
$total = 0; | ||
foreach ($stats as $dir => $files) { | ||
$total += count($files); | ||
} | ||
|
||
$total && ($output .= self::blue($total).$fileType); | ||
|
||
foreach ($stats as $dir => $files) { | ||
$count = count($files); | ||
$count && ($output .= self::addLine($dir, $count)); | ||
} | ||
|
||
$output .= PHP_EOL; | ||
} | ||
|
||
return trim($output, PHP_EOL); | ||
} | ||
} |
Oops, something went wrong.