public function replaceSiteDomainInSqlString($sql, $debug = false)
    {
        $optionsTable = $this->tablePrefix . 'options';

        $matches = [];
        preg_match("/INSERT\\s+INTO\\s+`{$optionsTable}`.*'home'\\s*,\\s*'(.*)',/uiU", $sql, $matches);

        if (empty($matches) || empty($matches[1])) {
            if ($debug) {
                codecept_debug('Dump file does not contain an `options` table INSERT instruction, not replacing');
            }

            return $sql;
        }

        $dumpSiteUrl = $matches[1];

        if (empty($dumpSiteUrl)) {
            if ($debug) {
                codecept_debug('Dump file does not contain dump of `home` option, not replacing.');
            }

            return $sql;
        }

        $thisSiteUrl = $this->url;

        if ($dumpSiteUrl === $thisSiteUrl) {
            if ($debug) {
                codecept_debug('Dump file domain not replaced as identical to the one specified in the configuration.');
            }

            return $sql;
        }

        $sql = str_replace($dumpSiteUrl, $thisSiteUrl, $sql);

        codecept_debug('Dump file domain [' . $dumpSiteUrl . '] replaced with [' . $thisSiteUrl . ']');

        return $sql;
    }