Conditions | 5 |
Paths | 6 |
Total Lines | 25 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
57 | protected function readSigned() |
||
58 | { |
||
59 | $data = $this->getStream()->read(3); |
||
60 | |||
61 | if (ByteOrder::MACHINE_ENDIAN !== $this->getByteOrder() |
||
62 | && $this->getMachineByteOrder() !== $this->getByteOrder() |
||
63 | ) { |
||
64 | $data = strrev($data); |
||
65 | } |
||
66 | |||
67 | switch ($this->getByteOrder()) { |
||
68 | case ByteOrder::BIG_ENDIAN: |
||
69 | $data = $data . "\x00"; |
||
70 | break; |
||
71 | case ByteOrder::LITTLE_ENDIAN: |
||
72 | $data = "\x00" . $data; |
||
73 | break; |
||
74 | default: |
||
75 | $data = $data . "\x00"; |
||
76 | } |
||
77 | |||
78 | |||
79 | list(, $value) = unpack('l*', $data); |
||
80 | return $value; |
||
81 | } |
||
82 | } |
||
83 |