Completed
Push — master ( 753c96...c3156c )
by Sébastien
01:47
created

PipeProcessor::clearCache()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
eloc 0
nc 1
nop 0
1
<?php
2
3
namespace Bdf\Pipeline\Processor;
4
5
use Bdf\Pipeline\ProcessorInterface;
6
7
/**
8
 * PipeProcessor
9
 *
10
 * @author Sébastien Tanneux
11
 */
12
class PipeProcessor implements ProcessorInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function process(array $pipes, array $payload, callable $outlet = null)
18
    {
19
        $payload = $payload[0] ?? null;
20
21
        foreach ($pipes as $pipe) {
22
            $payload = $pipe($payload);
23
        }
24
25
        if ($outlet !== null) {
26
            return $outlet($payload);
27
        }
28
29
        return $payload;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function clearCache()
36
    {
37
38
    }
39
}
40