• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tito10047 / migration-backup / 23041526045

13 Mar 2026 07:54AM UTC coverage: 86.131% (+19.5%) from 66.667%
23041526045

Pull #2

github

tito10047
update database URLs with version-specific server hints
Pull Request #2: add multi-format compression support (gzip, bzip2, zstd, zip, lz4, no…

92 of 111 new or added lines in 8 files covered. (82.88%)

236 of 274 relevant lines covered (86.13%)

57.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/Compressor/ZipCompressor.php
1
<?php
2

3
namespace Tito10047\MigrationBackup\Compressor;
4

5
use Symfony\Component\Filesystem\Filesystem;
6
use RuntimeException;
7
use ZipArchive;
8

9
class ZipCompressor implements CompressorInterface {
10
        public function __construct(
11
                private readonly Filesystem $fs
12
        ) {}
63✔
13

14
        public function compress(string $path): string {
15
                if (!$this->isAvailable()) {
21✔
NEW
16
                        throw new RuntimeException('Zip compression is not available (zip extension missing).');
×
17
                }
18

19
                $zipPath = $path . '.zip';
21✔
20
                $zip     = new ZipArchive();
21✔
21
                if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== true) {
21✔
NEW
22
                        throw new RuntimeException('Could not open file for compression: ' . $zipPath);
×
23
                }
24

25
                $zip->addFile($path, basename($path));
21✔
26
                $zip->close();
21✔
27

28
                $this->fs->remove($path);
21✔
29
                $this->fs->rename($zipPath, $path);
21✔
30

31
                return $path;
21✔
32
        }
33

34
        public function getExtension(): string {
35
                return '.zip';
21✔
36
        }
37

38
        public function isAvailable(): bool {
39
                return class_exists(ZipArchive::class);
42✔
40
        }
41
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc