AbstractVM.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Class AbstractVM
  5. */
  6. abstract class AbstractVM
  7. {
  8. public $name;
  9. public $host;
  10. public $user;
  11. public $vmId;
  12. public $vmMinSize;
  13. public $vmMaxSize;
  14. public $apiKey;
  15. public $vmClientId;
  16. public $messages = array();
  17. protected $connector;
  18. /**
  19. * @param array $settings
  20. */
  21. public function __construct($settings)
  22. {
  23. $this->name = $settings['name'];
  24. $this->host = $settings['host'];
  25. $this->user = $settings['user'];
  26. $this->apiKey = $settings['api_key'];
  27. $this->vmId = $settings['vm_id'];
  28. $this->vmMinSize = $settings['vm_min_size_id'];
  29. $this->vmMaxSize = $settings['vm_max_size_id'];
  30. $this->vmClientId = $settings['vm_client_id'];
  31. }
  32. /**
  33. * @param string $message
  34. */
  35. public function addMessage($message)
  36. {
  37. $this->messages[] = $message;
  38. }
  39. /**
  40. * @return string
  41. */
  42. public function getMessageToString()
  43. {
  44. return implode(PHP_EOL, $this->messages);
  45. }
  46. }