Total Complexity | 4 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | final class FormDataTransformer extends AbstractDataTransformer |
||
9 | { |
||
10 | /** |
||
11 | * @param Form $object |
||
12 | */ |
||
13 | public function transform($object, array $context = []): Form |
||
14 | { |
||
15 | /** @var FormViewFactory $factory */ |
||
16 | $factory = $this->container->get(FormViewFactory::class); |
||
17 | $object->setForm($factory->create($object)); |
||
18 | return $object; |
||
19 | } |
||
20 | |||
21 | public function supportsTransformation($data, array $context = []): bool |
||
22 | { |
||
23 | return $data instanceof Form && !$data->getForm(); |
||
24 | } |
||
25 | |||
26 | public static function getSubscribedServices(): array |
||
30 | ]; |
||
31 | } |
||
32 | } |
||
33 |