Total Complexity | 5 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
25 | class FormViewFactory |
||
26 | { |
||
27 | private FormFactoryInterface $formFactory; |
||
28 | private IriConverterInterface $iriConverter; |
||
29 | private UrlHelper $urlHelper; |
||
30 | |||
31 | public function __construct(FormFactoryInterface $formFactory, IriConverterInterface $iriConverter, UrlHelper $urlHelper) |
||
36 | } |
||
37 | |||
38 | public function create(Form $form): FormView |
||
39 | { |
||
40 | $builder = $this->formFactory->createBuilder($form->formType); |
||
41 | |||
42 | if (!($currentAction = $builder->getAction()) || '' === $currentAction) { |
||
43 | $builder->setAction($this->getFormAction($form)); |
||
44 | } |
||
45 | |||
46 | return new FormView($builder->getForm()); |
||
47 | } |
||
48 | |||
49 | private function getFormAction(Form $form): string |
||
52 | } |
||
53 | } |
||
54 |