public static function normalizeIndents(string $string, string $tabulationCost = "   "): string
    {
        $string = self::normalizeEndings($string, false);
        $lines = explode("\n", $string);
        $minIndent = null;
        foreach ($lines as $line) {
            if (!trim($line)) {
                continue;
            }
            $line = str_replace("\t", $tabulationCost, $line);
            //Getting indent size
            if (!preg_match("/^( +)/", $line, $matches)) {
                //Some line has no indent
                return $string;
            }
            if ($minIndent === null) {
                $minIndent = strlen($matches[1]);
            }
            $minIndent = min($minIndent, strlen($matches[1]));
        }
        //Fixing indent
        foreach ($lines as &$line) {
            if (empty($line)) {
                continue;
            }
            //Getting line indent
            preg_match("/^([ \t]+)/", $line, $matches);
            $indent = $matches[1];
            if (!trim($line)) {
                $line = '';
                continue;
            }
            //Getting new indent
            $useIndent = str_repeat(
                " ",
                strlen(str_replace("\t", $tabulationCost, $indent)) - $minIndent
            );
            $line = $useIndent . substr($line, strlen($indent));
            unset($line);
        }

        return join("\n", $lines);
    }