Completed
Push — master ( cf4b83...aa9c97 )
by Dmitry
15:01 queued 19s
created

EndpointProviderTrait::handler()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace hiapi\endpoints;
4
5
use Closure;
6
7
trait EndpointProviderTrait
8
{
9
    protected function handler(string $className): \Closure
10
    {
11
        return function ($input, callable $next) use ($className) {
0 ignored issues
show
Unused Code introduced by
The parameter $next is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
            // TODO: separate class
13
            xdebug_break();
14
            return \Yii::$container->get($className)->__invoke($input);
15
        };
16
    }
17
18
    // TODO: move to internal project
19
    protected function checkSelf(): Closure
20
    {
21
        return static function ($command, $next) {
22
            return $next($command);
23
        };
24
    }
25
26
    protected function input(array $inputOptions): array
27
    {
28
        // TODO: Take Tafid's Pact PR
29
        return $inputOptions;
30
    }
31
    protected function output(array $inputOptions): array
32
    {
33
        // TODO: Take Tafid's Pact PR
34
        return $inputOptions;
35
    }
36
}
37