public function denormalize($data, $class, $format = null, array $context = [])
{
if (isset($data->{'$ref'})) {
return new Reference($data->{'$ref'}, $context['rootSchema'] ?: null);
}
$object = new \Joli\Jane\OpenApi\Model\Response();
if (!isset($context['rootSchema'])) {
$context['rootSchema'] = $object;
}
if (property_exists($data, 'description')) {
$object->setDescription($data->{'description'});
}
if (property_exists($data, 'schema')) {
$value = $data->{'schema'};
if (is_object($data->{'schema'})) {
$value = $this->serializer->deserialize($data->{'schema'}, 'Joli\\Jane\\OpenApi\\Model\\Schema', 'raw', $context);
}
if (is_object($data->{'schema'}) and (isset($data->{'schema'}->{'type'}) and $data->{'schema'}->{'type'} == 'file')) {
$value = $this->serializer->deserialize($data->{'schema'}, 'Joli\\Jane\\OpenApi\\Model\\FileSchema', 'raw', $context);
}
$object->setSchema($value);
}
if (property_exists($data, 'headers')) {
$values = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
foreach ($data->{'headers'} as $key => $value_1) {
$values[$key] = $this->serializer->deserialize($value_1, 'Joli\\Jane\\OpenApi\\Model\\Header', 'raw', $context);
}
$object->setHeaders($values);
}
if (property_exists($data, 'examples')) {
$values_1 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
foreach ($data->{'examples'} as $key_1 => $value_2) {
$values_1[$key_1] = $value_2;
}
$object->setExamples($values_1);
}
return $object;
}