| 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\Ramsey\Uuid; |
| 14 |
|
| 15 |
use JsonSerializable; |
| 16 |
use Dudlewebs\WPMCS\Ramsey\Uuid\Fields\FieldsInterface; |
| 17 |
use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Hexadecimal; |
| 18 |
use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Integer as IntegerObject; |
| 19 |
use Serializable; |
| 20 |
/** |
| 21 |
* A UUID is a universally unique identifier adhering to an agreed-upon |
| 22 |
* representation format and standard for generation |
| 23 |
* |
| 24 |
* @psalm-immutable |
| 25 |
*/ |
| 26 |
interface UuidInterface extends DeprecatedUuidInterface, JsonSerializable, Serializable |
| 27 |
{ |
| 28 |
/** |
| 29 |
* Returns -1, 0, or 1 if the UUID is less than, equal to, or greater than |
| 30 |
* the other UUID |
| 31 |
* |
| 32 |
* The first of two UUIDs is greater than the second if the most |
| 33 |
* significant field in which the UUIDs differ is greater for the first |
| 34 |
* UUID. |
| 35 |
* |
| 36 |
* * Q. What's the value of being able to sort UUIDs? |
| 37 |
* * A. Use them as keys in a B-Tree or similar mapping. |
| 38 |
* |
| 39 |
* @param UuidInterface $other The UUID to compare |
| 40 |
* |
| 41 |
* @return int -1, 0, or 1 if the UUID is less than, equal to, or greater than $other |
| 42 |
*/ |
| 43 |
public function compareTo(UuidInterface $other): int; |
| 44 |
/** |
| 45 |
* Returns true if the UUID is equal to the provided object |
| 46 |
* |
| 47 |
* The result is true if and only if the argument is not null, is a UUID |
| 48 |
* object, has the same variant, and contains the same value, bit for bit, |
| 49 |
* as the UUID. |
| 50 |
* |
| 51 |
* @param object|null $other An object to test for equality with this UUID |
| 52 |
* |
| 53 |
* @return bool True if the other object is equal to this UUID |
| 54 |
*/ |
| 55 |
public function equals(?object $other): bool; |
| 56 |
/** |
| 57 |
* Returns the binary string representation of the UUID |
| 58 |
* |
| 59 |
* @psalm-return non-empty-string |
| 60 |
*/ |
| 61 |
public function getBytes(): string; |
| 62 |
/** |
| 63 |
* Returns the fields that comprise this UUID |
| 64 |
*/ |
| 65 |
public function getFields(): FieldsInterface; |
| 66 |
/** |
| 67 |
* Returns the hexadecimal representation of the UUID |
| 68 |
*/ |
| 69 |
public function getHex(): Hexadecimal; |
| 70 |
/** |
| 71 |
* Returns the integer representation of the UUID |
| 72 |
*/ |
| 73 |
public function getInteger(): IntegerObject; |
| 74 |
/** |
| 75 |
* Returns the string standard representation of the UUID |
| 76 |
* |
| 77 |
* @psalm-return non-empty-string |
| 78 |
*/ |
| 79 |
public function toString(): string; |
| 80 |
/** |
| 81 |
* Casts the UUID to the string standard representation |
| 82 |
* |
| 83 |
* @psalm-return non-empty-string |
| 84 |
*/ |
| 85 |
public function __toString(): string; |
| 86 |
} |
| 87 |
|