@@ -83,7 +83,7 @@ |
||
| 83 | 83 | |
| 84 | 84 | public function toInt(): int |
| 85 | 85 | { |
| 86 | - return (int) array_flip(self::CODE_TYPE_MAP)[$this->type]; |
|
| 86 | + return (int)array_flip(self::CODE_TYPE_MAP)[$this->type]; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public function isA(string $type): bool |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | { |
| 10 | 10 | public function toDNSRecord(): DNSRecord |
| 11 | 11 | { |
| 12 | - $type = DNSRecordType::createFromInt((int) $this->fields['type']); |
|
| 12 | + $type = DNSRecordType::createFromInt((int)$this->fields['type']); |
|
| 13 | 13 | $IPAddress = (isset($this->fields['data']) && IPAddress::isValid($this->fields['data'])) |
| 14 | 14 | ? $this->fields['data'] |
| 15 | 15 | : null; |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | { |
| 10 | 10 | public function toDNSRecord(): DNSRecord |
| 11 | 11 | { |
| 12 | - $type = DNSRecordType::createFromInt((int) $this->fields['type']); |
|
| 12 | + $type = DNSRecordType::createFromInt((int)$this->fields['type']); |
|
| 13 | 13 | $IPAddress = (isset($this->fields['data']) && IPAddress::isValid($this->fields['data'])) |
| 14 | 14 | ? $this->fields['data'] |
| 15 | 15 | : null; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function filteredByType(DNSRecordType $type): self |
| 33 | 33 | { |
| 34 | - return new self(...array_filter($this->records->getArrayCopy(), function (DNSRecord $record) use ($type) { |
|
| 34 | + return new self(...array_filter($this->records->getArrayCopy(), function(DNSRecord $record) use ($type) { |
|
| 35 | 35 | return $record->getType()->equals($type); |
| 36 | 36 | })); |
| 37 | 37 | } |
@@ -121,14 +121,14 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | public function withUniqueValuesExcluded(): self |
| 123 | 123 | { |
| 124 | - return $this->filterValues(function (DNSRecord $candidateRecord, DNSRecordCollection $remaining): bool { |
|
| 124 | + return $this->filterValues(function(DNSRecord $candidateRecord, DNSRecordCollection $remaining): bool { |
|
| 125 | 125 | return $remaining->has($candidateRecord); |
| 126 | 126 | })->withUniqueValues(); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function withUniqueValues(): self |
| 130 | 130 | { |
| 131 | - return $this->filterValues(function (DNSRecord $candidateRecord, DNSRecordCollection $remaining): bool { |
|
| 131 | + return $this->filterValues(function(DNSRecord $candidateRecord, DNSRecordCollection $remaining): bool { |
|
| 132 | 132 | return !$remaining->has($candidateRecord); |
| 133 | 133 | }); |
| 134 | 134 | } |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | throw new QueryFailure("Unable to query GoogleDNS API", 0, $e); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $result = (array) json_decode((string)$response->getBody(), true); |
|
| 86 | + $result = (array)json_decode((string)$response->getBody(), true); |
|
| 87 | 87 | |
| 88 | 88 | if (isset($result['Answer'])) { |
| 89 | 89 | return $result['Answer']; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public static function isValid(string $IPAddress): bool |
| 33 | 33 | { |
| 34 | - return (bool) filter_var($IPAddress, FILTER_VALIDATE_IP); |
|
| 34 | + return (bool)filter_var($IPAddress, FILTER_VALIDATE_IP); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public static function createFromString(string $IPAddress): IPAddress |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function isIPv6(): bool |
| 53 | 53 | { |
| 54 | - return (bool) filter_var($this->IPAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); |
|
| 54 | + return (bool)filter_var($this->IPAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function isIPv4(): bool |
| 58 | 58 | { |
| 59 | - return (bool) filter_var($this->IPAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); |
|
| 59 | + return (bool)filter_var($this->IPAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); |
|
| 60 | 60 | } |
| 61 | 61 | } |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | public function mapResults(MapperInterface $mapper, array $results): DNSRecordCollection |
| 115 | 115 | { |
| 116 | 116 | $collection = new DNSRecordCollection(); |
| 117 | - array_map(function (array $fields) use (&$collection, $mapper) { |
|
| 117 | + array_map(function(array $fields) use (&$collection, $mapper) { |
|
| 118 | 118 | try { |
| 119 | 119 | $collection[] = $mapper->mapFields($fields)->toDNSRecord(); |
| 120 | 120 | } catch (InvalidArgumentException $e) { |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $type, |
| 71 | 71 | $hostname, |
| 72 | 72 | $ttl, |
| 73 | - $IPAddress ? IPAddress::createFromString($IPAddress): null, |
|
| 73 | + $IPAddress ? IPAddress::createFromString($IPAddress) : null, |
|
| 74 | 74 | $class, |
| 75 | 75 | $data |
| 76 | 76 | ); |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | $rawIPAddres = $unserialized['IPAddress'] ?? null; |
| 150 | 150 | $this->recordType = DNSRecordType::createFromString($unserialized['type']); |
| 151 | 151 | $this->hostname = Hostname::createFromString($unserialized['hostname']); |
| 152 | - $this->TTL = (int) $unserialized['TTL']; |
|
| 153 | - $this->IPAddress = $rawIPAddres ? IPAddress::createFromString($rawIPAddres): null; |
|
| 152 | + $this->TTL = (int)$unserialized['TTL']; |
|
| 153 | + $this->IPAddress = $rawIPAddres ? IPAddress::createFromString($rawIPAddres) : null; |
|
| 154 | 154 | $this->class = $unserialized['class']; |
| 155 | 155 | $this->data = (isset($unserialized['data'])) |
| 156 | 156 | ? DataAbstract::createFromTypeAndString($this->recordType, $unserialized['data']) |
@@ -62,13 +62,13 @@ |
||
| 62 | 62 | $results = []; |
| 63 | 63 | $eachPromise = new EachPromise($this->generateEachTypeQuery($hostname), [ |
| 64 | 64 | 'concurrency' => 4, |
| 65 | - 'fulfilled' => function (Response $response) use (&$results) { |
|
| 65 | + 'fulfilled' => function(Response $response) use (&$results) { |
|
| 66 | 66 | $results = array_merge( |
| 67 | 67 | $results, |
| 68 | - $this->parseResult((array) json_decode((string)$response->getBody(), true)) |
|
| 68 | + $this->parseResult((array)json_decode((string)$response->getBody(), true)) |
|
| 69 | 69 | ); |
| 70 | 70 | }, |
| 71 | - 'rejected' => function (RequestException $e) : void { |
|
| 71 | + 'rejected' => function(RequestException $e) : void { |
|
| 72 | 72 | throw $e; |
| 73 | 73 | }, |
| 74 | 74 | ]); |