File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -12,25 +12,19 @@ final class GetStargazersCount
1212 public function __construct (
1313 private HttpClient $ httpClient ,
1414 private Cache $ cache ,
15- ) {
16- }
15+ ) {}
1716
1817 public function __invoke (): ?string
1918 {
2019 return $ this ->cache ->resolve (
2120 key: 'tempest-stargazers ' ,
2221 cache: function () {
23- try {
24- $ body = $ this ->httpClient ->get ('https://api.github.com/repos/tempestphp/tempest-framework ' )->body ;
25- $ stargazers = json_decode ($ body )->stargazers_count ?? null ;
22+ $ body = $ this ->httpClient ->get ('https://api.github.com/repos/tempestphp/tempest-framework ' )->body ;
23+ $ stargazers = json_decode ($ body )->stargazers_count ?? null ;
2624
27- return $ stargazers > 999
28- ? (round ($ stargazers / 1000 , 1 ) . 'K ' )
29- : $ stargazers ;
30- } catch (Throwable $ e ) {
31- ll ($ e );
32- return null ;
33- }
25+ return $ stargazers > 999
26+ ? (round ($ stargazers / 1000 , 1 ) . 'K ' )
27+ : $ stargazers ;
3428 },
3529 expiresAt: new DateTimeImmutable ('+12 hours ' ),
3630 );
You can’t perform that action at this time.
0 commit comments