Exemplo n.º 1
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\Network();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (isset($data->{'Name'})) {
         $object->setName($data->{'Name'});
     }
     if (isset($data->{'Id'})) {
         $object->setId($data->{'Id'});
     }
     if (isset($data->{'Scope'})) {
         $object->setScope($data->{'Scope'});
     }
     if (isset($data->{'Driver'})) {
         $object->setDriver($data->{'Driver'});
     }
     if (isset($data->{'IPAM'})) {
         $object->setIPAM($this->serializer->deserialize($data->{'IPAM'}, 'Docker\\API\\Model\\IPAM', 'raw', $context));
     }
     if (isset($data->{'Containers'})) {
         $values_241 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
         foreach ($data->{'Containers'} as $key_243 => $value_242) {
             $values_241[$key_243] = $this->serializer->deserialize($value_242, 'Docker\\API\\Model\\NetworkContainer', 'raw', $context);
         }
         $object->setContainers($values_241);
     }
     if (isset($data->{'Options'})) {
         $values_244 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
         foreach ($data->{'Options'} as $key_246 => $value_245) {
             $values_244[$key_246] = $value_245;
         }
         $object->setOptions($values_244);
     }
     return $object;
 }
Exemplo n.º 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\Network();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (property_exists($data, 'Name')) {
         $object->setName($data->{'Name'});
     }
     if (property_exists($data, 'Id')) {
         $object->setId($data->{'Id'});
     }
     if (property_exists($data, 'Scope')) {
         $object->setScope($data->{'Scope'});
     }
     if (property_exists($data, 'Driver')) {
         $object->setDriver($data->{'Driver'});
     }
     if (property_exists($data, 'EnableIPv6')) {
         $object->setEnableIPv6($data->{'EnableIPv6'});
     }
     if (property_exists($data, 'IPAM')) {
         $object->setIPAM($this->serializer->deserialize($data->{'IPAM'}, 'Docker\\API\\Model\\IPAM', 'raw', $context));
     }
     if (property_exists($data, 'Internal')) {
         $object->setInternal($data->{'Internal'});
     }
     if (property_exists($data, 'Containers')) {
         $values = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
         foreach ($data->{'Containers'} as $key => $value) {
             $values[$key] = $this->serializer->deserialize($value, 'Docker\\API\\Model\\NetworkContainer', 'raw', $context);
         }
         $object->setContainers($values);
     }
     if (property_exists($data, 'Options')) {
         $values_1 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
         foreach ($data->{'Options'} as $key_1 => $value_1) {
             $values_1[$key_1] = $value_1;
         }
         $object->setOptions($values_1);
     }
     return $object;
 }