Passed
Push — develop ( b729b4...acdfb2 )
by nguereza
42:48
created

MyRequestHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace Platine\Framework;
10
11
use Platine\Framework\Http\RequestData;
12
use Platine\Http\Handler\RequestHandlerInterface;
13
use Platine\Http\Response;
14
use Platine\Http\ResponseInterface;
15
use Platine\Http\ServerRequestInterface;
16
17
/**
18
 * Description of MyRequestHandler
19
 *
20
 * @author tony
21
 */
22
class MyRequestHandler implements RequestHandlerInterface
23
{
24
25
    public function handle(ServerRequestInterface $request): ResponseInterface
26
    {
27
        $param = new RequestData($request);
28
29
        $name = $param->post('name', 'Tony');
30
        $resp = new Response(200);
31
        $resp->getBody()->write("Hello ${name}");
32
33
        return $resp->withHeader('Framework', 'Platine PHP');
34
    }
35
}
36