File: CsvLineGenerator.php Lines 3 to 22
3
4class CsvLineGenerator
5{
6    /**
7     * CSVを1行ずつ返すgenerator
8     * @param string $fullpath
9     * @return \Generator
10     */
11    public static function eachLine($fullpath) {
Type Class Description
pmd ShortVariable Avoid variables with short names like $fp. Configured minimum length is 3.
12
Type Class Description
pmd ShortVariable Avoid variables with short names like $fp. Configured minimum length is 3.
        $fp = @fopen($fullpath, 'rb');
13        if($fp === false) {
14            throw new \RuntimeException("cannot open stream: $fullpath");
15        }
16        try {
17            while (false !== $line = fgetcsv($fp)) {
18                yield $line;
19            }
20        } finally {
21            fclose($fp);
22        }