protected function unmarshall(DOMElement $element)
    {
        $baseComponent = parent::unmarshall($element);

        if (($href = $this->getDOMElementAttributeAs($element, 'href')) !== null) {
            $object = new AssessmentItemRef($baseComponent->getIdentifier(), $href);
            $object->setRequired($baseComponent->isRequired());
            $object->setFixed($baseComponent->isFixed());
            $object->setPreConditions($baseComponent->getPreConditions());
            $object->setBranchRules($baseComponent->getBranchRules());
            $object->setItemSessionControl($baseComponent->getItemSessionControl());
            $object->setTimeLimits($baseComponent->getTimeLimits());

            // Deal with categories.
            if (($category = $this->getDOMElementAttributeAs($element, 'category')) !== null) {
                $object->setCategories(new IdentifierCollection(explode("\x20", $category)));
            }

            // Deal with variableMappings.
            $variableMappingElts = $element->getElementsByTagName('variableMapping');
            $variableMappings = new VariableMappingCollection();
            for ($i = 0; $i < $variableMappingElts->length; $i++) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($variableMappingElts->item($i));
                $variableMappings[] = $marshaller->unmarshall($variableMappingElts->item($i));
            }
            $object->setVariableMappings($variableMappings);

            // Deal with weights.
            $weightElts = $element->getElementsByTagName('weight');
            $weights = new WeightCollection();
            for ($i = 0; $i < $weightElts->length; $i++) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($weightElts->item($i));
                $weights[] = $marshaller->unmarshall($weightElts->item($i));
            }
            $object->setWeights($weights);

            // Deal with templateDefaults.
            $templateDefaultElts = $element->getElementsByTagName('templateDefault');
            $templateDefaults = new TemplateDefaultCollection();
            for ($i = 0; $i < $templateDefaultElts->length; $i++) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($templateDefaultElts->item($i));
                $templateDefaults[] = $marshaller->unmarshall($templateDefaultElts->item($i));
            }
            $object->setTemplateDefaults($templateDefaults);

            return $object;
        } else {
            $msg = "The mandatory attribute 'href' is missing from element '" . $element->localName . "'.";
            throw new UnmarshallingException($msg, $element);
        }
    }
protected function unmarshall(DOMElement $element)
    {
        $baseComponent = parent::unmarshall($element);

        if (($href = $this->getDOMElementAttributeAs($element, 'href')) !== null) {
            $object = new AssessmentItemRef($baseComponent->getIdentifier(), $href);
            $object->setRequired($baseComponent->isRequired());
            $object->setFixed($baseComponent->isFixed());
            $object->setPreConditions($baseComponent->getPreConditions());
            $object->setBranchRules($baseComponent->getBranchRules());
            $object->setItemSessionControl($baseComponent->getItemSessionControl());
            $object->setTimeLimits($baseComponent->getTimeLimits());

            // Deal with categories.
            if (($category = $this->getDOMElementAttributeAs($element, 'category')) !== null) {
                $object->setCategories(new IdentifierCollection(explode("\x20", $category)));
            }

            // Deal with variableMappings.
            $variableMappingElts = $element->getElementsByTagName('variableMapping');
            $variableMappings = new VariableMappingCollection();
            for ($i = 0; $i < $variableMappingElts->length; $i++) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($variableMappingElts->item($i));
                $variableMappings[] = $marshaller->unmarshall($variableMappingElts->item($i));
            }
            $object->setVariableMappings($variableMappings);

            // Deal with weights.
            $weightElts = $element->getElementsByTagName('weight');
            $weights = new WeightCollection();
            for ($i = 0; $i < $weightElts->length; $i++) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($weightElts->item($i));
                $weights[] = $marshaller->unmarshall($weightElts->item($i));
            }
            $object->setWeights($weights);

            // Deal with templateDefaults.
            $templateDefaultElts = $element->getElementsByTagName('templateDefault');
            $templateDefaults = new TemplateDefaultCollection();
            for ($i = 0; $i < $templateDefaultElts->length; $i++) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($templateDefaultElts->item($i));
                $templateDefaults[] = $marshaller->unmarshall($templateDefaultElts->item($i));
            }
            $object->setTemplateDefaults($templateDefaults);

            return $object;
        } else {
            $msg = "The mandatory attribute 'href' is missing from element '" . $element->localName . "'.";
            throw new UnmarshallingException($msg, $element);
        }
    }
protected function unmarshall ( DOMElement $ element ) { $ baseComponent = parent :: unmarshall ( $ element ) ; if ( ( $ href = $ this -> getDOMElementAttributeAs ( $ element , 'href' ) ) !== null ) { $ object = new AssessmentItemRef ( $ baseComponent -> getIdentifier ( ) , $ href ) ; $ object -> setRequired ( $ baseComponent -> isRequired ( ) ) ; $ object -> setFixed ( $ baseComponent -> isFixed ( ) ) ; $ object -> setPreConditions ( $ baseComponent -> getPreConditions ( ) ) ; $ object -> setBranchRules ( $ baseComponent -> getBranchRules ( ) ) ; $ object -> setItemSessionControl ( $ baseComponent -> getItemSessionControl ( ) ) ; $ object -> setTimeLimits ( $ baseComponent -> getTimeLimits ( ) ) ; // Deal with categories. if ( ( $ category = $ this -> getDOMElementAttributeAs ( $ element , 'category' ) ) !== null ) { $ object -> setCategories ( new IdentifierCollection ( explode ( "\x20" , $ category ) ) ) ; } // Deal with variableMappings. $ variableMappingElts = $ element -> getElementsByTagName ( 'variableMapping' ) ; $ variableMappings = new VariableMappingCollection ( ) ; for ( $ i = 0 ; $ i < $ variableMappingElts -> length ; $ i ++ ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ variableMappingElts -> item ( $ i ) ) ; $ variableMappings [ ] = $ marshaller -> unmarshall ( $ variableMappingElts -> item ( $ i ) ) ; } $ object -> setVariableMappings ( $ variableMappings ) ; // Deal with weights. $ weightElts = $ element -> getElementsByTagName ( 'weight' ) ; $ weights = new WeightCollection ( ) ; for ( $ i = 0 ; $ i < $ weightElts -> length ; $ i ++ ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ weightElts -> item ( $ i ) ) ; $ weights [ ] = $ marshaller -> unmarshall ( $ weightElts -> item ( $ i ) ) ; } $ object -> setWeights ( $ weights ) ; // Deal with templateDefaults. $ templateDefaultElts = $ element -> getElementsByTagName ( 'templateDefault' ) ; $ templateDefaults = new TemplateDefaultCollection ( ) ; for ( $ i = 0 ; $ i < $ templateDefaultElts -> length ; $ i ++ ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ templateDefaultElts -> item ( $ i ) ) ; $ templateDefaults [ ] = $ marshaller -> unmarshall ( $ templateDefaultElts -> item ( $ i ) ) ; } $ object -> setTemplateDefaults ( $ templateDefaults ) ; return $ object ; } else { $ msg = "The mandatory attribute 'href' is missing from element '" . $ element -> localName . "'." ; throw new UnmarshallingException ( $ msg , $ element ) ; } }
Unmarshall a DOMElement object corresponding to a QTI assessmentItemRef element.

@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent An AssessmentItemRef object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException If the mandatory attribute 'href' is missing.
Unmarshall a DOMElement object corresponding to a QTI assessmentItemRef element .