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   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 18
Bugs 2 Features 9
Metric Value
wmc 5
c 18
b 2
f 9
lcom 0
cbo 2
dl 0
loc 37
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 4
A getIterator() 0 4 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