@@ -14,23 +14,23 @@ discard block |
||
| 14 | 14 | class Decoder |
| 15 | 15 | { |
| 16 | 16 | /** |
| 17 | - * @var string Bencoded string being decoded |
|
| 18 | - */ |
|
| 17 | + * @var string Bencoded string being decoded |
|
| 18 | + */ |
|
| 19 | 19 | protected string $bencoded; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * @var int Length of the bencoded string |
|
| 23 | - */ |
|
| 22 | + * @var int Length of the bencoded string |
|
| 23 | + */ |
|
| 24 | 24 | protected int $len; |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * @var int Safe rightmost boundary |
|
| 28 | - */ |
|
| 27 | + * @var int Safe rightmost boundary |
|
| 28 | + */ |
|
| 29 | 29 | protected int $max; |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * @var int Position of the cursor while decoding |
|
| 33 | - */ |
|
| 32 | + * @var int Position of the cursor while decoding |
|
| 33 | + */ |
|
| 34 | 34 | protected int $offset; |
| 35 | 35 | |
| 36 | 36 | public static function decode(string $bencoded) |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | - * Check the cursor's position after decoding is done |
|
| 75 | - */ |
|
| 74 | + * Check the cursor's position after decoding is done |
|
| 75 | + */ |
|
| 76 | 76 | protected function checkCursorPosition(): void |
| 77 | 77 | { |
| 78 | 78 | if ($this->offset !== $this->len) |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * Adjust the rightmost boundary to the last safe character that can start a value |
|
| 96 | - * |
|
| 97 | - * Will rewind the boundary to skip the rightmost digits, optionally preceded by "i" or "i-" |
|
| 98 | - */ |
|
| 95 | + * Adjust the rightmost boundary to the last safe character that can start a value |
|
| 96 | + * |
|
| 97 | + * Will rewind the boundary to skip the rightmost digits, optionally preceded by "i" or "i-" |
|
| 98 | + */ |
|
| 99 | 99 | protected function computeSafeBoundary(): void |
| 100 | 100 | { |
| 101 | 101 | $boundary = $this->len - 1; |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | class EncodingException extends InvalidArgumentException |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * @var mixed Value that caused this exception to be thrown |
|
| 16 | - */ |
|
| 15 | + * @var mixed Value that caused this exception to be thrown |
|
| 16 | + */ |
|
| 17 | 17 | protected $value; |
| 18 | 18 | |
| 19 | 19 | public function __construct(string $message, $value) |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * Return the value that caused this exception to be thrown |
|
| 27 | - * |
|
| 28 | - * @return mixed |
|
| 29 | - */ |
|
| 26 | + * Return the value that caused this exception to be thrown |
|
| 27 | + * |
|
| 28 | + * @return mixed |
|
| 29 | + */ |
|
| 30 | 30 | public function getValue() |
| 31 | 31 | { |
| 32 | 32 | return $this->value; |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * Encode an array into either an array of a dictionary |
|
| 29 | - */ |
|
| 28 | + * Encode an array into either an array of a dictionary |
|
| 29 | + */ |
|
| 30 | 30 | protected static function encodeArray(array $value): string |
| 31 | 31 | { |
| 32 | 32 | if (empty($value)) |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * Encode given ArrayObject instance into a dictionary |
|
| 48 | - */ |
|
| 47 | + * Encode given ArrayObject instance into a dictionary |
|
| 48 | + */ |
|
| 49 | 49 | protected static function encodeArrayObject(ArrayObject $dict): string |
| 50 | 50 | { |
| 51 | 51 | $vars = $dict->getArrayCopy(); |