Code Duplication    Length = 3-5 lines in 4 locations

src/MySQLReplication/Config/Config.php 4 locations

@@ 143-145 (lines=3) @@
140
     */
141
    public static function validate()
142
    {
143
        if (!empty(self::$user) && !is_string(self::$user)) {
144
            throw new ConfigException(ConfigException::USER_ERROR_MESSAGE, ConfigException::USER_ERROR_CODE);
145
        }
146
        if (!empty(self::$host)) {
147
            $ip = gethostbyname(self::$host);
148
            if (!filter_var($ip, FILTER_VALIDATE_IP)) {
@@ 161-163 (lines=3) @@
158
        if (!empty(self::$password) && !is_string(self::$password) && !is_numeric(self::$password)) {
159
            throw new ConfigException(ConfigException::PASSWORD_ERROR_MESSAGE, ConfigException::PASSWORD_ERROR_CODE);
160
        }
161
        if (!empty(self::$charset) && !is_string(self::$charset)) {
162
            throw new ConfigException(ConfigException::CHARSET_ERROR_MESSAGE, ConfigException::CHARSET_ERROR_CODE);
163
        }
164
        if (!empty(self::$gtid) && !is_string(self::$gtid)) {
165
            foreach (explode(',', self::$gtid) as $gtid) {
166
                if (!(bool)preg_match(
@@ 180-184 (lines=5) @@
177
        ) {
178
            throw new ConfigException(ConfigException::SLAVE_ID_ERROR_MESSAGE, ConfigException::SLAVE_ID_ERROR_CODE);
179
        }
180
        if (!empty(self::$binLogFileName) && !is_string(self::$binLogFileName)) {
181
            throw new ConfigException(
182
                ConfigException::BIN_LOG_FILE_NAME_ERROR_MESSAGE, ConfigException::BIN_LOG_FILE_NAME_ERROR_CODE
183
            );
184
        }
185
        if (!empty(self::$binLogPosition) && !filter_var(
186
                self::$binLogPosition, FILTER_VALIDATE_INT, ['options' => ['min_range' => 0]]
187
            )
@@ 193-197 (lines=5) @@
190
                ConfigException::BIN_LOG_FILE_POSITION_ERROR_MESSAGE, ConfigException::BIN_LOG_FILE_POSITION_ERROR_CODE
191
            );
192
        }
193
        if (!empty(self::$mariaDbGtid) && !is_string(self::$mariaDbGtid)) {
194
            throw new ConfigException(
195
                ConfigException::MARIADBGTID_ERROR_MESSAGE, ConfigException::MARIADBGTID_ERROR_CODE
196
            );
197
        }
198
        if (!filter_var(self::$tableCacheSize, FILTER_VALIDATE_INT, ['options' => ['min_range' => 0]])) {
199
            throw new ConfigException(
200
                ConfigException::TABLE_CACHE_SIZE_ERROR_MESSAGE, ConfigException::TABLE_CACHE_SIZE_ERROR_CODE