Fix minor issues highlighted by Scrutinizer

This commit is contained in:
Ben Ramsey
2015-09-28 12:19:57 -05:00
parent 0c0ac34e86
commit 15db91b8f6
2 changed files with 11 additions and 11 deletions
+8 -8
View File
@@ -188,30 +188,30 @@ class Uuid implements UuidInterface
return $this->toString();
}
public function compareTo(UuidInterface $uuid)
public function compareTo(UuidInterface $other)
{
$comparison = 0;
if ($this->getMostSignificantBitsHex() < $uuid->getMostSignificantBitsHex()) {
if ($this->getMostSignificantBitsHex() < $other->getMostSignificantBitsHex()) {
$comparison = -1;
} elseif ($this->getMostSignificantBitsHex() > $uuid->getMostSignificantBitsHex()) {
} elseif ($this->getMostSignificantBitsHex() > $other->getMostSignificantBitsHex()) {
$comparison = 1;
} elseif ($this->getLeastSignificantBitsHex() < $uuid->getLeastSignificantBitsHex()) {
} elseif ($this->getLeastSignificantBitsHex() < $other->getLeastSignificantBitsHex()) {
$comparison = -1;
} elseif ($this->getLeastSignificantBitsHex() > $uuid->getLeastSignificantBitsHex()) {
} elseif ($this->getLeastSignificantBitsHex() > $other->getLeastSignificantBitsHex()) {
$comparison = 1;
}
return $comparison;
}
public function equals($obj)
public function equals($other)
{
if (!($obj instanceof UuidInterface)) {
if (!($other instanceof UuidInterface)) {
return false;
}
return ($this->compareTo($obj) == 0);
return ($this->compareTo($other) == 0);
}
public function getBytes()
+3 -3
View File
@@ -32,7 +32,7 @@ interface UuidInterface extends \JsonSerializable
* * Q. What's the value of being able to sort UUIDs?
* * A. Use them as keys in a B-Tree or similar mapping.
*
* @param UuidInterface $uuid UUID to which this UUID is compared
* @param UuidInterface $other UUID to which this UUID is compared
* @return int -1, 0 or 1 as this UUID is less than, equal to, or greater than `$uuid`
*/
public function compareTo(UuidInterface $other);
@@ -44,8 +44,8 @@ interface UuidInterface extends \JsonSerializable
* object, has the same variant, and contains the same value, bit for bit,
* as this UUID.
*
* @param object $obj
* @return bool True if `$obj` is equal to this UUID
* @param object $other
* @return bool True if `$other` is equal to this UUID
*/
public function equals($other);