/** * Translate requested word using all registered dictionary * @param string $word * @return NULL|string */ public function find($word = null) { $translation = new Translation(); foreach ($this->collection as $dictionary) { $dictionary->find($word, function ($ifo, $idx, $dict) use(&$translation) { $translation->addIfo($ifo); $translation->addIdx($idx); $translation->addDict($dict); }); } return $translation; }
/** * Add translation model to history stack * @param Translation $model */ public function addHistory(Translation $model = null) { $this->HistoryStack[md5($model->getWord())][] = $model; return $this; }