ArrayReader::getFields()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
ccs 3
cts 4
cp 0.75
cc 2
eloc 4
nc 2
nop 0
crap 2.0625
1
<?php
2
3
namespace Ddeboer\DataImport\Reader;
4
5
/**
6
 * Reads an array
7
 *
8
 * @author David de Boer <[email protected]>
9
 */
10
class ArrayReader extends \ArrayIterator implements CountableReader
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 1
    public function getFields()
16
    {
17
        // Examine first row
18 1
        if ($this->count() > 0) {
19 1
            return array_keys($this[0]);
20
        }
21
22
        return [];
23
    }
24
}
25