Passed
Push — master ( faf39f...21841e )
by Gerard van
43s
created

ChainTrait::chain()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
/**
3
 * @author Boudewijn Schoon <[email protected]>
4
 * @copyright Zicht Online <http://zicht.nl>
5
 */
6
7
namespace Zicht\Itertools\lib\Traits;
8
9
use Zicht\Itertools as iter;
10
11
trait ChainTrait
12
{
13
    /**
14
     * Returns an iterator that returns elements from the first iterable
15
     * until it is exhausted, then proceeds to the next iterable, until
16
     * all the iterables are exhausted.
17
     *
18
     * Used for creating consecutive sequences as a single sequence.
19
     *
20
     * Note that the keys of the returned ChainIterator follow 0, 1, etc,
21
     * regardless of the keys given in the iterables.
22
     *
23
     * > iter\iterable([1, 2, 3], [4, 5, 6])->chain()
24
     * 1 2 3 4 5 6
25
     *
26
     * > iter\iterable('ABC', 'DEF')->chain()
27
     * A B C D E F
28
     *
29
     * @param array|string|\Iterator $iterable
0 ignored issues
show
Bug introduced by
There is no parameter named $iterable. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
30
     * @param array|string|\Iterator $iterable2
0 ignored issues
show
Bug introduced by
There is no parameter named $iterable2. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
31
     * @return iter\lib\ChainIterator
32
     */
33 2
    public function chain(/* $iterable, $iterable2, ... */)
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
34
    {
35 2
        return call_user_func_array('\Zicht\itertools\chain', array_merge([$this], func_get_args()));
36
    }
37
}
38