Enhance the Guid documentation

This commit is contained in:
Ben Ramsey
2020-02-21 13:09:00 -06:00
parent bfde8d3130
commit d98764ac16
4 changed files with 21 additions and 1 deletions
+2 -1
View File
@@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Ramsey\Uuid\Codec;
use Ramsey\Uuid\Guid\Guid;
use Ramsey\Uuid\UuidInterface;
use function bin2hex;
@@ -22,7 +23,7 @@ use function substr;
/**
* GuidStringCodec encodes and decodes globally unique identifiers (GUID)
*
* @link https://en.wikipedia.org/wiki/Globally_unique_identifier Globally Unique Identifier
* @see Guid
*/
class GuidStringCodec extends StringCodec
{
+2
View File
@@ -38,6 +38,8 @@ use const STR_PAD_LEFT;
/**
* GUIDs are comprised of a set of named fields, according to RFC 4122
*
* @see Guid
*
* @psalm-immutable
*/
final class Fields implements FieldsInterface
+15
View File
@@ -30,7 +30,22 @@ use Ramsey\Uuid\UuidInterface;
* > subject to swapping. This byte swapping applies even for versions 3, 4, and
* > 5, where the canonical fields do not correspond to the content of the UUID.
*
* The first three fields of a GUID are encoded in little-endian byte order,
* while the last three fields are in network (big-endian) byte order. This is
* according to the history of the Microsoft definition of a GUID.
*
* According to the .NET Guid.ToByteArray method documentation:
*
* > Note that the order of bytes in the returned byte array is different from
* > the string representation of a Guid value. The order of the beginning
* > four-byte group and the next two two-byte groups is reversed, whereas the
* > order of the last two-byte group and the closing six-byte group is the
* > same.
*
* @link https://en.wikipedia.org/wiki/Universally_unique_identifier#Variants UUID Variants on Wikipedia
* @link https://docs.microsoft.com/en-us/windows/win32/api/guiddef/ns-guiddef-guid Windows GUID structure
* @link https://docs.microsoft.com/en-us/dotnet/api/system.guid .NET Guid Struct
* @link https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray .NET Guid.ToByteArray Method
*
* @psalm-immutable
*/
+2
View File
@@ -25,6 +25,8 @@ use Throwable;
/**
* GuidBuilder builds instances of Guid
*
* @see Guid
*
* @psalm-immutable
*/
class GuidBuilder implements UuidBuilderInterface