Skip to content

Commit 2c51d51

Browse files
committed
Expose PHP version support states as JSON
1 parent e1dec69 commit 2c51d51

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

releases/states.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
$_SERVER['BASE_PAGE'] = 'releases/active.php';
3+
4+
include_once __DIR__ . '/../include/prepend.inc';
5+
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/branches.inc';
6+
7+
header('Content-Type: application/json; charset=UTF-8');
8+
9+
$states = [];
10+
11+
function formatDate($date = null) {
12+
return $date !== null ? $date->format('c') : null;
13+
}
14+
15+
foreach (get_all_branches() as $major => $releases) {
16+
$states[$major] = [];
17+
foreach ($releases as $branch => $release) {
18+
$states[$major][$branch] = [
19+
'state' => get_branch_support_state($branch),
20+
'initial' => formatDate(get_branch_release_date($branch)),
21+
'until' => formatDate(get_branch_bug_eol_date($branch)),
22+
'eol' => formatDate(get_branch_security_eol_date($branch)),
23+
];
24+
}
25+
krsort($states[$major]);
26+
}
27+
28+
krsort($states);
29+
30+
echo json_encode($states);

0 commit comments

Comments
 (0)