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.

ReplaceableIterator::current()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Gielfeldt\Iterators;
4
5
class ReplaceableIterator implements \Iterator, \OuterIterator
6
{
7
    private $index;
8
    private $iterator;
9
10 5
    public function __construct(\Traversable $iterator = null)
11
    {
12 5
        $iterator = $iterator ?? new \EmptyIterator();
13 5
        $this->setInnerIterator($iterator);
14 5
    }
15
16 5
    public function setInnerIterator(\Traversable $iterator)
17
    {
18 5
        $this->iterator = $iterator instanceof \Iterator ? $iterator : new \IteratorIterator($iterator);
19 5
    }
20
21 5
    public function getInnerIterator()
22
    {
23 5
        return $this->iterator;
24
    }
25
26 5
    public function valid()
27
    {
28 5
        return $this->getInnerIterator()->valid();
29
    }
30
31 5
    public function key()
32
    {
33 5
        return $this->getInnerIterator()->key();
34
    }
35
36 5
    public function current()
37
    {
38 5
        return $this->getInnerIterator()->current();
39
    }
40
41 5
    public function rewind()
42
    {
43 5
        $this->index = 0;
44 5
        return $this->getInnerIterator()->rewind();
45
    }
46
47 5
    public function next()
48
    {
49 5
        $this->index++;
50 5
        return $this->getInnerIterator()->next();
51
    }
52
53 1
    public function getIndex()
54
    {
55 1
        return $this->index;
56
    }
57
58 2
    public function __call($method, $arguments)
59
    {
60 2
        return call_user_func_array([$this->getInnerIterator(), $method], $arguments);
61
    }
62
}
63