/**
  * Process a $value depending on its $baseType.
  * 
  * @param integer $baseType The baseType of the value to process.
  * @param mixed $value A QTI Runtime compliant value.
  * @throws PrintedVariableProcessingException If the baseType is unknown.
  * @return string
  */
 private function processValue($baseType, $value)
 {
     $printedVariable = $this->getComponent();
     if ($value === null) {
         return 'null';
     }
     if ($baseType === BaseType::INT_OR_IDENTIFIER) {
         $baseType = is_int($value) === true ? BaseType::INTEGER : BaseType::STRING;
     } else {
         if ($baseType === BaseType::IDENTIFIER || $baseType === BaseType::URI) {
             $baseType = BaseType::STRING;
         } else {
             if ($baseType === BaseType::FILE) {
                 // @todo support baseType::FILE in PrintedVariable.
                 $msg = "the 'file' BaseType is not supported yet by PrintedVariableEngine implementation.";
                 throw new PrintedVariableProcessingException($msg, $this, PrintedVariableProcessingException::RUNTIME_ERROR);
             }
         }
     }
     if ($baseType === BaseType::STRING) {
         return $value->getValue();
     } else {
         if ($baseType === BaseType::INTEGER || $baseType === BaseType::FLOAT) {
             $format = $printedVariable->getFormat();
             if (empty($format) === false) {
                 $format = Format::printfFormatIsoToPhp($format);
                 return sprintf($format, $value->getValue());
             } else {
                 if ($baseType === BaseType::FLOAT && $printedVariable->mustPowerForm() === true) {
                     return Format::scale10($value->getValue(), 'x');
                 } else {
                     if ($baseType === BaseType::FLOAT) {
                         return sprintf('%e', $value->getValue());
                     } else {
                         // integer to string
                         return '' . $value->getValue();
                     }
                 }
             }
         } else {
             if ($baseType === BaseType::DURATION) {
                 return '' . $value->getSeconds(true);
             } else {
                 if ($baseType === BaseType::BOOLEAN) {
                     return $value->getValue() === true ? 'true' : 'false';
                 } else {
                     if ($baseType === BaseType::POINT || $baseType === BaseType::PAIR || $baseType === BaseType::DIRECTED_PAIR) {
                         return $value->__toString();
                     } else {
                         $msg = "Unknown value type.";
                         throw new PrintedVariableProcessingException($msg, $this, PrintedVariableProcessingException::RUNTIME_ERROR);
                     }
                 }
             }
         }
     }
 }
 /**
  * @dataProvider scale10Provider
  */
 public function testScale10($float, $expected, $x = 'x', $precision = false)
 {
     $this->assertEquals($expected, Format::scale10($float, $x, $precision));
 }