CompositeStage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 32
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A processStage() 0 9 2
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015-2017, Efimov Evgenij <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
namespace AsyncSockets\RequestExecutor\Pipeline;
11
12
/**
13
 * Class CompositeStage
14
 */
15
class CompositeStage implements PipelineStageInterface
16
{
17
    /**
18
     * Stages
19
     *
20
     * @var PipelineStageInterface[]
21
     */
22
    private $stages;
23
24
    /**
25
     * CompositeStage constructor.
26
     *
27
     * @param PipelineStageInterface[] $stages Stages to process by this composite
28
     */
29 134
    public function __construct(array $stages)
30
    {
31 134
        $this->stages = $stages;
32 134
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37 82
    public function processStage(array $requestDescriptors)
38
    {
39 82
        $result = $requestDescriptors;
40 82
        foreach ($this->stages as $stage) {
41 82
            $result = $stage->processStage($result);
42 74
        }
43
44 74
        return $result;
45
    }
46
}
47