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

EchoHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 19
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\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