/** * @param resource $stream * @param Definition $definition * @param mixed $origin * @return mixed */ public function decode($stream, Definition $definition, &$origin = null) { $content = stream_get_contents($stream); $data = json_decode($content, true); return $this->normalizer->denormalize($data, $definition, $origin); }
public function testDenormalizeNull() { $origin = new \stdClass(); $normalizer = new Normalizer(); $definition = $this->getDefinitionMock(); $definition->expects($this->once())->method('isObject')->will($this->returnValue(true)); $definition->expects($this->once())->method('settle')->with($origin, null); $normalizer->denormalize(null, $definition, $origin); }