| 1 | <?php |
||
| 10 | class CpuAverageGauge implements GaugeInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Report every 60 seconds |
||
| 14 | * Load average is calculated every 1 minute |
||
| 15 | * |
||
| 16 | * @return int |
||
| 17 | */ |
||
| 18 | public function getSamplingPeriod() |
||
| 22 | |||
| 23 | /** |
||
| 24 | * CPU average load path reported to statsd |
||
| 25 | * |
||
| 26 | * @return string |
||
| 27 | */ |
||
| 28 | public function getPath() |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritdoc} |
||
| 35 | */ |
||
| 36 | public function getValue() |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Return CPU load average |
||
| 50 | * |
||
| 51 | * @return array |
||
| 52 | */ |
||
| 53 | protected function getLoadAverage() |
||
| 57 | } |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.