5
5
use function Laravel \Prompts \outro ;
6
6
use function Laravel \Prompts \table ;
7
7
use function Laravel \Prompts \warning ;
8
- use function Laravel \Prompts \note ;
9
8
use App \Presenter \Analyze \Summary \SummaryViewModel ;
10
9
11
10
class SummaryView
12
11
{
13
12
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
14
20
{
15
21
count ($ viewModel ->metrics ()) === 0
16
22
? warning ('No classes found ' )
17
23
: $ 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 ()));
24
24
}
25
25
26
26
private function showTable (SummaryViewModel $ viewModel ): void
@@ -31,6 +31,13 @@ private function showTable(SummaryViewModel $viewModel): void
31
31
);
32
32
}
33
33
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
+
34
41
private function showInfo (SummaryViewModel $ viewModel ): void
35
42
{
36
43
$ viewModel ->isHumanReadable ()
@@ -40,7 +47,8 @@ private function showInfo(SummaryViewModel $viewModel): void
40
47
41
48
private function showHumanReadableInfo (): void
42
49
{
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. ' );
44
52
outro ('An unstable and concrete class will likely suffer from side effects caused by its dependencies, making it harder to test. ' );
45
53
outro ('For more information, see the documentation: https://php-quality-tools.com/class-dependencies-analyzer ' );
46
54
}
@@ -63,4 +71,9 @@ private function showMetricsInfo(): void
63
71
outro ('Class with a high abstractness (A close to 1) is totally abstract and should not have any concrete code. ' );
64
72
outro ('See the documentation for more information : https://php-quality-tools.com/class-dependencies-analyzer ' );
65
73
}
74
+
75
+ private function displayCount (SummaryViewModel $ viewModel ): void
76
+ {
77
+ outro (sprintf ('Found %d classes in the given path ' , $ viewModel ->count ()));
78
+ }
66
79
}
0 commit comments