Overtrue\Pinyin\GeneratorFileDictLoader::getGenerator PHP Method

getGenerator() protected method

get Generator syntax.
protected getGenerator ( array $handles )
$handles array SplFileObjects
    protected function getGenerator(array $handles)
    {
        foreach ($handles as $handle) {
            $handle->seek(0);
            while ($handle->eof() === false) {
                $string = str_replace(['\'', ' ', PHP_EOL, ','], '', $handle->fgets());
                if (strpos($string, '=>') === false) {
                    continue;
                }
                list($string, $pinyin) = explode('=>', $string);
                (yield $string => $pinyin);
            }
        }
    }