Skip to content

Commit

Permalink
Improve phpdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersoncasimir committed Feb 3, 2025
1 parent c7767cb commit 73f26b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
15 changes: 8 additions & 7 deletions php/libraries/CSVParser.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ class CSVParser
/**
* Check that headers match (equivalent arrays)
*
* @param array $headers Headers parsed from csv file
* @param array $expectedHeaders Expected headers (ex: from instrument)
* @param bool $strict If true, $headers cannot be a superset
* of $expectedHeaders
* @param array|false $headers Headers parsed from csv file
* @param array $expectedHeaders Expected headers (ex: from instrument)
* @param bool $strict If true, $headers cannot be a superset
* of $expectedHeaders
*
* @return bool Returns true if headers are valid
* @return bool Returns true if headers are valid
*/
private function _validateHeaders(
array $headers, array $expectedHeaders, bool $strict = false
array|false $headers, array $expectedHeaders, bool $strict = false
): bool {
if ($strict && count($headers) !== count($expectedHeaders)) {
if (!$headers || ($strict && count($headers) !== count($expectedHeaders))
) {
return false;
}

Expand Down
5 changes: 1 addition & 4 deletions php/libraries/InstrumentDataParser.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ class InstrumentDataParser extends CSVParser
): array {
return array_merge(
['PSCID', 'Visit_label'], // SessionID
// Convert to static list of flag fields
// List: Data_entry, Required_elements_completed, Administration,
// Validity, Exclusion, Testdate
self::getFlagHeaders( // Whitelist would prevent invalid columns
self::getFlagHeaders(
[
'ID', 'SessionID', 'Test_name', 'TestID',
'CommentID', 'UserID', 'Data', 'DataID',
Expand Down

0 comments on commit 73f26b9

Please sign in to comment.