Completed
Push — master ( 493bbf...db23dc )
by Dmitry
13:54
created

EndpointProviderTrait::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
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 run(string $className): \Closure
10
    {
11
        return static 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
            return \Yii::$container->get($className)->__invoke($input);
13
        };
14
    }
15
16
    // TODO: move to internal project
17
    protected function checkSelf(): Closure
18
    {
19
        return static function ($command, $next) {
20
            return $next($command);
21
        };
22
    }
23
24
    protected function input(array $inputOptions): array
25
    {
26
        // TODO: Take Tafid's Pact PR
27
        return $inputOptions;
28
    }
29
    protected function output(array $inputOptions): array
30
    {
31
        // TODO: Take Tafid's Pact PR
32
        return $inputOptions;
33
    }
34
}
35