Skip to content

Commit 00c2c77

Browse files
renamed --human-readable option
1 parent a475e73 commit 00c2c77

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

app/Commands/Analyze/AnalyzeCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AnalyzeCommand extends AbstractCommand
1818
{--depth-limit=}
1919
{--debug}
2020
{--info}
21-
{--h : Display human readable metrics}
21+
{--human-readable : Display human readable metrics}
2222
';
2323

2424
protected $description = 'Analyze the given path';

app/Commands/Analyze/Summary/SummarySettingsFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function make(Command $command): SummarySettings
1212
return new SummarySettings(
1313
debug: $command->option('debug'),
1414
info: $command->option('info'),
15-
humanReadable: $command->option('h'),
15+
humanReadable: $command->option('human-readable'),
1616
);
1717
}
1818
}

app/Presenter/Analyze/Summary/SummaryView.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ public function show(SummaryViewModel $viewModel): void
1717

1818
private function displayMetrics(SummaryViewModel $viewModel): void
1919
{
20-
count($viewModel->metrics()) === 0
21-
? warning('No classes found')
22-
: $this->showTable($viewModel);
20+
$viewModel->hasMetrics()
21+
? $this->showMetrics($viewModel)
22+
: warning('No classes found');
2323
}
2424

25-
private function showTable(SummaryViewModel $viewModel): void
25+
private function showMetrics(SummaryViewModel $viewModel): void
2626
{
2727
table(
2828
headers: $viewModel->headers(),
@@ -72,6 +72,7 @@ private function showMetricsInfo(): void
7272
outro('Class with a low instability (I close to 0) is strongly used and probably critical for the application, its business logic must be tested.');
7373
outro('Class with a high instability (I close to 1) can suffer from side effects of its dependencies and must favor abstractions.');
7474
outro('Class with a high abstractness (A close to 1) is totally abstract and should not have any concrete code.');
75+
outro('Try --human-readable to get a more human readable output.');
7576
outro('See the documentation for more information : https://php-quality-tools.com/class-dependencies-analyzer');
7677
}
7778

app/Presenter/Analyze/Summary/SummaryViewModel.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,9 @@ public function count(): int
3838
{
3939
return $this->count;
4040
}
41+
42+
public function hasMetrics(): bool
43+
{
44+
return count($this->metrics) > 0;
45+
}
4146
}

0 commit comments

Comments
 (0)