示例#1
0
 /**
  * Test that the byte order enum returns all possible values
  */
 public function testByteOrderValues()
 {
     $this->assertSame([ByteOrder::MACHINE_ENDIAN, ByteOrder::BIG_ENDIAN, ByteOrder::LITTLE_ENDIAN], ByteOrder::values());
 }
示例#2
0
 /**
  * Set the byte order for integer handling.
  *
  * @param int $byteOrder The byte order to set. Must be one of the constants defined by the byte order enum.
  *
  * @throws Exception\InvalidArgumentException An exception will be thrown for invalid byte order arguments.
  *
  * @return $this
  */
 public function setByteOrder($byteOrder)
 {
     if (!in_array($byteOrder, ByteOrder::values(), true)) {
         throw new Exception\InvalidArgumentException('Invalid byte order');
     }
     $this->byteOrder = $byteOrder;
     return $this;
 }