protected function findRepositoryRoot(\ZipArchive $archive)
    {
        // Find root directory in zip file.
        $count    = $archive->numFiles;
        $rootFile = $archive->statIndex(0);
        $root     = $rootFile['name'];
        for ($i = 1; $i < $count; ++$i) {
            $file = $archive->statIndex($i);
            $root = $this->commonStartString($root, $file['name']);
        }

        return $root;
    }