1 | <?php |
||
7 | class ServerModel extends ServerEntity |
||
8 | { |
||
9 | /** @var VmachineModel[] */ |
||
10 | protected $vmArray = []; |
||
11 | |||
12 | /** |
||
13 | * @return VmachineModel[] |
||
14 | */ |
||
15 | public function getVmArray(): array |
||
19 | |||
20 | /** |
||
21 | * Subtract resources from given machine. |
||
22 | * |
||
23 | * @param VmachineModel $vmachine |
||
24 | * |
||
25 | * @return $this |
||
26 | */ |
||
27 | public function subtractResources(VmachineModel $vmachine) |
||
35 | |||
36 | /** |
||
37 | * if resources are greater than given. |
||
38 | * |
||
39 | * @param ServerModel $vmachine |
||
40 | * |
||
41 | * @return bool |
||
42 | */ |
||
43 | public function isGreaterThan(ServerModel $vmachine) |
||
44 | { |
||
45 | return $this->getCpu()->getAmount() > $vmachine->getCpu()->getAmount() |
||
46 | || $this->getRam()->getAmount() > $vmachine->getRam()->getAmount() |
||
47 | || $this->getHdd()->getAmount() > $vmachine->getHdd()->getAmount(); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * String output of VM. |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | public function toString() |
||
62 | |||
63 | /** |
||
64 | * Add VM to the server. |
||
65 | * |
||
66 | * @param VMachineModel $vmachine |
||
67 | * |
||
68 | * @return $this |
||
69 | */ |
||
70 | public function addVm(VMachineModel $vmachine) |
||
77 | } |
||
78 |