private function deindent (string $configText) : string
    {
        $configText = rtrim($configText);

        if (empty($configText))
        {
            return "";
        }

        // remove all heading whitespace-only lines
        $configText = preg_replace("~\\A\\s*\n~", "", $configText);

        // fetch indention of first line
        if (1 === preg_match('~\A(?P<indention>\\s*)[^\\s]~', $configText, $matches))
        {
            // check whether all lines have at least the indention of the first line
            if (1 === preg_match('~^(?!' . $matches["indention"] . ')~m', $configText))
            {
                // there is a line with a smaller indention than the first line
                // -> abort
                return "";
            }

            // deindent all lines
            return preg_replace('~^' . $matches["indention"] . '~m', "", $configText);
        }

        return "";
    }
private function deindent (string $configText) : string
    {
        $configText = rtrim($configText);

        if (empty($configText))
        {
            return "";
        }

        // remove all heading whitespace-only lines
        $configText = preg_replace("~\\A\\s*\n~", "", $configText);

        // fetch indention of first line
        if (1 === preg_match('~\A(?P<indention>\\s*)[^\\s]~', $configText, $matches))
        {
            // check whether all lines have at least the indention of the first line
            if (1 === preg_match('~^(?!' . $matches["indention"] . ')~m', $configText))
            {
                // there is a line with a smaller indention than the first line
                // -> abort
                return "";
            }

            // deindent all lines
            return preg_replace('~^' . $matches["indention"] . '~m', "", $configText);
        }

        return "";
    }
private function deindent ( string $ configText ) : string { $ configText = rtrim ( $ configText ) ; if ( empty ( $ configText ) ) { return "" ; } // remove all heading whitespace-only lines $ configText = preg_replace ( "~\\A\\s*\n~" , "" , $ configText ) ; // fetch indention of first line if ( 1 === preg_match ( '~\A(?P<indention>\\s*)[^\\s]~' , $ configText , $ matches ) ) { // check whether all lines have at least the indention of the first line if ( 1 === preg_match ( '~^(?!' . $ matches [ "indention" ] . ')~m' , $ configText ) ) { // there is a line with a smaller indention than the first line // -> abort return "" ; } // deindent all lines return preg_replace ( '~^' . $ matches [ "indention" ] . '~m' , "" , $ configText ) ; } return "" ; }
Deindents the given text

@param string $configText

@return string
Deindents the given text