Add lib/PhpAmqpLib

This commit is contained in:
Guillaume COEUGNET
2016-03-30 16:09:10 +02:00
parent 9c7cc69be6
commit fcd2aae898
45 changed files with 8677 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace PhpAmqpLib\Wire;
class AbstractClient
{
/**
* @var bool
*/
protected $is64bits;
/**
* @var bool
*/
protected $isLittleEndian;
public function __construct()
{
$this->is64bits = PHP_INT_SIZE == 8;
$tmp = unpack('S', "\x01\x00"); // to maintain 5.3 compatibility
$this->isLittleEndian = $tmp[1] == 1;
}
/**
* Converts byte-string between native and network byte order, in both directions
*
* @param string $byteStr
* @return string
*/
protected function correctEndianness($byteStr)
{
return $this->isLittleEndian ? strrev($byteStr) : $byteStr;
}
}