예제 #1
0
 /**
  * Unmarshall a DOMElement to its TestFeedbackRef data model representation.
  *
  * @param \DOMElement $element
  * @return \qtism\data\QtiComponent A TestFeedbackRef object.
  * @throws \qtism\data\storage\xml\marshalling\UnmarshallingException If the element cannot be unmarshalled.
  */
 public function unmarshall(DOMElement $element)
 {
     if (($identifier = self::getDOMElementAttributeAs($element, 'identifier')) !== null) {
         if (($href = self::getDOMElementAttributeAs($element, 'href')) !== null) {
             if (($outcomeIdentifier = self::getDOMElementAttributeAs($element, 'outcomeIdentifier')) !== null) {
                 if (($access = self::getDOMElementAttributeAs($element, 'access')) !== null) {
                     if (($showHide = self::getDOMElementAttributeAs($element, 'showHide')) !== null) {
                         $access = TestFeedbackAccess::getConstantByName($access);
                         $showHide = ShowHide::getConstantByName($showHide);
                         $component = new TestFeedbackRef($identifier, $outcomeIdentifier, $access, $showHide, $href);
                         return $component;
                     } else {
                         $msg = "The mandatory 'showHide' attribute is missing from element 'testFeedbackRef'.";
                         throw new UnmarshallingException($msg, $element);
                     }
                 } else {
                     $msg = "The mandatory 'access' attribute is missing from element 'testFeedbackRef'.";
                     throw new UnmarshallingException($msg, $element);
                 }
             } else {
                 $msg = "The mandatory 'outcomeIdentifier' attribute is missing from element 'testFeedbackRef'.";
                 throw new UnmarshallingException($msg, $element);
             }
         } else {
             $msg = "The mandatory 'href' attribute is missing from element 'testFeedbackRef'.";
             throw new UnmarshallingException($msg, $element);
         }
     } else {
         $msg = "The mandatory 'identifier' attribute is missing from element 'testFeedbackRef'.";
         throw new UnmarshallingException($msg, $element);
     }
 }