Flake\Core\DOM\HTMLElement::normalizeWhitespace PHP Method

normalizeWhitespace() protected method

protected normalizeWhitespace ( $sText )
    protected function normalizeWhitespace($sText)
    {
        $sText = str_replace(["\t", "\r\n", "\n"], ' ', $sText);
        # using multiple str_replace has proven to be twice as fast that regexp on big strings
        $iCount = 0;
        do {
            $sText = str_replace('  ', ' ', $sText, $iCount);
        } while ($iCount > 0);
        return trim($sText);
    }