/**
  * Write a Pair in the current binary stream.
  * 
  * @param Pair $pair A Pair object.
  * @throws QtiBinaryStreamAccessException
  */
 public function writePair(Pair $pair)
 {
     try {
         $this->writeString($pair->getFirst());
         $this->writeString($pair->getSecond());
     } catch (BinaryStreamAccessException $e) {
         $msg = "An error occured while writing a pair.";
         throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAccessException::PAIR, $e);
     }
 }
Exemplo n.º 2
0
 /**
  * Marshall a QTI pair datatype into its PCI JSON Representation.
  *
  * @param \qtism\common\datatypes\Pair $pair
  * @return array
  */
 protected function marshallPair(Pair $pair)
 {
     return array('base' => array('pair' => array($pair->getFirst(), $pair->getSecond())));
 }