service= $service; $this->name = $data['name']; $this->id = $data['id']; if (isset($data['serverId'])) { $this->serverId= $data['serverId']; } if (isset($data['updated'])) { $this->updated= $data['updated']; } if (isset($data['created'])) { $this->created= $data['created']; } if (isset($data['status'])) { $this->status= $data['status']; } if (isset($data['progress'])) { $this->progress= $data['progress']; } } /** * Get the name of the image * * @return string */ public function getName() { return $this->name; } /** * Get the image's id * * @return string */ public function getId() { return $this->id; } /** * Get the server's id of the image * * @return string */ public function getServerId() { return $this->serverId; } /** * Get the updated data * * @return string */ public function getUpdated() { return $this->updated; } /** * Get the created data * * @return string */ public function getCreated() { return $this->created; } /** * Get the image's status * * @return string|boolean */ public function getStatus() { $data= $this->service->getImage($this->id); if ($data!==false) { $data= $data->toArray(); $this->status= $data['status']; return $this->status; } return false; } /** * Get the progress's status * * @return integer|boolean */ public function getProgress() { $data= $this->service->getImage($this->id); if ($data!==false) { $data= $data->toArray(); $this->progress= $data['progress']; return $this->progress; } return false; } /** * To Array * * @return array */ public function toArray() { return array ( 'name' => $this->name, 'id' => $this->id, 'serverId' => $this->serverId, 'updated' => $this->updated, 'created' => $this->created, 'status' => $this->status, 'progress' => $this->progress ); } }