src/TextFormatter.php
protected function splitWords()
    {
        $indexedWords = [];
        $offset = 0;

        $words = explode($this->separator, $this->title);
        foreach ($words as $word) {
            if (mb_strlen($word, $this->encoding) == 0) {
                continue;
            }

            $wordIndex = $this->getWordIndex($word, $offset);

            if ($this->hasDash($word)) {
                $word = TextFormatter::titleCase($word, '-');
                $this->rebuildTitle($wordIndex, $word);
            }

            $indexedWords[$wordIndex] = $word;
            $offset += mb_strlen($word, $this->encoding) + 1; // plus space
        }

        return $this->indexedWords = $indexedWords;
    }
protected function splitWords()
    {
        $indexedWords = [];
        $offset = 0;

        $words = explode($this->separator, $this->title);
        foreach ($words as $word) {
            if (mb_strlen($word, $this->encoding) == 0) {
                continue;
            }

            $wordIndex = $this->getWordIndex($word, $offset);

            if ($this->hasDash($word)) {
                $word = TextFormatter::titleCase($word, '-');
                $this->rebuildTitle($wordIndex, $word);
            }

            $indexedWords[$wordIndex] = $word;
            $offset += mb_strlen($word, $this->encoding) + 1; // plus space
        }

        return $this->indexedWords = $indexedWords;
    }
protected function splitWords ( ) { $ indexedWords = [ ] ; $ offset = 0 ; $ words = explode ( $ this -> separator , $ this -> title ) ; foreach ( $ words as $ word ) { if ( mb_strlen ( $ word , $ this -> encoding ) == 0 ) { continue ; } $ wordIndex = $ this -> getWordIndex ( $ word , $ offset ) ; if ( $ this -> hasDash ( $ word ) ) { $ word = TextFormatter :: titleCase ( $ word , '-' ) ; $ this -> rebuildTitle ( $ wordIndex , $ word ) ; } $ indexedWords [ $ wordIndex ] = $ word ; $ offset += mb_strlen ( $ word , $ this -> encoding ) + 1 ; // plus space } return $ this -> indexedWords = $ indexedWords ; }
Creates an array of words from the title to be formatted
Creates an array of words from the title to be formatted