mirror of
https://github.com/danog/LibDNSNative.git
synced 2024-11-30 04:29:07 +01:00
Improvements
This commit is contained in:
parent
d6a3d9faa7
commit
f50d324faf
@ -12,6 +12,7 @@ use LibDNS\Packets\PacketFactory;
|
|||||||
use LibDNS\Records\Question;
|
use LibDNS\Records\Question;
|
||||||
use LibDNS\Records\QuestionFactory;
|
use LibDNS\Records\QuestionFactory;
|
||||||
use LibDNS\Records\Resource;
|
use LibDNS\Records\Resource;
|
||||||
|
use LibDNS\Records\ResourceClasses;
|
||||||
use LibDNS\Records\Types\DomainName;
|
use LibDNS\Records\Types\DomainName;
|
||||||
use LibDNS\Records\Types\Type;
|
use LibDNS\Records\Types\Type;
|
||||||
use LibDNS\Records\Types\TypeBuilder;
|
use LibDNS\Records\Types\TypeBuilder;
|
||||||
@ -80,7 +81,7 @@ class NativeDecoder
|
|||||||
$this->encodingContextFactory = $encodingContextFactory;
|
$this->encodingContextFactory = $encodingContextFactory;
|
||||||
$this->decoderFactory = $decoderFactory;
|
$this->decoderFactory = $decoderFactory;
|
||||||
|
|
||||||
$classes = new \ReflectionClass('\\LibDNS\\Records\\ResourceClasses');
|
$classes = new \ReflectionClass(ResourceClasses::class);
|
||||||
foreach ($classes->getConstants() as $name => $value) {
|
foreach ($classes->getConstants() as $name => $value) {
|
||||||
$this->classMap[$name] = $value;
|
$this->classMap[$name] = $value;
|
||||||
}
|
}
|
||||||
@ -97,7 +98,7 @@ class NativeDecoder
|
|||||||
/** @var \LibDNS\Records\Types\DomainName $domainName */
|
/** @var \LibDNS\Records\Types\DomainName $domainName */
|
||||||
$domainName = $this->typeBuilder->build(Types::DOMAIN_NAME);
|
$domainName = $this->typeBuilder->build(Types::DOMAIN_NAME);
|
||||||
$labels = \explode('.', $name);
|
$labels = \explode('.', $name);
|
||||||
if (!empty($last = \array_pop($labels))) {
|
if ('' !== $last = \array_pop($labels)) {
|
||||||
$labels[] = $last;
|
$labels[] = $last;
|
||||||
}
|
}
|
||||||
$domainName->setLabels($labels);
|
$domainName->setLabels($labels);
|
||||||
@ -190,7 +191,7 @@ class NativeDecoder
|
|||||||
/** @var \LibDNS\Records\Types\DomainName $domainName */
|
/** @var \LibDNS\Records\Types\DomainName $domainName */
|
||||||
$domainName = $this->typeBuilder->build(Types::DOMAIN_NAME);
|
$domainName = $this->typeBuilder->build(Types::DOMAIN_NAME);
|
||||||
$labels = \explode('.', $record['host']);
|
$labels = \explode('.', $record['host']);
|
||||||
if (!empty($last = \array_pop($labels))) {
|
if ('' !== $last = \array_pop($labels)) {
|
||||||
$labels[] = $last;
|
$labels[] = $last;
|
||||||
}
|
}
|
||||||
$domainName->setLabels($labels);
|
$domainName->setLabels($labels);
|
||||||
|
Loading…
Reference in New Issue
Block a user