@@ -20,7 +20,7 @@ |
||
20 | 20 | public function register() |
21 | 21 | { |
22 | 22 | // Register the main class to use with the facade |
23 | - $this->app->bind('ipv4-address-converter', function () { |
|
23 | + $this->app->bind('ipv4-address-converter', function() { |
|
24 | 24 | return new IPv4AddressConverter(); |
25 | 25 | }); |
26 | 26 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | class IPv4AddressConverter |
15 | 15 | { |
16 | - private int | string $address; |
|
16 | + private int|string $address; |
|
17 | 17 | private IPv4AddressConverterInterface $converter; |
18 | 18 | private int $inputFormat; |
19 | 19 | private bool $withDotNotation; |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return int|string |
163 | 163 | */ |
164 | - public function get(): int | string |
|
164 | + public function get(): int|string |
|
165 | 165 | { |
166 | 166 | if (!isset($this->converter)) { |
167 | 167 | throw new OutputFormatException(); |
168 | 168 | } |
169 | 169 | |
170 | - return match ($this->inputFormat) { |
|
170 | + return match($this->inputFormat) { |
|
171 | 171 | IPAddressFormat::BINARY => $this->getFromBinary(), |
172 | 172 | |
173 | 173 | IPAddressFormat::DECIMAL => $this->getFromDecimal(), |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | /** |
184 | 184 | * @return int|string |
185 | 185 | */ |
186 | - private function getFromBinary(): int | string |
|
186 | + private function getFromBinary(): int|string |
|
187 | 187 | { |
188 | 188 | $converter = $this->converter->fromBinary($this->address); |
189 | 189 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | /** |
196 | 196 | * @return int|string |
197 | 197 | */ |
198 | - private function getFromDecimal(): int | string |
|
198 | + private function getFromDecimal(): int|string |
|
199 | 199 | { |
200 | 200 | $converter = $this->converter->fromDecimal($this->address); |
201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | /** |
208 | 208 | * @return int|string |
209 | 209 | */ |
210 | - private function getFromHexadecimal(): int | string |
|
210 | + private function getFromHexadecimal(): int|string |
|
211 | 211 | { |
212 | 212 | $converter = $this->converter->fromHexadecimal($this->address); |
213 | 213 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | /** |
220 | 220 | * @return int|string |
221 | 221 | */ |
222 | - private function getFromLong(): int | string |
|
222 | + private function getFromLong(): int|string |
|
223 | 223 | { |
224 | 224 | $converter = $this->converter->fromLong($this->address); |
225 | 225 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function all(): object |
237 | 237 | { |
238 | - return match ($this->inputFormat) { |
|
238 | + return match($this->inputFormat) { |
|
239 | 239 | IPAddressFormat::BINARY => $this->getOutputFromBinaryAddress(), |
240 | 240 | |
241 | 241 | IPAddressFormat::DECIMAL => $this->getOutputFromDecimalAddress(), |
@@ -9,5 +9,5 @@ |
||
9 | 9 | * |
10 | 10 | * @return int|string |
11 | 11 | */ |
12 | - public function convert(): int | string; |
|
12 | + public function convert(): int|string; |
|
13 | 13 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | * |
15 | 15 | * @return int|string |
16 | 16 | */ |
17 | - public function convert(): int | string |
|
17 | + public function convert(): int|string |
|
18 | 18 | { |
19 | - return match ($this->inputFormat) { |
|
19 | + return match($this->inputFormat) { |
|
20 | 20 | IPAddressFormat::BINARY => $this->fromBinaryToLong($this->address), |
21 | 21 | IPAddressFormat::DECIMAL => $this->fromDecimalToLong($this->address), |
22 | 22 | IPAddressFormat::HEXADECIMAL => $this->fromHexadecimalToLong($this->address), |
@@ -14,9 +14,9 @@ |
||
14 | 14 | * |
15 | 15 | * @return int|string |
16 | 16 | */ |
17 | - public function convert(): int | string |
|
17 | + public function convert(): int|string |
|
18 | 18 | { |
19 | - return match ($this->inputFormat) { |
|
19 | + return match($this->inputFormat) { |
|
20 | 20 | IPAddressFormat::DECIMAL => $this->withDotNotation |
21 | 21 | ? $this->fromDecimalToDottedBinary($this->address) |
22 | 22 | : $this->fromDecimalToBinary($this->address), |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | abstract class BaseAddressConverter implements IPv4AddressConverterInterface |
9 | 9 | { |
10 | - protected int | string $address; |
|
10 | + protected int|string $address; |
|
11 | 11 | protected int $inputFormat; |
12 | 12 | |
13 | 13 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * @inheritDoc |
97 | 97 | */ |
98 | - public function convert(): int | string |
|
98 | + public function convert(): int|string |
|
99 | 99 | { |
100 | 100 | } |
101 | 101 | } |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @return int|string |
16 | 16 | */ |
17 | - public function convert(): int | string |
|
17 | + public function convert(): int|string |
|
18 | 18 | { |
19 | - return match ($this->inputFormat) { |
|
19 | + return match($this->inputFormat) { |
|
20 | 20 | IPAddressFormat::BINARY => $this->withDotNotation |
21 | 21 | ? $this->fromBinaryToDottedHex($this->address) |
22 | 22 | : $this->fromBinaryToHex($this->address), |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | ? $this->fromDecimalToDottedHex($this->address) |
25 | 25 | : $this->fromDecimalToHex($this->address), |
26 | 26 | IPAddressFormat::LONG => $this->withDotNotation ? |
27 | - $this->fromLongToDottedHex($this->address) : |
|
28 | - $this->fromLongToHex($this->address), |
|
27 | + $this->fromLongToDottedHex($this->address) : $this->fromLongToHex($this->address), |
|
29 | 28 | default => '', |
30 | 29 | }; |
31 | 30 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | * |
15 | 15 | * @return int|string |
16 | 16 | */ |
17 | - public function convert(): int | string |
|
17 | + public function convert(): int|string |
|
18 | 18 | { |
19 | - return match ($this->inputFormat) { |
|
19 | + return match($this->inputFormat) { |
|
20 | 20 | IPAddressFormat::BINARY => $this->fromBinaryToDecimal($this->address), |
21 | 21 | IPAddressFormat::HEXADECIMAL => $this->fromHexadecimalToDecimal($this->address), |
22 | 22 | IPAddressFormat::LONG => $this->fromLongToDecimal($this->address), |