コード例 #1
0
ファイル: XmlFormat.php プロジェクト: bcncommerce/serializer
 /**
  * @param  resource   $stream
  * @param  Definition $definition
  * @param  mixed      $origin
  * @return mixed
  */
 public function decode($stream, Definition $definition, &$origin = null)
 {
     $context = new RootContext(new DefinitionContext($origin, $definition));
     $handler = new ContextHandler($context);
     $this->parser->parse($stream, $handler);
     return $context->fetch();
 }
コード例 #2
0
 public function testFetch()
 {
     $fetched = new \stdClass();
     $context = $this->getParserContextMock();
     $context->expects($this->once())->method('fetch')->will($this->returnValue($fetched));
     $root = new RootContext($context);
     $this->assertSame($fetched, $root->fetch());
 }