From ec2819a31af6cfd833367ba64e52be780241065c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 5 Sep 2026 22:26:58 +0000 Subject: [PATCH 1/2] Initial plan From 78247d2ca53b376d8a5450b18f28ef75c69dfd34 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 5 Sep 2026 22:28:32 +0000 Subject: [PATCH 2/2] Add DNSQuery settings accessors Co-authored-by: purplepixie <1479871+purplepixie@users.noreply.github.com> --- src/PurplePixie/PhpDns/DNSQuery.php | 60 +++++++++++++++++++++++++++++ tests/DNSQueryTest.php | 26 +++++++++++++ 2 files changed, 86 insertions(+) diff --git a/src/PurplePixie/PhpDns/DNSQuery.php b/src/PurplePixie/PhpDns/DNSQuery.php index bb6cce8..eae2ba2 100644 --- a/src/PurplePixie/PhpDns/DNSQuery.php +++ b/src/PurplePixie/PhpDns/DNSQuery.php @@ -764,6 +764,66 @@ public function getLastnameservers(): DNSAnswer return $this->lastnameservers; } + public function getServer(): string + { + return $this->server; + } + + public function setServer(string $value): void + { + $this->server = $value; + } + + public function getPort(): int + { + return $this->port; + } + + public function setPort(int $value): void + { + $this->port = $value; + } + + public function getTimeout(): int + { + return $this->timeout; + } + + public function setTimeout(int $value): void + { + $this->timeout = $value; + } + + public function getUdp(): bool + { + return $this->udp; + } + + public function setUdp(bool $value): void + { + $this->udp = $value; + } + + public function getDebug(): bool + { + return $this->debug; + } + + public function setDebug(bool $value): void + { + $this->debug = $value; + } + + public function getBinarydebug(): bool + { + return $this->binarydebug; + } + + public function setBinarydebug(bool $value): void + { + $this->binarydebug = $value; + } + public function getLastadditional(): DNSAnswer { return $this->lastadditional; diff --git a/tests/DNSQueryTest.php b/tests/DNSQueryTest.php index 20a4070..ccbbf8c 100644 --- a/tests/DNSQueryTest.php +++ b/tests/DNSQueryTest.php @@ -28,6 +28,32 @@ class DNSQueryTest extends TestCase { + public function testQuerySettingsCanBeReadAndChanged(): void + { + $query = new DNSQuery('initial.server', 53, 60, true, false, false); + + $this->assertSame('initial.server', $query->getServer()); + $this->assertSame(53, $query->getPort()); + $this->assertSame(60, $query->getTimeout()); + $this->assertTrue($query->getUdp()); + $this->assertFalse($query->getDebug()); + $this->assertFalse($query->getBinarydebug()); + + $query->setServer('updated.server'); + $query->setPort(5353); + $query->setTimeout(10); + $query->setUdp(false); + $query->setDebug(true); + $query->setBinarydebug(true); + + $this->assertSame('updated.server', $query->getServer()); + $this->assertSame(5353, $query->getPort()); + $this->assertSame(10, $query->getTimeout()); + $this->assertFalse($query->getUdp()); + $this->assertTrue($query->getDebug()); + $this->assertTrue($query->getBinarydebug()); + } + /** * @covers \PurplePixie\PhpDns\DNSQuery::query * @covers \PurplePixie\PhpDns\DNSTypes::getIdFromName