From 77d2aa500737c2f4b7b5b7e6b1375e4d960788db Mon Sep 17 00:00:00 2001 From: Eric Thelin Date: Mon, 15 Apr 2013 17:48:14 -0500 Subject: [PATCH] only call the getClockSeqHiAndReserved method once because it will have the same data each time --- src/Rhumsaa/Uuid/Uuid.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Rhumsaa/Uuid/Uuid.php b/src/Rhumsaa/Uuid/Uuid.php index 8274158..532d3bf 100644 --- a/src/Rhumsaa/Uuid/Uuid.php +++ b/src/Rhumsaa/Uuid/Uuid.php @@ -719,11 +719,12 @@ final class Uuid */ public function getVariant() { - if (0 === ($this->getClockSeqHiAndReserved() & 0x80)) { + $clockSeq = $this->getClockSeqHiAndReserved(); + if (0 === ($clockSeq & 0x80)) { $variant = self::RESERVED_NCS; - } elseif (0 === ($this->getClockSeqHiAndReserved() & 0x40)) { + } elseif (0 === ($clockSeq & 0x40)) { $variant = self::RFC_4122; - } elseif (0 === ($this->getClockSeqHiAndReserved() & 0x20)) { + } elseif (0 === ($clockSeq & 0x20)) { $variant = self::RESERVED_MICROSOFT; } else { $variant = self::RESERVED_FUTURE;