Skip to content

Commit

Permalink
fix: code style, small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomiejmarszal committed Nov 25, 2024
1 parent 4c0eab2 commit 96af807
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/classes/class.QtiTestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1577,10 +1577,11 @@ private function getTestLabel(array $testMetadata, XmlDocument $testDefinition):
return in_array(RDFS_LABEL, $metadata->getPath());
});

if (count($labelMetadata) === 0) {
if (empty($labelMetadata)) {
if ($testDefinition->getDocumentComponent() === null) {
throw new Exception('No metadata label found for test and no title in the test definition.');
}

common_Logger::w('No metadata label found for test. Using the title from the test definition.');
return $testDefinition->getDocumentComponent()->getTitle();
}
Expand All @@ -1589,7 +1590,6 @@ private function getTestLabel(array $testMetadata, XmlDocument $testDefinition):
common_Logger::w('Multiple labels found for test. Using the first one.');
}


return reset($labelMetadata)->getValue();
}
}

0 comments on commit 96af807

Please sign in to comment.