Completed
Branch master (7d7b3f)
by Ori
01:38
created

BaseDataStream::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace frictionlessdata\datapackage\DataStreams;
4
5
/**
6
 * Provides a standard interface for streaming from a data stream (Read-only).
7
 *
8
 * functionality could mostly be replaced by php generators (http://php.net/manual/en/language.generators.syntax.php)
9
 * however, they are only supported on PHP 5.5 and above
10
 */
11
abstract class BaseDataStream implements \Iterator
12
{
13
    public $dataSource;
14
    public $dataSourceOptions;
15
16
    /**
17
     * @param string $dataSource
18
     * @param mixed  $dataSourceOptions
19
     *
20
     * @throws \frictionlessdata\datapackage\Exceptions\DataStreamOpenException
21
     */
22
    public function __construct($dataSource, $dataSourceOptions = null)
23
    {
24
        $this->dataSource = $dataSource;
25
        $this->dataSourceOptions = $dataSourceOptions;
26
    }
27
28
    /**
29
     * @return mixed
30
     *
31
     * @throws \frictionlessdata\datapackage\Exceptions\DataStreamValidationException
32
     */
33
    abstract public function current();
34
}
35