src/DocumentParser.php
protected function prepare(Text $text)
    {
        // Unify line endings
        $text->replaceString("\r\n", "\n");
        $text->replaceString("\r", "\n");

        // Replace tabs by spaces
        $text->replace('/(.*?)\t/', function (Text $whole, Text $string) {
            $tabWidth = 4;
            return $string . str_repeat(' ', $tabWidth - $string->getLength() % $tabWidth);
        });
    }
protected function prepare(Text $text)
    {
        // Unify line endings
        $text->replaceString("\r\n", "\n");
        $text->replaceString("\r", "\n");

        // Replace tabs by spaces
        $text->replace('/(.*?)\t/', function (Text $whole, Text $string) {
            $tabWidth = 4;
            return $string . str_repeat(' ', $tabWidth - $string->getLength() % $tabWidth);
        });
    }
protected function prepare ( Text $ text ) { // Unify line endings $ text -> replaceString ( "\r\n" , "\n" ) ; $ text -> replaceString ( "\r" , "\n" ) ; // Replace tabs by spaces $ text -> replace ( '/(.*?)\t/' , function ( Text $ whole , Text $ string ) { $ tabWidth = 4 ; return $ string . str_repeat ( ' ' , $ tabWidth - $ string -> getLength ( ) % $ tabWidth ) ; } ) ; }
Preprocess the text.

This unifies line endings and replaces tabs by spaces.

@param Text $text
@return void
Preprocess the text .