Code Duplication    Length = 37-37 lines in 2 locations

src/Ifsnop/Mysqldump/Mysqldump.php 2 locations

@@ 1064-1100 (lines=37) @@
1061
    }
1062
}
1063
1064
class CompressBzip2 extends CompressManagerFactory
1065
{
1066
    private $fileHandler = null;
1067
1068
    public function __construct()
1069
    {
1070
        if (! function_exists("bzopen")) {
1071
            throw new Exception("Compression is enabled, but bzip2 lib is not installed or configured properly");
1072
        }
1073
    }
1074
1075
    /**
1076
     * @param string $filename
1077
     */
1078
    public function open($filename)
1079
    {
1080
        $this->fileHandler = bzopen($filename, "w");
1081
        if (false === $this->fileHandler) {
1082
            throw new Exception("Output file is not writable");
1083
        }
1084
1085
        return true;
1086
    }
1087
1088
    public function write($str)
1089
    {
1090
        if (false === ($bytesWritten = bzwrite($this->fileHandler, $str))) {
1091
            throw new Exception("Writting to file failed! Probably, there is no more free space left?");
1092
        }
1093
        return $bytesWritten;
1094
    }
1095
1096
    public function close()
1097
    {
1098
        return bzclose($this->fileHandler);
1099
    }
1100
}
1101
1102
class CompressGzip extends CompressManagerFactory
1103
{
@@ 1102-1138 (lines=37) @@
1099
    }
1100
}
1101
1102
class CompressGzip extends CompressManagerFactory
1103
{
1104
    private $fileHandler = null;
1105
1106
    public function __construct()
1107
    {
1108
        if (! function_exists("gzopen")) {
1109
            throw new Exception("Compression is enabled, but gzip lib is not installed or configured properly");
1110
        }
1111
    }
1112
1113
    /**
1114
     * @param string $filename
1115
     */
1116
    public function open($filename)
1117
    {
1118
        $this->fileHandler = gzopen($filename, "wb");
1119
        if (false === $this->fileHandler) {
1120
            throw new Exception("Output file is not writable");
1121
        }
1122
1123
        return true;
1124
    }
1125
1126
    public function write($str)
1127
    {
1128
        if (false === ($bytesWritten = gzwrite($this->fileHandler, $str))) {
1129
            throw new Exception("Writting to file failed! Probably, there is no more free space left?");
1130
        }
1131
        return $bytesWritten;
1132
    }
1133
1134
    public function close()
1135
    {
1136
        return gzclose($this->fileHandler);
1137
    }
1138
}
1139
1140
class CompressNone extends CompressManagerFactory
1141
{