Open JohnRDOrazio opened 4 months ago
Currently refactoring the codebase in the temporary v9
branch, which once stable enough will be pulled into the dev
branch. v9
has nothing to do with a version 9, it's simply an escamotage since the only possible version names useful for testing purposes (the way the LitCal server is set up) are either dev
or v[3-9]
. Not wanting to mess with dev
yet for this feature branch I simply named it v9
temporarily, but it will be pulled into dev
which will become v4
when proven stable.
The situation currently much better on the v9
branch, a lot of refactoring has been done so far.
Here is some more that still needs to be done:
/calendars
endpoint (https://litcal.johnromanodorazio.com/api/v9/calendars):
litcal_metadata
property to litcal_calendars
national_calendars
sub-property to a true collection with properties such as nation
: ITALY
rather than using the country as a property name, and the collection of dioceses under it's own property dioceses
alongside nation
; we could even add a nation_lcl
property with the translation of the name of the nation into the most spoken language of that nation
national_calendars_metadata
property into the national_calendars
property to simplify our output, this way we avoid duplicating the dioceses
toodiocesan_calendars
sub-property to a true collection with properties such as diocese
: DIOCESIDIROMA
rather than using the name of the diocese as a property name. What should happen with the current property diocese
, which contains the nicely formatted name of the diocese? Perhaps rename it to diocese_nice
or diocese_pretty
or diocese_name
or something like that? diocesan_groups
sub-property to diocese_groups
which perhaps is a bit more clear that we are referring to a group of dioceses and not to groups of people within a diocese? And here again we should avoid the name of the diocesan group as a property and instead create a collection, where each result will have properties such as group
and dioceses
wider_regions
sub-property to a collection of objects, or can we just leave it as is, a simple collection? REFACTOREDroman_missals
from this endpoint seeing we have created a specific missals
endpoint?To that end, here are all the places where the property litcal_metadata
is used in this repo (v9
branch at least):
5 results - 3 files
schemas/LitCalMetadata.json:
5 "properties": {
6: "litcal_metadata": {
7 "$ref": "#/definitions/LitCalMetadata"
10 "required": [
11: "litcal_metadata"
12 ],
src/Params/CalendarParams.php:
64 $metadata = json_decode($metadataRaw);
65: if (JSON_ERROR_NONE === json_last_error() && property_exists($metadata, 'litcal_metadata')) {
66: $this->calendars = $metadata->litcal_metadata;
67 } else {
src/Paths/Metadata.php:
91 $response = json_encode([
92: "litcal_metadata" => [
93 "national_calendars" => Metadata::$nationalCalendars,
calendar
endpoint (https://litcal.johnromanodorazio.com/api/v9/calendar):
corpuschristi
=> corpus_christi
returntype
=> return_type
calendartype
=> calendar_type
eternalhighpriest
=> eternal_high_priest
datetime
=> date_time
eventidx
=> event_idx
litcal
should become litcal_calendar
to be more consistent with the naming style of the other endpoints?litcal
needs to be refactored so that it is a true collection of lit_event
objects with a property event_key
that can identify the liturgical event (currently, the property name of the event object)solemnities
and feasts_memorials
(under metadata
) should be refactored as true collections where instead of using the event_key
as the property name, we would create an actual event_key
property in each result in the collectionrequest_headers
can be considered an exception? can we just leave them as? or should we refactor this into a collection where each result will have properties name
and value
? well, maybe we should...This could be tricky to implement, and will require quite a bit of refactoring.
Here are all the places in the v9
repo where ->litcal
shows up:
10 results - 2 files
src/LitTest.php:
85
86: if (false === property_exists($this->dataToTest->litcal, $eventKey)) {
87 $this->setSuccess();
93 $firstErrorMessage = " The event {$eventKey} should exist, instead it was not found";
94: if (property_exists($this->dataToTest->litcal, $eventKey)) {
95: $actualValue = $this->dataToTest->litcal->{$eventKey}->date;
96 $secondErrorMessage = " The event {$eventKey} was expected to have timestamp {$assertion->expected_value}, instead it had timestamp {$actualValue}";
src/Paths/Calendar.php:
2579 if (json_last_error() === JSON_ERROR_NONE && property_exists($this->WiderRegionData, "litcal")) {
2580: foreach ($this->WiderRegionData->litcal as $idx => $value) {
2581 $tag = $value->festivity->tag;
2582: $this->WiderRegionData->litcal[$idx]->festivity->name = $widerRegionI18nData->{ $tag };
2583 }
2889 if ($this->WiderRegionData !== null && property_exists($this->WiderRegionData, "litcal")) {
2890: $this->handleNationalCalendarRows($this->WiderRegionData->litcal);
2891 }
2893 if ($this->NationalData !== null && property_exists($this->NationalData, "litcal")) {
2894: $this->handleNationalCalendarRows($this->NationalData->litcal);
2895 }
3307 {
3308: foreach ($this->DiocesanData->litcal as $key => $obj) {
3309 //if sinceYear is undefined or null or empty, let's go ahead and create the event in any case
3435 $ical .= "X-PUBLISHED-TTL:PT1D\r\n";
3436: foreach ($SerializeableLitCal->litcal as $FestivityKey => $CalEvent) {
3437 $displayGrade = "";
3521
3522: $SerializeableLitCal->litcal = $this->Cal->getFestivities();
3523 $SerializeableLitCal->messages = $this->Messages;
data
directory (sanctorale data, temporale data, decrees data
UPPERCASE
to snake_case
Again this will require quite a bit of work, here are occurrences in the v9
repo just for the GRADE
property:
32 results - 2 files
src/Paths/Calendar.php:
1139 $tempCalSolemnities = array_filter($this->tempCal[ RomanMissal::EDITIO_TYPICA_1970 ], function ($el) {
1140: return $el->GRADE === LitGrade::SOLEMNITY;
1141 });
1143 $currentFeastDate = DateTime::createFromFormat('!j-n-Y', $row->DAY . '-' . $row->MONTH . '-' . $this->CalendarParams->Year, new \DateTimeZone('UTC'));
1144: $tempFestivity = new Festivity($row->NAME, $currentFeastDate, $row->COLOR, LitFeastType::FIXED, $row->GRADE, $row->COMMON);
1145 //A Solemnity impeded in any given year is transferred to the nearest day following designated in nn. 1-8 of the Tables given above ( LY 60 )
1340 $tempCal = array_filter($this->tempCal[ RomanMissal::EDITIO_TYPICA_1970 ], function ($el) {
1341: return $el->GRADE === LitGrade::FEAST_LORD;
1342 });
1345 $currentFeastDate = DateTime::createFromFormat('!j-n-Y', $row->DAY . '-' . $row->MONTH . '-' . $this->CalendarParams->Year, new \DateTimeZone('UTC'));
1346: $festivity = new Festivity($row->NAME, $currentFeastDate, $row->COLOR, LitFeastType::FIXED, $row->GRADE, $row->COMMON);
1347 if ($row->TAG === 'DedicationLateran') {
1470 $tempCal = array_filter($this->tempCal[ RomanMissal::EDITIO_TYPICA_1970 ], function ($el) {
1471: return $el->GRADE === LitGrade::FEAST;
1472 });
1483 if (self::dateIsNotSunday($row->DATE) && !$this->Cal->inSolemnities($row->DATE)) {
1484: $festivity = new Festivity($row->NAME, $row->DATE, $row->COLOR, LitFeastType::FIXED, $row->GRADE, $row->COMMON);
1485 $this->Cal->addFestivity($row->TAG, $festivity);
1631 $message,
1632: $this->LitGrade->i18n($row->GRADE, false),
1633 $row->NAME,
1649 $tempCal = array_filter($this->tempCal[ $missal ], function ($el) use ($grade) {
1650: return $el->GRADE === $grade;
1651 });
1655 if (self::dateIsNotSunday($row->DATE) && $this->Cal->notInSolemnitiesFeastsOrMemorials($row->DATE)) {
1656: $newFestivity = new Festivity($row->NAME, $row->DATE, $row->COLOR, LitFeastType::FIXED, $row->GRADE, $row->COMMON);
1657 //Calendar::debugWrite( "adding new memorial '$row->NAME', common vartype = " . gettype( $row->COMMON ) . ", common = " . implode(', ', $row->COMMON) );
1717 $message,
1718: $this->LitGrade->i18n($row->GRADE, false),
1719 $row->NAME,
1788 $message,
1789: $this->LitGrade->i18n($row->GRADE, false),
1790 $row->NAME,
1825 _('The %1$s \'%2$s\', added on %3$s since the year %4$d (%5$s), is however superseded by a %6$s \'%7$s\' in the year %8$d.'),
1826: $this->LitGrade->i18n($row->festivity->GRADE),
1827 $row->festivity->NAME,
1847 if ($ImmaculateHeart !== null) {
1848: if ((int)$row->GRADE === LitGrade::MEMORIAL) {
1849 if ($currentFeastDate->format('U') === $ImmaculateHeart->date->format('U')) {
1976 $locale = strtoupper(LitLocale::$PRIMARY_LANGUAGE);
1977: if ($row->festivity->GRADE === LitGrade::MEMORIAL_OPT) {
1978 if ($this->Cal->notInSolemnitiesFeastsOrMemorials($row->festivity->DATE)) {
1983 LitFeastType::FIXED,
1984: $row->festivity->GRADE,
1985 $row->festivity->COMMON
1997 _('The %1$s \'%2$s\' has been added on %3$s since the year %4$d (%5$s), applicable to the year %6$d.'),
1998: $this->LitGrade->i18n($row->festivity->GRADE, false),
1999 $row->festivity->NAME,
2044 case "grade":
2045: if ($row->festivity->GRADE > $festivity->grade) {
2046 //example: StMaryMagdalene raised to Feast in 2016
2070 $festivity->name,
2071: $this->LitGrade->i18n($row->festivity->GRADE, false),
2072 $row->metadata->since_year,
2075 );
2076: $this->Cal->setProperty($row->festivity->TAG, "grade", $row->festivity->GRADE);
2077 break;
2148 function ($row) use ($grade) {
2149: return $row->metadata->action !== "makeDoctor" && $row->festivity->GRADE === $grade;
2150 }
2182 LitFeastType::MOBILE,
2183: $row->festivity->GRADE,
2184 $row->festivity->COMMON
2203 _('The %1$s \'%2$s\' has been added on %3$s since the year %4$d (%5$s), applicable to the year %6$d.'),
2204: $this->LitGrade->i18n($row->festivity->GRADE, false),
2205 $row->festivity->NAME,
2214 {
2215: if ($row->festivity->GRADE === LitGrade::MEMORIAL) {
2216 $url = $row->metadata->url;
2242 _('The %1$s \'%2$s\', added on %3$s since the year %4$d (%5$s), is however superseded by the %6$s \'%7$s\' in the year %8$d.'),
2243: $this->LitGrade->i18n($row->festivity->GRADE, false),
2244 '<i>' . $row->festivity->NAME . '</i>',
2271 '<i>' . $coincidingFestivity->name . '</i>',
2272: $this->LitGrade->i18n($row->festivity->GRADE, false),
2273 '<i>' . $row->festivity->NAME . '</i>',
2313 $row = (object)$this->PropriumDeTempore[ "ImmaculateHeart" ];
2314: $row->GRADE = LitGrade::MEMORIAL;
2315 $row->DATE = LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P' . ( 7 * 9 + 6 ) . 'D'));
2349 $row = $this->tempCal[ RomanMissal::EDITIO_TYPICA_1970 ][ 'StJaneFrancesDeChantal' ];
2350: $festivity = new Festivity($row->NAME, $StJaneFrancesNewDate, $row->COLOR, LitFeastType::FIXED, $row->GRADE, $row->COMMON);
2351 $this->Cal->addFestivity("StJaneFrancesDeChantal", $festivity);
2926 LitFeastType::FIXED,
2927: $row->GRADE,
2928 $row->COMMON,
2938 LitFeastType::FIXED,
2939: $row->GRADE,
2940 $row->COMMON,
2960 $this->NationalData->metadata->region . ": " . _('The %1$s \'%2$s\' (%3$s), added to the national calendar in the %4$s, is superseded by the %5$s \'%6$s\' in the year %7$d'),
2961: $row->DISPLAYGRADE !== "" ? $row->DISPLAYGRADE : $this->LitGrade->i18n($row->GRADE, false),
2962 '<i>' . $row->NAME . '</i>',
3008 $row = $this->tempCal[ RomanMissal::EDITIO_TYPICA_1970 ][ $tag ];
3009: $festivity = new Festivity($row->NAME, $newDate, $row->COLOR, LitFeastType::FIXED, $row->GRADE, $row->COMMON);
3010 $this->Cal->addFestivity($tag, $festivity);
src/Paths/Events.php:
470 self::$FestivityCollection[ $key ] = (array) $festivity;
471: self::$FestivityCollection[ $key ][ "GRADE_LCL" ] = self::$LitGrade->i18n($festivity->GRADE, false);
472 self::$FestivityCollection[ $key ][ "COMMON_LCL" ] = self::$LitCommon->c($festivity->COMMON);
propriumdetempore
resource needs to be refactored as a collection, where instead of using the event_key
s as property names we would create an event_key
property for each result in the collection.Here are a number of references to the Proprium de Tempore:
75 results - 5 files
schemas/PropriumDeTempore.json:
2 "$schema": "http://json-schema.org/draft-07/schema#",
3: "title": "PropriumDeTempore",
4 "type": "object",
src/Health.php:
108 API_BASE_PATH . '/calendars/' => LitSchema::METADATA,
109: "data/propriumdetempore.json" => LitSchema::PROPRIUMDETEMPORE,
110 "data/propriumdesanctis_1970/propriumdesanctis_1970.json" => LitSchema::PROPRIUMDESANCTIS,
src/Enum/LitSchema.php:
11 public const PROPRIUMDESANCTIS = self::SCHEMA_BASE_PATH . "/PropriumDeSanctis.json";
12: public const PROPRIUMDETEMPORE = self::SCHEMA_BASE_PATH . "/PropriumDeTempore.json";
13 public const WIDERREGION = self::SCHEMA_BASE_PATH . "/WiderRegionCalendar.json";
23 LitSchema::PROPRIUMDESANCTIS => "Schema validation error: Proprium de Sanctis data not created / updated",
24: LitSchema::PROPRIUMDETEMPORE => "Schema validation error: Proprium de Tempore data not created / updated",
25 LitSchema::WIDERREGION => "Schema validation error: Wider Region data not created / updated",
src/Paths/Calendar.php:
49
50: private array $PropriumDeTempore = [];
51 private array $Messages = [];
530 */
531: private function loadPropriumDeTemporeData(): void
532 {
533 $locale = LitLocale::$PRIMARY_LANGUAGE;
534: $propriumdetemporeFile = "data/propriumdetempore/{$locale}.json";
535: if (file_exists($propriumdetemporeFile)) {
536: $PropriumDeTempore = json_decode(file_get_contents($propriumdetemporeFile), true);
537 if (json_last_error() === JSON_ERROR_NONE) {
538: foreach ($PropriumDeTempore as $key => $event) {
539: $this->PropriumDeTempore[ $key ] = [ "NAME" => $event ];
540 }
654 $HolyThurs = new Festivity(
655: $this->PropriumDeTempore[ "HolyThurs" ][ "NAME" ],
656 LitFunc::calcGregEaster($this->CalendarParams->Year)->sub(new \DateInterval('P3D')),
661 $GoodFri = new Festivity(
662: $this->PropriumDeTempore[ "GoodFri" ][ "NAME" ],
663 LitFunc::calcGregEaster($this->CalendarParams->Year)->sub(new \DateInterval('P2D')),
668 $EasterVigil = new Festivity(
669: $this->PropriumDeTempore[ "EasterVigil" ][ "NAME" ],
670 LitFunc::calcGregEaster($this->CalendarParams->Year)->sub(new \DateInterval('P1D')),
675 $Easter = new Festivity(
676: $this->PropriumDeTempore[ "Easter" ][ "NAME" ],
677 LitFunc::calcGregEaster($this->CalendarParams->Year),
698 $Epiphany = new Festivity(
699: $this->PropriumDeTempore[ "Epiphany" ][ "NAME" ],
700 DateTime::createFromFormat('!j-n-Y', '6-1-' . $this->CalendarParams->Year, new \DateTimeZone('UTC')),
719 $Christmas2 = new Festivity(
720: $this->PropriumDeTempore[ "Christmas2" ][ "NAME" ],
721 $dateTime,
821 $Epiphany = new Festivity(
822: $this->PropriumDeTempore[ "Epiphany" ][ "NAME" ],
823 $dateTime,
838 $Epiphany = new Festivity(
839: $this->PropriumDeTempore[ "Epiphany" ][ "NAME" ],
840 $SundayOfEpiphany,
940 $Christmas = new Festivity(
941: $this->PropriumDeTempore[ "Christmas" ][ "NAME" ],
942 DateTime::createFromFormat('!j-n-Y', '25-12-' . $this->CalendarParams->Year, new \DateTimeZone('UTC')),
960 $Ascension = new Festivity(
961: $this->PropriumDeTempore[ "Ascension" ][ "NAME" ],
962 LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P39D')),
967 $Easter7 = new Festivity(
968: $this->PropriumDeTempore[ "Easter7" ][ "NAME" ],
969 LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P' . ( 7 * 6 ) . 'D')),
976 $Ascension = new Festivity(
977: $this->PropriumDeTempore[ "Ascension" ][ "NAME" ],
978 LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P' . ( 7 * 6 ) . 'D')),
986 $Pentecost = new Festivity(
987: $this->PropriumDeTempore[ "Pentecost" ][ "NAME" ],
988 LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P' . ( 7 * 7 ) . 'D')),
1001 $Advent4Date = DateTime::createFromFormat('!j-n-Y', '25-12-' . $this->CalendarParams->Year, new \DateTimeZone('UTC'))->modify('last Sunday');
1002: $this->Cal->addFestivity("Advent1", new Festivity($this->PropriumDeTempore[ "Advent1" ][ "NAME" ], $Advent1Date, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1003: $this->Cal->addFestivity("Advent2", new Festivity($this->PropriumDeTempore[ "Advent2" ][ "NAME" ], $Advent2Date, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1004: $this->Cal->addFestivity("Advent3", new Festivity($this->PropriumDeTempore[ "Advent3" ][ "NAME" ], $Advent3Date, LitColor::PINK, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1005: $this->Cal->addFestivity("Advent4", new Festivity($this->PropriumDeTempore[ "Advent4" ][ "NAME" ], $Advent4Date, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1006 $Lent1Date = LitFunc::calcGregEaster($this->CalendarParams->Year)->sub(new \DateInterval('P' . ( 6 * 7 ) . 'D'));
1010 $Lent5Date = LitFunc::calcGregEaster($this->CalendarParams->Year)->sub(new \DateInterval('P' . ( 2 * 7 ) . 'D'));
1011: $this->Cal->addFestivity("Lent1", new Festivity($this->PropriumDeTempore[ "Lent1" ][ "NAME" ], $Lent1Date, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1012: $this->Cal->addFestivity("Lent2", new Festivity($this->PropriumDeTempore[ "Lent2" ][ "NAME" ], $Lent2Date, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1013: $this->Cal->addFestivity("Lent3", new Festivity($this->PropriumDeTempore[ "Lent3" ][ "NAME" ], $Lent3Date, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1014: $this->Cal->addFestivity("Lent4", new Festivity($this->PropriumDeTempore[ "Lent4" ][ "NAME" ], $Lent4Date, LitColor::PINK, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1015: $this->Cal->addFestivity("Lent5", new Festivity($this->PropriumDeTempore[ "Lent5" ][ "NAME" ], $Lent5Date, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1016 $PalmSunDate = LitFunc::calcGregEaster($this->CalendarParams->Year)->sub(new \DateInterval('P7D'));
1022 $TrinityDate = LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P' . ( 7 * 8 ) . 'D'));
1023: $this->Cal->addFestivity("PalmSun", new Festivity($this->PropriumDeTempore[ "PalmSun" ][ "NAME" ], $PalmSunDate, LitColor::RED, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1024: $this->Cal->addFestivity("Easter2", new Festivity($this->PropriumDeTempore[ "Easter2" ][ "NAME" ], $Easter2Date, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1025: $this->Cal->addFestivity("Easter3", new Festivity($this->PropriumDeTempore[ "Easter3" ][ "NAME" ], $Easter3Date, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1026: $this->Cal->addFestivity("Easter4", new Festivity($this->PropriumDeTempore[ "Easter4" ][ "NAME" ], $Easter4Date, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1027: $this->Cal->addFestivity("Easter5", new Festivity($this->PropriumDeTempore[ "Easter5" ][ "NAME" ], $Easter5Date, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1028: $this->Cal->addFestivity("Easter6", new Festivity($this->PropriumDeTempore[ "Easter6" ][ "NAME" ], $Easter6Date, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1029: $this->Cal->addFestivity("Trinity", new Festivity($this->PropriumDeTempore[ "Trinity" ][ "NAME" ], $TrinityDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY));
1030 if ($this->CalendarParams->CorpusChristi === CorpusChristi::THURSDAY) {
1031 $CorpusChristi = new Festivity(
1032: $this->PropriumDeTempore[ "CorpusChristi" ][ "NAME" ],
1033 LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P' . ( 7 * 8 + 4 ) . 'D')),
1041 $CorpusChristi = new Festivity(
1042: $this->PropriumDeTempore[ "CorpusChristi" ][ "NAME" ],
1043 LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P' . ( 7 * 9 ) . 'D')),
1052 if ($this->CalendarParams->Locale === LitLocale::LATIN) {
1053: $divineMercySunday = $this->PropriumDeTempore[ "Easter2" ][ "NAME" ]
1054 . " vel Dominica Divinæ Misericordiæ";
1057 $or = _("or");
1058: $divineMercySunday = $this->PropriumDeTempore[ "Easter2" ][ "NAME" ]
1059 . " $or "
1068 {
1069: $AshWednesday = new Festivity($this->PropriumDeTempore[ "AshWednesday" ][ "NAME" ], LitFunc::calcGregEaster($this->CalendarParams->Year)->sub(new \DateInterval('P46D')), LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1070 $this->Cal->addFestivity("AshWednesday", $AshWednesday);
1078 $WedHolyWeekDate = LitFunc::calcGregEaster($this->CalendarParams->Year)->sub(new \DateInterval('P4D'));
1079: $MonHolyWeek = new Festivity($this->PropriumDeTempore[ "MonHolyWeek" ][ "NAME" ], $MonHolyWeekDate, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1080: $TueHolyWeek = new Festivity($this->PropriumDeTempore[ "TueHolyWeek" ][ "NAME" ], $TueHolyWeekDate, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1081: $WedHolyWeek = new Festivity($this->PropriumDeTempore[ "WedHolyWeek" ][ "NAME" ], $WedHolyWeekDate, LitColor::PURPLE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1082 $this->Cal->addFestivity("MonHolyWeek", $MonHolyWeek);
1095 $SatOctaveEasterDate = LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P6D'));
1096: $MonOctaveEaster = new Festivity($this->PropriumDeTempore[ "MonOctaveEaster" ][ "NAME" ], $MonOctaveEasterDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1097: $TueOctaveEaster = new Festivity($this->PropriumDeTempore[ "TueOctaveEaster" ][ "NAME" ], $TueOctaveEasterDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1098: $WedOctaveEaster = new Festivity($this->PropriumDeTempore[ "WedOctaveEaster" ][ "NAME" ], $WedOctaveEasterDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1099: $ThuOctaveEaster = new Festivity($this->PropriumDeTempore[ "ThuOctaveEaster" ][ "NAME" ], $ThuOctaveEasterDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1100: $FriOctaveEaster = new Festivity($this->PropriumDeTempore[ "FriOctaveEaster" ][ "NAME" ], $FriOctaveEasterDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1101: $SatOctaveEaster = new Festivity($this->PropriumDeTempore[ "SatOctaveEaster" ][ "NAME" ], $SatOctaveEasterDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::HIGHER_SOLEMNITY);
1102
1113 $SacredHeartDate = LitFunc::calcGregEaster($this->CalendarParams->Year)->add(new \DateInterval('P' . ( 7 * 9 + 5 ) . 'D'));
1114: $SacredHeart = new Festivity($this->PropriumDeTempore[ "SacredHeart" ][ "NAME" ], $SacredHeartDate, LitColor::RED, LitFeastType::MOBILE, LitGrade::SOLEMNITY);
1115 $this->Cal->addFestivity("SacredHeart", $SacredHeart);
1118 $ChristKingDate = DateTime::createFromFormat('!j-n-Y', '25-12-' . $this->CalendarParams->Year, new \DateTimeZone('UTC'))->modify('last Sunday')->sub(new \DateInterval('P' . ( 4 * 7 ) . 'D'));
1119: $ChristKing = new Festivity($this->PropriumDeTempore[ "ChristKing" ][ "NAME" ], $ChristKingDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::SOLEMNITY);
1120 $this->Cal->addFestivity("ChristKing", $ChristKing);
1126 $MotherGod = new Festivity(
1127: $this->PropriumDeTempore[ "MotherGod" ][ "NAME" ],
1128 DateTime::createFromFormat(
1331 $BaptismLordDate = DateTime::createFromFormat('!j-n-Y', $this->BaptismLordFmt, new \DateTimeZone('UTC'))->modify($this->BaptismLordMod);
1332: $BaptismLord = new Festivity($this->PropriumDeTempore[ "BaptismLord" ][ "NAME" ], $BaptismLordDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::FEAST_LORD);
1333 $this->Cal->addFestivity("BaptismLord", $BaptismLord);
1356 $holyFamilyDate = DateTime::createFromFormat('!j-n-Y', '30-12-' . $this->CalendarParams->Year, new \DateTimeZone('UTC'));
1357: $HolyFamily = new Festivity($this->PropriumDeTempore[ "HolyFamily" ][ "NAME" ], $holyFamilyDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::FEAST_LORD);
1358 $this->Messages[] = sprintf(
1370 $holyFamilyDate = DateTime::createFromFormat('!j-n-Y', '25-12-' . $this->CalendarParams->Year, new \DateTimeZone('UTC'))->modify('next Sunday');
1371: $HolyFamily = new Festivity($this->PropriumDeTempore[ "HolyFamily" ][ "NAME" ], $holyFamilyDate, LitColor::WHITE, LitFeastType::MOBILE, LitGrade::FEAST_LORD);
1372 }
1420 if (!$this->Cal->inSolemnities($firstOrdinary)) {
1421: $this->Cal->addFestivity("OrdSunday" . $ordSun, new Festivity($this->PropriumDeTempore[ "OrdSunday" . $ordSun ][ "NAME" ], $firstOrdinary, LitColor::GREEN, LitFeastType::MOBILE, LitGrade::FEAST_LORD));
1422 } else {
1425 _('\'%1$s\' is superseded by the %2$s \'%3$s\' in the year %4$d.'),
1426: $this->PropriumDeTempore[ "OrdSunday" . $ordSun ][ "NAME" ],
1427 $this->Cal->solemnityFromDate($firstOrdinary)->grade > LitGrade::SOLEMNITY ? '<i>' . $this->LitGrade->i18n($this->Cal->solemnityFromDate($firstOrdinary)->grade, false) . '</i>' : $this->LitGrade->i18n($this->Cal->solemnityFromDate($firstOrdinary)->grade, false),
1453 if (!$this->Cal->inSolemnities($lastOrdinary)) {
1454: $this->Cal->addFestivity("OrdSunday" . $ordSun, new Festivity($this->PropriumDeTempore[ "OrdSunday" . $ordSun ][ "NAME" ], $lastOrdinary, LitColor::GREEN, LitFeastType::MOBILE, LitGrade::FEAST_LORD));
1455 } else {
1458 _('\'%1$s\' is superseded by the %2$s \'%3$s\' in the year %4$d.'),
1459: $this->PropriumDeTempore[ "OrdSunday" . $ordSun ][ "NAME" ],
1460 $this->Cal->solemnityFromDate($lastOrdinary)->grade > LitGrade::SOLEMNITY ? '<i>' . $this->LitGrade->i18n($this->Cal->solemnityFromDate($lastOrdinary)->grade, false) . '</i>' : $this->LitGrade->i18n($this->Cal->solemnityFromDate($lastOrdinary)->grade, false),
2300 new Festivity(
2301: $this->PropriumDeTempore[ "ImmaculateHeart" ][ "NAME" ],
2302 $row->DATE,
2312 } else {
2313: $row = (object)$this->PropriumDeTempore[ "ImmaculateHeart" ];
2314 $row->GRADE = LitGrade::MEMORIAL;
3070
3071: $this->loadPropriumDeTemporeData();
3072 /**
src/Paths/Events.php:
334
335: private function processPropriumDeTemporeData(): void
336 {
337: $DataFile = 'data/propriumdetempore.json';
338: $I18nFile = 'data/propriumdetempore/' . $this->EventsParams->Locale . ".json";
339 if (!file_exists($DataFile) || !file_exists($I18nFile)) {
556 $this->processMissalData();
557: $this->processPropriumDeTemporeData();
558 $this->processMemorialsFromDecreesData();
There currently is no consistency in the casing of property names in our JSON resources and JSON output. The project was built piecemeal, but it's perhaps time to clean it up with a consistent use of casing so that developers will know what to expect.
While Google recommends to use
camelCase
for property names in JSON APIs (see the Google JSON style guide), most APIs today are usingsnake_case
:So we should refactor the codebase to use the most common format being adopted, which in this case is
snake_case
.As for XML element names, there again isn't really a consensus on the casing:
Considering that the majority of the recommendations is to use
PascalCase
for elements and types, andcamelCase
for attributes, we will adopt this convention for XML.