Skip to content

Commit

Permalink
add WiderRegions property to metadata output
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed Feb 7, 2022
1 parent 745c017 commit b3f567f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion LitCalMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,21 @@
$nationalCalendars[$nation] = [];
}
}
$filterDirResults = ['..', '.', 'index.json'];
$dirResults = array_diff( scandir('nations'), $filterDirResults );
$widerRegionsFiles = array_values( array_filter( $dirResults, function($el) {
return !is_dir('nations/' . $el) && pathinfo('nations/' . $el, PATHINFO_EXTENSION) === 'json';
}) );
$widerRegionsNames = array_map( function($el){
return pathinfo('nations/' . $el, PATHINFO_FILENAME);
}, $widerRegionsFiles );

$response = json_encode( [
"LitCalMetadata" => [
"NationalCalendars" => $nationalCalendars,
"DiocesanCalendars" => $diocesanCalendars,
"DiocesanGroups" => $diocesanGroups
"DiocesanGroups" => $diocesanGroups,
"WiderRegions" => $widerRegionsNames
],
], JSON_PRETTY_PRINT );
$responseHash = md5( $response );
Expand Down

0 comments on commit b3f567f

Please sign in to comment.