1 | <?php |
||
10 | class Aggregator |
||
11 | { |
||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $metrics; |
||
16 | |||
17 | /** |
||
18 | * @var float[][] |
||
19 | */ |
||
20 | protected $flat; |
||
21 | |||
22 | /** |
||
23 | * @param array $metrics An AnalyzerInterface::execute result |
||
24 | */ |
||
25 | public function __construct($metrics) |
||
29 | |||
30 | /** |
||
31 | * Get metric averages. |
||
32 | * |
||
33 | * @return float[] |
||
34 | */ |
||
35 | public function average() |
||
46 | |||
47 | /** |
||
48 | * Get metric minima. |
||
49 | * |
||
50 | * @return float[] |
||
51 | */ |
||
52 | public function min() |
||
58 | |||
59 | /** |
||
60 | * Get metric maxima. |
||
61 | * |
||
62 | * @return float[] |
||
63 | */ |
||
64 | public function max() |
||
70 | |||
71 | /** |
||
72 | * Get weighed metric averages, where the bigger a method/class is, the more |
||
73 | * it's metric value will count towards the result. |
||
74 | * |
||
75 | * @return float[] |
||
76 | */ |
||
77 | public function weigh() |
||
96 | |||
97 | /** |
||
98 | * Flatten metrics into [metric => [value1, value1, value3]] array. |
||
99 | * |
||
100 | * @return float[][] |
||
101 | */ |
||
102 | protected function flatten() |
||
110 | |||
111 | /** |
||
112 | * @param array $metrics |
||
113 | * |
||
114 | * @return float[][] |
||
115 | */ |
||
116 | protected function recurse(array $metrics) |
||
147 | } |
||
148 |
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.