Skip to content

Commit

Permalink
fix: code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Karol-Stelmaczonek committed Dec 8, 2023
1 parent 3925753 commit 8318b4e
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@

namespace oat\taoQtiTest\models\classes\eventHandler\ResultTransmissionEventHandler;

use common_exception_Error;
use oat\oatbox\event\EventManager;
use oat\oatbox\service\ServiceManager;
use oat\oatbox\service\ServiceNotFoundException;
use oat\tao\model\service\InjectionAwareService;
use oat\taoDelivery\model\execution\DeliveryServerService;
use oat\taoQtiTest\models\classes\event\ResultTestVariablesTransmissionEvent;
Expand Down Expand Up @@ -63,7 +65,7 @@ public function transmitResultTestVariable(ResultTestVariablesTransmissionEvent
$event->getTestUri()
);

if (empty($this->containsScoreTotal($event))) {
if (!$this->containsScoreTotal($event)) {
return;
}

Expand All @@ -90,8 +92,9 @@ public function getServiceLocator()
}

/**
* @return ReadableResultStorage
* @throws ServiceNotFoundException
* @throws common_exception_Error
* @throws InvalidServiceManagerException
*/
private function getResultsStorage(): ReadableResultStorage
{
Expand All @@ -105,18 +108,16 @@ private function getResultsStorage(): ReadableResultStorage
return $storage;
}

/**
* @param ResultTestVariablesTransmissionEvent $event
* @return array
*/
private function containsScoreTotal(ResultTestVariablesTransmissionEvent $event): array
private function containsScoreTotal(ResultTestVariablesTransmissionEvent $event): bool
{
return array_filter(
$scoreTotal = array_filter(
$event->getVariables(),
function ($item) {
return $item->getIdentifier() === 'SCORE_TOTAL';
}
);

return !empty($scoreTotal);
}

/**
Expand Down

0 comments on commit 8318b4e

Please sign in to comment.