public function parseWords($string, $searches) { // IWords[] $wordsStats = array(); // String[] $words = array(); $matches = array(); if (preg_match_all($this->_pattern, $string, $matches)) { $words = $matches[0]; foreach ($words as $word) { $wordInstance = new Word($word); $wordInstance->setCount(1); $wordInstance->setBroadSearches($searches); $wordsStats[] = $wordInstance; } } return $wordsStats; }