1 | <?php |
||
8 | abstract class StringIdentity implements Identity |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | private $string; |
||
14 | |||
15 | public function __construct($string) |
||
20 | |||
21 | /** |
||
22 | * Creates an identifier object from a string representation |
||
23 | * |
||
24 | * @param $string |
||
25 | * @return static |
||
26 | */ |
||
27 | public static function fromString($string) |
||
31 | |||
32 | /** |
||
33 | * Returns a string that can be parsed by fromString() |
||
34 | * |
||
35 | * @return string |
||
36 | */ |
||
37 | public function __toString() |
||
41 | |||
42 | /** |
||
43 | * Compares the object to another IdentifiesAggregate object. Returns true if both have the same type and value. |
||
44 | * |
||
45 | * @param Identity $other |
||
46 | * @return boolean |
||
47 | */ |
||
48 | public function equals(Identity $other) |
||
52 | |||
53 | /** |
||
54 | * Make sure that the input is in fact a string |
||
55 | * |
||
56 | * @param $string |
||
57 | */ |
||
58 | private static function guardString($string) |
||
64 | } |
||
65 |