@@ -170,9 +170,9 @@ |
||
170 | 170 | if (is_array($this->rdata)) { |
171 | 171 | $rdata = '('; |
172 | 172 | foreach ($this->rdata as $key => $value) { |
173 | - $rdata .= $key.': '.$value.', '; |
|
173 | + $rdata .= $key . ': ' . $value . ', '; |
|
174 | 174 | } |
175 | - $rdata = rtrim($rdata, ', ').')'; |
|
175 | + $rdata = rtrim($rdata, ', ') . ')'; |
|
176 | 176 | } else { |
177 | 177 | $rdata = $this->rdata; |
178 | 178 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | $domainName = ''; |
50 | 50 | while (0 !== $len) { |
51 | - $domainName .= substr($string, $offset, $len).'.'; |
|
51 | + $domainName .= substr($string, $offset, $len) . '.'; |
|
52 | 52 | $offset += $len; |
53 | 53 | $len = ord($string[$offset]); |
54 | 54 | ++$offset; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function isWildcardDomain(string $domain): bool |
78 | 78 | { |
79 | - $domain = rtrim($domain, '.').'.'; |
|
79 | + $domain = rtrim($domain, '.') . '.'; |
|
80 | 80 | $pattern = '/^\*\.(?:[a-zA-Z0-9\-\_]+\.)*$/'; |
81 | 81 | |
82 | 82 | return (bool) preg_match($pattern, $domain); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | if ('.' !== substr($name, -1, 1)) { |
173 | - return $name.'.'.$parent; |
|
173 | + return $name . '.' . $parent; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | return $name; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function processZone(array $zone): array |
51 | 51 | { |
52 | - $parent = rtrim($zone['domain'], '.').'.'; |
|
52 | + $parent = rtrim($zone['domain'], '.') . '.'; |
|
53 | 53 | $defaultTtl = $zone['default-ttl']; |
54 | 54 | $rrs = $zone['resource-records']; |
55 | 55 | $resourceRecords = []; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function isLegacyFormat(array $zone): bool |
80 | 80 | { |
81 | - $keys = array_map(function ($value) { |
|
81 | + $keys = array_map(function($value) { |
|
82 | 82 | return strtolower($value); |
83 | 83 | }, array_keys($zone)); |
84 | 84 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | $resourceRecords = []; |
98 | 98 | foreach ($zones as $domain => $types) { |
99 | - $domain = rtrim($domain, '.').'.'; |
|
99 | + $domain = rtrim($domain, '.') . '.'; |
|
100 | 100 | foreach ($types as $type => $data) { |
101 | 101 | $data = (array) $data; |
102 | 102 | $type = RecordTypeEnum::getTypeFromName($type); |
@@ -149,7 +149,7 @@ |
||
149 | 149 | */ |
150 | 150 | private function IANA2PHP(int $type): int |
151 | 151 | { |
152 | - $constantName = 'DNS_'.RecordTypeEnum::getName($type); |
|
152 | + $constantName = 'DNS_' . RecordTypeEnum::getName($type); |
|
153 | 153 | if (!defined($constantName)) { |
154 | 154 | throw new UnsupportedTypeException(sprintf('Record type "%d" is not a supported type.', $type)); |
155 | 155 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__.'/../vendor/autoload.php'; |
|
3 | +require_once __DIR__ . '/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | // JsonResolver created and provided with path to file with json dns records |
6 | -$jsonResolver = new yswery\DNS\Resolver\JsonResolver([__DIR__.'/record.json', __DIR__.'/example.com.json']); |
|
6 | +$jsonResolver = new yswery\DNS\Resolver\JsonResolver([__DIR__ . '/record.json', __DIR__ . '/example.com.json']); |
|
7 | 7 | |
8 | 8 | // System resolver acting as a fallback to the JsonResolver |
9 | 9 | $systemResolver = new yswery\DNS\Resolver\SystemResolver(); |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | public function setUp() |
39 | 39 | { |
40 | 40 | $xmlResolver = new XmlResolver([ |
41 | - __DIR__.'/Resources/test.com.xml', |
|
41 | + __DIR__ . '/Resources/test.com.xml', |
|
42 | 42 | ]); |
43 | 43 | |
44 | 44 | $jsonResolver = new JsonResolver([ |
45 | - __DIR__.'/Resources/test_records.json', |
|
46 | - __DIR__.'/Resources/example.com.json', |
|
45 | + __DIR__ . '/Resources/test_records.json', |
|
46 | + __DIR__ . '/Resources/example.com.json', |
|
47 | 47 | ]); |
48 | 48 | |
49 | 49 | $resolver = new StackableResolver([ |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $qname = Encoder::encodeDomainName($name); |
67 | 67 | $flags = 0b0000000000000000; |
68 | 68 | $header = pack('nnnnnn', $id, $flags, 1, 0, 0, 0); |
69 | - $question = $qname.pack('nn', $type, 1); |
|
69 | + $question = $qname . pack('nn', $type, 1); |
|
70 | 70 | |
71 | 71 | return [$header, $question]; |
72 | 72 | } |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | private function mockQueryAndResponse(): array |
80 | 80 | { |
81 | 81 | list($queryHeader, $question) = $this->encodeQuery($name = 'test.com.', RecordTypeEnum::TYPE_A, $id = 1337); |
82 | - $query = $queryHeader.$question; |
|
82 | + $query = $queryHeader . $question; |
|
83 | 83 | |
84 | 84 | $flags = 0b1000010000000000; |
85 | 85 | $qname = Encoder::encodeDomainName($name); |
86 | 86 | $header = pack('nnnnnn', $id, $flags, 1, 1, 0, 0); |
87 | 87 | |
88 | 88 | $rdata = inet_pton('111.111.111.111'); |
89 | - $answer = $qname.pack('nnNn', 1, 1, 300, strlen($rdata)).$rdata; |
|
89 | + $answer = $qname . pack('nnNn', 1, 1, 300, strlen($rdata)) . $rdata; |
|
90 | 90 | |
91 | - $response = $header.$question.$answer; |
|
91 | + $response = $header . $question . $answer; |
|
92 | 92 | |
93 | 93 | return [$query, $response]; |
94 | 94 | } |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | public function setUp() |
25 | 25 | { |
26 | 26 | $files = [ |
27 | - __DIR__.'/../Resources/records.yml', |
|
28 | - __DIR__.'/../Resources/example.com.yml', |
|
27 | + __DIR__ . '/../Resources/records.yml', |
|
28 | + __DIR__ . '/../Resources/example.com.yml', |
|
29 | 29 | ]; |
30 | 30 | $this->resolver = new YamlResolver($files); |
31 | 31 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function testParseException() |
37 | 37 | { |
38 | 38 | $this->expectException(ParseException::class); |
39 | - new YamlResolver([__DIR__.'/../Resources/invalid_dns_records.json']); |
|
39 | + new YamlResolver([__DIR__ . '/../Resources/invalid_dns_records.json']); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function testResolveLegacyRecord() |
@@ -21,9 +21,9 @@ |
||
21 | 21 | public function setUp() |
22 | 22 | { |
23 | 23 | $files = [ |
24 | - __DIR__.'/../Resources/example.com.xml', |
|
25 | - __DIR__.'/../Resources/test.com.xml', |
|
26 | - __DIR__.'/../Resources/test2.com.xml', |
|
24 | + __DIR__ . '/../Resources/example.com.xml', |
|
25 | + __DIR__ . '/../Resources/test.com.xml', |
|
26 | + __DIR__ . '/../Resources/test2.com.xml', |
|
27 | 27 | ]; |
28 | 28 | $this->resolver = new XmlResolver($files); |
29 | 29 | } |