Passed
Push — master ( 7bba5d...c1c3fd )
by Fabrice
02:35
created

LineExtractor::getTraversable()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 3
eloc 6
nc 3
nop 1
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)
23
    {
24
        if (!$this->extract($param)) {
25
            return;
26
        }
27
28
        while (false !== ($line = fgets($this->handle))) {
29
            yield $line;
30
        }
31
32
        $this->releaseHandle();
33
    }
34
}
35