public static function createFromDataModel(ValueCollection $valueCollection)
    {
        $container = new static();
        foreach ($valueCollection as $value) {
            $fieldIdentifier = $value->getFieldIdentifier();

            if (!empty($fieldIdentifier)) {
                $container[$value->getFieldIdentifier()] = RuntimeUtils::valueToRuntime($value->getValue(), $value->getBaseType());
            } else {
                $msg = "Cannot include qtism\\data\\state\\Value '" . $value->getValue() . "' in the RecordContainer ";
                $msg .= "because it has no fieldIdentifier specified.";
                throw new InvalidArgumentException($msg);
            }
        }

        return $container;
    }
public static function createFromDataModel(ValueCollection $valueCollection)
    {
        $container = new static();
        foreach ($valueCollection as $value) {
            $fieldIdentifier = $value->getFieldIdentifier();

            if (!empty($fieldIdentifier)) {
                $container[$value->getFieldIdentifier()] = RuntimeUtils::valueToRuntime($value->getValue(), $value->getBaseType());
            } else {
                $msg = "Cannot include qtism\\data\\state\\Value '" . $value->getValue() . "' in the RecordContainer ";
                $msg .= "because it has no fieldIdentifier specified.";
                throw new InvalidArgumentException($msg);
            }
        }

        return $container;
    }
public static function createFromDataModel ( ValueCollection $ valueCollection ) { $ container = new static ( ) ; foreach ( $ valueCollection as $ value ) { $ fieldIdentifier = $ value -> getFieldIdentifier ( ) ; if ( ! empty ( $ fieldIdentifier ) ) { $ container [ $ value -> getFieldIdentifier ( ) ] = RuntimeUtils :: valueToRuntime ( $ value -> getValue ( ) , $ value -> getBaseType ( ) ) ; } else { $ msg = "Cannot include qtism\\data\\state\\Value '" . $ value -> getValue ( ) . "' in the RecordContainer " ; $ msg .= "because it has no fieldIdentifier specified." ; throw new InvalidArgumentException ( $ msg ) ; } } return $ container ; }
Create a RecordContainer object from a Data Model ValueCollection object.

@param \qtism\data\state\ValueCollection $valueCollection A collection of qtism\data\state\Value objects.
@return \qtism\runtime\common\RecordContainer A Container object populated with the values found in $valueCollection.
@throws \InvalidArgumentException If a value from $valueCollection is not compliant with the QTI Runtime Model or the container type or if a value has no fieldIdentifier.
Create a RecordContainer object from a Data Model ValueCollection object .