@@ -212,37 +212,37 @@ public function __construct(int $serverId, ?GuzzleClient $httpClient = null)
212212 */
213213 public function setAdditionalData ($ data )
214214 {
215- $ this ->name = $ data ->name ;
216- $ this ->status = $ data ->status ?: null ;
217- $ this ->public_net = $ data ->public_net ?: null ;
218- $ this ->publicNet = $ data ->public_net ?: null ;
219- $ this ->private_net = property_exists ( $ data, ' private_net ' ) ? $ data ->private_net : [];
220- $ this ->privateNet = property_exists ( $ data, ' private_net ' ) ? $ data ->private_net : [];
221- $ this ->server_type = $ data ->server_type ? ServerType::parse ($ data ->server_type ) : null ;
222- $ this ->serverType = $ data ->server_type ? ServerType::parse ($ data ->server_type ) : null ;
223- $ this ->datacenter = $ data ->datacenter ? Datacenter::parse ($ data ->datacenter ) : null ;
215+ $ this ->name = $ data ->name ?? null ;
216+ $ this ->status = $ data ->status ?? null ;
217+ $ this ->public_net = $ data ->public_net ?? null ;
218+ $ this ->publicNet = $ data ->public_net ?? null ;
219+ $ this ->private_net = $ data ->private_net ?? [];
220+ $ this ->privateNet = $ data ->private_net ?? [];
221+ $ this ->server_type = property_exists ( $ data , ' server_type ' ) && $ data ->server_type ? ServerType::parse ($ data ->server_type ) : null ;
222+ $ this ->serverType = property_exists ( $ data , ' server_type ' ) && $ data ->server_type ? ServerType::parse ($ data ->server_type ) : null ;
223+ $ this ->datacenter = property_exists ( $ data , ' datacenter ' ) && $ data ->datacenter ? Datacenter::parse ($ data ->datacenter ) : null ;
224224 $ this ->location = property_exists ($ data , 'location ' ) && $ data ->location ? Location::parse ($ data ->location ) : null ;
225- $ this ->created = $ data ->created ;
226- $ this ->image = $ data ->image ? Image::parse ($ data ->image ) : null ;
227- $ this ->iso = $ data ->iso ? ISO ::parse ($ data ->iso ) : null ;
225+ $ this ->created = $ data ->created ?? null ;
226+ $ this ->image = property_exists ( $ data , ' image ' ) && $ data ->image ? Image::parse ($ data ->image ) : null ;
227+ $ this ->iso = property_exists ( $ data , ' iso ' ) && $ data ->iso ? ISO ::parse ($ data ->iso ) : null ;
228228 $ this ->rescue_enabled = $ data ->rescue_enabled ?? null ;
229229 $ this ->rescueEnabled = $ data ->rescue_enabled ?? null ;
230230 $ this ->locked = $ data ->locked ?? null ;
231- $ this ->backup_window = $ data ->backup_window ?: null ;
232- $ this ->backupWindow = $ data ->backup_window ?: null ;
233- $ this ->outgoing_traffic = $ data ->outgoing_traffic ?: null ;
234- $ this ->outgoingTraffic = $ data ->outgoing_traffic ?: null ;
235- $ this ->ingoing_traffic = $ data ->ingoing_traffic ?: null ;
236- $ this ->ingoingTraffic = $ data ->ingoing_traffic ?: null ;
237- $ this ->included_traffic = $ data ->included_traffic ?: null ;
238- $ this ->includedTraffic = $ data ->included_traffic ?: null ;
239- $ this ->volumes = property_exists ( $ data, ' volumes ' ) ? $ data ->volumes : [];
240- $ this ->protection = $ data ->protection ? Protection::parse ($ data ->protection ) : null ;
241- $ this ->labels = get_object_vars ($ data ->labels );
242- $ this ->primary_disk_size = $ data ->primary_disk_size ?: null ;
243- $ this ->primaryDiskSize = $ data ->primary_disk_size ?: null ;
244- $ this ->placement_group = property_exists ( $ data, ' placement_group ' ) ? $ data ->placement_group : null ;
245- $ this ->load_balancers = property_exists ( $ data, ' load_balancers ' ) ? $ data ->load_balancers : [];
231+ $ this ->backup_window = $ data ->backup_window ?? null ;
232+ $ this ->backupWindow = $ data ->backup_window ?? null ;
233+ $ this ->outgoing_traffic = $ data ->outgoing_traffic ?? null ;
234+ $ this ->outgoingTraffic = $ data ->outgoing_traffic ?? null ;
235+ $ this ->ingoing_traffic = $ data ->ingoing_traffic ?? null ;
236+ $ this ->ingoingTraffic = $ data ->ingoing_traffic ?? null ;
237+ $ this ->included_traffic = $ data ->included_traffic ?? null ;
238+ $ this ->includedTraffic = $ data ->included_traffic ?? null ;
239+ $ this ->volumes = $ data ->volumes ?? [];
240+ $ this ->protection = property_exists ( $ data , ' protection ' ) && $ data ->protection ? Protection::parse ($ data ->protection ) : null ;
241+ $ this ->labels = property_exists ( $ data , ' labels ' ) && $ data -> labels ? get_object_vars ($ data ->labels ) : [] ;
242+ $ this ->primary_disk_size = $ data ->primary_disk_size ?? null ;
243+ $ this ->primaryDiskSize = $ data ->primary_disk_size ?? null ;
244+ $ this ->placement_group = $ data ->placement_group ?? null ;
245+ $ this ->load_balancers = $ data ->load_balancers ?? [];
246246
247247 return $ this ;
248248 }
0 commit comments