Completed
Pull Request — master (#90)
by Arnaud
03:11
created

ListResponder::respond()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 17
ccs 0
cts 6
cp 0
rs 9.4285
cc 2
eloc 11
nc 2
nop 4
crap 6
1
<?php
2
3
namespace LAG\AdminBundle\Action\Responder;
4
5
use LAG\AdminBundle\Action\Configuration\ActionConfiguration;
6
use LAG\AdminBundle\Admin\AdminInterface;
7
use Symfony\Component\Form\FormInterface;
8
use Symfony\Component\HttpFoundation\Response;
9
10
class ListResponder extends AbstractResponder
11
{
12
    /**
13
     * @param ActionConfiguration $configuration
14
     * @param AdminInterface      $admin
15
     * @param FormInterface       $form
16
     * @param FormInterface       $filterForm
17
     *
18
     * @return Response
19
     *
20
     */
21
    public function respond(
22
        ActionConfiguration $configuration,
23
        AdminInterface $admin,
24
        FormInterface $form,
25
        FormInterface $filterForm = null
26
    ) {
27
        $context = [
28
            'admin' => $admin,
29
            'form' => $form->createView(),
30
        ];
31
    
32
        if (null !== $filterForm) {
33
            $context['filterForm'] = $filterForm->createView();
34
        }
35
    
36
        return $this->render($configuration->getParameter('template'), $context);
37
    }
38
}
39