@@ -15,23 +15,23 @@ discard block |
||
| 15 | 15 | class Bencode |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * @var string Bencoded string being decoded |
|
| 19 | - */ |
|
| 18 | + * @var string Bencoded string being decoded |
|
| 19 | + */ |
|
| 20 | 20 | protected string $bencoded; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * @var int Length of the bencoded string |
|
| 24 | - */ |
|
| 23 | + * @var int Length of the bencoded string |
|
| 24 | + */ |
|
| 25 | 25 | protected int $len; |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * @var int Safe rightmost boundary |
|
| 29 | - */ |
|
| 28 | + * @var int Safe rightmost boundary |
|
| 29 | + */ |
|
| 30 | 30 | protected int $max; |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * @var int Position of the cursor while decoding |
|
| 34 | - */ |
|
| 33 | + * @var int Position of the cursor while decoding |
|
| 34 | + */ |
|
| 35 | 35 | protected int $pos; |
| 36 | 36 | |
| 37 | 37 | protected function __construct(string $bencoded) |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | - * Adjust the rightmost boundary to the last safe character |
|
| 92 | - * |
|
| 93 | - * Will rewind the boundary to skip the rightmost digits, optionally preceded by "i" or "i-" |
|
| 94 | - */ |
|
| 91 | + * Adjust the rightmost boundary to the last safe character |
|
| 92 | + * |
|
| 93 | + * Will rewind the boundary to skip the rightmost digits, optionally preceded by "i" or "i-" |
|
| 94 | + */ |
|
| 95 | 95 | protected function computeSafeBoundary(): void |
| 96 | 96 | { |
| 97 | 97 | $boundary = $this->len - 1; |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
| 255 | - * Bencode a value |
|
| 256 | - */ |
|
| 255 | + * Bencode a value |
|
| 256 | + */ |
|
| 257 | 257 | public static function encode($value): string |
| 258 | 258 | { |
| 259 | 259 | if (is_scalar($value)) |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
| 280 | - * Encode an array into either an array of a dictionary |
|
| 281 | - */ |
|
| 280 | + * Encode an array into either an array of a dictionary |
|
| 281 | + */ |
|
| 282 | 282 | protected static function encodeArray(array $value): string |
| 283 | 283 | { |
| 284 | 284 | if (empty($value)) |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | - * Encode given ArrayObject instance into a dictionary |
|
| 300 | - */ |
|
| 299 | + * Encode given ArrayObject instance into a dictionary |
|
| 300 | + */ |
|
| 301 | 301 | protected static function encodeArrayObject(ArrayObject $dict): string |
| 302 | 302 | { |
| 303 | 303 | $vars = $dict->getArrayCopy(); |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
| 317 | - * Encode a scalar value |
|
| 318 | - */ |
|
| 317 | + * Encode a scalar value |
|
| 318 | + */ |
|
| 319 | 319 | protected static function encodeScalar($value): string |
| 320 | 320 | { |
| 321 | 321 | if (is_int($value) || is_float($value) || is_bool($value)) |