15
15
use Symfony \Contracts \Cache \CacheInterface ;
16
16
use Symfony \Contracts \HttpClient \HttpClientInterface ;
17
17
18
+ /**
19
+ * @internal
20
+ */
18
21
final class ChangelogProvider
19
22
{
20
23
public function __construct (
@@ -27,26 +30,28 @@ public function getChangelog(int $page = 1): array
27
30
{
28
31
$ changelog = [];
29
32
30
- foreach ($ this ->loadReleases ($ page ) as $ release ) {
33
+ foreach ($ this ->getReleases ($ page ) as $ release ) {
31
34
$ changelog [] = $ release ;
32
35
}
33
36
34
37
return $ changelog ;
35
38
}
36
39
37
- private function loadReleases (int $ page = 1 ): array
40
+ private function getReleases (int $ page = 1 ): array
38
41
{
39
42
return $ this ->cache ->get ('releases-symfony-ux- ' .$ page , function (CacheItemInterface $ item ) use ($ page ) {
40
- $ item ->expiresAfter (3600 );
43
+ $ item ->expiresAfter (604800 ); // 1 week
41
44
42
- return $ this ->getReleases ('symfony ' , 'ux ' , $ page );
45
+ return $ this ->fetchReleases ('symfony ' , 'ux ' , $ page );
43
46
});
44
47
}
45
48
46
49
/**
47
50
* @return array<int, array{id: int, name: string, version: string, date: string, body: string}>
51
+ *
52
+ * @internal
48
53
*/
49
- public function getReleases (string $ owner , string $ repo , int $ page = 1 , int $ perPage = 20 ): array
54
+ private function fetchReleases (string $ owner , string $ repo , int $ page = 1 , int $ perPage = 20 ): array
50
55
{
51
56
$ response = $ this ->httpClient ->request ('GET ' , sprintf ('https://api.github.com/repos/%s/%s/releases ' , $ owner , $ repo ), [
52
57
'query ' => [
0 commit comments