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

BaseDataSource::getNextLine()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 1
1
<?php
2
namespace frictionlessdata\tableschema\DataSources;
3
4
/**
5
 * base data source class with some common functionality
6
 */
7
abstract class BaseDataSource implements DataSourceInterface
8
{
9
    public function __construct($dataSource, $options=null)
10
    {
11
        $this->dataSource = $dataSource;
12
        $this->options = empty($options) ? (object)[] : $options;
13
    }
14
15
    public function open() {
16
17
    }
18
19
    abstract public function getNextLine();
20
    abstract public function isEof();
21
22
    public function close()
23
    {
24
25
    }
26
27
    protected $dataSource;
28
    protected $options;
29
30
    protected function getOption($name, $default=null)
31
    {
32
        if (isset($this->options->{$name})) {
33
            return $this->options->{$name};
34
        } else {
35
            return $default;
36
        }
37
    }
38
}
39