Completed
Push — master ( 9442e1...116254 )
by Tomas
02:50
created

EchoHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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