SimpleTraversable::key()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 1
nc 1
nop 0
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