diff --git a/LitCalHealth.php b/LitCalHealth.php index 79b058d8..16108ba0 100644 --- a/LitCalHealth.php +++ b/LitCalHealth.php @@ -2,329 +2,363 @@ error_reporting(E_ALL); ini_set("display_errors", 1); -include_once( 'includes/enums/AcceptHeader.php' ); include_once( 'includes/enums/LitSchema.php' ); -include_once( 'includes/enums/RequestMethod.php' ); -include_once( 'includes/enums/RequestContentType.php' ); -include_once( 'includes/enums/ReturnType.php' ); -include_once( 'includes/APICore.php' ); include_once( 'tests/NativityJohnBaptistTest.php' ); include_once( 'tests/StJaneFrancesDeChantalTest.php' ); include_once( 'vendor/autoload.php' ); use Swaggest\JsonSchema\InvalidValue; use Swaggest\JsonSchema\Schema; +use Ratchet\MessageComponentInterface; +use Ratchet\ConnectionInterface; -if( file_exists("allowedOrigins.php") ) { - include_once( 'allowedOrigins.php' ); -} +class LitCalHealth implements MessageComponentInterface { + protected $clients; -$allowedOrigins = [ - "https://johnromanodorazio.com", - "https://www.johnromanodorazio.com", - "https://litcal.johnromanodorazio.com", - "https://litcal-staging.johnromanodorazio.com" -]; + public function onOpen(ConnectionInterface $conn) { + // Store the new connection to send messages to later + $this->clients->attach($conn); -if( defined('ALLOWED_ORIGINS') && is_array( ALLOWED_ORIGINS ) ) { - $allowedOrigins = array_merge( $allowedOrigins, ALLOWED_ORIGINS ); -} + echo "New connection! ({$conn->resourceId})\n"; + } -$LitCalHealth = new LitCalHealth(); + public function onMessage(ConnectionInterface $from, $msg) { + echo sprintf('Receiving message "%s" from connection %d', $msg, $from->resourceId); + $messageReceived = json_decode( $msg ); + if( json_last_error() === JSON_ERROR_NONE ) { + if( property_exists( $messageReceived, 'action' ) ) { + switch( $messageReceived->action ) { + case 'executeValidation': + if( property_exists( $messageReceived, 'validate' ) ) { + $this->executeValidation( $messageReceived->validate, $from ); + } + break; + case 'validateCalendar': + if( + property_exists( $messageReceived, 'category' ) && + property_exists( $messageReceived, 'year' ) && + property_exists( $messageReceived, 'calendar' ) + ) { + $this->validateCalendar( $messageReceived->calendar, $messageReceived->year, $messageReceived->category, $from ); + } + break; + case 'executeUnitTest': + if( + property_exists( $messageReceived, 'category' ) && + property_exists( $messageReceived, 'year' ) + ) { + $this->executeUnitTest( $messageReceived->category, $messageReceived->year, $from ); + } + default: + $message = new stdClass(); + $message->type = "echobot"; + $message->text = $msg; + $this->sendMessage( $from, $message ); + } + } + } -$LitCalHealth->APICore->setAllowedOrigins( $allowedOrigins ); -$LitCalHealth->APICore->setAllowedReferers( array_map( function($el){ return $el . "/"; }, $allowedOrigins ) ); + } -$LitCalHealth->APICore->setAllowedAcceptHeaders( [ AcceptHeader::JSON ] ); -$LitCalHealth->APICore->setAllowedRequestContentTypes( [ RequestContentType::JSON, RequestContentType::FORMDATA ] ); -$LitCalHealth->APICore->setAllowedRequestMethods( [ RequestMethod::GET, RequestMethod::POST, RequestMethod::OPTIONS ] ); -$LitCalHealth->Init(); + public function onClose(ConnectionInterface $conn) { + // The connection is closed, remove it, as we can no longer send it messages + $this->clients->detach($conn); + echo "Connection {$conn->resourceId} has disconnected\n"; + } -class LitCalHealth { + public function onError(ConnectionInterface $conn, \Exception $e) { + echo "An error has occurred: {$e->getMessage()}\n"; + $conn->close(); + } - const DataSchema = [ - "data/memorialsFromDecrees/memorialsFromDecrees.json" => LitSchema::DECREEMEMORIALS, - "data/propriumdesanctis_1970/propriumdesanctis_1970.json" => LitSchema::PROPRIUMDESANCTIS, - "data/propriumdesanctis_2002/propriumdesanctis_2002.json" => LitSchema::PROPRIUMDESANCTIS, - "data/propriumdesanctis_2008/propriumdesanctis_2008.json" => LitSchema::PROPRIUMDESANCTIS, + private function sendMessage( ConnectionInterface $from, string|stdClass $msg ) { + if( gettype( $msg ) !== 'string' ) { + $msg = json_encode( $msg ); + } + foreach ($this->clients as $client) { + if ($from === $client) { + // The message from sender will be echoed back only to the sender, not to other clients + $client->send($msg); + } + } + } + + + const SchemaValidation = [ + "LitCalMetadata" => "https://litcal.johnromanodorazio.com/api/dev/LitCalMetadata.php", + "PropriumDeTempore" => "data/propriumdetempore.json", + "PropriumDeSanctis1970" => "data/propriumdesanctis_1970/propriumdesanctis_1970.json", + "PropriumDeSanctis2002" => "data/propriumdesanctis_2002/propriumdesanctis_2002.json", + "PropriumDeSanctis2008" => "data/propriumdesanctis_2008/propriumdesanctis_2008.json", + "PropriumDeSanctisITALY1983" => "data/propriumdesanctis_ITALY_1983/propriumdesanctis_ITALY_1983.json", + "PropriumDeSanctisUSA2011" => "data/propriumdesanctis_USA_2011/propriumdesanctis_USA_2011.json", + "MemorialsFromDecrees" => "data/memorialsFromDecrees/memorialsFromDecrees.json", + "RegionalCalendarsIndex" => "nations/index.json" + ]; + + const DataPathToSchema = [ + "https://litcal.johnromanodorazio.com/api/dev/LitCalMetadata.php" => LitSchema::METADATA, + "data/propriumdetempore.json" => LitSchema::PROPRIUMDETEMPORE, + "data/propriumdesanctis_1970/propriumdesanctis_1970.json" => LitSchema::PROPRIUMDESANCTIS, + "data/propriumdesanctis_2002/propriumdesanctis_2002.json" => LitSchema::PROPRIUMDESANCTIS, + "data/propriumdesanctis_2008/propriumdesanctis_2008.json" => LitSchema::PROPRIUMDESANCTIS, "data/propriumdesanctis_ITALY_1983/propriumdesanctis_ITALY_1983.json" => LitSchema::PROPRIUMDESANCTIS, "data/propriumdesanctis_USA_2011/propriumdesanctis_USA_2011.json" => LitSchema::PROPRIUMDESANCTIS, - "data/propriumdetempore.json" => LitSchema::PROPRIUMDETEMPORE, - "nations/index.json" => LitSchema::INDEX, - "https://litcal.johnromanodorazio.com/api/dev/LitCalMetadata.php" => LitSchema::METADATA + "data/memorialsFromDecrees/memorialsFromDecrees.json" => LitSchema::DECREEMEMORIALS, + "nations/index.json" => LitSchema::INDEX ]; const LitCalBaseUrl = "https://litcal.johnromanodorazio.com/api/dev/LitCalEngine.php"; - public APICore $APICore; private object $CalendarData; - public function __construct(){ - $this->APICore = new APICore(); - $this->RESPONSE = new stdClass(); - $this->RESPONSE->requestHeadersReceived = $this->APICore->getJsonEncodedRequestHeaders(); + public function __construct() { + $this->clients = new \SplObjectStorage; } - private function executeValidations() { - $MetadataIsValid = false; - $Metadata = new stdClass(); - $result = new stdClass(); - $result->messages = []; - foreach( LitCalHealth::DataSchema as $dataPath => $schema ) { + private function executeValidation( string $validate, ConnectionInterface $to ) { + if( array_key_exists( $validate, LitCalHealth::SchemaValidation ) ) { + $dataPath = LitCalHealth::SchemaValidation[ $validate ]; + $schema = LitCalHealth::DataPathToSchema[ $dataPath ]; $data = file_get_contents( $dataPath ); if( $data !== false ) { $message = new stdClass(); $message->type = "success"; $message->text = "The Data file $dataPath exists"; - $result->messages[] = $message; + $message->classes = ".$validate.file-exists"; + $this->sendMessage( $to, $message ); $jsonData = json_decode( $data ); if( json_last_error() === JSON_ERROR_NONE ) { $message = new stdClass(); $message->type = "success"; $message->text = "The Data file $dataPath was successfully decoded as JSON"; - $result->messages[] = $message; + $message->classes = ".$validate.json-valid"; + $this->sendMessage( $to, $message ); $validationResult = $this->validateDataAgainstSchema( $jsonData, $schema ); if( gettype( $validationResult ) === 'boolean' && $validationResult === true ) { - if( $schema === LitSchema::METADATA ) { - $MetadataIsValid = true; - $Metadata = $jsonData->LitCalMetadata; - } $message = new stdClass(); $message->type = "success"; $message->text = "The Data file $dataPath was successfully validated against the Schema $schema"; - $result->messages[] = $message; + $message->classes = ".$validate.schema-valid"; + $this->sendMessage( $to, $message ); } else if( gettype( $validationResult === 'object' ) ) { - $result->messages[] = $validationResult; + $validationResult->classes = ".$validate.schema-valid"; + $this->sendMessage( $to, $validationResult ); } } else { $message = new stdClass(); $message->type = "error"; $message->text = "There was an error decoding the Data file $dataPath as JSON: " . json_last_error_msg(); - $result->messages[] = $message; + $message->classes = ".$validate.json-valid"; + $this->sendMessage( $to, $message ); } } else { $message = new stdClass(); $message->type = "error"; $message->text = "Data file $dataPath does not exist"; - $result->messages[] = $message; - } - } - if( $MetadataIsValid ) { - $NationalCalendars = []; - $DiocesanCalendars = []; - $Years = []; - foreach( $Metadata->NationalCalendars as $key => $value ){ - array_push( $NationalCalendars, $key ); - array_push( $DiocesanCalendars, ...$value ); - } - $twentyYearsFromNow = (int)date("Y") + 20; - for( $i=10; $i>0; $i-- ) { - array_push( $Years, rand(1970,$twentyYearsFromNow) ); + $message->classes = ".$validate.file-exists"; + $this->sendMessage( $to, $message ); } + } else { + $message = new stdClass(); + $message->type = "error"; + $message->text = "The validation requested \"{$validate}\" does not seem to be a supported validation"; + $this->sendMessage( $to, $message ); } - $result = $this->validateCalendars( $NationalCalendars, $Years, 'nationalcalendar', $result ); - $result = $this->validateCalendars( $DiocesanCalendars, $Years, 'diocesancalendar', $result ); - $result = $this->testJohnBaptist( $NationalCalendars, [2022, 2033, 2044], 'nationalcalendar', $result ); - $result = $this->testJohnBaptist( $DiocesanCalendars, [2022, 2033, 2044], 'diocesancalendar', $result ); - $result = $this->testStJaneFrancesDeChantalMoved( $NationalCalendars, [2001, 2002, 2010], 'nationalcalendar', $result, 'movedornot' ); - $result = $this->testStJaneFrancesDeChantalMoved( $DiocesanCalendars, [2001, 2002, 2010], 'diocesancalendar', $result, 'movedornot' ); - $yearsOverridden = [ - 1971, - 1976, - 1982, - 1993, - 1999, - 2012, - 2018, - 2029, - 2035, - 2040, - 2046 - ]; - $result = $this->testStJaneFrancesDeChantalMoved( $NationalCalendars, $yearsOverridden, 'nationalcalendar', $result, 'overridden' ); - $result = $this->testStJaneFrancesDeChantalMoved( $DiocesanCalendars, $yearsOverridden, 'diocesancalendar', $result, 'overridden' ); - die( json_encode( $result ) ); } - private function validateCalendars( array $Calendars, array $Years, string $type, object $result ) : object { - foreach( $Calendars as $Calendar ) { - foreach( $Years as $Year ) { - if( $Calendar === 'VATICAN' ) { - $req = "?year=$Year"; - } else { - $req = "?$type=$Calendar&year=$Year"; - } - $data = file_get_contents( self::LitCalBaseUrl . $req ); - if( $data !== false ) { + private function validateCalendar( string $Calendar, int $Year, string $type, ConnectionInterface $to ) : void { + if( $Calendar === 'VATICAN' ) { + $req = "?year=$Year"; + } else { + $req = "?$type=$Calendar&year=$Year"; + } + $data = file_get_contents( self::LitCalBaseUrl . $req ); + if( $data !== false ) { + $message = new stdClass(); + $message->type = "success"; + $message->text = "The $type of $Calendar for the year $Year exists"; + $message->classes = ".calendar-$Calendar.file-exists.year-$Year"; + $this->sendMessage( $to, $message ); + + $jsonData = json_decode( $data ); + if( json_last_error() === JSON_ERROR_NONE ) { + $message = new stdClass(); + $message->type = "success"; + $message->text = "The $type of $Calendar for the year $Year was successfully decoded as JSON"; + $message->classes = ".calendar-$Calendar.json-valid.year-$Year"; + $this->sendMessage( $to, $message ); + + $validationResult = $this->validateDataAgainstSchema( $jsonData, LitSchema::LITCAL ); + if( gettype( $validationResult ) === 'boolean' && $validationResult === true ) { $message = new stdClass(); $message->type = "success"; - $message->text = "The $type of $Calendar for the year $Year exists"; - $result->messages[] = $message; - - $jsonData = json_decode( $data ); - if( json_last_error() === JSON_ERROR_NONE ) { - $message = new stdClass(); - $message->type = "success"; - $message->text = "The $type of $Calendar for the year $Year was successfully decoded as JSON"; - $result->messages[] = $message; - - $validationResult = $this->validateDataAgainstSchema( $jsonData, LitSchema::LITCAL ); - if( gettype( $validationResult ) === 'boolean' && $validationResult === true ) { - $message = new stdClass(); - $message->type = "success"; - $message->text = "The $type of $Calendar for the year $Year was successfully validated against the Schema " . LitSchema::LITCAL; - $result->messages[] = $message; - } - else if( gettype( $validationResult === 'object' ) ) { - $result->messages[] = $validationResult; - } - } else { - $message = new stdClass(); - $message->type = "error"; - $message->text = "There was an error decoding the $type of $Calendar for the year $Year from the URL " . self::LitCalBaseUrl . $req . " as JSON: " . json_last_error_msg(); - $result->messages[] = $message; - } - } else { - $message = new stdClass(); - $message->type = "error"; - $message->text = "The $type of $Calendar for the year $Year does not exist at the URL " . self::LitCalBaseUrl . $req; - $result->messages[] = $message; + $message->text = "The $type of $Calendar for the year $Year was successfully validated against the Schema " . LitSchema::LITCAL; + $message->classes = ".calendar-$Calendar.schema-valid.year-$Year"; + $this->sendMessage( $to, $message ); + } + else if( gettype( $validationResult === 'object' ) ) { + $validationResult->classes = ".calendar-$Calendar.schema-valid.year-$Year"; + $this->sendMessage( $to, $validationResult ); } + } else { + $message = new stdClass(); + $message->type = "error"; + $message->text = "There was an error decoding the $type of $Calendar for the year $Year from the URL " . self::LitCalBaseUrl . $req . " as JSON: " . json_last_error_msg(); + $message->classes = ".calendar-$Calendar.json-valid.year-$Year"; + $this->sendMessage( $to, $message ); } + } else { + $message = new stdClass(); + $message->type = "error"; + $message->text = "The $type of $Calendar for the year $Year does not exist at the URL " . self::LitCalBaseUrl . $req; + $message->classes = ".calendar-$Calendar.file-exists.year-$Year"; + $this->sendMessage( $to, $message ); } - return $result; } - private function testJohnBaptist( array $Calendars, array $Years, string $type, object $result ) : object { - foreach( $Calendars as $Calendar ) { - foreach( $Years as $Year ) { - if( $Calendar === 'VATICAN' ) { - $req = "?year=$Year"; - } else { - $req = "?$type=$Calendar&year=$Year"; - } - $data = file_get_contents( self::LitCalBaseUrl . $req ); - if( $data !== false ) { + private function executeUnitTest( string $test, int $year, ConnectionInterface $to ) { + switch( $test ) { + case 'testJohnBaptist': + $this->testJohnBaptist( $year, $to ); + break; + case 'testStJaneFrancesDeChantalMoved': + $this->testStJaneFrancesDeChantalMoved( $year, $to, 'StJaneFrancesDeChantalMoved' ); + break; + case 'testStJaneFrancesDeChantalOverridden': + $this->testStJaneFrancesDeChantalMoved( $year, $to, 'StJaneFrancesDeChantalOverridden' ); + break; + } + } + + private function testJohnBaptist( int $Year, ConnectionInterface $to ) : void { + $req = "?year=$Year"; + $data = file_get_contents( self::LitCalBaseUrl . $req ); + if( $data !== false ) { + $message = new stdClass(); + $message->type = "success"; + $message->text = "The Universal Calendar for the year $Year exists"; + $message->classes = ".nativityjohnbaptist.year-{$Year}.file-exists"; + $this->sendMessage( $to, $message ); + + $jsonData = json_decode( $data ); + if( json_last_error() === JSON_ERROR_NONE ) { + $message = new stdClass(); + $message->type = "success"; + $message->text = "The Universal Calendar for the year $Year was successfully decoded as JSON"; + $message->classes = ".nativityjohnbaptist.year-{$Year}.json-valid"; + $this->sendMessage( $to, $message ); + + $validationResult = $this->validateDataAgainstSchema( $jsonData, LitSchema::LITCAL ); + if( gettype( $validationResult ) === 'boolean' && $validationResult === true ) { $message = new stdClass(); $message->type = "success"; - $message->text = "The $type of $Calendar for the year $Year exists"; - $result->messages[] = $message; - - $jsonData = json_decode( $data ); - if( json_last_error() === JSON_ERROR_NONE ) { + $message->text = "The Universal Calendar for the year $Year was successfully validated against the Schema " . LitSchema::LITCAL; + $message->classes = ".nativityjohnbaptist.year-{$Year}.schema-valid"; + $this->sendMessage( $to, $message ); + NativityJohnBaptistTest::$testObject = $jsonData; + $NativityJohnBaptistTest = new NativityJohnBaptistTest; + $testResult = $NativityJohnBaptistTest->testJune23(); + if( gettype( $testResult ) === 'boolean' && $testResult === true ) { $message = new stdClass(); $message->type = "success"; - $message->text = "The $type of $Calendar for the year $Year was successfully decoded as JSON"; - $result->messages[] = $message; - - $validationResult = $this->validateDataAgainstSchema( $jsonData, LitSchema::LITCAL ); - if( gettype( $validationResult ) === 'boolean' && $validationResult === true ) { - $message = new stdClass(); - $message->type = "success"; - $message->text = "The $type of $Calendar for the year $Year was successfully validated against the Schema " . LitSchema::LITCAL; - $result->messages[] = $message; - NativityJohnBaptistTest::$testObject = $jsonData; - $NativityJohnBaptistTest = new NativityJohnBaptistTest; - $testResult = $NativityJohnBaptistTest->testJune23(); - if( gettype( $testResult ) === 'boolean' && $testResult === true ) { - $message = new stdClass(); - $message->type = "success"; - $message->text = "Nativity of John the Baptist test passed for the $type of $Calendar for the year $Year"; - $result->messages[] = $message; - } - else if( gettype( $testResult ) === 'object' ) { - $result->messages[] = $testResult; - } - } - else if( gettype( $validationResult === 'object' ) ) { - $result->messages[] = $validationResult; - } - } else { - $message = new stdClass(); - $message->type = "error"; - $message->text = "There was an error decoding the $type of $Calendar for the year $Year from the URL " . self::LitCalBaseUrl . $req . " as JSON: " . json_last_error_msg(); - $result->messages[] = $message; + $message->text = "Nativity of John the Baptist test passed for the Universal Calendar for the year $Year"; + $message->classes = ".nativityjohnbaptist.year-{$Year}.test-valid"; + $this->sendMessage( $to, $message ); + } + else if( gettype( $testResult ) === 'object' ) { + $testResult->classes = ".nativityjohnbaptist.year-{$Year}.test-valid"; + $this->sendMessage( $to, $testResult ); } - } else { - $message = new stdClass(); - $message->type = "error"; - $message->text = "The $type of $Calendar for the year $Year does not exist at the URL " . self::LitCalBaseUrl . $req; - $result->messages[] = $message; } + else if( gettype( $validationResult === 'object' ) ) { + $validationResult->classes = ".nativityjohnbaptist.year-{$Year}.schema-valid"; + $this->sendMessage( $to, $validationResult ); + } + } else { + $message = new stdClass(); + $message->type = "error"; + $message->text = "There was an error decoding the Universal Calendar for the year $Year from the URL " . self::LitCalBaseUrl . $req . " as JSON: " . json_last_error_msg(); + $message->classes = ".nativityjohnbaptist.year-{$Year}.json-valid"; + $this->sendMessage( $to, $message ); } + } else { + $message = new stdClass(); + $message->type = "error"; + $message->text = "The Universal Calendar for the year $Year does not exist at the URL " . self::LitCalBaseUrl . $req; + $message->classes = ".nativityjohnbaptist.year-{$Year}.file-exists"; + $this->sendMessage( $to, $message ); } - return $result; } - private function testStJaneFrancesDeChantalMoved( array $Calendars, array $Years, string $type, object $result, string $test ) : object { - foreach( $Calendars as $Calendar ) { - foreach( $Years as $Year ) { - if( $Calendar === 'VATICAN' ) { - $req = "?year=$Year"; - } else { - $req = "?$type=$Calendar&year=$Year"; - } - $data = file_get_contents( self::LitCalBaseUrl . $req ); - if( $data !== false ) { + private function testStJaneFrancesDeChantalMoved( int $Year, ConnectionInterface $to, string $test ) : void { + $req = "?year=$Year"; + $data = file_get_contents( self::LitCalBaseUrl . $req ); + if( $data !== false ) { + $message = new stdClass(); + $message->type = "success"; + $message->text = "The Universal Calendar for the year $Year exists"; + $message->classes = ".{$test}.year-{$Year}.file-exists"; + $this->sendMessage( $to, $message ); + + $jsonData = json_decode( $data ); + if( json_last_error() === JSON_ERROR_NONE ) { + $message = new stdClass(); + $message->type = "success"; + $message->text = "The Universal Calendar for the year $Year was successfully decoded as JSON"; + $message->classes = ".{$test}.year-{$Year}.json-valid"; + $this->sendMessage( $to, $message ); + + $validationResult = $this->validateDataAgainstSchema( $jsonData, LitSchema::LITCAL ); + if( gettype( $validationResult ) === 'boolean' && $validationResult === true ) { $message = new stdClass(); $message->type = "success"; - $message->text = "The $type of $Calendar for the year $Year exists"; - $result->messages[] = $message; - - $jsonData = json_decode( $data ); - if( json_last_error() === JSON_ERROR_NONE ) { + $message->text = "The Universal Calendar for the year $Year was successfully validated against the Schema " . LitSchema::LITCAL; + $message->classes = ".{$test}.year-{$Year}.schema-valid"; + $this->sendMessage( $to, $message ); + StJaneFrancesDeChantalTest::$testObject = $jsonData; + $StJaneFrancesDeChantalTest = new StJaneFrancesDeChantalTest; + if( $test === 'StJaneFrancesDeChantalMoved' ) { + $testResult = $StJaneFrancesDeChantalTest->testMovedOrNot(); + } + else if( $test === 'StJaneFrancesDeChantalOverridden' ) { + $testResult = $StJaneFrancesDeChantalTest->testOverridden(); + } + if( gettype( $testResult ) === 'boolean' && $testResult === true ) { $message = new stdClass(); $message->type = "success"; - $message->text = "The $type of $Calendar for the year $Year was successfully decoded as JSON"; - $result->messages[] = $message; - - $validationResult = $this->validateDataAgainstSchema( $jsonData, LitSchema::LITCAL ); - if( gettype( $validationResult ) === 'boolean' && $validationResult === true ) { - $message = new stdClass(); - $message->type = "success"; - $message->text = "The $type of $Calendar for the year $Year was successfully validated against the Schema " . LitSchema::LITCAL; - $result->messages[] = $message; - StJaneFrancesDeChantalTest::$testObject = $jsonData; - $StJaneFrancesDeChantalTest = new StJaneFrancesDeChantalTest; - if( $test === 'movedornot' ) { - $testResult = $StJaneFrancesDeChantalTest->testMovedOrNot(); - } - else if( $test === 'overridden' ) { - $testResult = $StJaneFrancesDeChantalTest->testOverridden(); - } - if( gettype( $testResult ) === 'boolean' && $testResult === true ) { - $message = new stdClass(); - $message->type = "success"; - $message->text = "Saint Jane Frances de Chantal test ($test) passed for the $type of $Calendar for the year $Year"; - $result->messages[] = $message; - } - else if( gettype( $testResult ) === 'object' ) { - $result->messages[] = $testResult; - } - } - else if( gettype( $validationResult === 'object' ) ) { - $result->messages[] = $validationResult; - } - } else { - $message = new stdClass(); - $message->type = "error"; - $message->text = "There was an error decoding the $type of $Calendar for the year $Year from the URL " . self::LitCalBaseUrl . $req . " as JSON: " . json_last_error_msg(); - $result->messages[] = $message; + $message->text = "Saint Jane Frances de Chantal test ($test) passed for the Universal Calendar for the year $Year"; + $message->classes = ".{$test}.year-{$Year}.test-valid"; + $this->sendMessage( $to, $message ); + } + else if( gettype( $testResult ) === 'object' ) { + $testResult->classes = ".{$test}.year-{$Year}.test-valid"; + $this->sendMessage( $to, $testResult ); } - } else { - $message = new stdClass(); - $message->type = "error"; - $message->text = "The $type of $Calendar for the year $Year does not exist at the URL " . self::LitCalBaseUrl . $req; - $result->messages[] = $message; } + else if( gettype( $validationResult === 'object' ) ) { + $validationResult->classes = ".{$test}.year-{$Year}.schema-valid"; + $this->sendMessage( $to, $validationResult ); + } + } else { + $message = new stdClass(); + $message->type = "error"; + $message->text = "There was an error decoding the Universal Calendar for the year $Year from the URL " . self::LitCalBaseUrl . $req . " as JSON: " . json_last_error_msg(); + $message->classes = ".{$test}.year-{$Year}.json-valid"; + $this->sendMessage( $to, $message ); } + } else { + $message = new stdClass(); + $message->type = "error"; + $message->text = "The Universal Calendar for the year $Year does not exist at the URL " . self::LitCalBaseUrl . $req; + $message->classes = ".{$test}.year-{$Year}.file-exists"; + $this->sendMessage( $to, $message ); } - return $result; } private function validateDataAgainstSchema( object|array $data, string $schemaUrl ) : bool|object { @@ -342,42 +376,7 @@ private function validateDataAgainstSchema( object|array $data, string $schemaUr return $res; } - private function handleRequestedMethod() { - switch( strtoupper( $_SERVER[ "REQUEST_METHOD" ] ) ) { - case RequestMethod::GET: - $this->handleGetPostRequests( $_GET ); - break; - case RequestMethod::POST: - $this->handleGetPostRequests( $_POST ); - break; - case RequestMethod::OPTIONS: - //continue; - break; - default: - header( $_SERVER[ "SERVER_PROTOCOL" ]." 405 Method Not Allowed", true, 405 ); - $errorMessage = '{"error":"You seem to be forming a strange kind of request? Allowed Request Methods are '; - $errorMessage .= implode( ' and ', $this->AllowedRequestMethods ); - $errorMessage .= ', but your Request Method was ' . strtoupper( $_SERVER[ 'REQUEST_METHOD' ] ) . '"}'; - die( $errorMessage ); - } - } - - private function handleGetPostRequests( array $REQUEST ) { - - $this->APICore->validateAcceptHeader( true ); - if( $this->APICore->getRequestContentType() === 'application/json' ) { - $this->DATA = $this->APICore->retrieveRequestParamsFromJsonBody(); - } else { - $this->DATA = (object)$REQUEST; - } - $this->executeValidations(); - } +} - public function Init() { - $this->APICore->Init(); - $this->APICore->setResponseContentTypeHeader(); - $this->handleRequestedMethod(); - } - -} +$LitCalHealth = new LitCalHealth(); diff --git a/LitCalTestServer.php b/LitCalTestServer.php new file mode 100644 index 00000000..b87d8759 --- /dev/null +++ b/LitCalTestServer.php @@ -0,0 +1,18 @@ +run(); diff --git a/composer.json b/composer.json index d50b2438..c158d45a 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "require": { "swaggest/json-schema": "^0.12", - "phpunit/phpunit": "^9" + "phpunit/phpunit": "^9", + "cboden/ratchet": "^0.4.4" } } diff --git a/composer.lock b/composer.lock index b2a3a572..79d871de 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,71 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ab0f11bdd318adc2a529d7d6ae41c432", + "content-hash": "915dec09222581a50d1afa1274b75b0b", "packages": [ + { + "name": "cboden/ratchet", + "version": "v0.4.4", + "source": { + "type": "git", + "url": "https://github.com/ratchetphp/Ratchet.git", + "reference": "5012dc954541b40c5599d286fd40653f5716a38f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ratchetphp/Ratchet/zipball/5012dc954541b40c5599d286fd40653f5716a38f", + "reference": "5012dc954541b40c5599d286fd40653f5716a38f", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^1.7|^2.0", + "php": ">=5.4.2", + "ratchet/rfc6455": "^0.3.1", + "react/event-loop": ">=0.4", + "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5", + "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0", + "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ratchet\\": "src/Ratchet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "role": "Developer" + }, + { + "name": "Matt Bonneau", + "role": "Developer" + } + ], + "description": "PHP WebSocket library", + "homepage": "http://socketo.me", + "keywords": [ + "Ratchet", + "WebSockets", + "server", + "sockets", + "websocket" + ], + "support": { + "chat": "https://gitter.im/reactphp/reactphp", + "issues": "https://github.com/ratchetphp/Ratchet/issues", + "source": "https://github.com/ratchetphp/Ratchet/tree/v0.4.4" + }, + "time": "2021-12-14T00:20:41+00:00" + }, { "name": "doctrine/instantiator", "version": "1.4.1", @@ -76,6 +139,168 @@ ], "time": "2022-03-03T08:28:38+00:00" }, + { + "name": "evenement/evenement", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/igorw/evenement.git", + "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7", + "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Evenement": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/master" + }, + "time": "2017-07-23T21:35:13+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c94a94f120803a18554c1805ef2e539f8285f9a2", + "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.2.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2022-03-20T21:55:58+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.11.0", @@ -966,37 +1191,805 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-04-01T12:37:26+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "time": "2019-04-30T12:38:16+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "ratchet/rfc6455", + "version": "v0.3.1", + "source": { + "type": "git", + "url": "https://github.com/ratchetphp/RFC6455.git", + "reference": "7c964514e93456a52a99a20fcfa0de242a43ccdb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ratchetphp/RFC6455/zipball/7c964514e93456a52a99a20fcfa0de242a43ccdb", + "reference": "7c964514e93456a52a99a20fcfa0de242a43ccdb", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^2 || ^1.7", + "php": ">=5.4.2" + }, + "require-dev": { + "phpunit/phpunit": "^5.7", + "react/socket": "^1.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ratchet\\RFC6455\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "role": "Developer" + }, + { + "name": "Matt Bonneau", + "role": "Developer" + } + ], + "description": "RFC6455 WebSocket protocol handler", + "homepage": "http://socketo.me", + "keywords": [ + "WebSockets", + "rfc6455", + "websocket" + ], + "support": { + "chat": "https://gitter.im/reactphp/reactphp", + "issues": "https://github.com/ratchetphp/RFC6455/issues", + "source": "https://github.com/ratchetphp/RFC6455/tree/v0.3.1" + }, + "time": "2021-12-09T23:20:49+00:00" + }, + { + "name": "react/cache", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "4bf736a2cccec7298bdf745db77585966fc2ca7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/4bf736a2cccec7298bdf745db77585966fc2ca7e", + "reference": "4bf736a2cccec7298bdf745db77585966fc2ca7e", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.1.1" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2021-02-02T06:47:52+00:00" + }, + { + "name": "react/dns", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "6d38296756fa644e6cb1bfe95eff0f9a4ed6edcb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/6d38296756fa644e6cb1bfe95eff0f9a4ed6edcb", + "reference": "6d38296756fa644e6cb1bfe95eff0f9a4ed6edcb", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.0 || ^2.7 || ^1.2.1", + "react/promise-timer": "^1.8" + }, + "require-dev": { + "clue/block-react": "^1.2", + "phpunit/phpunit": "^9.3 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.9.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2021-12-20T08:46:54+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "187fb56f46d424afb6ec4ad089269c72eec2e137" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/187fb56f46d424afb6ec4ad089269c72eec2e137", + "reference": "187fb56f46d424afb6ec4ad089269c72eec2e137", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + }, + "suggest": { + "ext-event": "~1.0 for ExtEventLoop", + "ext-pcntl": "For signal handling support when using the StreamSelectLoop", + "ext-uv": "* for ExtUvLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-03-17T11:10:22+00:00" + }, + { + "name": "react/promise", + "version": "v2.9.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910", + "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v2.9.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-02-11T10:27:51+00:00" + }, + { + "name": "react/promise-timer", + "version": "v1.8.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise-timer.git", + "reference": "0bbbcc79589e5bfdddba68a287f1cb805581a479" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise-timer/zipball/0bbbcc79589e5bfdddba68a287f1cb805581a479", + "reference": "0bbbcc79589e5bfdddba68a287f1cb805581a479", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/event-loop": "^1.2", + "react/promise": "^3.0 || ^2.7.0 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\Timer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A trivial implementation of timeouts for Promises, built on top of ReactPHP.", + "homepage": "https://github.com/reactphp/promise-timer", + "keywords": [ + "async", + "event-loop", + "promise", + "reactphp", + "timeout", + "timer" + ], + "support": { + "issues": "https://github.com/reactphp/promise-timer/issues", + "source": "https://github.com/reactphp/promise-timer/tree/v1.8.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2021-12-06T11:08:48+00:00" + }, + { + "name": "react/socket", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "f474156aaab4f09041144fa8b57c7d70aed32a1c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/f474156aaab4f09041144fa8b57c7d70aed32a1c", + "reference": "f474156aaab4f09041144fa8b57c7d70aed32a1c", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.8", + "react/event-loop": "^1.2", + "react/promise": "^2.6.0 || ^1.2.1", + "react/promise-timer": "^1.8", + "react/stream": "^1.2" + }, + "require-dev": { + "clue/block-react": "^1.5", + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/promise-stream": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.11.0" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-01-14T10:14:32+00:00" + }, + { + "name": "react/stream", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/7a423506ee1903e89f1e08ec5f0ed430ff784ae9", + "reference": "7a423506ee1903e89f1e08ec5f0ed430ff784ae9", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", "keywords": [ - "phpunit", - "testing", - "xunit" + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" ], "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.2.0" }, "funding": [ { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" + "url": "https://github.com/WyriHaximus", + "type": "github" }, { - "url": "https://github.com/sebastianbergmann", + "url": "https://github.com/clue", "type": "github" } ], - "time": "2022-04-01T12:37:26+00:00" + "time": "2021-07-11T12:37:55+00:00" }, { "name": "sebastian/cli-parser", @@ -2056,6 +3049,146 @@ }, "time": "2021-10-15T18:12:27+00:00" }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "6b0d0e4aca38d57605dcd11e2416994b38774522" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/6b0d0e4aca38d57605dcd11e2416994b38774522", + "reference": "6b0d0e4aca38d57605dcd11e2416994b38774522", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/mime": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/mime": "To use the file extension guesser" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Defines an object-oriented layer for the HTTP specification", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-foundation/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-17T15:07:29+00:00" + }, { "name": "symfony/polyfill-ctype", "version": "v1.25.0", @@ -2221,6 +3354,179 @@ ], "time": "2021-11-30T18:21:41+00:00" }, + { + "name": "symfony/polyfill-php80", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-03-04T08:16:47+00:00" + }, + { + "name": "symfony/routing", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "e07817bb6244ea33ef5ad31abc4a9288bef3f2f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/e07817bb6244ea33ef5ad31abc4a9288bef3f2f7", + "reference": "e07817bb6244ea33ef5ad31abc4a9288bef3f2f7", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "doctrine/annotations": "<1.12", + "symfony/config": "<5.3", + "symfony/dependency-injection": "<4.4", + "symfony/yaml": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.12", + "psr/log": "^1|^2|^3", + "symfony/config": "^5.3|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/config": "For using the all-in-one router or any loader", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Maps an HTTP request to a set of configuration variables", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "support": { + "source": "https://github.com/symfony/routing/tree/v5.4.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-04-18T21:45:37+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.1", diff --git a/includes/LitCalAPI.php b/includes/LitCalAPI.php index 8ccdffa9..845ed87e 100644 --- a/includes/LitCalAPI.php +++ b/includes/LitCalAPI.php @@ -777,7 +777,7 @@ private function calculateFeastsMarySaints() : void { //With the decree Apostolorum Apostola ( June 3rd 2016 ), the Congregation for Divine Worship //with the approval of Pope Francis elevated the memorial of Saint Mary Magdalen to a Feast //source: http://www.vatican.va/roman_curia/congregations/ccdds/documents/articolo-roche-maddalena_it.pdf - //This is taken care of ahead when the memorials are created, see comment tag MARYMAGDALEN: + //This is taken care of ahead when the "memorials from decrees" are applied } @@ -939,7 +939,7 @@ private function calculateMemorials( int $grade = LitGrade::MEMORIAL, string $mi private function reduceMemorialsInAdventLentToCommemoration( DateTime $currentFeastDate, stdClass $row ) { //If a fixed date optional memorial falls between 17 Dec. to 24 Dec., the Octave of Christmas or weekdays of the Lenten season, - //it is reduced in rank to a Commemoration ( only the collect can be used + //it is reduced in rank to a Commemoration ( only the collect can be used ) if ( $this->Cal->inWeekdaysAdventChristmasLent( $currentFeastDate ) ) { $this->Cal->setProperty( $row->TAG, "grade", LitGrade::COMMEMORATION ); /**translators: