@@ -165,17 +165,7 @@ public function getOptions() : array
165165 * min: float,
166166 * max: float,
167167 * total: float,
168- * collected: array<int,array{
169- * collection: string,
170- * collector: string,
171- * class: string,
172- * description: string,
173- * start: float,
174- * end: float,
175- * total: float,
176- * left: float,
177- * width: float,
178- * }>,
168+ * collected: array<int,Activity>,
179169 * }
180170 */
181171 public function getActivities () : array
@@ -190,12 +180,12 @@ public function getActivities() : array
190180 $ max = .0 ;
191181 if ($ collected ) {
192182 \usort ($ collected , static function ($ c1 , $ c2 ) {
193- return $ c1[ ' start ' ] <=> $ c2[ ' start ' ] ;
183+ return $ c1-> start <=> $ c2-> start ;
194184 });
195185 $ min = \min (\array_column ($ collected , 'start ' ));
196186 $ max = \max (\array_column ($ collected , 'end ' ));
197- foreach ($ collected as & $ activity ) {
198- $ activity = $ this -> addActivityValues ( $ activity , $ min , $ max );
187+ foreach ($ collected as $ activity ) {
188+ $ activity-> setTimeBarValues ( $ min , $ max );
199189 }
200190 unset($ activity );
201191 }
@@ -207,51 +197,6 @@ public function getActivities() : array
207197 ];
208198 }
209199
210- /**
211- * Updates the $activity variable.
212- *
213- * Adds the "total" key representing the total execution time.
214- *
215- * Adds the "left" and "width" keys representing the CSS `margin-left` and
216- * `width` properties used to create the time bar.
217- *
218- * @param array{
219- * collection: string,
220- * collector: string,
221- * class: string,
222- * description: string,
223- * start: float,
224- * end: float,
225- * } $activity Current activity
226- * @param float $min The minimum time of the collected activities
227- * @param float $max The maximum time of collected activities
228- *
229- * @return array{
230- * collection: string,
231- * collector: string,
232- * class: string,
233- * description: string,
234- * start: float,
235- * end: float,
236- * total: float,
237- * left: float,
238- * width: float,
239- * }
240- */
241- protected function addActivityValues (array $ activity , float $ min , float $ max ) : array
242- {
243- $ total = $ max - $ min ;
244- $ activity ['total ' ] = $ activity ['end ' ] - $ activity ['start ' ];
245- if ($ total > 0 ) {
246- $ activity ['left ' ] = \round (($ activity ['start ' ] - $ min ) * 100 / $ total , 3 );
247- $ activity ['width ' ] = \round ($ activity ['total ' ] * 100 / $ total , 3 );
248- return $ activity ;
249- }
250- $ activity ['left ' ] = .0 ;
251- $ activity ['width ' ] = .0 ;
252- return $ activity ;
253- }
254-
255200 /**
256201 * Set the path of the debugbar view.
257202 *
0 commit comments