Code Duplication    Length = 37-37 lines in 2 locations

src/Ifsnop/Mysqldump/Mysqldump.php 2 locations

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