| Total Complexity | 15 |
| Total Lines | 121 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | class Computer |
||
| 23 | { |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $software; |
||
| 29 | /** |
||
| 30 | * @var int |
||
| 31 | */ |
||
| 32 | protected $hdd = 500; |
||
| 33 | /** |
||
| 34 | * @var int |
||
| 35 | */ |
||
| 36 | protected $ram = 4096; |
||
| 37 | /** |
||
| 38 | * @var int |
||
| 39 | */ |
||
| 40 | protected $gpu = 2048; |
||
| 41 | /** |
||
| 42 | * @var int |
||
| 43 | */ |
||
| 44 | protected $cpu = 2000; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Computer constructor. |
||
| 48 | * @param string $software |
||
| 49 | */ |
||
| 50 | public function __construct(string $software) |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param null $key |
||
|
|
|||
| 57 | * @return $this |
||
| 58 | */ |
||
| 59 | public function increaseHdd($key = null) |
||
| 60 | { |
||
| 61 | $this->hdd = isset($key) ? $this->hdd * $key : $this->hdd + 500; |
||
| 62 | return $this; |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param null $key |
||
| 67 | * @return $this |
||
| 68 | */ |
||
| 69 | public function increaseRam($key = null) |
||
| 70 | { |
||
| 71 | $this->ram = isset($key) ? $this->ram * $key : $this->ram + 4096; |
||
| 72 | return $this; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param null $key |
||
| 77 | * @return $this |
||
| 78 | */ |
||
| 79 | public function overclockGpu($key = null) |
||
| 80 | { |
||
| 81 | $this->gpu = isset($key) ? $this->gpu * $key : $this->gpu + 1024; |
||
| 82 | return $this; |
||
| 83 | } |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @param null $key |
||
| 87 | * @return $this |
||
| 88 | */ |
||
| 89 | public function overclockCpu($key = null) |
||
| 90 | { |
||
| 91 | $this->cpu = isset($key) ? $this->cpu + $key : $this->cpu + 500; |
||
| 92 | return $this; |
||
| 93 | } |
||
| 94 | |||
| 95 | /** |
||
| 96 | * @param string $software |
||
| 97 | * @return $this |
||
| 98 | */ |
||
| 99 | public function changeSoftware(string $software) |
||
| 100 | { |
||
| 101 | $this->software = $software; |
||
| 102 | return $this; |
||
| 103 | } |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @return mixed |
||
| 107 | */ |
||
| 108 | public function getSoftware(): string |
||
| 109 | { |
||
| 110 | return $this->software; |
||
| 111 | } |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @return int |
||
| 115 | */ |
||
| 116 | public function getHdd(): int |
||
| 117 | { |
||
| 118 | return $this->hdd; |
||
| 119 | } |
||
| 120 | |||
| 121 | /** |
||
| 122 | * @return int |
||
| 123 | */ |
||
| 124 | public function getRam(): int |
||
| 125 | { |
||
| 126 | return $this->ram; |
||
| 127 | } |
||
| 128 | |||
| 129 | /** |
||
| 130 | * @return int |
||
| 131 | */ |
||
| 132 | public function getGpu(): int |
||
| 135 | } |
||
| 136 | |||
| 137 | /** |
||
| 138 | * @return int |
||
| 139 | */ |
||
| 140 | public function getCpu(): int |
||
| 143 | } |
||
| 144 | } |
||
| 145 |