From f50d324faff007bc09023c33f193370703f7c282 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 22 Aug 2019 22:40:37 +0200 Subject: [PATCH] Improvements --- lib/NativeDecoder.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/NativeDecoder.php b/lib/NativeDecoder.php index 5c6c26b..29b30ee 100644 --- a/lib/NativeDecoder.php +++ b/lib/NativeDecoder.php @@ -12,6 +12,7 @@ use LibDNS\Packets\PacketFactory; use LibDNS\Records\Question; use LibDNS\Records\QuestionFactory; use LibDNS\Records\Resource; +use LibDNS\Records\ResourceClasses; use LibDNS\Records\Types\DomainName; use LibDNS\Records\Types\Type; use LibDNS\Records\Types\TypeBuilder; @@ -80,7 +81,7 @@ class NativeDecoder $this->encodingContextFactory = $encodingContextFactory; $this->decoderFactory = $decoderFactory; - $classes = new \ReflectionClass('\\LibDNS\\Records\\ResourceClasses'); + $classes = new \ReflectionClass(ResourceClasses::class); foreach ($classes->getConstants() as $name => $value) { $this->classMap[$name] = $value; } @@ -97,7 +98,7 @@ class NativeDecoder /** @var \LibDNS\Records\Types\DomainName $domainName */ $domainName = $this->typeBuilder->build(Types::DOMAIN_NAME); $labels = \explode('.', $name); - if (!empty($last = \array_pop($labels))) { + if ('' !== $last = \array_pop($labels)) { $labels[] = $last; } $domainName->setLabels($labels); @@ -190,7 +191,7 @@ class NativeDecoder /** @var \LibDNS\Records\Types\DomainName $domainName */ $domainName = $this->typeBuilder->build(Types::DOMAIN_NAME); $labels = \explode('.', $record['host']); - if (!empty($last = \array_pop($labels))) { + if ('' !== $last = \array_pop($labels)) { $labels[] = $last; } $domainName->setLabels($labels);