Test Failed
Push — master ( a58c94...1bcec0 )
by Brent
03:26
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
7
class Site implements Iterator {
8
9
    /** @var Page[] */
10
    private $pages;
11
12
    /** @var int */
13
    private $position = 0;
14
15
    public function __construct() {
16
        $this->position = 0;
17
    }
18
19
    public function addPage(Page $page) {
20
        $this->pages[] = $page;
21
    }
22
23
    public function rewind() {
24
        $this->position = 0;
25
    }
26
27
    public function current() {
28
        return $this->pages[$this->position];
29
    }
30
31
    public function key() {
32
        return $this->position;
33
    }
34
35
    public function next() {
36
        ++$this->position;
37
    }
38
39
    public function valid() {
40
        return isset($this->pages[$this->position]);
41
    }
42
    
43
}
44