1 | <?php |
||
16 | abstract class EntityId implements Comparable, Serializable { |
||
17 | |||
18 | protected $serialization; |
||
19 | |||
20 | /** |
||
21 | * @param $serialization |
||
22 | */ |
||
23 | protected function __construct( $serialization ) { |
||
26 | |||
27 | /** |
||
28 | * @return string |
||
29 | */ |
||
30 | public abstract function getEntityType(); |
||
31 | |||
32 | /** |
||
33 | * @return string |
||
34 | */ |
||
35 | public function getSerialization() { |
||
38 | |||
39 | /** |
||
40 | * Returns an array with 3 elements: the foreign repository name as the first element, the local ID as the last |
||
41 | * element and everything that is in between as the second element. |
||
42 | * |
||
43 | * @param $serialization |
||
44 | * @return array |
||
45 | */ |
||
46 | public static function splitSerialization( $serialization ) { |
||
54 | |||
55 | /** |
||
56 | * Concatenates parts of an EntityId serialization with ':'. |
||
57 | * |
||
58 | * @param array $parts |
||
59 | * @return string |
||
60 | */ |
||
61 | public static function joinSerialization( $parts ) { |
||
64 | |||
65 | /** |
||
66 | * Returns the foreign repository name or empty string for local entities. |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getRepoName() { |
||
74 | |||
75 | /** |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getLocalPart() { |
||
83 | |||
84 | /** |
||
85 | * @return bool |
||
86 | */ |
||
87 | public function isForeign() { |
||
90 | |||
91 | protected static function normalizeIdSerialization( $id ) { |
||
100 | |||
101 | /** |
||
102 | * This is a human readable representation of the EntityId. |
||
103 | * This format is allowed to change and should therefore not |
||
104 | * be relied upon to be stable. |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | public function __toString() { |
||
111 | |||
112 | /** |
||
113 | * @see Comparable::equals |
||
114 | * |
||
115 | * @since 0.5 |
||
116 | * |
||
117 | * @param mixed $target |
||
118 | * |
||
119 | * @return bool |
||
120 | */ |
||
121 | public function equals( $target ) { |
||
129 | |||
130 | } |
||
131 |