1 | <?php |
||
13 | class DispatchingEntityIdParser implements EntityIdParser { |
||
14 | |||
15 | /** |
||
16 | * @var callable[] |
||
17 | */ |
||
18 | private $idBuilders; |
||
19 | |||
20 | /** |
||
21 | * Takes an array in which each key is a preg_match pattern. |
||
22 | * The first pattern the id matches against will be picked. |
||
23 | * The value this key points to has to be a builder function |
||
24 | * that takes as only required argument the id serialization |
||
25 | * (string) and returns an EntityId instance. |
||
26 | * |
||
27 | * @param callable[] $idBuilders |
||
28 | */ |
||
29 | 12 | public function __construct( array $idBuilders ) { |
|
32 | |||
33 | /** |
||
34 | * @param string $idSerialization |
||
35 | * |
||
36 | * @throws EntityIdParsingException |
||
37 | * @return EntityId |
||
38 | */ |
||
39 | 12 | public function parse( $idSerialization ) { |
|
62 | 12 | ||
63 | 12 | /** |
|
64 | 3 | * @param callable $idBuilder |
|
65 | * @param string $idSerialization |
||
66 | 9 | * |
|
67 | * @throws EntityIdParsingException |
||
68 | * @return EntityId |
||
69 | */ |
||
70 | private function buildId( $idBuilder, $idSerialization ) { |
||
78 | |||
79 | } |
||
80 |