コード例 #1
0
ファイル: Marshaller.php プロジェクト: nagyist/qti-sdk
 /**
  * Marshall a QTI directedPair datatype into its PCI JSON Representation.
  *
  * @param \qtism\common\datatypes\DirectedPair $directedPair
  * @return array
  */
 protected function marshallDirectedPair(QtiDirectedPair $directedPair)
 {
     return array('base' => array('directedPair' => array($directedPair->getFirst(), $directedPair->getSecond())));
 }
コード例 #2
0
 private function assertDirectPair(QtiDirectedPair $pair, $expectedFirstValue, $expectedSecondValue)
 {
     $this->assertEquals($expectedFirstValue, $pair->getFirst());
     $this->assertEquals($expectedSecondValue, $pair->getSecond());
 }
コード例 #3
0
 /**
  * Write a DirectedPair in the current binary stream.
  *
  * @param \qtism\common\datatypes\DirectedPair $directedPair A DirectedPair object.
  * @throws \qtism\runtime\storage\binary\QtiBinaryStreamAccessException
  */
 public function writeDirectedPair(QtiDirectedPair $directedPair)
 {
     try {
         $this->writeString($directedPair->getFirst());
         $this->writeString($directedPair->getSecond());
     } catch (BinaryStreamAccessException $e) {
         $msg = "An error occured while writing a directedPair.";
         throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAccessException::DIRECTEDPAIR, $e);
     }
 }