File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 66
77class 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}
You can’t perform that action at this time.
0 commit comments