TestController::indexAction()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Behat\Sf2DemoBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
use Symfony\Component\HttpFoundation\Request;
7
use Symfony\Component\HttpFoundation\Response;
8
9
class TestController extends Controller
10
{
11
    public function indexAction(Request $request)
12
    {
13
        $type = $request->get('type') ?: 'stranger';
14
15
        return new Response(<<<RESPONSE
16
<html>
17
    <body>
18
        <h1>Hello, {$type}</h1>
19
20
        You are?:
21
        <a href="?type=human">Human</a>
22
        <a href="?type=orc">Orc</a>
23
        <a href="?type=elf">Elf</a>
24
    </body>
25
</html>
26
RESPONSE
27
        );
28
    }
29
}
30