1 | <?php declare(strict_types=1); |
||
8 | class Factory |
||
9 | { |
||
10 | const ANNOTATIONS = [ |
||
11 | Annotations\Collection::class => Annotations\Handler\CollectionHandler::class, |
||
12 | Annotations\Nested::class => Annotations\Handler\NestedHandler::class, |
||
13 | Annotations\Rename::class => Annotations\Handler\RenameHandler::class, |
||
14 | ]; |
||
15 | |||
16 | 7 | public static function create(ContainerInterface $container, array $options = []): Hydrator |
|
17 | { |
||
18 | 7 | $options[Options::ANNOTATIONS] = static::annotations($options[Options::ANNOTATIONS] ?? []); |
|
19 | |||
20 | 7 | $hydrator = new Hydrator($container, $options); |
|
21 | |||
22 | self::preheat($hydrator, $options); |
||
23 | |||
24 | return $hydrator; |
||
25 | } |
||
26 | |||
27 | 7 | protected static function annotations(array $annotations): array |
|
39 | |||
40 | protected static function preheat(Hydrator $hydrator, array $options) |
||
50 | } |
||
51 |