ListController::listAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
ccs 0
cts 0
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\TranslationsBundle\Controller;
13
14
use ONGR\FilterManagerBundle\Search\SearchResponse;
15
use ONGR\TranslationsBundle\Service\TranslationManager;
16
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
17
use Symfony\Component\HttpFoundation\JsonResponse;
18
use Symfony\Component\HttpFoundation\Request;
19
use Symfony\Component\HttpFoundation\Response;
20
21
/**
22
 * Controller used for displaying translations.
23
 */
24
class ListController extends Controller
25
{
26
    /**
27
     * @param Request $request
28
     * @return JsonResponse
29
     */
30
    public function listAction(Request $request)
31
    {
32
        /** @var SearchResponse $filterResponse */
33
        $filterResponse = $this->get('ongr_translations.filter_manager')->handleRequest($request);
34
35
        return new JsonResponse(iterator_to_array($filterResponse->getResult()));
36
    }
37
38
    /**
39
     * Renders view with filter manager response.
40
     *
41
     * @param Request $request Request.
42
     *
43
     * @return Response
44
     */
45
    public function indexAction(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
46
    {
47
        /** @var TranslationManager $manager */
48
        $manager = $this->get('ongr_translations.translation_manager');
49
50
        return $this->render(
51
            'ONGRTranslationsBundle:List:list.html.twig',
52
            [
53
                'locales' => $this->getParameter('ongr_translations.locales'),
54
                'tags' => $manager->getTags(),
55
                'domains' => $manager->getDomains(),
56
            ]
57
        );
58
    }
59
}
60