Пример #1
0
 /**
  * Check if $value is a QTI Runtime compliant value.
  *
  * @throws \InvalidArgumentException If $value is not a QTI Runtime compliant value.
  */
 protected function checkType($value)
 {
     if (RuntimeUtils::isQtiScalarDatatypeCompliant($value)) {
         return;
     } elseif ($value instanceof MultipleContainer || $value instanceof OrderedContainer || $value instanceof RecordContainer) {
         return;
     } else {
         $value = gettype($value) === 'object' ? get_class($value) : $value;
         $msg = "The OperandsCollection only accepts QTI Runtime compliant values, '" . $value . "' given.";
         throw new InvalidArgumentException($msg);
     }
 }
Пример #2
0
 /**
  * @see \qtism\common\collections\AbstractCollection::checkType()
  */
 protected function checkType($value)
 {
     if (!RuntimeUtils::isQtiScalarDatatypeCompliant($value)) {
         $displayType = PhpUtils::displayType($value);
         $msg = "Cannot insert a non QTI Scalar Datatype into a QTI Container. The following Datatypes are accepted ";
         $msg .= "null, QTI Identifier, QTI Boolean, QTI Integer, QTI Float, QTI String, QTI Point, QTI Pair, QTI DirectedPair, ";
         $msg .= "QTI Duration, QTI File, QTI Uri, QTI IntOrIdentifier. '{$displayType}' given.";
         throw new InvalidArgumentException($msg);
     }
 }