1 | <?php |
||
5 | class AbstractClient |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * @var bool |
||
10 | */ |
||
11 | protected $is64bits; |
||
12 | |||
13 | /** |
||
14 | * @var bool |
||
15 | */ |
||
16 | protected $isLittleEndian; |
||
17 | |||
18 | 435 | public function __construct() |
|
19 | { |
||
20 | 435 | $this->is64bits = PHP_INT_SIZE == 8; |
|
21 | |||
22 | 435 | $tmp = unpack('S', "\x01\x00"); // to maintain 5.3 compatibility |
|
23 | 435 | $this->isLittleEndian = $tmp[1] == 1; |
|
24 | 435 | } |
|
25 | |||
26 | /** |
||
27 | * Converts byte-string between native and network byte order, in both directions |
||
28 | * |
||
29 | * @param string $byteStr |
||
30 | * @return string |
||
31 | */ |
||
32 | 65 | protected function correctEndianness($byteStr) |
|
36 | } |
||
37 |