1 | <?php |
||
24 | class PrefixMappingEntityIdParser implements EntityIdParser { |
||
25 | |||
26 | /** |
||
27 | * @var string[] |
||
28 | */ |
||
29 | private $prefixMapping; |
||
30 | |||
31 | /** |
||
32 | * @var EntityIdParser |
||
33 | */ |
||
34 | private $idParser; |
||
35 | |||
36 | /** |
||
37 | * @param string[] $prefixMapping Must contain an empty-string key defining prefix added to id serializations |
||
38 | * that do not contain any of prefixed defined in $prefixMapping. Values should not contain colons, |
||
39 | * in particular at the end of the string |
||
40 | * @param EntityIdParser $idParser |
||
41 | * |
||
42 | * @throws ParameterAssertionException |
||
43 | */ |
||
44 | public function __construct( array $prefixMapping, EntityIdParser $idParser ) { |
||
60 | |||
61 | /** |
||
62 | * Maps prefix(es) of the id serialization according to the prefix mapping definition, or adds a fixed prefix |
||
63 | * to the id serialization if there is no relevant prefix mapping, |
||
64 | * Resulting id serialization is parsed as an EntityId. |
||
65 | * |
||
66 | * @see docs/foreign-entity-ids.wiki in the DataModel module |
||
67 | * |
||
68 | * @param string $idSerialization |
||
69 | * |
||
70 | * @return EntityId |
||
71 | * @throws EntityIdParsingException |
||
72 | */ |
||
73 | public function parse( $idSerialization ) { |
||
85 | |||
86 | } |
||
87 |