private function clearLeadingAndTrailingSpaces(string $sentence) : string
    {
        if ($this->trailing_optimization) {
            $sentence = preg_replace('/^\\s+/', '', $sentence);
            $sentence = preg_replace('/\\s+$/', '', $sentence);
            $sentence = preg_replace('/\\s*\\n\\s*/', ' ', $sentence);
        }

        return $sentence;
    }
private function clearLeadingAndTrailingSpaces(string $sentence) : string
    {
        if ($this->trailing_optimization) {
            $sentence = preg_replace('/^\\s+/', '', $sentence);
            $sentence = preg_replace('/\\s+$/', '', $sentence);
            $sentence = preg_replace('/\\s*\\n\\s*/', ' ', $sentence);
        }

        return $sentence;
    }
private function clearLeadingAndTrailingSpaces ( string $ sentence ) : string { if ( $ this -> trailing_optimization ) { $ sentence = preg_replace ( '/^\\s+/' , '' , $ sentence ) ; $ sentence = preg_replace ( '/\\s+$/' , '' , $ sentence ) ; $ sentence = preg_replace ( '/\\s*\\n\\s*/' , ' ' , $ sentence ) ; } return $ sentence ; }
Clean all leading and trailing spaces in a sentence. To prevent to alter literals in the sentence, this method
could to be called before apply variable values.
@param string $sentence Sentence to be cleaned.
@return string Returns the Sentence cleaned if the Leading & Trailing Optimization is enabled.
Clean all leading and trailing spaces in a sentence . To prevent to alter literals in the sentence this method could to be called before apply variable values .