TranslationController::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Controller\Scenario\Forms;
4
5
use App\Service\ScenarioService;
6
use Symfony\Component\HttpFoundation\JsonResponse;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpFoundation\JsonResponse was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Component\HttpFoundation\RequestStack;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpFoundation\RequestStack was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
use Symfony\Component\Routing\Annotation\Route;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Routing\Annotation\Route was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
/**
12
 * Class TranslationController
13
 */
14
final class TranslationController
15
{
16
    /**
17
     * @var \App\Service\ScenarioService
18
     */
19
    private $scenarioService;
20
21
    /**
22
     * @var \Symfony\Component\HttpFoundation\RequestStack
23
     */
24
    private $requestStack;
25
26
    /**
27
     * @var string
28
     */
29
    private $locale;
30
31
    /**
32
     * Constructor
33
     *
34
     * @param \App\Service\ScenarioService $scenarioService
35
     * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
36
     */
37
    public function __construct(ScenarioService $scenarioService, RequestStack $requestStack, string $locale)
38
    {
39
        $this->scenarioService = $scenarioService;
40
        $this->requestStack = $requestStack;
41
        $this->locale = $locale;
42
    }
43
44
    /**
45
     * Form
46
     *
47
     * @Route(path="/scenarios/{uuid}/forms/translation", methods={"GET"})
48
     * @param string $uuid
49
     * @return \Symfony\Component\HttpFoundation\JsonResponse
50
     */
51
    public function get($uuid)
0 ignored issues
show
Unused Code introduced by
The parameter $uuid is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

51
    public function get(/** @scrutinizer ignore-unused */ $uuid)

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

Loading history...
52
    {
53
        $request = $this->requestStack->getCurrentRequest();
54
        $locale = $request->query->get('locale', 'en');
55
        $response = new JsonResponse([$locale => 'test']);
56
57
        return $response;
58
    }
59
}
60