| 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 <ben@benramsey.com> |
| 10 |
* @license http://opensource.org/licenses/MIT MIT |
| 11 |
*/ |
| 12 |
declare (strict_types=1); |
| 13 |
namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid; |
| 14 |
|
| 15 |
use DateTimeInterface; |
| 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 |
/** |
| 20 |
* UuidFactoryInterface defines the common functionality all `UuidFactory` instances must implement |
| 21 |
*/ |
| 22 |
interface UuidFactoryInterface |
| 23 |
{ |
| 24 |
/** |
| 25 |
* Creates a UUID from a byte string |
| 26 |
* |
| 27 |
* @param string $bytes A binary string |
| 28 |
* |
| 29 |
* @return UuidInterface A UuidInterface instance created from a binary string representation |
| 30 |
* |
| 31 |
* @pure |
| 32 |
*/ |
| 33 |
public function fromBytes(string $bytes) : UuidInterface; |
| 34 |
/** |
| 35 |
* Creates a UUID from a DateTimeInterface instance |
| 36 |
* |
| 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 |
* |
| 42 |
* @return UuidInterface A UuidInterface instance that represents a version 1 UUID created from a DateTimeInterface instance |
| 43 |
*/ |
| 44 |
public function fromDateTime(DateTimeInterface $dateTime, ?Hexadecimal $node = null, ?int $clockSeq = null) : UuidInterface; |
| 45 |
/** |
| 46 |
* Creates a UUID from a 128-bit integer string |
| 47 |
* |
| 48 |
* @param string $integer String representation of 128-bit integer |
| 49 |
* |
| 50 |
* @return UuidInterface A UuidInterface instance created from the string representation of a 128-bit integer |
| 51 |
* |
| 52 |
* @pure |
| 53 |
*/ |
| 54 |
public function fromInteger(string $integer) : UuidInterface; |
| 55 |
/** |
| 56 |
* Creates a UUID from the string standard representation |
| 57 |
* |
| 58 |
* @param string $uuid A hexadecimal string |
| 59 |
* |
| 60 |
* @return UuidInterface A UuidInterface instance created from a hexadecimal string representation |
| 61 |
* |
| 62 |
* @pure |
| 63 |
*/ |
| 64 |
public function fromString(string $uuid) : UuidInterface; |
| 65 |
/** |
| 66 |
* Returns the validator used by the factory |
| 67 |
*/ |
| 68 |
public function getValidator() : ValidatorInterface; |
| 69 |
/** |
| 70 |
* Returns a version 1 (Gregorian time) UUID from a host ID, sequence number, and the current time |
| 71 |
* |
| 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 |
| 76 |
* |
| 77 |
* @return UuidInterface A UuidInterface instance that represents a version 1 UUID |
| 78 |
*/ |
| 79 |
public function uuid1($node = null, ?int $clockSeq = null) : UuidInterface; |
| 80 |
/** |
| 81 |
* Returns a version 2 (DCE Security) UUID from a local domain, local identifier, host ID, clock sequence, and the |
| 82 |
* current time |
| 83 |
* |
| 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 |
| 91 |
* |
| 92 |
* @return UuidInterface A UuidInterface instance that represents a version 2 UUID |
| 93 |
*/ |
| 94 |
public function uuid2(int $localDomain, ?IntegerObject $localIdentifier = null, ?Hexadecimal $node = null, ?int $clockSeq = null) : UuidInterface; |
| 95 |
/** |
| 96 |
* Returns a version 3 (name-based) UUID based on the MD5 hash of a namespace ID and a name |
| 97 |
* |
| 98 |
* @param UuidInterface | string $ns The namespace (must be a valid UUID) |
| 99 |
* @param string $name The name to use for creating a UUID |
| 100 |
* |
| 101 |
* @return UuidInterface A UuidInterface instance that represents a version 3 UUID |
| 102 |
* |
| 103 |
* @pure |
| 104 |
*/ |
| 105 |
public function uuid3($ns, string $name) : UuidInterface; |
| 106 |
/** |
| 107 |
* Returns a version 4 (random) UUID |
| 108 |
* |
| 109 |
* @return UuidInterface A UuidInterface instance that represents a version 4 UUID |
| 110 |
*/ |
| 111 |
public function uuid4() : UuidInterface; |
| 112 |
/** |
| 113 |
* Returns a version 5 (name-based) UUID based on the SHA-1 hash of a namespace ID and a name |
| 114 |
* |
| 115 |
* @param UuidInterface | string $ns The namespace (must be a valid UUID) |
| 116 |
* @param string $name The name to use for creating a UUID |
| 117 |
* |
| 118 |
* @return UuidInterface A UuidInterface instance that represents a version 5 UUID |
| 119 |
* |
| 120 |
* @pure |
| 121 |
*/ |
| 122 |
public function uuid5($ns, string $name) : UuidInterface; |
| 123 |
/** |
| 124 |
* Returns a version 6 (reordered Gregorian time) UUID from a host ID, sequence number, and the current time |
| 125 |
* |
| 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 |
| 129 |
* |
| 130 |
* @return UuidInterface A UuidInterface instance that represents a version 6 UUID |
| 131 |
*/ |
| 132 |
public function uuid6(?Hexadecimal $node = null, ?int $clockSeq = null) : UuidInterface; |
| 133 |
} |
| 134 |
|