Skip to content

Commit 81785c5

Browse files
improved rendering of SummaryView
1 parent 9077066 commit 81785c5

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

app/Presenter/Analyze/Summary/SummaryView.php

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
use function Laravel\Prompts\outro;
66
use function Laravel\Prompts\table;
77
use function Laravel\Prompts\warning;
8-
use function Laravel\Prompts\note;
98
use App\Presenter\Analyze\Summary\SummaryViewModel;
109

1110
class SummaryView
1211
{
1312
public function show(SummaryViewModel $viewModel): void
13+
{
14+
$this->displayMetrics($viewModel);
15+
$this->displayInfo($viewModel);
16+
$this->displayCount($viewModel);
17+
}
18+
19+
private function displayMetrics(SummaryViewModel $viewModel): void
1420
{
1521
count($viewModel->metrics()) === 0
1622
? warning('No classes found')
1723
: $this->showTable($viewModel);
18-
19-
$viewModel->needInfo()
20-
? $this->showInfo($viewModel)
21-
: outro('Add --info to get more information on metrics.');
22-
23-
outro(sprintf('Found %d classes in the given path', $viewModel->count()));
2424
}
2525

2626
private function showTable(SummaryViewModel $viewModel): void
@@ -31,6 +31,13 @@ private function showTable(SummaryViewModel $viewModel): void
3131
);
3232
}
3333

34+
private function displayInfo(SummaryViewModel $viewModel): void
35+
{
36+
$viewModel->needInfo()
37+
? $this->showInfo($viewModel)
38+
: outro('Add --info to get more information on metrics.');
39+
}
40+
3441
private function showInfo(SummaryViewModel $viewModel): void
3542
{
3643
$viewModel->isHumanReadable()
@@ -40,7 +47,8 @@ private function showInfo(SummaryViewModel $viewModel): void
4047

4148
private function showHumanReadableInfo(): void
4249
{
43-
outro('A stable and concrete class may be challenging to modify, as it likely does not follow the open/closed principle.');
50+
outro('A stable and concrete class is heavily used by the application and has few abstractions.');
51+
outro('It is probably not open to extension and it will be necessary to modify it to add behaviors.');
4452
outro('An unstable and concrete class will likely suffer from side effects caused by its dependencies, making it harder to test.');
4553
outro('For more information, see the documentation: https://php-quality-tools.com/class-dependencies-analyzer');
4654
}
@@ -63,4 +71,9 @@ private function showMetricsInfo(): void
6371
outro('Class with a high abstractness (A close to 1) is totally abstract and should not have any concrete code.');
6472
outro('See the documentation for more information : https://php-quality-tools.com/class-dependencies-analyzer');
6573
}
74+
75+
private function displayCount(SummaryViewModel $viewModel): void
76+
{
77+
outro(sprintf('Found %d classes in the given path', $viewModel->count()));
78+
}
6679
}

0 commit comments

Comments
 (0)