Run   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 52.63 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 4
dl 10
loc 19
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A flow() 10 10 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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\NodeInterface;
21
use Psr\Log\LoggerAwareInterface;
22
use Psr\Log\LogLevel;
23
24
class Run extends FlowCollection implements FlowInterface, LoggerAwareInterface
25
{
26
    use InvokeTrait;
27
    use OptionalLoggerTrait;
28
29
    /**
30
     * @inheritdoc
31
     */
32 3 View Code Duplication
    public function flow(NodeInterface $node)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34 3
        $this->log(LogLevel::NOTICE, "Running through {count} flows", ['count' => count($this->items)]);
35
36 3
        $current = $node;
37 3
        foreach ($this->items as $flow) {
38 3
            $current = $flow->flow($current);
39 3
        }
40 3
        return $current;
41
    }
42
}
43