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

OnlyIterator   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 40
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A current() 0 4 1
A next() 0 4 1
A key() 0 4 1
A valid() 0 4 1
A rewind() 0 4 1
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