protected function unmarshall(DOMElement $element)
    {
        $version = $this->getVersion();
        if (($responseIdentifier = $this->getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {

            $objectElts = $this->getChildElementsByTagName($element, 'object');
            if (count($objectElts) > 0) {

                $object = $this->getMarshallerFactory()->createMarshaller($objectElts[0])->unmarshall($objectElts[0]);
                $component = new PositionObjectInteraction($responseIdentifier, $object);

                if (($maxChoices = $this->getDOMElementAttributeAs($element, 'maxChoices', 'integer')) !== null) {
                    $component->setMaxChoices($maxChoices);
                }

                if (Version::compare($version, '2.1.0', '>=') === true && ($minChoices = $this->getDOMElementAttributeAs($element, 'minChoices', 'integer')) !== null) {
                    $component->setMinChoices($minChoices);
                }

                if (($centerPoint = $this->getDOMElementAttributeAs($element, 'centerPoint')) !== null) {
                    $points = explode("\x20", $centerPoint);
                    $pointsCount = count($points);

                    if ($pointsCount === 2) {

                        if (Format::isInteger($points[0]) === true) {

                            if (Format::isInteger($points[1]) === true) {

                                $component->setCenterPoint(new QtiPoint(intval($points[0]), intval($points[1])));
                            } else {
                                $msg = "The 2nd integer of the 'centerPoint' attribute value is not a valid integer for element 'positionObjectInteraction'.";
                                throw new UnmarshallingException($msg, $element);
                            }
                        } else {
                            $msg = "The 1st value of the 'centerPoint' attribute value is not a valid integer for element 'positionObjectInteraction'.";
                            throw new UnmarshallingException($msg, $element);
                        }
                    } else {
                        $msg = "The value of the 'centePoint' attribute of a 'positionObjectInteraction' element must be composed of exactly 2 integer values, ${pointsCount} given.";
                        throw new UnmarshallingException($msg, $element);
                    }
                }

                $this->fillBodyElement($component, $element);

                return $component;
            } else {
                $msg = "A 'positionObjectInteraction' element must contain exactly one 'object' element, none given.";
                throw new UnmarshallingException($msg, $element);
            }
        } else {
            $msg = "The mandatory 'responseIdentifier' attribute is missing from the 'positionObjectInteraction' object.";
            throw new UnmarshallingException($msg, $element);
        }
    }
protected function unmarshall(DOMElement $element)
    {
        $version = $this->getVersion();
        if (($responseIdentifier = $this->getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {

            $objectElts = $this->getChildElementsByTagName($element, 'object');
            if (count($objectElts) > 0) {

                $object = $this->getMarshallerFactory()->createMarshaller($objectElts[0])->unmarshall($objectElts[0]);
                $component = new PositionObjectInteraction($responseIdentifier, $object);

                if (($maxChoices = $this->getDOMElementAttributeAs($element, 'maxChoices', 'integer')) !== null) {
                    $component->setMaxChoices($maxChoices);
                }

                if (Version::compare($version, '2.1.0', '>=') === true && ($minChoices = $this->getDOMElementAttributeAs($element, 'minChoices', 'integer')) !== null) {
                    $component->setMinChoices($minChoices);
                }

                if (($centerPoint = $this->getDOMElementAttributeAs($element, 'centerPoint')) !== null) {
                    $points = explode("\x20", $centerPoint);
                    $pointsCount = count($points);

                    if ($pointsCount === 2) {

                        if (Format::isInteger($points[0]) === true) {

                            if (Format::isInteger($points[1]) === true) {

                                $component->setCenterPoint(new QtiPoint(intval($points[0]), intval($points[1])));
                            } else {
                                $msg = "The 2nd integer of the 'centerPoint' attribute value is not a valid integer for element 'positionObjectInteraction'.";
                                throw new UnmarshallingException($msg, $element);
                            }
                        } else {
                            $msg = "The 1st value of the 'centerPoint' attribute value is not a valid integer for element 'positionObjectInteraction'.";
                            throw new UnmarshallingException($msg, $element);
                        }
                    } else {
                        $msg = "The value of the 'centePoint' attribute of a 'positionObjectInteraction' element must be composed of exactly 2 integer values, ${pointsCount} given.";
                        throw new UnmarshallingException($msg, $element);
                    }
                }

                $this->fillBodyElement($component, $element);

                return $component;
            } else {
                $msg = "A 'positionObjectInteraction' element must contain exactly one 'object' element, none given.";
                throw new UnmarshallingException($msg, $element);
            }
        } else {
            $msg = "The mandatory 'responseIdentifier' attribute is missing from the 'positionObjectInteraction' object.";
            throw new UnmarshallingException($msg, $element);
        }
    }
protected function unmarshall ( DOMElement $ element ) { $ version = $ this -> getVersion ( ) ; if ( ( $ responseIdentifier = $ this -> getDOMElementAttributeAs ( $ element , 'responseIdentifier' ) ) !== null ) { $ objectElts = $ this -> getChildElementsByTagName ( $ element , 'object' ) ; if ( count ( $ objectElts ) > 0 ) { $ object = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ objectElts [ 0 ] ) -> unmarshall ( $ objectElts [ 0 ] ) ; $ component = new PositionObjectInteraction ( $ responseIdentifier , $ object ) ; if ( ( $ maxChoices = $ this -> getDOMElementAttributeAs ( $ element , 'maxChoices' , 'integer' ) ) !== null ) { $ component -> setMaxChoices ( $ maxChoices ) ; } if ( Version :: compare ( $ version , '2.1.0' , '>=' ) === true && ( $ minChoices = $ this -> getDOMElementAttributeAs ( $ element , 'minChoices' , 'integer' ) ) !== null ) { $ component -> setMinChoices ( $ minChoices ) ; } if ( ( $ centerPoint = $ this -> getDOMElementAttributeAs ( $ element , 'centerPoint' ) ) !== null ) { $ points = explode ( "\x20" , $ centerPoint ) ; $ pointsCount = count ( $ points ) ; if ( $ pointsCount === 2 ) { if ( Format :: isInteger ( $ points [ 0 ] ) === true ) { if ( Format :: isInteger ( $ points [ 1 ] ) === true ) { $ component -> setCenterPoint ( new QtiPoint ( intval ( $ points [ 0 ] ) , intval ( $ points [ 1 ] ) ) ) ; } else { $ msg = "The 2nd integer of the 'centerPoint' attribute value is not a valid integer for element 'positionObjectInteraction'." ; throw new UnmarshallingException ( $ msg , $ element ) ; } } else { $ msg = "The 1st value of the 'centerPoint' attribute value is not a valid integer for element 'positionObjectInteraction'." ; throw new UnmarshallingException ( $ msg , $ element ) ; } } else { $ msg = "The value of the 'centePoint' attribute of a 'positionObjectInteraction' element must be composed of exactly 2 integer values, ${pointsCount} given." ; throw new UnmarshallingException ( $ msg , $ element ) ; } } $ this -> fillBodyElement ( $ component , $ element ) ; return $ component ; } else { $ msg = "A 'positionObjectInteraction' element must contain exactly one 'object' element, none given." ; throw new UnmarshallingException ( $ msg , $ element ) ; } } else { $ msg = "The mandatory 'responseIdentifier' attribute is missing from the 'positionObjectInteraction' object." ; throw new UnmarshallingException ( $ msg , $ element ) ; } }
Unmarshall a DOMElement object corresponding to an positionObjectInteraction element.

@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A PositionObjectInteraction object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException
Unmarshall a DOMElement object corresponding to an positionObjectInteraction element .