ArrayReader   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 39
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getData() 0 4 1
A getIterator() 0 4 1
A count() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of plumphp/plum.
5
 *
6
 * (c) Florian Eckerstorfer <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Plum\Plum\Reader;
12
13
use ArrayIterator;
14
15
/**
16
 * ArrayReader.
17
 *
18
 * @author    Florian Eckerstorfer <[email protected]>
19
 * @copyright 2014-2016 Florian Eckerstorfer
20
 */
21
class ArrayReader implements ReaderInterface
22
{
23
    /** @var array */
24
    private $data = [];
25
26
    /**
27
     * @param array $data
28
     */
29 1
    public function __construct(array $data)
30
    {
31 1
        $this->data = $data;
32 1
    }
33
34
    /**
35
     * @return array
36
     */
37 1
    public function getData()
38
    {
39 1
        return $this->data;
40
    }
41
42
    /**
43
     * @return ArrayIterator
44
     */
45 1
    public function getIterator()
46
    {
47 1
        return new ArrayIterator($this->data);
48
    }
49
50
    /**
51
     * Returns the number of elements in the array.
52
     *
53
     * @return int
54
     */
55 1
    public function count()
56
    {
57 1
        return count($this->data);
58
    }
59
}
60