Completed
Pull Request — master (#90)
by Arnaud
02:00
created

ListResponder::respond()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 11
nc 2
nop 4
crap 2
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
     * Display the template "list" with an optional filter form.
14
     *
15
     * @param ActionConfiguration $configuration
16
     * @param AdminInterface      $admin
17
     * @param FormInterface       $form
18
     * @param FormInterface       $filterForm
19
     *
20
     * @return Response
21 1
     */
22
    public function respond(
23
        ActionConfiguration $configuration,
24
        AdminInterface $admin,
25
        FormInterface $form,
26
        FormInterface $filterForm = null
27
    ) {
28 1
        $context = [
29 1
            'admin' => $admin->getView(),
30
            'form' => $form->createView(),
31
        ];
32 1
    
33 1
        if (null !== $filterForm) {
34
            $context['filterForm'] = $filterForm->createView();
35
        }
36 1
    
37
        return $this->render($configuration->getParameter('template'), $context);
38
    }
39
}
40