public function toSentence(): Utility
    {
        $sentences = preg_split(
            '/([^\.\!\?;]+[\.\!\?;"]+)/',
            $this->string,
            -1,
            PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
        );

        $sentences = array_map(function ($sentence) {
            $sentence = trim($sentence);
            if (!ctype_upper($sentence[0])) {
                $sentence = ucfirst($sentence);
            }
            return $sentence;
        }, $sentences);

        $string = implode(' ', $sentences);

        if (preg_match('/[\p{P}]$/', $string)) {
            return new static($string, $this->encoding);
        }

        return (new static($string, $this->encoding))->ensureEndsWith('.');
    }
public function toSentence(): Utility
    {
        $sentences = preg_split(
            '/([^\.\!\?;]+[\.\!\?;"]+)/',
            $this->string,
            -1,
            PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
        );

        $sentences = array_map(function ($sentence) {
            $sentence = trim($sentence);
            if (!ctype_upper($sentence[0])) {
                $sentence = ucfirst($sentence);
            }
            return $sentence;
        }, $sentences);

        $string = implode(' ', $sentences);

        if (preg_match('/[\p{P}]$/', $string)) {
            return new static($string, $this->encoding);
        }

        return (new static($string, $this->encoding))->ensureEndsWith('.');
    }
public function toSentence ( ) : Utility { $ sentences = preg_split ( '/([^\.\!\?;]+[\.\!\?;"]+)/' , $ this -> string , - 1 , PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ) ; $ sentences = array_map ( function ( $ sentence ) { $ sentence = trim ( $ sentence ) ; if ( ! ctype_upper ( $ sentence [ 0 ] ) ) { $ sentence = ucfirst ( $ sentence ) ; } return $ sentence ; } , $ sentences ) ; $ string = implode ( ' ' , $ sentences ) ; if ( preg_match ( '/[\p{P}]$/' , $ string ) ) { return new static ( $ string , $ this -> encoding ) ; } return ( new static ( $ string , $ this -> encoding ) ) -> ensureEndsWith ( '.' ) ; }
Turn the string into a sentence.

@return $this
Turn the string into a sentence .