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.

SkipIterator::accept()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 10
rs 9.4286
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
namespace Pipes\Iterator;
4
5
use Traversable;
6
7
class SkipIterator extends \FilterIterator
8
{
9
    /**
10
     * @var int number of elements to skip
11
     */
12
    protected $num;
13
    protected $skipped = 0;
14
15
    public function __construct(Traversable $iterator, $num)
16
    {
17
        parent::__construct($iterator);
18
        $this->num = $num;
19
    }
20
21
    /**
22
     * Check whether the current element of the iterator is acceptable.
23
     *
24
     * @link http://php.net/manual/en/filteriterator.accept.php
25
     *
26
     * @return bool true if the current element is acceptable, otherwise false.
27
     */
28
    public function accept()
29
    {
30
        if ($this->skipped >= $this->num) {
31
            return true;
32
        }
33
34
        ++$this->skipped;
35
36
        return false;
37
    }
38
39
    public function rewind()
40
    {
41
        $this->skipped = 0;
42
        parent::rewind();
43
    }
44
}
45