PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/google/ramsey/uuid/src/UuidFactoryInterface.php +71 -98 1.2.8 → 1.4.2 View file →
@@ -9,152 +9,125 @@
9 9 * @copyright Copyright (c) Ben Ramsey <[email protected]>
10 10 * @license http://opensource.org/licenses/MIT MIT
11 11 */
12 12 declare (strict_types=1);
13 -namespace Dudlewebs\WPMCS\Ramsey\Uuid;
13 +namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid;
14 14
15 15 use DateTimeInterface;
16 -use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Hexadecimal;
17 -use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Integer as IntegerObject;
18 -use Dudlewebs\WPMCS\Ramsey\Uuid\Validator\ValidatorInterface;
16 +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Type\Hexadecimal;
17 +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Type\Integer as IntegerObject;
18 +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Validator\ValidatorInterface;
19 19 /**
20 - * UuidFactoryInterface defines common functionality all `UuidFactory` instances
21 - * must implement
20 + * UuidFactoryInterface defines the common functionality all `UuidFactory` instances must implement
22 21 */
23 22 interface UuidFactoryInterface
24 23 {
25 24 /**
26 - * Returns the validator to use for the factory
25 + * Creates a UUID from a byte string
27 26 *
28 - * @psalm-mutation-free
27 + * @param string $bytes A binary string
28 + *
29 + * @return UuidInterface A UuidInterface instance created from a binary string representation
30 + *
31 + * @pure
29 32 */
30 - public function getValidator(): ValidatorInterface;
33 + public function fromBytes(string $bytes) : UuidInterface;
31 34 /**
32 - * Returns a version 1 (time-based) UUID from a host ID, sequence number,
33 - * and the current time
35 + * Creates a UUID from a DateTimeInterface instance
34 36 *
35 - * @param Hexadecimal|int|string|null $node A 48-bit number representing the
36 - * hardware address; this number may be represented as an integer or a
37 - * hexadecimal string
38 - * @param int|null $clockSeq A 14-bit number used to help avoid duplicates
39 - * that could arise when the clock is set backwards in time or if the
40 - * node ID changes
37 + * @param DateTimeInterface $dateTime The date and time
38 + * @param Hexadecimal | null $node A 48-bit number representing the hardware address
39 + * @param int | null $clockSeq A 14-bit number used to help avoid duplicates that could arise when the clock is set
40 + * backwards in time or if the node ID changes
41 41 *
42 - * @return UuidInterface A UuidInterface instance that represents a
43 - * version 1 UUID
42 + * @return UuidInterface A UuidInterface instance that represents a version 1 UUID created from a DateTimeInterface instance
44 43 */
45 - public function uuid1($node = null, ?int $clockSeq = null): UuidInterface;
44 + public function fromDateTime(DateTimeInterface $dateTime, ?Hexadecimal $node = null, ?int $clockSeq = null) : UuidInterface;
46 45 /**
47 - * Returns a version 2 (DCE Security) UUID from a local domain, local
48 - * identifier, host ID, clock sequence, and the current time
46 + * Creates a UUID from a 128-bit integer string
49 47 *
50 - * @param int $localDomain The local domain to use when generating bytes,
51 - * according to DCE Security
52 - * @param IntegerObject|null $localIdentifier The local identifier for the
53 - * given domain; this may be a UID or GID on POSIX systems, if the local
54 - * domain is person or group, or it may be a site-defined identifier
55 - * if the local domain is org
56 - * @param Hexadecimal|null $node A 48-bit number representing the hardware
57 - * address
58 - * @param int|null $clockSeq A 14-bit number used to help avoid duplicates
59 - * that could arise when the clock is set backwards in time or if the
60 - * node ID changes
48 + * @param string $integer String representation of 128-bit integer
61 49 *
62 - * @return UuidInterface A UuidInterface instance that represents a
63 - * version 2 UUID
50 + * @return UuidInterface A UuidInterface instance created from the string representation of a 128-bit integer
51 + *
52 + * @pure
64 53 */
65 - public function uuid2(int $localDomain, ?IntegerObject $localIdentifier = null, ?Hexadecimal $node = null, ?int $clockSeq = null): UuidInterface;
54 + public function fromInteger(string $integer) : UuidInterface;
66 55 /**
67 - * Returns a version 3 (name-based) UUID based on the MD5 hash of a
68 - * namespace ID and a name
56 + * Creates a UUID from the string standard representation
69 57 *
70 - * @param string|UuidInterface $ns The namespace (must be a valid UUID)
71 - * @param string $name The name to use for creating a UUID
58 + * @param string $uuid A hexadecimal string
72 59 *
73 - * @return UuidInterface A UuidInterface instance that represents a
74 - * version 3 UUID
60 + * @return UuidInterface A UuidInterface instance created from a hexadecimal string representation
75 61 *
76 - * @psalm-pure
62 + * @pure
77 63 */
78 - public function uuid3($ns, string $name): UuidInterface;
64 + public function fromString(string $uuid) : UuidInterface;
79 65 /**
80 - * Returns a version 4 (random) UUID
81 - *
82 - * @return UuidInterface A UuidInterface instance that represents a
83 - * version 4 UUID
66 + * Returns the validator used by the factory
84 67 */
85 - public function uuid4(): UuidInterface;
68 + public function getValidator() : ValidatorInterface;
86 69 /**
87 - * Returns a version 5 (name-based) UUID based on the SHA-1 hash of a
88 - * namespace ID and a name
70 + * Returns a version 1 (Gregorian time) UUID from a host ID, sequence number, and the current time
89 71 *
90 - * @param string|UuidInterface $ns The namespace (must be a valid UUID)
91 - * @param string $name The name to use for creating a UUID
72 + * @param Hexadecimal | int | string | null $node A 48-bit number representing the hardware address; this number may
73 + * be represented as an integer or a hexadecimal string
74 + * @param int | null $clockSeq A 14-bit number used to help avoid duplicates that could arise when the clock is set
75 + * backwards in time or if the node ID changes
92 76 *
93 - * @return UuidInterface A UuidInterface instance that represents a
94 - * version 5 UUID
95 - *
96 - * @psalm-pure
77 + * @return UuidInterface A UuidInterface instance that represents a version 1 UUID
97 78 */
98 - public function uuid5($ns, string $name): UuidInterface;
79 + public function uuid1($node = null, ?int $clockSeq = null) : UuidInterface;
99 80 /**
100 - * Returns a version 6 (ordered-time) UUID from a host ID, sequence number,
101 - * and the current time
81 + * Returns a version 2 (DCE Security) UUID from a local domain, local identifier, host ID, clock sequence, and the
82 + * current time
102 83 *
103 - * @param Hexadecimal|null $node A 48-bit number representing the hardware
104 - * address
105 - * @param int|null $clockSeq A 14-bit number used to help avoid duplicates
106 - * that could arise when the clock is set backwards in time or if the
107 - * node ID changes
84 + * @param int $localDomain The local domain to use when generating bytes, according to DCE Security
85 + * @param IntegerObject | null $localIdentifier The local identifier for the given domain; this may be a UID or GID
86 + * on POSIX systems, if the local domain is a person or group, or it may be a site-defined identifier if the
87 + * local domain is org
88 + * @param Hexadecimal | null $node A 48-bit number representing the hardware address
89 + * @param int | null $clockSeq A 14-bit number used to help avoid duplicates that could arise when the clock is set
90 + * backwards in time or if the node ID changes
108 91 *
109 - * @return UuidInterface A UuidInterface instance that represents a
110 - * version 6 UUID
92 + * @return UuidInterface A UuidInterface instance that represents a version 2 UUID
111 93 */
112 - public function uuid6(?Hexadecimal $node = null, ?int $clockSeq = null): UuidInterface;
94 + public function uuid2(int $localDomain, ?IntegerObject $localIdentifier = null, ?Hexadecimal $node = null, ?int $clockSeq = null) : UuidInterface;
113 95 /**
114 - * Creates a UUID from a byte string
96 + * Returns a version 3 (name-based) UUID based on the MD5 hash of a namespace ID and a name
115 97 *
116 - * @param string $bytes A binary string
98 + * @param UuidInterface | string $ns The namespace (must be a valid UUID)
99 + * @param string $name The name to use for creating a UUID
117 100 *
118 - * @return UuidInterface A UuidInterface instance created from a binary
119 - * string representation
101 + * @return UuidInterface A UuidInterface instance that represents a version 3 UUID
120 102 *
121 - * @psalm-pure
103 + * @pure
122 104 */
123 - public function fromBytes(string $bytes): UuidInterface;
105 + public function uuid3($ns, string $name) : UuidInterface;
124 106 /**
125 - * Creates a UUID from the string standard representation
107 + * Returns a version 4 (random) UUID
126 108 *
127 - * @param string $uuid A hexadecimal string
128 - *
129 - * @return UuidInterface A UuidInterface instance created from a hexadecimal
130 - * string representation
131 - *
132 - * @psalm-pure
109 + * @return UuidInterface A UuidInterface instance that represents a version 4 UUID
133 110 */
134 - public function fromString(string $uuid): UuidInterface;
111 + public function uuid4() : UuidInterface;
135 112 /**
136 - * Creates a UUID from a 128-bit integer string
113 + * Returns a version 5 (name-based) UUID based on the SHA-1 hash of a namespace ID and a name
137 114 *
138 - * @param string $integer String representation of 128-bit integer
115 + * @param UuidInterface | string $ns The namespace (must be a valid UUID)
116 + * @param string $name The name to use for creating a UUID
139 117 *
140 - * @return UuidInterface A UuidInterface instance created from the string
141 - * representation of a 128-bit integer
118 + * @return UuidInterface A UuidInterface instance that represents a version 5 UUID
142 119 *
143 - * @psalm-pure
120 + * @pure
144 121 */
145 - public function fromInteger(string $integer): UuidInterface;
122 + public function uuid5($ns, string $name) : UuidInterface;
146 123 /**
147 - * Creates a UUID from a DateTimeInterface instance
124 + * Returns a version 6 (reordered Gregorian time) UUID from a host ID, sequence number, and the current time
148 125 *
149 - * @param DateTimeInterface $dateTime The date and time
150 - * @param Hexadecimal|null $node A 48-bit number representing the hardware
151 - * address
152 - * @param int|null $clockSeq A 14-bit number used to help avoid duplicates
153 - * that could arise when the clock is set backwards in time or if the
154 - * node ID changes
126 + * @param Hexadecimal | null $node A 48-bit number representing the hardware address
127 + * @param int | null $clockSeq A 14-bit number used to help avoid duplicates that could arise when the clock is set
128 + * backwards in time or if the node ID changes
155 129 *
156 - * @return UuidInterface A UuidInterface instance that represents a
157 - * version 1 UUID created from a DateTimeInterface instance
130 + * @return UuidInterface A UuidInterface instance that represents a version 6 UUID
158 131 */
159 - public function fromDateTime(DateTimeInterface $dateTime, ?Hexadecimal $node = null, ?int $clockSeq = null): UuidInterface;
132 + public function uuid6(?Hexadecimal $node = null, ?int $clockSeq = null) : UuidInterface;
160 133 }