Completed
Push — master ( e0250b...fc23d8 )
by Tomas
02:44
created

EchoHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 3
dl 0
loc 22
ccs 7
cts 7
cp 1
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 9
    public function params()
14
    {
15
        return [
16 9
            new InputParam(InputParam::TYPE_GET, 'status', InputParam::REQUIRED, ['ok', 'error']),
17 9
            new InputParam(InputParam::TYPE_GET, 'message'),
18 9
        ];
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 3
    public function handle($params)
25
    {
26 3
        $status = $params['status'];
27 3
        return new JsonApiResponse(200, ['status' => $status, 'params' => $params]);
28
    }
29
}
30