Exemplo n.º 1
0
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     $object = new \Joli\Jane\OpenApi\Tests\Expected\Model\Schema();
     if (property_exists($data, 'stringProperty')) {
         $object->setStringProperty($data->{'stringProperty'});
     }
     if (property_exists($data, 'integerProperty')) {
         $object->setIntegerProperty($data->{'integerProperty'});
     }
     if (property_exists($data, 'floatProperty')) {
         $object->setFloatProperty($data->{'floatProperty'});
     }
     if (property_exists($data, 'arrayProperty')) {
         $values = [];
         foreach ($data->{'arrayProperty'} as $value) {
             $values[] = $value;
         }
         $object->setArrayProperty($values);
     }
     if (property_exists($data, 'mapProperty')) {
         $values_1 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
         foreach ($data->{'mapProperty'} as $key => $value_1) {
             $values_1[$key] = $value_1;
         }
         $object->setMapProperty($values_1);
     }
     if (property_exists($data, 'objectProperty')) {
         $object->setObjectProperty($this->serializer->deserialize($data->{'objectProperty'}, 'Joli\\Jane\\OpenApi\\Tests\\Expected\\Model\\ObjectProperty', 'raw', $context));
     }
     if (property_exists($data, 'objectRefProperty')) {
         $object->setObjectRefProperty($this->serializer->deserialize($data->{'objectRefProperty'}, 'Joli\\Jane\\OpenApi\\Tests\\Expected\\Model\\Schema', 'raw', $context));
     }
     return $object;
 }
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     if (empty($data)) {
         return null;
     }
     if (isset($data->{'$ref'})) {
         return new Reference($data->{'$ref'}, $context['rootSchema'] ?: null);
     }
     $object = new \Joli\Jane\OpenApi\Tests\Expected\Model\Schema();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (isset($data->{'stringProperty'})) {
         $object->setStringProperty($data->{'stringProperty'});
     }
     if (isset($data->{'integerProperty'})) {
         $object->setIntegerProperty($data->{'integerProperty'});
     }
     if (isset($data->{'floatProperty'})) {
         $object->setFloatProperty($data->{'floatProperty'});
     }
     if (isset($data->{'arrayProperty'})) {
         $values = [];
         foreach ($data->{'arrayProperty'} as $value) {
             $values[] = $value;
         }
         $object->setArrayProperty($values);
     }
     if (isset($data->{'mapProperty'})) {
         $values_0 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
         foreach ($data->{'mapProperty'} as $key => $value_1) {
             $values_0[$key] = $value_1;
         }
         $object->setMapProperty($values_0);
     }
     if (isset($data->{'objectProperty'})) {
         $object->setObjectProperty($this->serializer->deserialize($data->{'objectProperty'}, 'Joli\\Jane\\OpenApi\\Tests\\Expected\\Model\\ObjectProperty', 'raw', $context));
     }
     if (isset($data->{'objectRefProperty'})) {
         $object->setObjectRefProperty($this->serializer->deserialize($data->{'objectRefProperty'}, 'Joli\\Jane\\OpenApi\\Tests\\Expected\\Model\\Schema', 'raw', $context));
     }
     return $object;
 }