DifferenceTrait::difference()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 12
loc 12
ccs 7
cts 7
cp 1
crap 2
rs 9.8666
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Zicht Online <http://zicht.nl>
4
 */
5
6
namespace Zicht\Itertools\lib\Traits;
7
8
use Zicht\Itertools\conversions;
9
use Zicht\Itertools\lib\DifferenceIterator;
10
11 View Code Duplication
trait DifferenceTrait
0 ignored issues
show
Duplication introduced by
This class 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...
12
{
13
    /**
14
     * Returns a DifferenceIterator containing elements in $this but not in $iterable
15
     *
16
     * @param array|string|\Iterator $iterable
17
     * @param null|string|\Closure $strategy Optional
18
     * @return null|DifferenceIterator
19
     */
20 8
    public function difference($iterable, $strategy = null)
21
    {
22 8
        if ($this instanceof \Iterator) {
23 7
            return new DifferenceIterator(
24 7
                $this,
25 7
                conversions\mixed_to_iterator($iterable),
0 ignored issues
show
Deprecated Code introduced by
The function Zicht\Itertools\conversions\mixed_to_iterator() has been deprecated with message: Use \Zicht\Itertools\util\Conversions::mixedToIterator, will be removed in version 3.0

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
26 7
                conversions\mixed_to_value_getter($strategy)
0 ignored issues
show
Deprecated Code introduced by
The function Zicht\Itertools\conversi...mixed_to_value_getter() has been deprecated with message: Use \Zicht\Itertools\util\Conversions::mixedToClosure, will be removed in version 3.0

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
27
            );
28
        }
29
30 1
        return null;
31
    }
32
}
33