Skip to content

Commit

Permalink
redcap - phan
Browse files Browse the repository at this point in the history
  • Loading branch information
regisoc committed Nov 17, 2024
1 parent 92016d7 commit c647fea
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ use LORIS\redcap\configurations\RedcapConfiguration;
class RedcapConfigurationParser
{
/**
* Instances defined in configuration.
* REDCap configuration.
*
* @var array
* @var RedcapConfiguration
*/
private RedcapConfiguration $_config;

Expand Down
2 changes: 1 addition & 1 deletion modules/redcap/php/endpoints/notifications.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class Notifications extends Endpoint
*
* @param RedcapNotification $notif the REDCap notification.
*
* @return true if the notification should be ignored, else false.
* @return bool if the notification should be ignored, else false.
*/
private function _ignoreNotification(RedcapNotification $notif): bool
{
Expand Down
7 changes: 7 additions & 0 deletions modules/redcap/php/models/records/iredcaprecord.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ interface IRedcapRecord
* @return array
*/
public function getPropertyNames(): array;

/**
* Props array.
*
* @return array
*/
public function toArray(): array;
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,14 @@ class RedcapNotificationHandler
if ($nNotUpdated > 0) {
$recNotUp = array_map(
fn($k) => $records[$k]->getInstrumentName(),
$notUpdated
array_keys($notUpdated)
);
$recMsg = implode(',', $recNotUp);
$msg = "[redcap] [pscid:$recordId][visit:$visitName]"
. " repeating instruments not updated: $recMsg.";
throw new \LorisException($msg);
}
sprintf(
STDOUT,
error_log(
"[redcap] [pscid:$recordId][visit:$visitName]"
."[instrument:$instrumentName] instrument updated."
);
Expand Down Expand Up @@ -205,7 +204,7 @@ class RedcapNotificationHandler
// E.g. from 'form_name_and_field_name' to 'and_field_name'
foreach ($instrument->getDataDictionary() as $field) {
$dict_names[] = preg_replace(
"/^${instrument_name}_/",
"/^{$instrument_name}_/",
"",
$field->getName()
);
Expand Down Expand Up @@ -507,9 +506,9 @@ class RedcapNotificationHandler
/**
* Get the 'redcap' examiner ID.
*
* @return string the redcap examiner ID.
* @return ?string the redcap examiner ID.
*/
private function _getRedcapExaminerId(): string
private function _getRedcapExaminerId(): ?string
{
$db = $this->_loris->getDatabaseConnection();
return $db->pselectOne(
Expand Down
2 changes: 1 addition & 1 deletion modules/redcap/php/redcaphttpclient.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class REDCapHTTPClient
*
* @param array $data the data to send.
*
* @return string string representation, data results
* @return ?string string representation, data results
*/
private function _sendRequest(array $data): ?string
{
Expand Down

0 comments on commit c647fea

Please sign in to comment.