1 | <?php |
||
11 | class DiskUsageMonitor extends BaseMonitor |
||
12 | { |
||
13 | /** @var int */ |
||
14 | protected $totalSpace; |
||
15 | |||
16 | /** @var int */ |
||
17 | protected $freeSpace; |
||
18 | |||
19 | /** @var int */ |
||
20 | protected $usedSpace; |
||
21 | |||
22 | /** @var float */ |
||
23 | protected $percentageUsed; |
||
24 | |||
25 | /** @var string */ |
||
26 | protected $path; |
||
27 | |||
28 | /** @var int */ |
||
29 | protected $alarmPercentage = 75; |
||
30 | |||
31 | /** |
||
32 | * @param array $config |
||
33 | */ |
||
34 | public function __construct(array $config) |
||
46 | |||
47 | /** |
||
48 | * @throws InvalidPath |
||
49 | */ |
||
50 | public function runMonitor() |
||
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getTotalSpace() |
||
78 | |||
79 | /** |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getFreeSpace() |
||
86 | |||
87 | /** |
||
88 | * @return string |
||
89 | */ |
||
90 | public function getUsedSpace() |
||
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getPercentageUsed() |
||
102 | |||
103 | /** |
||
104 | * @return mixed|string |
||
105 | */ |
||
106 | public function getPath() |
||
110 | |||
111 | /** |
||
112 | * @return string |
||
113 | */ |
||
114 | public function getAlarmPercentage() |
||
118 | } |
||
119 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.