Code Duplication    Length = 37-37 lines in 2 locations

src/Ifsnop/Mysqldump/Mysqldump.php 2 locations

@@ 1004-1040 (lines=37) @@
1001
    }
1002
}
1003
1004
class CompressBzip2 extends CompressManagerFactory
1005
{
1006
    private $fileHandler = null;
1007
1008
    public function __construct()
1009
    {
1010
        if (! function_exists("bzopen")) {
1011
            throw new Exception("Compression is enabled, but bzip2 lib is not installed or configured properly");
1012
        }
1013
    }
1014
1015
    /**
1016
     * @param string $filename
1017
     */
1018
    public function open($filename)
1019
    {
1020
        $this->fileHandler = bzopen($filename, "w");
1021
        if (false === $this->fileHandler) {
1022
            throw new Exception("Output file is not writable");
1023
        }
1024
1025
        return true;
1026
    }
1027
1028
    public function write($str)
1029
    {
1030
        if (false === ($bytesWritten = bzwrite($this->fileHandler, $str))) {
1031
            throw new Exception("Writting to file failed! Probably, there is no more free space left?");
1032
        }
1033
        return $bytesWritten;
1034
    }
1035
1036
    public function close()
1037
    {
1038
        return bzclose($this->fileHandler);
1039
    }
1040
}
1041
1042
class CompressGzip extends CompressManagerFactory
1043
{
@@ 1042-1078 (lines=37) @@
1039
    }
1040
}
1041
1042
class CompressGzip extends CompressManagerFactory
1043
{
1044
    private $fileHandler = null;
1045
1046
    public function __construct()
1047
    {
1048
        if (! function_exists("gzopen")) {
1049
            throw new Exception("Compression is enabled, but gzip lib is not installed or configured properly");
1050
        }
1051
    }
1052
1053
    /**
1054
     * @param string $filename
1055
     */
1056
    public function open($filename)
1057
    {
1058
        $this->fileHandler = gzopen($filename, "wb");
1059
        if (false === $this->fileHandler) {
1060
            throw new Exception("Output file is not writable");
1061
        }
1062
1063
        return true;
1064
    }
1065
1066
    public function write($str)
1067
    {
1068
        if (false === ($bytesWritten = gzwrite($this->fileHandler, $str))) {
1069
            throw new Exception("Writting to file failed! Probably, there is no more free space left?");
1070
        }
1071
        return $bytesWritten;
1072
    }
1073
1074
    public function close()
1075
    {
1076
        return gzclose($this->fileHandler);
1077
    }
1078
}
1079
1080
class CompressNone extends CompressManagerFactory
1081
{