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.

DOMList::next()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace BetterDOMDocument;
2
3
// A BetterDOMNodeList object, which is very similar to a DOMNodeList, but it iterates in a reasonable way.
4
// Specifically, replacing or removing a node in the list won't screw up the index.
5
class DOMList implements \Countable, \Iterator {
6
  
7
  private $array = array();
8
  private $position = 0;
9
  
10
  private $length = 0;
11
  private $dom;
12
  
13 18
  public function __construct(\DOMNodeList $DOMNodeList, DOMDoc $dom) {
14 18
    foreach ($DOMNodeList as $item) {
15 18
      $this->array[] = $item;
16
    }
17
    
18 18
    $this->dom = $dom;
19 18
    $this->length = count($this->array);
20 18
    $this->position = 0;
21 18
  }
22
  
23
  // Provides read-only access to $length and $dom
24
  public function __get ($prop) {
25
    if ($prop == 'length') {
26
      return $this->length;
27
    }
28
    else if ($prop == 'dom') {
29
      return $this->dom;
30
    }
31
    else {
32
      return null;
33
    }
34
  }
35
36 1
  public function rewind() {
37 1
    $this->position = 0;
38 1
  }
39
40 1
  public function current() {
41 1
    return $this->array[$this->position];
42
  }
43
44
  public function key() {
45
    return $this->position;
46
  }
47
48 1
  public function next() {
49 1
    ++$this->position;
50 1
  }
51
52 1
  public function valid() {
53 1
    return isset($this->array[$this->position]);
54
  }
55
  
56 17
  public function item($index) {
57 17
    if (isset($this->array[$index])) {
58 17
      return $this->array[$index];
59
    }
60
    else return FALSE;
61
  }
62
  
63 18
  public function count() {
64 18
    return count($this->array);
65
  }
66
}