protected function getLineCount($path)
    {
        $fh = fopen($path, 'r');
        if (!$fh) {
            throw new RuntimeException("Can not open file: $path");
        }
        $fileSize = @filesize($path);
        /* @var $output OutputStyle */
        $output = $this->getOutput();
        $bar = $output->createProgressBar($fileSize);
        $bar->setFormat('<info>Reading File:</info> ' . basename($path) . ' %bar% %percent%% <info>Remaining Time:</info> %remaining%');

        $steps = 0;
        $currentSize = 0;
        while (!feof($fh)) {
            $line = fgets($fh);
            $currentSize += strlen($line);
            // ignore empty lines and comments
            if (!$line or $line === '' or strpos($line, '#') === 0) continue;
            $steps++;
            // Reading is so much faster, must slow down advances
            if (isset($bar) && $steps % ($this->bufferSize * 100) === 0) {
                $bar->advance($currentSize);
                $currentSize = 0;
            }
        }
        fclose($fh);
        if (isset($bar)) {
            $bar->finish();
            $output->newLine();
        }
        return $steps;
    }