From 84247fc5ee1cb570ea0cb2676f72e248ee92c374 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 6 Nov 2023 11:42:36 +0000 Subject: [PATCH] feat: improve detail --- src/Printers/Detail.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Printers/Detail.php b/src/Printers/Detail.php index 6d5d823..81549aa 100644 --- a/src/Printers/Detail.php +++ b/src/Printers/Detail.php @@ -36,6 +36,11 @@ public function print(Result $result): void $dnsRecords = dns_get_record($domain, DNS_AAAA + DNS_A); $dnsRecords = array_map(fn (array $record): string => $record['ipv6'] ?? $record['ip'], $dnsRecords ?: []); $dnsRecords = array_unique($dnsRecords); + if (count($dnsRecords) > 3) { + $dnsRecords = array_slice($dnsRecords, 0, 3); + $dnsRecords[] = '(…)'; + } + $dnsRecords = implode(', ', $dnsRecords); $this->twoColumnDetail('DNS Lookup Duration', <<twoColumnDetail(<<— TTFB - $percentage % + $percentage % — including server processing time HTML, "$value"); $color = $this->color($result->requests->download->duration->avg, 100.0, 300.0, 1000.0);