Total Complexity | 5 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
7 | class FormObjectTransformer extends AbstractSerializerRequestTransformer |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * {@inheritdoc} |
||
12 | */ |
||
13 | public function transform($formData = []): array |
||
14 | { |
||
15 | if (empty($formData)) { |
||
16 | return []; |
||
17 | } |
||
18 | |||
19 | if (is_object($formData)) { |
||
20 | $formData = $this->serializer->toArray( |
||
21 | $formData, |
||
22 | $this->serializationContext |
||
23 | ); |
||
24 | } |
||
25 | |||
26 | return $formData; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Checks if the formData is supported to execute the transformation. |
||
31 | * |
||
32 | * @param array|object $formData |
||
33 | * |
||
34 | * @return bool |
||
35 | */ |
||
36 | public function supports($formData): bool |
||
39 | } |
||
40 | } |
||
41 |