public function process()
    {
        $itemSubset = $this->getItemSubset();

        if (count($itemSubset) === 0) {
            return null;
        }

        $testSession = $this->getState();
        $outcomeIdentifier = $this->getExpression()->getOutcomeIdentifier();
        // If no weightIdentifier specified, its value is an empty string ('').
        $weightIdentifier = $this->getExpression()->getWeightIdentifier();
        $result = new MultipleContainer(BaseType::FLOAT);

        foreach ($itemSubset as $item) {
            $itemSessions = $testSession->getAssessmentItemSessions($item->getIdentifier());

            foreach ($itemSessions as $itemSession) {

               // Apply variable mapping on $outcomeIdentifier.
               $id = self::getMappedVariableIdentifier($itemSession->getAssessmentItem(), $outcomeIdentifier);
               if ($id === false) {
                   // Variable name conflict.
                   continue;
               }

               if (isset($itemSession[$id]) && $itemSession->getVariable($id) instanceof OutcomeVariable) {

                    $var = $itemSession->getVariable($id);
                    $itemRefIdentifier = $itemSession->getAssessmentItem()->getIdentifier();
                    $weight = (empty($weightIdentifier) === true) ? false : $testSession->getWeight("${itemRefIdentifier}.${weightIdentifier}");

                    // Does this OutcomeVariable contain a value for normalMaximum?
                    if (($normalMaximum = $var->getNormalMaximum()) !== false) {

                        if ($weight === false) {
                            // No weight to be applied.
                            $result[] = new QtiFloat($normalMaximum);
                        } else {
                            // A weight has to be applied.
                            $result[] = new QtiFloat(floatval($normalMaximum *= $weight->getValue()));
                        }
                    } else {
                        // If any of the items in the given subset have no declared maximum
                        // the result is NULL.
                        return null;
                    }
                } else {
                    return null;
                }
            }
        }

        return $result;
    }
public function process()
    {
        $itemSubset = $this->getItemSubset();

        if (count($itemSubset) === 0) {
            return null;
        }

        $testSession = $this->getState();
        $outcomeIdentifier = $this->getExpression()->getOutcomeIdentifier();
        // If no weightIdentifier specified, its value is an empty string ('').
        $weightIdentifier = $this->getExpression()->getWeightIdentifier();
        $result = new MultipleContainer(BaseType::FLOAT);

        foreach ($itemSubset as $item) {
            $itemSessions = $testSession->getAssessmentItemSessions($item->getIdentifier());

            foreach ($itemSessions as $itemSession) {

               // Apply variable mapping on $outcomeIdentifier.
               $id = self::getMappedVariableIdentifier($itemSession->getAssessmentItem(), $outcomeIdentifier);
               if ($id === false) {
                   // Variable name conflict.
                   continue;
               }

               if (isset($itemSession[$id]) && $itemSession->getVariable($id) instanceof OutcomeVariable) {

                    $var = $itemSession->getVariable($id);
                    $itemRefIdentifier = $itemSession->getAssessmentItem()->getIdentifier();
                    $weight = (empty($weightIdentifier) === true) ? false : $testSession->getWeight("${itemRefIdentifier}.${weightIdentifier}");

                    // Does this OutcomeVariable contain a value for normalMaximum?
                    if (($normalMaximum = $var->getNormalMaximum()) !== false) {

                        if ($weight === false) {
                            // No weight to be applied.
                            $result[] = new QtiFloat($normalMaximum);
                        } else {
                            // A weight has to be applied.
                            $result[] = new QtiFloat(floatval($normalMaximum *= $weight->getValue()));
                        }
                    } else {
                        // If any of the items in the given subset have no declared maximum
                        // the result is NULL.
                        return null;
                    }
                } else {
                    return null;
                }
            }
        }

        return $result;
    }
public function process ( ) { $ itemSubset = $ this -> getItemSubset ( ) ; if ( count ( $ itemSubset ) === 0 ) { return null ; } $ testSession = $ this -> getState ( ) ; $ outcomeIdentifier = $ this -> getExpression ( ) -> getOutcomeIdentifier ( ) ; // If no weightIdentifier specified, its value is an empty string (''). $ weightIdentifier = $ this -> getExpression ( ) -> getWeightIdentifier ( ) ; $ result = new MultipleContainer ( BaseType :: FLOAT ) ; foreach ( $ itemSubset as $ item ) { $ itemSessions = $ testSession -> getAssessmentItemSessions ( $ item -> getIdentifier ( ) ) ; foreach ( $ itemSessions as $ itemSession ) { // Apply variable mapping on $outcomeIdentifier. $ id = self :: getMappedVariableIdentifier ( $ itemSession -> getAssessmentItem ( ) , $ outcomeIdentifier ) ; if ( $ id === false ) { // Variable name conflict. continue ; } if ( isset ( $ itemSession [ $ id ] ) && $ itemSession -> getVariable ( $ id ) instanceof OutcomeVariable ) { $ var = $ itemSession -> getVariable ( $ id ) ; $ itemRefIdentifier = $ itemSession -> getAssessmentItem ( ) -> getIdentifier ( ) ; $ weight = ( empty ( $ weightIdentifier ) === true ) ? false : $ testSession -> getWeight ( "${itemRefIdentifier}.${weightIdentifier}" ) ; // Does this OutcomeVariable contain a value for normalMaximum? if ( ( $ normalMaximum = $ var -> getNormalMaximum ( ) ) !== false ) { if ( $ weight === false ) { // No weight to be applied. $ result [ ] = new QtiFloat ( $ normalMaximum ) ; } else { // A weight has to be applied. $ result [ ] = new QtiFloat ( floatval ( $ normalMaximum *= $ weight -> getValue ( ) ) ) ; } } else { // If any of the items in the given subset have no declared maximum // the result is NULL. return null ; } } else { return null ; } } } return $ result ; }
Process the related OutcomeMaximum expression.

@return \qtism\runtime\common\MultipleContainer|null A MultipleContainer object with baseType float containing all the retrieved normalMaximum values or NULL if no declared maximum in the sub-set.
@throws \qtism\runtime\expressions\ExpressionProcessingException
Process the related OutcomeMaximum expression .