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

Complexity

Total Complexity 11

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 0
dl 0
loc 58
ccs 25
cts 25
cp 1
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setInnerIterator() 0 4 2
A getInnerIterator() 0 4 1
A valid() 0 4 1
A key() 0 4 1
A current() 0 4 1
A rewind() 0 5 1
A next() 0 5 1
A getIndex() 0 4 1
A __call() 0 4 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