| @@ 46-68 (lines=23) @@ | ||
| 43 | * @throws EndOfFileReachedException |
|
| 44 | * |
|
| 45 | */ |
|
| 46 | public function readArray(int $length): array |
|
| 47 | { |
|
| 48 | $buffer = []; |
|
| 49 | ||
| 50 | for ($iterator = 0; $iterator < $length; ++$iterator) { |
|
| 51 | $bytes = []; |
|
| 52 | ||
| 53 | $this->assertNotEndOfFile(); |
|
| 54 | $bytes[] = $this->getByte($this->offset++); |
|
| 55 | $this->assertNotEndOfFile(); |
|
| 56 | $bytes[] = $this->getByte($this->offset++); |
|
| 57 | $this->assertNotEndOfFile(); |
|
| 58 | $bytes[] = $this->getByte($this->offset++); |
|
| 59 | $this->assertNotEndOfFile(); |
|
| 60 | $bytes[] = $this->getByte($this->offset++); |
|
| 61 | ||
| 62 | $data = $this->endianMode->applyEndianess($bytes); |
|
| 63 | ||
| 64 | $buffer[] = $this->mergeBytes($data); |
|
| 65 | } |
|
| 66 | ||
| 67 | return $buffer; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @param array $data |
|
| @@ 46-68 (lines=23) @@ | ||
| 43 | * |
|
| 44 | * @return array |
|
| 45 | */ |
|
| 46 | public function readArray(int $length): array |
|
| 47 | { |
|
| 48 | $buffer = []; |
|
| 49 | ||
| 50 | for ($iterator = 0; $iterator < $length; ++$iterator) { |
|
| 51 | $bytes = []; |
|
| 52 | ||
| 53 | $this->assertNotEndOfFile(); |
|
| 54 | $bytes[] = $this->getByte($this->offset++); |
|
| 55 | $this->assertNotEndOfFile(); |
|
| 56 | $bytes[] = $this->getByte($this->offset++); |
|
| 57 | $this->assertNotEndOfFile(); |
|
| 58 | $bytes[] = $this->getByte($this->offset++); |
|
| 59 | $this->assertNotEndOfFile(); |
|
| 60 | $bytes[] = $this->getByte($this->offset++); |
|
| 61 | ||
| 62 | $data = $this->endianMode->applyEndianess($bytes); |
|
| 63 | ||
| 64 | $buffer[] = $this->mergeBytes($data); |
|
| 65 | } |
|
| 66 | ||
| 67 | return $buffer; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @param array $data |
|