| Conditions | 1 |
| Paths | 1 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 12 | */ |
|
| 34 | public function write($string): string |
||
| 35 | 12 | { |
|
| 36 | 12 | if (!($string instanceof Buffer)) { |
|
| 37 | 12 | throw new \InvalidArgumentException('FixedLengthString::write() must be passed a Buffer'); |
|
| 38 | 12 | } |
|
| 39 | 12 | ||
| 40 | $data = new Buffer($string->getBinary(), $this->length); |
||
| 41 | if (!$this->isBigEndian()) { |
||
| 42 | 12 | $data = $data->flip(); |
|
| 43 | } |
||
| 44 | return $data->getBinary(); |
||
| 62 |