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

EchoHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 57.14%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 2
dl 0
loc 22
ccs 4
cts 7
cp 0.5714
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A params() 0 7 1
A handle() 0 5 1
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