From 3b923a9f9b41d9035a2c5ce8a51d498976cba134 Mon Sep 17 00:00:00 2001 From: Karol Stelmaczonek Date: Wed, 6 Dec 2023 17:01:57 +0100 Subject: [PATCH] fix: code review --- helpers/class.TestSession.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/helpers/class.TestSession.php b/helpers/class.TestSession.php index af9b99a71..97099ea19 100644 --- a/helpers/class.TestSession.php +++ b/helpers/class.TestSession.php @@ -832,10 +832,14 @@ private function triggerResultTestVariablesTransmissionEvent( public function attachToTransmissionEvent(ResultTestVariablesTransmissionEvent $event): void { - $scoreTotal = array_filter($event->getVariables(), function ($item) { - return $item->getIdentifier() === 'SCORE_TOTAL'; - })[0]; - if ($scoreTotal === null) { + $scoreTotal = array_filter( + $event->getVariables(), + function ($item) { + return $item->getIdentifier() === 'SCORE_TOTAL'; + } + ); + + if (empty($scoreTotal)) { return; } $outcomeVariables = $this->getResultsStorage()->getDeliveryVariables($event->getDeliveryExecutionId()); @@ -851,10 +855,11 @@ private function isManualScored(): bool /** @var AssessmentItemRef $itemRef */ foreach ($this->getRoute()->getAssessmentItemRefs() as $itemRef) { foreach ($itemRef->getComponents() as $component) { - if ($component instanceof OutcomeDeclaration) { - if ($component->isExternallyScored()) { - return true; - } + if ( + $component instanceof OutcomeDeclaration + && $component->isExternallyScored() + ) { + return true; } } }