protected function processFiles(array $files, int $filesPerLine, int $totalFiles): int
    {
        $fileCountLength = strlen((string)$totalFiles);
        $processed = 0;

        while (!empty($files)) {
            /** @var SplFileInfo[] $chunk */
            $chunk = array_shift($files);
            $chunkFiles = count($chunk);

            $processed += $this->processJunks($chunk);

            if ($this->format !== 'json') {
                $this->output->write(str_pad('', $filesPerLine - $chunkFiles));
                $this->output->writeln('  ' . str_pad((string)$processed, $fileCountLength, ' ', STR_PAD_LEFT) . '/' . $totalFiles . ' (' . floor((100 / $totalFiles) * $processed) . '%)');
            }
        }

        return $totalFiles;
    }