Skip to content

Commit 78f1df2

Browse files
committed
fix: compare bool
1 parent 69e73be commit 78f1df2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/Compress/Gz.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,34 @@
66

77
class Gz
88
{
9-
const EXTENSION_COMPRESS = 'gz';
9+
public const EXTENSION_COMPRESS = 'gz';
1010

11-
public function handler($file): string
11+
public function handler(string $filename): string
1212
{
13-
$fileCompress = $file.'.'.self::EXTENSION_COMPRESS;
13+
$filenameCompress = $filename.'.'.self::EXTENSION_COMPRESS;
1414

15-
$fd = fopen($file, 'r');
15+
$fd = fopen($filename, 'r');
1616

17-
if (!$fd) {
18-
throw new Exception("file {$file} not can read.", 100);
17+
if ($fd === false) {
18+
throw new Exception("file {$filename} not can read.", 100);
1919
}
2020

21-
$gz = gzopen($fileCompress, 'wb');
21+
$gz = gzopen($filenameCompress, 'wb');
2222

23-
if (! $gz) {
23+
if ($gz === false) {
2424
fclose($fd);
2525

26-
throw new Exception("file {$fileCompress} not can open.", 101);
26+
throw new Exception("file {$filenameCompress} not can open.", 101);
2727
}
2828

29-
while (! feof($fd)) {
29+
while (!feof($fd)) {
3030
gzwrite($gz, fread($fd, 1024 * 512));
3131
}
3232

3333
gzclose($gz);
3434
fclose($fd);
35-
unlink($file);
35+
unlink($filename);
3636

37-
return $fileCompress;
37+
return $filenameCompress;
3838
}
3939
}

0 commit comments

Comments
 (0)