KeyPipeline   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 18
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A pipe() 0 12 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/pipeline/blob/master/LICENSE.md
6
 * @link       https://github.com/flipbox/pipeline
7
 */
8
9
namespace Flipbox\Pipeline\Pipelines;
10
11
/**
12
 * Supports the ability to define a pipe with an associated key.  This allows pipes to be overwritten and
13
 * handled by the processor in unique ways.
14
 *
15
 * @author Flipbox Digital <[email protected]>
16
 * @since 1.0.0
17
 */
18
class KeyPipeline extends Pipeline
19
{
20
    /**
21
     * @inheritdoc
22
     */
23
    public function pipe(callable $stage, $key = null)
24
    {
25
        $pipeline = clone $this;
26
27
        if ($key === null) {
28
            $pipeline->stages[] = $stage;
29
        } else {
30
            $pipeline->stages[$key] = $stage;
31
        }
32
33
        return $pipeline;
34
    }
35
}
36