Completed
Push — master ( fcda7e...e0250b )
by Tomas
02:45
created

EchoHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Tomaj\NetteApi\Handlers;
4
5
use Tomaj\NetteApi\Params\InputParam;
6
use Tomaj\NetteApi\Response\JsonApiResponse;
7
8
class EchoHandler extends BaseHandler
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13 6
    public function params()
14
    {
15
        return [
16 6
            new InputParam(InputParam::TYPE_GET, 'status', InputParam::REQUIRED, ['ok', 'error']),
17 6
            new InputParam(InputParam::TYPE_GET, 'message'),
18 6
        ];
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function handle($params)
25
    {
26
        $status = $params['status'];
27
        return new JsonApiResponse(200, ['status' => $status, 'params' => $params]);
28
    }
29
}
30