Make HttpResponseBuilder use the Stringable implementation of Timings.
This commit is contained in:
parent
16e9676430
commit
c2bcb0611b
2 changed files with 3 additions and 15 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.2504.31518
|
||||
0.2504.31541
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// HttpResponseBuilder.php
|
||||
// Created: 2022-02-08
|
||||
// Updated: 2025-03-12
|
||||
// Updated: 2025-04-03
|
||||
|
||||
namespace Index\Http;
|
||||
|
||||
|
@ -191,19 +191,7 @@ final class HttpResponseBuilder extends HttpMessageBuilder {
|
|||
* @param Timings $timings Timings to supply to the devtools.
|
||||
*/
|
||||
public function setServerTiming(Timings $timings): void {
|
||||
$laps = $timings->laps;
|
||||
$timings = [];
|
||||
|
||||
foreach($laps as $lap) {
|
||||
$timing = $lap->name;
|
||||
if(!empty($lap->comment))
|
||||
$timing .= ';desc="' . strtr($lap->comment, ['"' => '\\"']) . '"';
|
||||
|
||||
$timing .= ';dur=' . round($lap->durationTime, 5);
|
||||
$timings[] = $timing;
|
||||
}
|
||||
|
||||
$this->setHeader('Server-Timing', implode(', ', $timings));
|
||||
$this->setHeader('Server-Timing', (string)$timings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue