• 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

76.92
/src/Compressor/ZstdCompressor.php
1
<?php
2

3
namespace Tito10047\MigrationBackup\Compressor;
4

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

8
class ZstdCompressor implements CompressorInterface {
9
        public function __construct(
10
                private readonly Filesystem $fs
11
        ) {}
3✔
12

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

18
                $data = file_get_contents($path);
1✔
19
                if ($data === false) {
1✔
NEW
20
                        throw new RuntimeException('Could not read file for compression: ' . $path);
×
21
                }
22

23
                $compressed = zstd_compress($data, 3);
1✔
24
                if ($compressed === false) {
1✔
NEW
25
                        throw new RuntimeException('Zstd compression failed for file: ' . $path);
×
26
                }
27

28
                $this->fs->dumpFile($path, $compressed);
1✔
29

30
                return $path;
1✔
31
        }
32

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

37
        public function isAvailable(): bool {
38
                return function_exists('zstd_compress');
2✔
39
        }
40
}
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