public static function removeLineFromFile($filePath, $match) {
        $allLines = file($filePath);
        $matches = preg_grep('/' . $match . '/i', $allLines, PREG_GREP_INVERT);

        // This removes any lines with returns, so we avoid additional blank lines when we glue
        // back together again.
        $cleanMatches = array_map(function ($str) {
            return str_replace(PHP_EOL, '', $str);
        }, $matches);

        // Write each match back onto its own line.
        file_put_contents($filePath, implode(PHP_EOL, array_filter($cleanMatches)));
    }