SimpleTraversable   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
dl 0
loc 28
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A valid() 0 3 1
A rewind() 0 3 1
A current() 0 3 1
A next() 0 3 1
A key() 0 3 1
1
<?php
2
namespace HakimCh\Http\Tests;
3
4
use Iterator;
5
6
class SimpleTraversable implements Iterator
7
{
8
    protected $position = 0;
9
10
    protected $data = array(
11
        array('GET', '/foo', 'foo_action', null),
12
        array('POST', '/bar', 'bar_action', 'second_route')
13
    );
14
15
    public function current()
16
    {
17
        return $this->data[$this->position];
18
    }
19
    public function key()
20
    {
21
        return $this->position;
22
    }
23
    public function next()
24
    {
25
        ++$this->position;
26
    }
27
    public function rewind()
28
    {
29
        $this->position = 0;
30
    }
31
    public function valid()
32
    {
33
        return isset($this->data[$this->position]);
34
    }
35
}
36