Vm.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace ModulesGarden\ProxmoxAddon\App\Services;
  3. use MGProvision\Proxmox\v2\models\Kvm;
  4. use MGProvision\Proxmox\v2\models\Lxc;
  5. use ModulesGarden\ProxmoxAddon\App\Models\VmModel;
  6. class Vm {
  7. /**
  8. * @var Kvm|Lxc
  9. */
  10. protected $vm;
  11. /**
  12. * @var VmModel
  13. */
  14. protected $vmModel;
  15. /**
  16. * @return Kvm|Lxc
  17. */
  18. public function getVm()
  19. {
  20. return $this->vm;
  21. }
  22. /**
  23. * @param Kvm|Lxc $vm
  24. * @return Vm
  25. */
  26. public function setVm($vm)
  27. {
  28. $this->vm = $vm;
  29. return $this;
  30. }
  31. public function hasVm(){
  32. return $this->vm != null;
  33. }
  34. /**
  35. * @return VmModel
  36. */
  37. public function getVmModel()
  38. {
  39. if(is_null( $this->vmModel)){
  40. throw new \InvalidArgumentException('VmModel not set');
  41. }
  42. return $this->vmModel;
  43. }
  44. /**
  45. * @param VmModel $vmModel
  46. * @return $this
  47. */
  48. public function setVmModel(VmModel $vmModel)
  49. {
  50. $this->vmModel = $vmModel;
  51. return $this;
  52. }
  53. public function hasVmModel(){
  54. return $this->vmModel !=null;
  55. }
  56. }
  57. {
  58. }