Completed
Push — master ( fba866...b10a48 )
by Ori
03:03
created

NativeDataSource   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getNextLine() 0 4 1
A isEof() 0 4 1
1
<?php
2
namespace frictionlessdata\tableschema\DataSources;
3
4
use frictionlessdata\tableschema\Exceptions\DataSourceException;
5
6
/**
7
 * the data source parameter provided to the constructor should be an array of values
8
 * those values are then returned on each iteration
9
 */
10
class NativeDataSource extends BaseDataSource
11
{
12
    /**
13
     * @return array
14
     * @throws DataSourceException
15
     */
16
    public function getNextLine()
17
    {
18
        return $this->dataSource[$this->curRowNum++];
19
    }
20
21
    /**
22
     * @return bool
23
     * @throws DataSourceException
24
     */
25
    public function isEof()
26
    {
27
        return ($this->curRowNum >= count($this->dataSource));
28
    }
29
30
    protected $curRowNum = 0;
31
}
32