protected function determineTargetType($words) { foreach ($words as $word) { if (isset($this->targetTypes[$word])) { return $word; } } // if we do not recognise the word, substitute a suitable default return 'field'; }