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 \Docker\API\Model\IPAM();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (isset($data->{'Driver'})) {
         $object->setDriver($data->{'Driver'});
     }
     if (isset($data->{'Config'})) {
         $values_217 = [];
         foreach ($data->{'Config'} as $value_218) {
             $values_219 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
             foreach ($value_218 as $key_221 => $value_220) {
                 $values_219[$key_221] = $value_220;
             }
             $values_217[] = $values_219;
         }
         $object->setConfig($values_217);
     }
     return $object;
 }
Example #2
0
 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 \Docker\API\Model\IPAM();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (isset($data->{'Driver'})) {
         $object->setDriver($data->{'Driver'});
     }
     if (isset($data->{'Config'})) {
         $values_253 = [];
         foreach ($data->{'Config'} as $value_254) {
             $values_253[] = $this->serializer->deserialize($value_254, 'Docker\\API\\Model\\IPAMConfig', 'raw', $context);
         }
         $object->setConfig($values_253);
     }
     if (isset($data->{'Options'})) {
         $values_255 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
         foreach ($data->{'Options'} as $key_257 => $value_256) {
             $values_255[$key_257] = $value_256;
         }
         $object->setOptions($values_255);
     }
     return $object;
 }
Example #3
0
 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 \Docker\API\Model\IPAM();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (property_exists($data, 'Driver')) {
         $object->setDriver($data->{'Driver'});
     }
     if (property_exists($data, 'Config')) {
         $value = $data->{'Config'};
         if (is_array($data->{'Config'})) {
             $values = [];
             foreach ($data->{'Config'} as $value_1) {
                 $values[] = $this->serializer->deserialize($value_1, 'Docker\\API\\Model\\IPAMConfig', 'raw', $context);
             }
             $value = $values;
         }
         if (is_null($data->{'Config'})) {
             $value = $data->{'Config'};
         }
         $object->setConfig($value);
     }
     if (property_exists($data, 'Options')) {
         $value_2 = $data->{'Options'};
         if (is_object($data->{'Options'})) {
             $values_1 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
             foreach ($data->{'Options'} as $key => $value_3) {
                 $values_1[$key] = $value_3;
             }
             $value_2 = $values_1;
         }
         if (is_null($data->{'Options'})) {
             $value_2 = $data->{'Options'};
         }
         $object->setOptions($value_2);
     }
     return $object;
 }