| @@ 117-140 (lines=24) @@ | ||
| 114 | * |
|
| 115 | * @throws EndOfFileReachedException |
|
| 116 | */ |
|
| 117 | public function writeArray(array $data): void |
|
| 118 | { |
|
| 119 | $dataLength = count($data); |
|
| 120 | $startBytePosition = $this->offset; |
|
| 121 | ||
| 122 | for ($i = $startBytePosition; $i <= $startBytePosition - 1 + $dataLength; ++$i) { |
|
| 123 | $bytes = $this->splitBytes($data[$i - $startBytePosition]); |
|
| 124 | ||
| 125 | $bytes = $this->endianMode->applyEndianess($bytes); |
|
| 126 | ||
| 127 | $this->assertNotEndOfFile(); |
|
| 128 | $this->setByte($this->offset++, $bytes[0]); |
|
| 129 | ||
| 130 | $this->assertNotEndOfFile(); |
|
| 131 | $this->setByte($this->offset++, $bytes[1]); |
|
| 132 | ||
| 133 | $this->assertNotEndOfFile(); |
|
| 134 | $this->setByte($this->offset++, $bytes[2]); |
|
| 135 | ||
| 136 | $this->assertNotEndOfFile(); |
|
| 137 | $this->setByte($this->offset++, $bytes[3]); |
|
| 138 | ||
| 139 | } |
|
| 140 | } |
|
| 141 | ||
| 142 | /** |
|
| 143 | * @param int|float $data |
|
| @@ 109-132 (lines=24) @@ | ||
| 106 | * |
|
| 107 | * @throws EndOfFileReachedException |
|
| 108 | */ |
|
| 109 | public function writeArray(array $data): void |
|
| 110 | { |
|
| 111 | $dataLength = count($data); |
|
| 112 | $startBytePosition = $this->offset; |
|
| 113 | ||
| 114 | for ($i = $startBytePosition; $i <= $startBytePosition - 1 + $dataLength; ++$i) { |
|
| 115 | $bytes = $this->splitBytes($data[$i - $startBytePosition]); |
|
| 116 | ||
| 117 | $bytes = $this->endianMode->applyEndianess($bytes); |
|
| 118 | ||
| 119 | $this->assertNotEndOfFile(); |
|
| 120 | $this->setByte($this->offset++, $bytes[0]); |
|
| 121 | ||
| 122 | $this->assertNotEndOfFile(); |
|
| 123 | $this->setByte($this->offset++, $bytes[1]); |
|
| 124 | ||
| 125 | $this->assertNotEndOfFile(); |
|
| 126 | $this->setByte($this->offset++, $bytes[2]); |
|
| 127 | ||
| 128 | $this->assertNotEndOfFile(); |
|
| 129 | $this->setByte($this->offset++, $bytes[3]); |
|
| 130 | ||
| 131 | } |
|
| 132 | } |
|
| 133 | ||
| 134 | /** |
|
| 135 | * @param int $data |
|