Completed
Push — master ( db23dc...cb2e11 )
by Dmitry
14:06
created

EndpointProviderTrait::call()   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
use Guzzle\Common\Collection;
7
8
trait EndpointProviderTrait
9
{
10
    protected function call(string $className): \Closure
11
    {
12
        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...
13
            return \Yii::$container->get($className)->__invoke($input);
14
        };
15
    }
16
17
    protected function collectionOf(string $className): \Closure
18
    {
19
        return Collection::of($className);
20
    }
21
22
    // TODO: move to internal project
23
    protected function checkSelf(): Closure
24
    {
25
        return static function ($command, $next) {
26
            return $next($command);
27
        };
28
    }
29
30
    protected function input(array $inputOptions): array
31
    {
32
        // TODO: Take Tafid's Pact PR
33
        return $inputOptions;
34
    }
35
    protected function output(array $inputOptions): array
36
    {
37
        // TODO: Take Tafid's Pact PR
38
        return $inputOptions;
39
    }
40
}
41