From e6cffbfd7df15615f708e848d20ad55ce652acbe Mon Sep 17 00:00:00 2001 From: Maxime Mulder Date: Wed, 16 Jul 2025 06:42:39 +0000 Subject: [PATCH 1/2] delete IRedcapRecord --- .../models/records/iredcaprecord.class.inc | 53 ------------------- .../models/records/redcaprecord.class.inc | 2 +- .../records/redcaprepeatingrecord.class.inc | 2 +- .../php/client/redcaphttpclient.class.inc | 3 +- .../php/redcapnotificationhandler.class.inc | 10 ++-- 5 files changed, 8 insertions(+), 62 deletions(-) delete mode 100644 modules/redcap/php/client/models/records/iredcaprecord.class.inc diff --git a/modules/redcap/php/client/models/records/iredcaprecord.class.inc b/modules/redcap/php/client/models/records/iredcaprecord.class.inc deleted file mode 100644 index 8c723531227..00000000000 --- a/modules/redcap/php/client/models/records/iredcaprecord.class.inc +++ /dev/null @@ -1,53 +0,0 @@ - - * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 - * @link https://www.github.com/aces/Loris/ - */ - -namespace LORIS\redcap\client\models\records; - -/** - * This interface allows for type abstraction of REDCap records - * - * @category REDCap - * @package Main - * @author Regis Ongaro-Carcy - * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 - * @link https://www.github.com/aces/Loris/ - */ -interface IRedcapRecord -{ - /** - * Get the instrument name - * - * @return string - */ - public function getFormName(): string; - - /** - * Get the instrument name - * - * @return string - */ - public function getInstrumentName(): string; - - /** - * Get the props names - * - * @return array - */ - public function getPropertyNames(): array; - - /** - * Props array. - * - * @return array - */ - public function toArray(): array; -} diff --git a/modules/redcap/php/client/models/records/redcaprecord.class.inc b/modules/redcap/php/client/models/records/redcaprecord.class.inc index 2ee331ce7f9..fa57e5a7025 100644 --- a/modules/redcap/php/client/models/records/redcaprecord.class.inc +++ b/modules/redcap/php/client/models/records/redcaprecord.class.inc @@ -21,7 +21,7 @@ namespace LORIS\redcap\client\models\records; * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 * @link https://www.github.com/aces/Loris/ */ -class RedcapRecord implements IRedcapRecord +class RedcapRecord { private string $_form_name; diff --git a/modules/redcap/php/client/models/records/redcaprepeatingrecord.class.inc b/modules/redcap/php/client/models/records/redcaprepeatingrecord.class.inc index 26907ab2a66..067fbc3fe87 100644 --- a/modules/redcap/php/client/models/records/redcaprepeatingrecord.class.inc +++ b/modules/redcap/php/client/models/records/redcaprepeatingrecord.class.inc @@ -21,7 +21,7 @@ namespace LORIS\redcap\client\models\records; * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 * @link https://www.github.com/aces/Loris/ */ -class RedcapRepeatingRecord extends RedcapRecord implements IRedcapRecord +class RedcapRepeatingRecord extends RedcapRecord { private int $_repeat_index; diff --git a/modules/redcap/php/client/redcaphttpclient.class.inc b/modules/redcap/php/client/redcaphttpclient.class.inc index 344516beee5..9331d65ca50 100644 --- a/modules/redcap/php/client/redcaphttpclient.class.inc +++ b/modules/redcap/php/client/redcaphttpclient.class.inc @@ -24,7 +24,6 @@ use LORIS\redcap\client\models\RedcapProject; use LORIS\redcap\client\models\RedcapSurveyParticipant; use LORIS\redcap\client\models\mappings\RedcapRepeatingInstrumentEvent; use LORIS\redcap\client\models\mappings\RedcapInstrumentEventMap; -use LORIS\redcap\client\models\records\IRedcapRecord; use LORIS\redcap\client\models\records\RedcapRecord; use LORIS\redcap\client\models\records\RedcapRepeatingRecord; @@ -653,7 +652,7 @@ class RedcapHttpClient * * @throws \LorisException * - * @return IRedcapRecord[] an array of records + * @return RedcapRecord[] an array of records */ public function getInstrumentRecord( string $instrument_name, diff --git a/modules/redcap/php/redcapnotificationhandler.class.inc b/modules/redcap/php/redcapnotificationhandler.class.inc index 2accb25883e..51d85939399 100644 --- a/modules/redcap/php/redcapnotificationhandler.class.inc +++ b/modules/redcap/php/redcapnotificationhandler.class.inc @@ -16,8 +16,8 @@ use \LORIS\LorisInstance; use \LORIS\redcap\RedcapQueries; use \LORIS\redcap\client\RedcapHttpClient; use \LORIS\redcap\config\RedcapConfig; -use \LORIS\redcap\client\models\records\IRedcapRecord; use \LORIS\redcap\client\models\RedcapNotification; +use \LORIS\redcap\client\models\records\RedcapRecord; /** * This represents a REDCap notification handler. @@ -234,7 +234,7 @@ class RedcapNotificationHandler * Check that the REDCap and LORIS dictionaries of an instrument match. * * @param \NDB_BVL_Instrument $instrument a LORIS instrument object - * @param IRedcapRecord $record a REDCap instrument record + * @param RedcapRecord $record a REDCap instrument record * * @throws \LorisException if a REDCap field not in LORIS instrument * @@ -242,7 +242,7 @@ class RedcapNotificationHandler */ private function _assertDictionaryMatches( \NDB_BVL_Instrument $instrument, - IRedcapRecord $record + RedcapRecord $record ): void { // var $instrument_name = $instrument->testName; @@ -393,13 +393,13 @@ class RedcapNotificationHandler * Update a LORIS instrument data with a REDCap record data. * * @param \NDB_BVL_Instrument $instrument a LORIS instrument instance - * @param IRedcapRecord $record a REDCap record + * @param RedcapRecord $record a REDCap record * * @return void */ private function _updateInstrument( \NDB_BVL_Instrument $instrument, - IRedcapRecord $record + RedcapRecord $record ): void { // var $instrument_name = $record->getFormName(); From dcd1d000f403ceb959261016ec60b0868b66e441 Mon Sep 17 00:00:00 2001 From: Maxime Mulder Date: Wed, 16 Jul 2025 06:42:53 +0000 Subject: [PATCH 2/2] rename RedcapRecord->getLorisInstrumentName() --- .../redcap/php/client/models/records/redcaprecord.class.inc | 4 ++-- .../php/client/models/records/redcaprepeatingrecord.class.inc | 4 ++-- modules/redcap/php/redcapnotificationhandler.class.inc | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/redcap/php/client/models/records/redcaprecord.class.inc b/modules/redcap/php/client/models/records/redcaprecord.class.inc index fa57e5a7025..1e3c1b490b3 100644 --- a/modules/redcap/php/client/models/records/redcaprecord.class.inc +++ b/modules/redcap/php/client/models/records/redcaprecord.class.inc @@ -50,11 +50,11 @@ class RedcapRecord } /** - * Get the instrument name + * Get the LORIS instrument name. * * @return string */ - public function getInstrumentName(): string + public function getLorisInstrumentName(): string { return $this->_form_name; } diff --git a/modules/redcap/php/client/models/records/redcaprepeatingrecord.class.inc b/modules/redcap/php/client/models/records/redcaprepeatingrecord.class.inc index 067fbc3fe87..2fcf6bae336 100644 --- a/modules/redcap/php/client/models/records/redcaprepeatingrecord.class.inc +++ b/modules/redcap/php/client/models/records/redcaprepeatingrecord.class.inc @@ -50,11 +50,11 @@ class RedcapRepeatingRecord extends RedcapRecord } /** - * Get the instrument name. + * Get the LORIS instrument name. * * @return string */ - public function getInstrumentName(): string + public function getLorisInstrumentName(): string { return $this->getFormName() . '_' . $this->_repeat_index; } diff --git a/modules/redcap/php/redcapnotificationhandler.class.inc b/modules/redcap/php/redcapnotificationhandler.class.inc index 51d85939399..3d6f6278fc1 100644 --- a/modules/redcap/php/redcapnotificationhandler.class.inc +++ b/modules/redcap/php/redcapnotificationhandler.class.inc @@ -168,7 +168,7 @@ class RedcapNotificationHandler // foreach ($records as $record) { // if repeating instrument, contains the repeat index - $instrument_name = $record->getInstrumentName(); + $instrument_name = $record->getLorisInstrumentName(); // get the comment ID for that instrument $comment_id = $this->_getCommentId(