Passed
Push — master ( bf91e1...52cffa )
by Fabrice
02:32
created

LineExtractor::getTraversable()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 6
nc 4
nop 1
dl 0
loc 13
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of YaEtl.
5
 *     (c) Fabrice de Stefanis / https://github.com/fab2s/YaEtl
6
 * This source file is licensed under the MIT license which you will
7
 * find in the LICENSE file or at https://opensource.org/licenses/MIT
8
 */
9
10
namespace fab2s\YaEtl\Extractors\File;
11
12
/**
13
 * Class LineExtractor
14
 */
15
class LineExtractor extends FileExtractorAbstract
16
{
17
    /**
18
     * @param mixed $param
19
     *
20
     * @return \Generator
21
     */
22
    public function getTraversable($param = null)
23
    {
24
        while ($this->extract($param)) {
25
            if (!$this->readBom()) {
26
                return;
27
            }
28
29
            while (false !== ($line = $this->getNextNonEmptyLine())) {
30
                yield $line;
31
            }
32
        }
33
34
        $this->releaseHandle();
35
    }
36
}
37