From 896cd9c4e2183cab0c6520b27165ff24d9f7547d Mon Sep 17 00:00:00 2001 From: Aztech Date: Fri, 14 Aug 2015 22:43:58 +0200 Subject: [PATCH] Use GUID codec in all cases as it is now endianness independant --- src/FeatureSet.php | 7 +------ tests/TestCase.php | 9 +++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/FeatureSet.php b/src/FeatureSet.php index c465eb2..04f763b 100644 --- a/src/FeatureSet.php +++ b/src/FeatureSet.php @@ -42,11 +42,6 @@ use Ramsey\Uuid\Provider\TimeProviderInterface; class FeatureSet { - public static function isLittleEndianSystem() - { - return current(unpack('v', pack('S', 0x00FF))) === 0x00FF; - } - private $disableBigNumber = false; private $disable64Bit = false; @@ -124,7 +119,7 @@ class FeatureSet protected function buildCodec($useGuids = false) { - if ($useGuids && $this->isLittleEndianSystem()) { + if ($useGuids) { return new GuidStringCodec($this->builder); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 2316fa4..145c2a8 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -28,7 +28,7 @@ class TestCase extends \PHPUnit_Framework_TestCase protected function skipIfLittleEndianHost() { - if (FeatureSet::isLittleEndianSystem()) { + if (self::isLittleEndianSystem()) { $this->markTestSkipped( 'Skipping test targeting big-endian architectures.' ); @@ -37,10 +37,15 @@ class TestCase extends \PHPUnit_Framework_TestCase protected function skipIfBigEndianHost() { - if (! FeatureSet::isLittleEndianSystem()) { + if (! self::isLittleEndianSystem()) { $this->markTestSkipped( 'Skipping test targeting little-endian architectures.' ); } } + + public static function isLittleEndianSystem() + { + return current(unpack('v', pack('S', 0x00FF))) === 0x00FF; + } }