diff --git a/src/BigNumberConverter.php b/src/BigNumberConverter.php index 0e1b3fd..97551cf 100644 --- a/src/BigNumberConverter.php +++ b/src/BigNumberConverter.php @@ -4,6 +4,9 @@ namespace Rhumsaa\Uuid; class BigNumberConverter { + /** + * @param string $hex + */ public function fromHex($hex) { $number = \Moontoast\Math\BigNumber::baseConvert($hex, 16, 10); diff --git a/src/Codec.php b/src/Codec.php index 9912851..f32800e 100644 --- a/src/Codec.php +++ b/src/Codec.php @@ -4,11 +4,23 @@ namespace Rhumsaa\Uuid; interface Codec { + /** + * @return string + */ public function encode(UuidInterface $uuid); + /** + * @return string + */ public function encodeBinary(UuidInterface $uuid); + /** + * @return callable + */ public function decode($encodedUuid); + /** + * @param string $bytes + */ public function decodeBytes($bytes); } diff --git a/src/Codec/GuidStringCodec.php b/src/Codec/GuidStringCodec.php index ec9e5bd..53999fb 100644 --- a/src/Codec/GuidStringCodec.php +++ b/src/Codec/GuidStringCodec.php @@ -2,12 +2,8 @@ namespace Rhumsaa\Uuid\Codec; -use InvalidArgumentException; use Rhumsaa\Uuid\UuidInterface; use Rhumsaa\Uuid\Uuid; -use Rhumsaa\Uuid\BigNumberConverter; -use Rhumsaa\Uuid\UuidFactory; -use Rhumsaa\Uuid\UuidBuilder; use Rhumsaa\Uuid\Codec; class GuidStringCodec extends StringCodec diff --git a/src/Codec/StringCodec.php b/src/Codec/StringCodec.php index 3147f81..852116b 100644 --- a/src/Codec/StringCodec.php +++ b/src/Codec/StringCodec.php @@ -3,12 +3,10 @@ namespace Rhumsaa\Uuid\Codec; use InvalidArgumentException; -use Rhumsaa\Uuid\BigNumberConverter; use Rhumsaa\Uuid\Codec; use Rhumsaa\Uuid\Uuid; use Rhumsaa\Uuid\UuidBuilder; use Rhumsaa\Uuid\UuidInterface; -use Rhumsaa\Uuid\UuidFactory; class StringCodec implements Codec { diff --git a/src/Console/Command/DecodeCommand.php b/src/Console/Command/DecodeCommand.php index 22c99c3..ff44bf6 100644 --- a/src/Console/Command/DecodeCommand.php +++ b/src/Console/Command/DecodeCommand.php @@ -15,7 +15,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\TableHelper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Rhumsaa\Uuid\Console\Exception; use Rhumsaa\Uuid\Uuid; diff --git a/src/Node/SystemNodeProvider.php b/src/Node/SystemNodeProvider.php index 819ce9b..dde9753 100644 --- a/src/Node/SystemNodeProvider.php +++ b/src/Node/SystemNodeProvider.php @@ -29,6 +29,7 @@ class SystemNodeProvider implements NodeProvider * @todo Needs evaluation and possibly modification to ensure this works * well across multiple platforms. * @codeCoverageIgnore + * @return string */ protected function getIfconfig() { diff --git a/src/RandomGenerator.php b/src/RandomGenerator.php index 9fac8b9..d703d04 100644 --- a/src/RandomGenerator.php +++ b/src/RandomGenerator.php @@ -4,5 +4,10 @@ namespace Rhumsaa\Uuid; interface RandomGenerator { + /** + * @param integer $length + * + * @return string + */ function generate($length); } diff --git a/src/Uuid.php b/src/Uuid.php index 7ed74ca..ab0c5ca 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -12,8 +12,6 @@ namespace Rhumsaa\Uuid; use InvalidArgumentException; -use Rhumsaa\Uuid\Codec\GuidStringCodec; -use Rhumsaa\Uuid\Codec\StringCodec; /** * Represents a universally unique identifier (UUID), according to RFC 4122 @@ -747,7 +745,6 @@ class Uuid implements UuidInterface, \JsonSerializable * in the toString() method. * * @param string $name A string that specifies a UUID - * @param bool $littleEndian A boolean specifying whether the time_low, time_mid, time_hi_and_version are encoded in little-endian format. * @return Uuid * @throws InvalidArgumentException If the $name isn't a valid UUID */ @@ -813,7 +810,7 @@ class Uuid implements UuidInterface, \JsonSerializable * Generate a version 3 UUID based on the MD5 hash of a namespace identifier (which * is a UUID) and a name (which is a string). * - * @param Uuid|string $ns The UUID namespace in which to create the named UUID + * @param string $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return Uuid */ @@ -836,7 +833,7 @@ class Uuid implements UuidInterface, \JsonSerializable * Generate a version 5 UUID based on the SHA-1 hash of a namespace identifier (which * is a UUID) and a name (which is a string). * - * @param Uuid|string $ns The UUID namespace in which to create the named UUID + * @param string $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return Uuid */ diff --git a/src/UuidBuilder.php b/src/UuidBuilder.php index 6f777be..b4f490c 100644 --- a/src/UuidBuilder.php +++ b/src/UuidBuilder.php @@ -4,5 +4,8 @@ namespace Rhumsaa\Uuid; interface UuidBuilder { + /** + * @return Uuid + */ public function build(Codec $codec, array $fields); } diff --git a/src/UuidFactory.php b/src/UuidFactory.php index a66617f..5df3116 100644 --- a/src/UuidFactory.php +++ b/src/UuidFactory.php @@ -2,16 +2,6 @@ namespace Rhumsaa\Uuid; -use Rhumsaa\Uuid\Codec\StringCodec; -use Rhumsaa\Uuid\Codec\GuidStringCodec; -use Rhumsaa\Uuid\Time\PhpTimeConverter; -use Rhumsaa\Uuid\Time\BigNumberTimeConverter; -use Rhumsaa\Uuid\Time\DegradedTimeConverter; -use Rhumsaa\Uuid\Time\SystemTimeProvider; -use Rhumsaa\Uuid\Node\FallbackNodeProvider; -use Rhumsaa\Uuid\Node\SystemNodeProvider; -use Rhumsaa\Uuid\Node\RandomNodeProvider; - class UuidFactory { @@ -125,7 +115,6 @@ class UuidFactory * in the toString() method. * * @param string $name A string that specifies a UUID - * @param bool $littleEndian A boolean specifying whether the time_low, time_mid, time_hi_and_version are encoded in little-endian format. * @return Uuid * @throws InvalidArgumentException If the $name isn't a valid UUID */ @@ -245,6 +234,10 @@ class UuidFactory return $clockSeqHi; } + /** + * @param string $timeHi + * @param integer $version + */ protected function applyVersion($timeHi, $version) { $timeHi = hexdec($timeHi) & 0x0fff; @@ -254,6 +247,11 @@ class UuidFactory return $timeHi; } + /** + * @param string $name + * @param integer $version + * @param string $hashFunction + */ protected function uuidFromNsAndName($ns, $name, $version, $hashFunction) { if (!($ns instanceof Uuid)) { diff --git a/src/UuidInterface.php b/src/UuidInterface.php index 7858fee..4e852e2 100644 --- a/src/UuidInterface.php +++ b/src/UuidInterface.php @@ -5,46 +5,106 @@ namespace Rhumsaa\Uuid; interface UuidInterface { + /** + * @return integer + */ public function compareTo(UuidInterface $other); + /** + * @return boolean + */ public function equals($other); + /** + * @return BigNumberConverter + */ public function getConverter(); + /** + * @return string + */ public function getHex(); public function getFieldsHex(); + /** + * @return string + */ public function getClockSeqHiAndReservedHex(); + /** + * @return string + */ public function getClockSeqLowHex(); + /** + * @return string + */ public function getClockSequenceHex(); + /** + * @return \DateTime + */ public function getDateTime(); + /** + * @return \Moontoast\Math\BigNumber + */ public function getInteger(); + /** + * @return string + */ public function getLeastSignificantBitsHex(); + /** + * @return string + */ public function getMostSignificantBitsHex(); + /** + * @return string + */ public function getNodeHex(); + /** + * @return string + */ public function getTimeHiAndVersionHex(); + /** + * @return string + */ public function getTimeLowHex(); + /** + * @return string + */ public function getTimeMidHex(); + /** + * @return string + */ public function getTimestampHex(); + /** + * @return string + */ public function getUrn(); + /** + * @return integer + */ public function getVariant(); + /** + * @return integer|null + */ public function getVersion(); + /** + * @return string + */ public function toString(); }