Debian Codegraph @

vendor/ramsey/uuid/src/Guid/Guid.php

raw
1 <?php
2
3 /**
4 * This file is part of the ramsey/uuid library
5 *
6 * For the full copyright and license information, please view the LICENSE
7 * file that was distributed with this source code.
8 *
9 * @copyright Copyright (c) Ben Ramsey <[email protected]>
10 * @license http://opensource.org/licenses/MIT MIT
11 */
12
13 declare(strict_types=1);
14
15 namespace Ramsey\Uuid\Guid;
16
17 use Ramsey\Uuid\Codec\CodecInterface;
18 use Ramsey\Uuid\Converter\NumberConverterInterface;
19 use Ramsey\Uuid\Converter\TimeConverterInterface;
20 use Ramsey\Uuid\Uuid;
21
22 /**
23 * Guid represents a UUID with "native" (little-endian) byte order
24 *
25 * From Wikipedia:
26 *
27 * > The first three fields are unsigned 32- and 16-bit integers and are subject to swapping, while the last two fields
28 * > consist of uninterpreted bytes, not subject to swapping. This byte swapping applies even for versions 3, 4, and 5,
29 * > where the canonical fields do not correspond to the content of the UUID.
30 *
31 * The first three fields of a GUID are encoded in little-endian byte order, while the last three fields are in network
32 * (big-endian) byte order. This is according to the history of the Microsoft GUID definition.
33 *
34 * According to the .NET Guid.ToByteArray method documentation:
35 *
36 * > Note that the order of bytes in the returned byte array is different from the string representation of a Guid value.
37 * > The order of the beginning four-byte group and the next two two-byte groups is reversed, whereas the order of the
38 * > last two-byte group and the closing six-byte group is the same.
39 *
40 * @link https://en.wikipedia.org/wiki/Universally_unique_identifier#Variants UUID Variants on Wikipedia
41 * @link https://docs.microsoft.com/en-us/windows/win32/api/guiddef/ns-guiddef-guid Windows GUID structure
42 * @link https://docs.microsoft.com/en-us/dotnet/api/system.guid .NET Guid Struct
43 * @link https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray .NET Guid.ToByteArray Method
44 *
45 * @immutable
46 */
47 final class Guid extends Uuid
48 {
49 public function __construct(
50 Fields $fields,
51 NumberConverterInterface $numberConverter,
52 CodecInterface $codec,
53 TimeConverterInterface $timeConverter,
54 ) {
55 parent::__construct($fields, $numberConverter, $codec, $timeConverter);
56 }
57 }