protected function add_unit(ImsQtiWriter $body, $question)
 {
     switch ($question->options->showunits) {
         case self::UNIT_TEXTBOX:
             //Edit unit Editable text input element
             $expected_length = 1;
             foreach ($question->options->units as $unit) {
                 $expected_length = max($expected_length, strlen($unit->unit));
             }
             return $body->add_extendedTextInteraction(self::UNIT, $expected_length, 1, 1);
         case self::UNIT_RADIO:
             //Select units Choice radio element of 2 Units minimum
             $result = $body->add_choiceInteraction(self::UNIT, 1, false);
             foreach ($question->options->units as $unit) {
                 $choice = $result->add_simpleChoice($unit->unit);
                 $choice->add_span($unit->unit);
             }
             return $result;
         case self::UNIT_READONLY:
             //Display unit NON editable text of Unit No1
             if (isset($question->options->units[0])) {
                 $result = $body->add_span($question->options->units[0]->unit);
             } else {
                 $result = null;
             }
             return $result;
         case self::UNIT_HIDE:
             //No unit display Only numerical answer will be graded
             //do nothing
             return null;
     }
 }