Example #1
0
 /**
  * 
  * @param  Context $context
  * @return ObjectExpr_Container
  */
 private function getContainer(Context $context)
 {
     $asArray = $context->getOption(JsonCodec::OBJECT_AS_ARRAY);
     return $asArray ? new ObjectExpr_ArrayContainer() : new ObjectExpr_StdClassContainer();
 }
Example #2
0
 /**
  * 現在の文字が数字 ("0" から "9") かどうかを調べます.
  * 
  * @param  Context $context 解析対象の Context
  * @return bool             現在の文字が 0 から 9 のいずれかの場合のみ true
  */
 public static function checkDigit(Context $context)
 {
     $code = $context->currentCodePoint();
     return 0x30 <= $code && $code <= 0x39;
 }
Example #3
0
 /**
  * @covers Peach\DF\JsonCodec\Context::skip
  * @expectedException Peach\DF\JsonCodec\DecodeException
  */
 public function testSkipFail()
 {
     $context = new Context("This is a pen.", new ArrayMap());
     // read "This is a "
     $context->skip(10);
     // The remaining count is 4, but skipping 5
     $context->skip(5);
 }