1 | <?php |
||
8 | abstract class UuidIdentity implements Identity, Generator |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | private $uuid; |
||
14 | |||
15 | private function __construct($uuid) |
||
19 | |||
20 | /** |
||
21 | * Generates a UUID v4 Identity |
||
22 | * @return static |
||
23 | */ |
||
24 | public static function generate() |
||
28 | |||
29 | /** |
||
30 | * Creates an identifier object from a string representation |
||
31 | * @param $string |
||
32 | * @return static |
||
33 | */ |
||
34 | public static function fromString($string) |
||
39 | |||
40 | /** |
||
41 | * Returns a string that can be parsed by fromString() |
||
42 | * @return string |
||
43 | */ |
||
44 | public function __toString() |
||
48 | |||
49 | /** |
||
50 | * Compares the object to another IdentifiesAggregate object. Returns true if both have the same type and value. |
||
51 | * @param Identity $other |
||
52 | * @return boolean |
||
53 | */ |
||
54 | public function equals(Identity $other) |
||
58 | |||
59 | /** |
||
60 | * Returns a version 4 UUID |
||
61 | * @return string |
||
62 | */ |
||
63 | private static function uuid4() |
||
96 | |||
97 | private static function generateBytes($length) |
||
106 | |||
107 | private static function guardUuid($string) |
||
114 | } |
||
115 |