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.

ArrayPoppingGenerator::resume()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 4
cts 4
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
/*
3
 * Copyright 2016 - 2017 Eric D. Hough (https://github.com/ehough)
4
 *
5
 * This file is part of ehough/generators (https://github.com/ehough/generators)
6
 *
7
 * This Source Code Form is subject to the terms of the Mozilla Public
8
 * License, v. 2.0. If a copy of the MPL was not distributed with this
9
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
 */
11
12
namespace Hough\Generators;
13
14
class ArrayPoppingGenerator extends AbstractGenerator
15
{
16
    /**
17
     * @var array
18
     */
19
    private $_array;
20
21 1
    public function __construct(array &$incoming)
22
    {
23 1
        $this->_array = &$incoming;
24 1
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29 1
    public function resume($position)
30
    {
31 1
        if (count($this->_array) === 0) {
32
33 1
            return null;
34
        }
35
36 1
        return array(array_pop($this->_array));
37
    }
38
}
39