Completed
Push — master ( 8db10c...40b1cc )
by Karsten
01:41
created

TakeUntilPredicate   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A apply() 9 9 1

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
 * File was created 06.05.2015 16:25
4
 *
5
 * @author Karsten J. Gerber <[email protected]>
6
 */
7
8
namespace PeekAndPoke\Component\Psi\Operation\Intermediate\Predicate;
9
10
use PeekAndPoke\Component\Psi\Solver\IntermediateContext;
11
12
/**
13
 * @author Karsten J. Gerber <[email protected]>
14
 */
15 View Code Duplication
class TakeUntilPredicate extends AbstractPredicateOperation
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 5
    public function apply($input, $index, IntermediateContext $context)
21
    {
22 5
        $take = ! $this->test($input, $index);
23
24 5
        $context->outUseItem     = $take;
25 5
        $context->outCanContinue = $take;
26
27 5
        return $input;
28
    }
29
}
30