CompositeStage::processStage()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 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