Reader::current()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Tleckie\Csv;
4
5
use SplFileObject;
6
use Tleckie\Csv\Reader\ReaderInterface;
7
8
/**
9
 * Class Reader
10
 *
11
 * @package Tleckie\Csv
12
 * @author  Teodoro Leckie Westberg <[email protected]>
13
 */
14
class Reader extends CsvAbstract implements ReaderInterface
15
{
16
    /**
17
     * Reader constructor.
18
     *
19
     * @param string $file
20
     * @param string $separator
21
     * @param string $enclosure
22
     * @param string $escape
23
     * @param string $mode
24
     */
25
    public function __construct(
26
        string $file,
27
        string $separator = ',',
28
        string $enclosure = '"',
29
        string $escape = "\\",
30
        string $mode = "r"
31
    ) {
32
        parent::__construct($file, $separator, $enclosure, $escape, $mode);
33
34
        $this->setFlags(
35
            SplFileObject::READ_CSV |
36
            SplFileObject::READ_AHEAD |
37
            SplFileObject::SKIP_EMPTY |
38
            SplFileObject::DROP_NEW_LINE
39
        );
40
    }
41
42
    /**
43
     * @return RowInterface
44
     */
45
    public function current(): RowInterface
46
    {
47
        return new Row(parent::current());
48
    }
49
}
50