PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.3.1
Defender Security – Malware Scanner, Login Security & Firewall v5.3.1
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / ramsey / uuid / src / UuidFactoryInterface.php

UuidFactoryInterface.php in Defender Security – Malware Scanner, Login Security & Firewall 5.3.1, at vendor/ramsey/uuid/src/UuidFactoryInterface.php

183 lines 6.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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;
16
17 use DateTimeInterface;
18 use Ramsey\Uuid\Type\Hexadecimal;
19 use Ramsey\Uuid\Type\Integer as IntegerObject;
20 use Ramsey\Uuid\Validator\ValidatorInterface;
21
22 /**
23 * UuidFactoryInterface defines common functionality all `UuidFactory` instances
24 * must implement
25 */
26 interface UuidFactoryInterface
27 {
28 /**
29 * Returns the validator to use for the factory
30 *
31 * @psalm-mutation-free
32 */
33 public function getValidator(): ValidatorInterface;
34
35 /**
36 * Returns a version 1 (time-based) UUID from a host ID, sequence number,
37 * and the current time
38 *
39 * @param Hexadecimal|int|string|null $node A 48-bit number representing the
40 * hardware address; this number may be represented as an integer or a
41 * hexadecimal string
42 * @param int|null $clockSeq A 14-bit number used to help avoid duplicates
43 * that could arise when the clock is set backwards in time or if the
44 * node ID changes
45 *
46 * @return UuidInterface A UuidInterface instance that represents a
47 * version 1 UUID
48 */
49 public function uuid1($node = null, ?int $clockSeq = null): UuidInterface;
50
51 /**
52 * Returns a version 2 (DCE Security) UUID from a local domain, local
53 * identifier, host ID, clock sequence, and the current time
54 *
55 * @param int $localDomain The local domain to use when generating bytes,
56 * according to DCE Security
57 * @param IntegerObject|null $localIdentifier The local identifier for the
58 * given domain; this may be a UID or GID on POSIX systems, if the local
59 * domain is person or group, or it may be a site-defined identifier
60 * if the local domain is org
61 * @param Hexadecimal|null $node A 48-bit number representing the hardware
62 * address
63 * @param int|null $clockSeq A 14-bit number used to help avoid duplicates
64 * that could arise when the clock is set backwards in time or if the
65 * node ID changes
66 *
67 * @return UuidInterface A UuidInterface instance that represents a
68 * version 2 UUID
69 */
70 public function uuid2(
71 int $localDomain,
72 ?IntegerObject $localIdentifier = null,
73 ?Hexadecimal $node = null,
74 ?int $clockSeq = null
75 ): UuidInterface;
76
77 /**
78 * Returns a version 3 (name-based) UUID based on the MD5 hash of a
79 * namespace ID and a name
80 *
81 * @param string|UuidInterface $ns The namespace (must be a valid UUID)
82 * @param string $name The name to use for creating a UUID
83 *
84 * @return UuidInterface A UuidInterface instance that represents a
85 * version 3 UUID
86 *
87 * @psalm-pure
88 */
89 public function uuid3($ns, string $name): UuidInterface;
90
91 /**
92 * Returns a version 4 (random) UUID
93 *
94 * @return UuidInterface A UuidInterface instance that represents a
95 * version 4 UUID
96 */
97 public function uuid4(): UuidInterface;
98
99 /**
100 * Returns a version 5 (name-based) UUID based on the SHA-1 hash of a
101 * namespace ID and a name
102 *
103 * @param string|UuidInterface $ns The namespace (must be a valid UUID)
104 * @param string $name The name to use for creating a UUID
105 *
106 * @return UuidInterface A UuidInterface instance that represents a
107 * version 5 UUID
108 *
109 * @psalm-pure
110 */
111 public function uuid5($ns, string $name): UuidInterface;
112
113 /**
114 * Returns a version 6 (ordered-time) UUID from a host ID, sequence number,
115 * and the current time
116 *
117 * @param Hexadecimal|null $node A 48-bit number representing the hardware
118 * address
119 * @param int|null $clockSeq A 14-bit number used to help avoid duplicates
120 * that could arise when the clock is set backwards in time or if the
121 * node ID changes
122 *
123 * @return UuidInterface A UuidInterface instance that represents a
124 * version 6 UUID
125 */
126 public function uuid6(?Hexadecimal $node = null, ?int $clockSeq = null): UuidInterface;
127
128 /**
129 * Creates a UUID from a byte string
130 *
131 * @param string $bytes A binary string
132 *
133 * @return UuidInterface A UuidInterface instance created from a binary
134 * string representation
135 *
136 * @psalm-pure
137 */
138 public function fromBytes(string $bytes): UuidInterface;
139
140 /**
141 * Creates a UUID from the string standard representation
142 *
143 * @param string $uuid A hexadecimal string
144 *
145 * @return UuidInterface A UuidInterface instance created from a hexadecimal
146 * string representation
147 *
148 * @psalm-pure
149 */
150 public function fromString(string $uuid): UuidInterface;
151
152 /**
153 * Creates a UUID from a 128-bit integer string
154 *
155 * @param string $integer String representation of 128-bit integer
156 *
157 * @return UuidInterface A UuidInterface instance created from the string
158 * representation of a 128-bit integer
159 *
160 * @psalm-pure
161 */
162 public function fromInteger(string $integer): UuidInterface;
163
164 /**
165 * Creates a UUID from a DateTimeInterface instance
166 *
167 * @param DateTimeInterface $dateTime The date and time
168 * @param Hexadecimal|null $node A 48-bit number representing the hardware
169 * address
170 * @param int|null $clockSeq A 14-bit number used to help avoid duplicates
171 * that could arise when the clock is set backwards in time or if the
172 * node ID changes
173 *
174 * @return UuidInterface A UuidInterface instance that represents a
175 * version 1 UUID created from a DateTimeInterface instance
176 */
177 public function fromDateTime(
178 DateTimeInterface $dateTime,
179 ?Hexadecimal $node = null,
180 ?int $clockSeq = null
181 ): UuidInterface;
182 }
183