1 | <?php |
||
18 | class PrefixedEntityIdParser implements EntityIdParser { |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $prefix; |
||
24 | |||
25 | /** |
||
26 | * @var EntityIdParser |
||
27 | */ |
||
28 | private $idParser; |
||
29 | |||
30 | /** |
||
31 | * @param string $prefix The prefix to be stripped. Stripping is case sensitive. |
||
32 | * @param EntityIdParser $idParser |
||
33 | */ |
||
34 | public function __construct( $prefix, EntityIdParser $idParser ) { |
||
38 | |||
39 | /** |
||
40 | * Parses the given string into an EntityId by first stripping a fixed prefix. |
||
41 | * If the string does not start with the expected prefix, an EntityIdParsingException |
||
42 | * is thrown. |
||
43 | * |
||
44 | * @param string $idSerialization An entity ID with some prefix attached, e.g. an entity URI. |
||
45 | * |
||
46 | * @throws EntityIdParsingException If the string does not start with the expected prefix, |
||
47 | * or the remaining suffix is not a valid entity ID string. |
||
48 | * @return EntityId |
||
49 | */ |
||
50 | public function parse( $idSerialization ) { |
||
61 | |||
62 | } |
||
63 |