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

tito10047 / migration-backup / 23041620724

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

Pull #2

github

web-flow
Merge 0b4c0e04c into 30f9cf60f
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%)

2.75 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
        ) {}
3✔
13

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

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

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

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

31
                return $path;
1✔
32
        }
33

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

38
        public function isAvailable(): bool {
39
                return class_exists(ZipArchive::class);
2✔
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