GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Pipe::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 2
Metric Value
c 3
b 0
f 2
dl 0
loc 12
rs 9.2
cc 4
eloc 7
nc 8
nop 1
1
<?php
2
3
namespace Pipes;
4
5
use IteratorAggregate;
6
use Pipes\Iterator\PlainArrayIterator;
7
8
class Pipe implements IteratorAggregate
9
{
10
    use PipenessTrait;
11
12
    protected $var;
13
14
    public function __construct(&$var = null)
15
    {
16
        if (is_array($var)) {
17
            $this->var = new PlainArrayIterator($var);
18
        }
19
        if ($var instanceof \Traversable) {
20
            $this->var = $var;
21
        }
22
        if (!func_num_args()) {
23
            $this->var = [];
24
        }
25
    }
26
27
    /**
28
     * This method is implemented just because it's required by the
29
     * \IteratorAggregate interface.
30
     *
31
     * Returns an instance of the last array/Traversable of the chain
32
     * Don't use this method: it won't return a Pipe instance:
33
     * no more chaining magic.
34
     * It may very well be a plain array.
35
     *
36
     * If you need an iterator, use toIterator() instead.
37
     *
38
     * @return array|\Traversable
39
     */
40
    public function getIterator()
41
    {
42
        return $this->var;
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->var; of type Traversable|array adds the type array to the return on line 42 which is incompatible with the return type declared by the interface IteratorAggregate::getIterator of type Traversable.
Loading history...
43
    }
44
}
45