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

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A resume() 0 9 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