protected function determineIndexType($words) { foreach ($words as $word) { if (isset($this->indexTypes[$word])) { return $this->indexTypes[$word]; } } // if we do not recognise the word, we want the first match return 0; }