-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_bootstrap.php
More file actions
25 lines (19 loc) · 756 Bytes
/
_bootstrap.php
File metadata and controls
25 lines (19 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php declare(strict_types=1);
use Amp\Dns\DnsRecord;
require __DIR__ . "/../vendor/autoload.php";
/**
* @param array<DnsRecord> $records
*/
function pretty_print_records(string $queryName, array $records): void
{
print "---------- " . $queryName . " " . str_repeat("-", 55 - strlen($queryName)) . " TTL --\r\n";
$format = "%-10s %-56s %-5d\r\n";
foreach ($records as $record) {
print sprintf($format, DnsRecord::getName($record->getType()), $record->getValue(), $record->getTtl() ?? 0);
}
}
function pretty_print_error(string $queryName, \Throwable $error): void
{
print "-- " . $queryName . " " . str_repeat("-", 70 - strlen($queryName)) . "\r\n";
print get_class($error) . ": " . $error->getMessage() . "\r\n";
}