Completed
Push — master ( f60e47...74fc93 )
by Sandro
02:28
created

OnlyIterator::rewind()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Sandro Keil (https://sandro-keil.de)
4
 *
5
 * @link      http://github.com/sandrokeil/interop-config for the canonical source repository
6
 * @copyright Copyright (c) 2015-2016 Sandro Keil
7
 * @license   http://github.com/sandrokeil/interop-config/blob/master/LICENSE.md New BSD License
8
 */
9
10
namespace InteropTest\Config\TestAsset;
11
12
13
class OnlyIterator implements \Iterator
14
{
15
    /**
16
     * data
17
     *
18
     * @var array
19
     */
20
    private $data;
21
22
    public function __construct(array $data)
23
    {
24
        $this->data = $data;
25
    }
26
27
    public function current()
28
    {
29
        return current($this->data);
30
    }
31
32
    public function next()
33
    {
34
        next($this->data);
35
    }
36
37
    public function key()
38
    {
39
        return key($this->data);
40
    }
41
42
    public function valid()
43
    {
44
        return current($this->data);
45
    }
46
47
    public function rewind()
48
    {
49
        reset($this->data);
50
    }
51
52
}
53