Test Failed
Push — master ( 3e2d27...57452d )
by Brent
04:10
created

Site   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 7
lcom 1
cbo 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A addPage() 0 3 1
A rewind() 0 3 1
A current() 0 3 1
A key() 0 3 1
A next() 0 3 1
A valid() 0 3 1
1
<?php
2
3
namespace brendt\stitcher\site;
4
5
use \Iterator;
6
use brendt\stitcher\site\Page;
7
8
class Site implements Iterator {
9
10
    /** @var Page[] */
11
    private $pages;
12
13
    /** @var int */
14
    private $position = 0;
15
16
    public function __construct() {
17
        $this->position = 0;
18
    }
19
20
    public function addPage(Page $page) {
21
        $this->pages[] = $page;
22
    }
23
24
    public function rewind() {
25
        $this->position = 0;
26
    }
27
28
    public function current() {
29
        return $this->pages[$this->position];
30
    }
31
32
    public function key() {
33
        return $this->position;
34
    }
35
36
    public function next() {
37
        ++$this->position;
38
    }
39
40
    public function valid() {
41
        return isset($this->pages[$this->position]);
42
    }
43
    
44
}
45