Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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
 
13
declare(strict_types=1);
14
 
15
namespace Ramsey\Uuid;
16
 
17
use JsonSerializable;
18
use Ramsey\Uuid\Fields\FieldsInterface;
19
use Ramsey\Uuid\Type\Hexadecimal;
20
use Ramsey\Uuid\Type\Integer as IntegerObject;
21
use Serializable;
621 lars 22
use Stringable;
148 lars 23
 
24
/**
25
 * A UUID is a universally unique identifier adhering to an agreed-upon
26
 * representation format and standard for generation
27
 *
28
 * @psalm-immutable
29
 */
30
interface UuidInterface extends
31
    DeprecatedUuidInterface,
32
    JsonSerializable,
621 lars 33
    Serializable,
34
    Stringable
148 lars 35
{
36
    /**
37
     * Returns -1, 0, or 1 if the UUID is less than, equal to, or greater than
38
     * the other UUID
39
     *
40
     * The first of two UUIDs is greater than the second if the most
41
     * significant field in which the UUIDs differ is greater for the first
42
     * UUID.
43
     *
44
     * * Q. What's the value of being able to sort UUIDs?
45
     * * A. Use them as keys in a B-Tree or similar mapping.
46
     *
47
     * @param UuidInterface $other The UUID to compare
48
     *
49
     * @return int -1, 0, or 1 if the UUID is less than, equal to, or greater than $other
50
     */
51
    public function compareTo(UuidInterface $other): int;
52
 
53
    /**
54
     * Returns true if the UUID is equal to the provided object
55
     *
56
     * The result is true if and only if the argument is not null, is a UUID
57
     * object, has the same variant, and contains the same value, bit for bit,
58
     * as the UUID.
59
     *
60
     * @param object|null $other An object to test for equality with this UUID
61
     *
62
     * @return bool True if the other object is equal to this UUID
63
     */
64
    public function equals(?object $other): bool;
65
 
66
    /**
67
     * Returns the binary string representation of the UUID
68
     *
69
     * @psalm-return non-empty-string
70
     */
71
    public function getBytes(): string;
72
 
73
    /**
74
     * Returns the fields that comprise this UUID
75
     */
76
    public function getFields(): FieldsInterface;
77
 
78
    /**
79
     * Returns the hexadecimal representation of the UUID
80
     */
81
    public function getHex(): Hexadecimal;
82
 
83
    /**
84
     * Returns the integer representation of the UUID
85
     */
86
    public function getInteger(): IntegerObject;
87
 
88
    /**
89
     * Returns the string standard representation of the UUID as a URN
90
     *
91
     * @link http://en.wikipedia.org/wiki/Uniform_Resource_Name Uniform Resource Name
92
     * @link https://tools.ietf.org/html/rfc4122#section-3 RFC 4122, § 3: Namespace Registration Template
93
     */
94
    public function getUrn(): string;
95
 
96
    /**
97
     * Returns the string standard representation of the UUID
98
     *
99
     * @psalm-return non-empty-string
100
     */
101
    public function toString(): string;
102
 
103
    /**
104
     * Casts the UUID to the string standard representation
105
     *
106
     * @psalm-return non-empty-string
107
     */
108
    public function __toString(): string;
109
}