Completed
Push — master ( 3830bc...2c9d17 )
by Samuel
02:31
created

BaseHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 30
ccs 5
cts 5
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
__invoke() 0 1 ?
A setValidatedValues() 0 4 1
A validate() 0 4 1
1
<?php
2
3
namespace Kelemen\ApiNette\Handler;
4
5
use Nette\Application\IResponse;
6
use Nette\Http\Request;
7
use Nette\Http\Response;
8
9
abstract class BaseHandler
10
{
11
    /** @var array      Values validated by validator. Doesn't contains all input values! */
12
    protected $values;
13
14
    /**
15
     * @param array $values
16
     */
17 4
    public function setValidatedValues(array $values)
18
    {
19 4
        $this->values = $values;
20 4
    }
21
22
    /**
23
     * Validate input
24
     * @return array
25
     */
26 4
    public function validate()
27
    {
28 4
        return [];
29
    }
30
31
    /**
32
     * @param Request $request
33
     * @param Response $response
34
     * @param callable $next
35
     * @return IResponse
36
     */
37
    abstract public function __invoke(Request $request, Response $response, callable $next);
38
}
39