protected function unmarshallUnit(array $unit)
    {
        if (isset($unit['base'])) {

            // Primitive base type.
            try {
                $keys = array_keys($unit['base']);
                switch ($keys[0]) {
                    case 'boolean':
                        return $this->unmarshallBoolean($unit);
                    break;

                    case 'integer':
                        return $this->unmarshallInteger($unit);
                    break;

                    case 'float':
                        return $this->unmarshallFloat($unit);
                    break;

                    case 'string':
                        return $this->unmarshallString($unit);
                    break;

                    case 'point':
                        return $this->unmarshallPoint($unit);
                    break;

                    case 'pair':
                        return $this->unmarshallPair($unit);
                    break;

                    case 'directedPair':
                        return $this->unmarshallDirectedPair($unit);
                    break;

                    case 'duration':
                        return $this->unmarshallDuration($unit);
                    break;

                    case 'file':
                        return $this->unmarshallFile($unit);
                    break;

                    case 'uri':
                        return $this->unmarshallUri($unit);
                    break;

                    case 'intOrIdentifier':
                        return $this->unmarshallIntOrIdentifier($unit);
                    break;

                    case 'identifier':
                        return $this->unmarshallIdentifier($unit);
                    break;

                    default:
                        throw new UnmarshallingException("Unknown QTI baseType '" . $keys[0] . "'");
                    break;
                }
            } catch (InvalidArgumentException $e) {
                $msg = "A value does not satisfy its baseType.";
                throw new UnmarshallingException($msg, UnmarshallingException::NOT_PCI, $e);
            }
        } elseif ($unit['base'] === null) {
            return null;
        }
    }
protected function unmarshallUnit(array $unit)
    {
        if (isset($unit['base'])) {

            // Primitive base type.
            try {
                $keys = array_keys($unit['base']);
                switch ($keys[0]) {
                    case 'boolean':
                        return $this->unmarshallBoolean($unit);
                    break;

                    case 'integer':
                        return $this->unmarshallInteger($unit);
                    break;

                    case 'float':
                        return $this->unmarshallFloat($unit);
                    break;

                    case 'string':
                        return $this->unmarshallString($unit);
                    break;

                    case 'point':
                        return $this->unmarshallPoint($unit);
                    break;

                    case 'pair':
                        return $this->unmarshallPair($unit);
                    break;

                    case 'directedPair':
                        return $this->unmarshallDirectedPair($unit);
                    break;

                    case 'duration':
                        return $this->unmarshallDuration($unit);
                    break;

                    case 'file':
                        return $this->unmarshallFile($unit);
                    break;

                    case 'uri':
                        return $this->unmarshallUri($unit);
                    break;

                    case 'intOrIdentifier':
                        return $this->unmarshallIntOrIdentifier($unit);
                    break;

                    case 'identifier':
                        return $this->unmarshallIdentifier($unit);
                    break;

                    default:
                        throw new UnmarshallingException("Unknown QTI baseType '" . $keys[0] . "'");
                    break;
                }
            } catch (InvalidArgumentException $e) {
                $msg = "A value does not satisfy its baseType.";
                throw new UnmarshallingException($msg, UnmarshallingException::NOT_PCI, $e);
            }
        } elseif ($unit['base'] === null) {
            return null;
        }
    }
protected function unmarshallUnit ( array $ unit ) { if ( isset ( $ unit [ 'base' ] ) ) { // Primitive base type. try { $ keys = array_keys ( $ unit [ 'base' ] ) ; switch ( $ keys [ 0 ] ) { case 'boolean' : return $ this -> unmarshallBoolean ( $ unit ) ; break ; case 'integer' : return $ this -> unmarshallInteger ( $ unit ) ; break ; case 'float' : return $ this -> unmarshallFloat ( $ unit ) ; break ; case 'string' : return $ this -> unmarshallString ( $ unit ) ; break ; case 'point' : return $ this -> unmarshallPoint ( $ unit ) ; break ; case 'pair' : return $ this -> unmarshallPair ( $ unit ) ; break ; case 'directedPair' : return $ this -> unmarshallDirectedPair ( $ unit ) ; break ; case 'duration' : return $ this -> unmarshallDuration ( $ unit ) ; break ; case 'file' : return $ this -> unmarshallFile ( $ unit ) ; break ; case 'uri' : return $ this -> unmarshallUri ( $ unit ) ; break ; case 'intOrIdentifier' : return $ this -> unmarshallIntOrIdentifier ( $ unit ) ; break ; case 'identifier' : return $ this -> unmarshallIdentifier ( $ unit ) ; break ; default : throw new UnmarshallingException ( "Unknown QTI baseType '" . $ keys [ 0 ] . "'" ) ; break ; } } catch ( InvalidArgumentException $ e ) { $ msg = "A value does not satisfy its baseType." ; throw new UnmarshallingException ( $ msg , UnmarshallingException :: NOT_PCI , $ e ) ; } } elseif ( $ unit [ 'base' ] === null ) { return null ; } }
Unmarshall a unit of data into QTISM runtime model.

@param array $unit
@throws \qtism\runtime\pci\json\UnmarshallingException
@return null|qtism\common\datatypes\QtiDatatype
Unmarshall a unit of data into QTISM runtime model .