Skip to content

Commit 67507e3

Browse files
committed
refactor: use number util
1 parent 29888b7 commit 67507e3

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

composer.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GitHub/GetStargazersCount.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace App\GitHub;
44

5-
use PDO;
65
use Tempest\HttpClient\HttpClient;
6+
use Tempest\Support\Number;
77
use Throwable;
88

99
use function Tempest\env;
@@ -18,9 +18,7 @@ public function __construct(
1818
public function __invoke(): ?string
1919
{
2020
if ($stargazers = $this->getStargazersCount()) {
21-
return $stargazers > 999
22-
? (round($stargazers / 1000, 1) . 'K')
23-
: $stargazers;
21+
return Number\to_human_readable($stargazers, maxPrecision: 1);
2422
}
2523

2624
return null;

0 commit comments

Comments
 (0)