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\ImageItem();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (isset($data->{'RepoTags'})) {
         $values_159 = [];
         foreach ($data->{'RepoTags'} as $value_160) {
             $values_159[] = $value_160;
         }
         $object->setRepoTags($values_159);
     }
     if (isset($data->{'Id'})) {
         $object->setId($data->{'Id'});
     }
     if (isset($data->{'ParentId'})) {
         $object->setParentId($data->{'ParentId'});
     }
     if (isset($data->{'Created'})) {
         $object->setCreated($data->{'Created'});
     }
     if (isset($data->{'Size'})) {
         $object->setSize($data->{'Size'});
     }
     if (isset($data->{'VirtualSize'})) {
         $object->setVirtualSize($data->{'VirtualSize'});
     }
     if (isset($data->{'Labels'})) {
         $values_161 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
         foreach ($data->{'Labels'} as $key_163 => $value_162) {
             $values_161[$key_163] = $value_162;
         }
         $object->setLabels($values_161);
     }
     if (isset($data->{'RepoDigests'})) {
         $values_164 = [];
         foreach ($data->{'RepoDigests'} as $value_165) {
             $values_164[] = $value_165;
         }
         $object->setRepoDigests($values_164);
     }
     return $object;
 }
示例#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\ImageItem();
     if (!isset($context['rootSchema'])) {
         $context['rootSchema'] = $object;
     }
     if (property_exists($data, 'RepoTags')) {
         $value = $data->{'RepoTags'};
         if (is_array($data->{'RepoTags'})) {
             $values = [];
             foreach ($data->{'RepoTags'} as $value_1) {
                 $values[] = $value_1;
             }
             $value = $values;
         }
         if (is_null($data->{'RepoTags'})) {
             $value = $data->{'RepoTags'};
         }
         $object->setRepoTags($value);
     }
     if (property_exists($data, 'Id')) {
         $object->setId($data->{'Id'});
     }
     if (property_exists($data, 'ParentId')) {
         $object->setParentId($data->{'ParentId'});
     }
     if (property_exists($data, 'Created')) {
         $object->setCreated($data->{'Created'});
     }
     if (property_exists($data, 'Size')) {
         $object->setSize($data->{'Size'});
     }
     if (property_exists($data, 'VirtualSize')) {
         $object->setVirtualSize($data->{'VirtualSize'});
     }
     if (property_exists($data, 'Labels')) {
         $value_2 = $data->{'Labels'};
         if (is_object($data->{'Labels'})) {
             $values_1 = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
             foreach ($data->{'Labels'} as $key => $value_3) {
                 $values_1[$key] = $value_3;
             }
             $value_2 = $values_1;
         }
         if (is_null($data->{'Labels'})) {
             $value_2 = $data->{'Labels'};
         }
         $object->setLabels($value_2);
     }
     if (property_exists($data, 'RepoDigests')) {
         $value_4 = $data->{'RepoDigests'};
         if (is_array($data->{'RepoDigests'})) {
             $values_2 = [];
             foreach ($data->{'RepoDigests'} as $value_5) {
                 $values_2[] = $value_5;
             }
             $value_4 = $values_2;
         }
         if (is_null($data->{'RepoDigests'})) {
             $value_4 = $data->{'RepoDigests'};
         }
         $object->setRepoDigests($value_4);
     }
     return $object;
 }