/** * @param mixed $data * @param string $class * @param string $name * @param string $format * @param array $context * * @throws RuntimeException * * @return mixed|object */ protected function denormalizeProperty($data, $class, $name, $format = null, array $context = array()) { if (!$this->propertyInfoExtractor) { return $data; } /** @var Type[] $types */ $types = $this->propertyInfoExtractor->getTypes($class, $name); if (empty($types)) { return $data; } foreach ($types as $type) { if ($data === null && $type->isNullable()) { return $data; } if (!$this->serializer instanceof DenormalizerInterface) { $message = 'Cannot denormalize attribute "%s" because injected serializer is not a denormalizer'; throw new RuntimeException(sprintf($message, $name)); } return $this->serializer->denormalize($data, $type->getClassName(), $format, $context); } }
public function testGetProperties() { $this->assertEquals(array('a', 'b'), $this->propertyInfo->getProperties('Foo')); }