Code Duplication    Length = 37-37 lines in 2 locations

src/Ifsnop/Mysqldump/Mysqldump.php 2 locations

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