Completed
Push — master ( eb04a4...cf4b83 )
by Dmitry
11:42
created

MiddlewareBuilderTrait::buildMiddlewares()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
4
namespace hiapi\endpoints\Module\Middleware;
5
6
use hiapi\endpoints\EndpointConfigurationInterface;
7
8
/**
9
 * Trait MiddlewareBuilderTrait
10
 *
11
 * @author Dmytro Naumenko <[email protected]>
12
 */
13
trait MiddlewareBuilderTrait
14
{
15
    /**
16
     * @psalm-var list<string|Closure>
17
     */
18
    protected $pipe = [];
19
20
    public function pipe(...$middlewares)
21
    {
22
        $this->pipe = $middlewares;
23
24
        return $this;
25
    }
26
27
    protected function buildMiddlewares(EndpointConfigurationInterface $configuration)
28
    {
29
        $configuration->set('middlewares', $this->pipe);
30
    }
31
}
32