Passed
Push — master ( e8b80d...3e47ad )
by Mike
04:17 queued 37s
created

IndexController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 27
ccs 5
cts 11
cp 0.4545
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 6 2
A nameAction() 0 8 1
1
<?php
2
3
4
namespace App\Application\Business\Controller;
5
6
7
use Symfony\Component\HttpFoundation\Request;
8
use Symfony\Component\HttpFoundation\Response;
9
use Xervice\Controller\Business\Controller\AbstractController;
10
use Xervice\Core\Factory\FactoryInterface;
11
12
/**
13
 * @method \App\Application\ApplicationFactory getFactory()
14
 */
15
class IndexController extends AbstractController
16
{
17 1
    public function indexAction(): Response
18
    {
19 1
        return $this->sendResponse(
20 1
            sprintf(
21 1
                'Hello World %s',
22 1
                $this->getFactory()->getSessionClient()->get('name') ?: 'undefined'
23
            )
24
        );
25
    }
26
27
    /**
28
     * @param \Symfony\Component\HttpFoundation\Request $request
29
     * @param string $name
30
     *
31
     * @return \Symfony\Component\HttpFoundation\Response
32
     * @throws \Core\Locator\Dynamic\ServiceNotParseable
33
     */
34
    public function nameAction(Request $request, string $name): Response
0 ignored issues
show
Unused Code introduced by
The parameter $request 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

34
    public function nameAction(/** @scrutinizer ignore-unused */ Request $request, string $name): Response

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...
35
    {
36
        $this->getFactory()->getSessionClient()->set('name', $name);
37
38
        return $this->sendResponse(
39
            sprintf(
40
                'Set name %s',
41
                $name
42
            )
43
        );
44
    }
45
}