ToAll::flow()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * This file is part of graze/data-flow
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/data-flow/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/data-flow
12
 */
13
14
namespace Graze\DataFlow\Flow\Runner;
15
16
use Graze\DataFile\Helper\OptionalLoggerTrait;
17
use Graze\DataFlow\Flow\FlowCollection;
18
use Graze\DataFlow\Flow\InvokeTrait;
19
use Graze\DataFlow\FlowInterface;
20
use Graze\DataNode\NodeCollection;
21
use Graze\DataNode\NodeInterface;
22
use Psr\Log\LoggerAwareInterface;
23
24
/**
25
 * Runs through a set of flows but providing the initial node to all flows and return th
26
 */
27
class ToAll extends FlowCollection implements FlowInterface, LoggerAwareInterface
28
{
29
    use InvokeTrait;
30
    use OptionalLoggerTrait;
31
32
    /**
33
     * @inheritdoc
34
     */
35 3
    public function flow(NodeInterface $node)
36
    {
37 3
        $collection = new NodeCollection();
38 3
        foreach ($this->items as $flow) {
39 3
            $collection->add($flow->flow($node));
40 3
        }
41 3
        return $collection;
42
    }
43
}
44