Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
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(); |
||
45 | } |
||
46 | |||
62 |