1 | <?php |
||
12 | trait Factory |
||
13 | { |
||
14 | /** |
||
15 | * @var IdFactory Fallback factory |
||
16 | */ |
||
17 | private $factory; |
||
18 | |||
19 | /** |
||
20 | * Set factory used if this factory fails |
||
21 | */ |
||
22 | 5 | public function __construct(IdFactory $factory = null) |
|
26 | |||
27 | /** |
||
28 | * Create ID object from raw id string |
||
29 | * |
||
30 | * @param string $raw Raw id string |
||
31 | * @return IdInterface |
||
32 | */ |
||
33 | 5 | public function createId($raw) |
|
41 | |||
42 | /** |
||
43 | * Instantiate ID object |
||
44 | * |
||
45 | * @param string $raw Raw id string |
||
46 | * @return IdInterface |
||
47 | */ |
||
48 | abstract protected function createNewInstance($raw); |
||
49 | } |
||
50 |