mirror of
https://github.com/danog/LibDNSNative.git
synced 2024-11-30 04:29:07 +01:00
phpcs fix
This commit is contained in:
parent
5a3a88d018
commit
d6a3d9faa7
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
use danog\LibDNSNative\NativeEncoderFactory;
|
|
||||||
use LibDNS\Records\QuestionFactory;
|
|
||||||
use danog\LibDNSNative\NativeDecoderFactory;
|
use danog\LibDNSNative\NativeDecoderFactory;
|
||||||
use LibDNS\Records\ResourceQTypes;
|
use danog\LibDNSNative\NativeEncoderFactory;
|
||||||
use LibDNS\Messages\MessageFactory;
|
use LibDNS\Messages\MessageFactory;
|
||||||
use LibDNS\Messages\MessageTypes;
|
use LibDNS\Messages\MessageTypes;
|
||||||
|
use LibDNS\Records\QuestionFactory;
|
||||||
|
use LibDNS\Records\ResourceQTypes;
|
||||||
|
|
||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
@ -18,9 +18,9 @@ $records->add($question);
|
|||||||
$encoder = (new NativeEncoderFactory)->create();
|
$encoder = (new NativeEncoderFactory)->create();
|
||||||
$question = $encoder->encode($message);
|
$question = $encoder->encode($message);
|
||||||
|
|
||||||
$result = dns_get_record(...$question);
|
$result = \dns_get_record(...$question);
|
||||||
|
|
||||||
$decoder = (new NativeDecoderFactory)->create();
|
$decoder = (new NativeDecoderFactory)->create();
|
||||||
$result = $decoder->decode($result, ...$question);
|
$result = $decoder->decode($result, ...$question);
|
||||||
|
|
||||||
var_dump($result);
|
\var_dump($result);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace danog\LibDNSNative;
|
namespace danog\LibDNSNative;
|
||||||
|
|
||||||
use LibDNS\Decoder\Decoder;
|
|
||||||
use LibDNS\Decoder\DecoderFactory;
|
use LibDNS\Decoder\DecoderFactory;
|
||||||
use LibDNS\Encoder\EncodingContext;
|
use LibDNS\Encoder\EncodingContext;
|
||||||
use LibDNS\Encoder\EncodingContextFactory;
|
use LibDNS\Encoder\EncodingContextFactory;
|
||||||
@ -50,7 +49,7 @@ class NativeDecoder
|
|||||||
private $decoderFactory;
|
private $decoderFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map class names to IDs
|
* Map class names to IDs.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
@ -110,7 +109,7 @@ class NativeDecoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode a question record
|
* Encode a question record.
|
||||||
*
|
*
|
||||||
* @param \LibDNS\Encoder\EncodingContext $encodingContext
|
* @param \LibDNS\Encoder\EncodingContext $encodingContext
|
||||||
* @param \LibDNS\Records\Question $record
|
* @param \LibDNS\Records\Question $record
|
||||||
@ -132,7 +131,7 @@ class NativeDecoder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Encode a DomainName field
|
* Encode a DomainName field.
|
||||||
*
|
*
|
||||||
* @param \LibDNS\Records\Types\DomainName $domainName
|
* @param \LibDNS\Records\Types\DomainName $domainName
|
||||||
* @param \LibDNS\Encoder\EncodingContext $encodingContext
|
* @param \LibDNS\Encoder\EncodingContext $encodingContext
|
||||||
@ -180,7 +179,7 @@ class NativeDecoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode a resource record
|
* Encode a resource record.
|
||||||
*
|
*
|
||||||
* @param \LibDNS\Encoder\EncodingContext $encodingContext
|
* @param \LibDNS\Encoder\EncodingContext $encodingContext
|
||||||
* @param array $record
|
* @param array $record
|
||||||
@ -243,17 +242,17 @@ class NativeDecoder
|
|||||||
|
|
||||||
$this->encodeQuestionRecord($encodingContext, $domain, $type);
|
$this->encodeQuestionRecord($encodingContext, $domain, $type);
|
||||||
|
|
||||||
$expectedAnswers = count($result);
|
$expectedAnswers = \count($result);
|
||||||
for ($i = 0; $i < $expectedAnswers; $i++) {
|
for ($i = 0; $i < $expectedAnswers; $i++) {
|
||||||
$this->encodeResourceRecord($encodingContext, $result[$i]);
|
$this->encodeResourceRecord($encodingContext, $result[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$expectedAuth = count($authoritative);
|
$expectedAuth = \count($authoritative);
|
||||||
for ($i = 0; $i < $expectedAuth; $i++) {
|
for ($i = 0; $i < $expectedAuth; $i++) {
|
||||||
$this->encodeResourceRecord($encodingContext, $authoritative[$i]);
|
$this->encodeResourceRecord($encodingContext, $authoritative[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$expectedAdditional = count($additional);
|
$expectedAdditional = \count($additional);
|
||||||
for ($i = 0; $i < $expectedAdditional; $i++) {
|
for ($i = 0; $i < $expectedAdditional; $i++) {
|
||||||
$this->encodeResourceRecord($encodingContext, $additional[$i]);
|
$this->encodeResourceRecord($encodingContext, $additional[$i]);
|
||||||
}
|
}
|
||||||
|
@ -9,17 +9,10 @@
|
|||||||
|
|
||||||
namespace danog\LibDNSNative;
|
namespace danog\LibDNSNative;
|
||||||
|
|
||||||
use LibDNS\Decoder\DecodingContextFactory;
|
|
||||||
use \LibDNS\Messages\MessageFactory;
|
use \LibDNS\Messages\MessageFactory;
|
||||||
use \LibDNS\Packets\PacketFactory;
|
use \LibDNS\Packets\PacketFactory;
|
||||||
use \LibDNS\Records\QuestionFactory;
|
use \LibDNS\Records\QuestionFactory;
|
||||||
use \LibDNS\Records\RDataBuilder;
|
|
||||||
use \LibDNS\Records\RDataFactory;
|
|
||||||
use \LibDNS\Records\RecordCollectionFactory;
|
use \LibDNS\Records\RecordCollectionFactory;
|
||||||
use \LibDNS\Records\ResourceBuilder;
|
|
||||||
use \LibDNS\Records\ResourceFactory;
|
|
||||||
use \LibDNS\Records\TypeDefinitions\FieldDefinitionFactory;
|
|
||||||
use \LibDNS\Records\TypeDefinitions\TypeDefinitionFactory;
|
|
||||||
use \LibDNS\Records\TypeDefinitions\TypeDefinitionManager;
|
use \LibDNS\Records\TypeDefinitions\TypeDefinitionManager;
|
||||||
use \LibDNS\Records\Types\TypeBuilder;
|
use \LibDNS\Records\Types\TypeBuilder;
|
||||||
use \LibDNS\Records\Types\TypeFactory;
|
use \LibDNS\Records\Types\TypeFactory;
|
||||||
|
@ -14,9 +14,8 @@
|
|||||||
|
|
||||||
namespace danog\LibDNSNative;
|
namespace danog\LibDNSNative;
|
||||||
|
|
||||||
use LibDNS\Messages\MessageTypes;
|
|
||||||
use \LibDNS\Messages\Message;
|
use \LibDNS\Messages\Message;
|
||||||
use LibDNS\Records\ResourceQTypes;
|
use LibDNS\Messages\MessageTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encodes Message objects to query strings.
|
* Encodes Message objects to query strings.
|
||||||
|
@ -38,7 +38,7 @@ class NativeDecoderTest extends TestCase
|
|||||||
'class' => 'IN',
|
'class' => 'IN',
|
||||||
'ttl' => 3600,
|
'ttl' => 3600,
|
||||||
'type' => 48,
|
'type' => 48,
|
||||||
'data' => base64_decode('AQADDaCTEREs+ROIGM0v6ulw671NajD2CIwlsyWjmrvFzRGXqgmCg+Wq9CEXfCql1xSZKplX0bzBj5jNcfHxgGtl4Ug='),
|
'data' => \base64_decode('AQADDaCTEREs+ROIGM0v6ulw671NajD2CIwlsyWjmrvFzRGXqgmCg+Wq9CEXfCql1xSZKplX0bzBj5jNcfHxgGtl4Ug='),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
@ -46,7 +46,7 @@ class NativeDecoderTest extends TestCase
|
|||||||
'class' => 'IN',
|
'class' => 'IN',
|
||||||
'ttl' => 3600,
|
'ttl' => 3600,
|
||||||
'type' => 48,
|
'type' => 48,
|
||||||
'data' => base64_decode('AQEDDZnbLMFMq9wz1td9pjovFfcRElhPI06NHcQo456KSpfhqicaVV3JBwHhfipMS28SC3wy1E9KwCvYlM8tS+d3ihk='),
|
'data' => \base64_decode('AQEDDZnbLMFMq9wz1td9pjovFfcRElhPI06NHcQo456KSpfhqicaVV3JBwHhfipMS28SC3wy1E9KwCvYlM8tS+d3ihk='),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'daniil.it',
|
'daniil.it',
|
||||||
@ -65,7 +65,7 @@ class NativeDecoderTest extends TestCase
|
|||||||
'class' => 'IN',
|
'class' => 'IN',
|
||||||
'ttl' => 2898,
|
'ttl' => 2898,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'data' => base64_decode('EazgLw=='),
|
'data' => \base64_decode('EazgLw=='),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
@ -73,7 +73,7 @@ class NativeDecoderTest extends TestCase
|
|||||||
'class' => 'IN',
|
'class' => 'IN',
|
||||||
'ttl' => 2898,
|
'ttl' => 2898,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'data' => base64_decode('EY6gOw=='),
|
'data' => \base64_decode('EY6gOw=='),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
@ -81,7 +81,7 @@ class NativeDecoderTest extends TestCase
|
|||||||
'class' => 'IN',
|
'class' => 'IN',
|
||||||
'ttl' => 2898,
|
'ttl' => 2898,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'data' => base64_decode('EbJgOw=='),
|
'data' => \base64_decode('EbJgOw=='),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'apple.com',
|
'apple.com',
|
||||||
@ -100,7 +100,7 @@ class NativeDecoderTest extends TestCase
|
|||||||
'class' => 'IN',
|
'class' => 'IN',
|
||||||
'ttl' => 166,
|
'ttl' => 166,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'data' => base64_decode('aBgUIg=='),
|
'data' => \base64_decode('aBgUIg=='),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
@ -108,7 +108,7 @@ class NativeDecoderTest extends TestCase
|
|||||||
'class' => 'IN',
|
'class' => 'IN',
|
||||||
'ttl' => 166,
|
'ttl' => 166,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'data' => base64_decode('aBgVIg=='),
|
'data' => \base64_decode('aBgVIg=='),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'amphp.org',
|
'amphp.org',
|
||||||
@ -126,7 +126,7 @@ class NativeDecoderTest extends TestCase
|
|||||||
'class' => 'IN',
|
'class' => 'IN',
|
||||||
'ttl' => 282,
|
'ttl' => 282,
|
||||||
'type' => 5,
|
'type' => 5,
|
||||||
'data' => base64_decode('A2docwxnb29nbGVob3N0ZWQDY29tAA=='),
|
'data' => \base64_decode('A2docwxnb29nbGVob3N0ZWQDY29tAA=='),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'tssthacks.daniil.it',
|
'tssthacks.daniil.it',
|
||||||
@ -141,7 +141,7 @@ class NativeDecoderTest extends TestCase
|
|||||||
'class' => 'IN',
|
'class' => 'IN',
|
||||||
'ttl' => 289,
|
'ttl' => 289,
|
||||||
'type' => 15,
|
'type' => 15,
|
||||||
'data' => base64_decode('AAoCbXgGeWFuZGV4A25ldAA='),
|
'data' => \base64_decode('AAoCbXgGeWFuZGV4A25ldAA='),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'daniil.it',
|
'daniil.it',
|
||||||
|
@ -5,8 +5,8 @@ namespace danog\LibDNSNative\Test;
|
|||||||
use danog\LibDNSNative\NativeDecoderFactory;
|
use danog\LibDNSNative\NativeDecoderFactory;
|
||||||
use danog\LibDNSNative\NativeEncoderFactory;
|
use danog\LibDNSNative\NativeEncoderFactory;
|
||||||
use LibDNS\Messages\MessageTypes;
|
use LibDNS\Messages\MessageTypes;
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
use LibDNS\Records\ResourceQTypes;
|
use LibDNS\Records\ResourceQTypes;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class NativeEncoderTest extends TestCase
|
class NativeEncoderTest extends TestCase
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user